Delete a project

This commit is contained in:
ziajka 2017-09-28 12:13:35 +02:00
parent 7968368b81
commit a4525a67f1
3 changed files with 25 additions and 6 deletions

View File

@ -6,13 +6,16 @@
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let project of projects">
<td><a [routerLink]="['/server', server.id, 'project', project.project_id]">{{ project.name }}</a></td>
<td><button class="btn btn-outline-danger btn-sm" (click)="delete(project)">Remove</button></td>
</tr>
</tbody>
</table>
</div>

View File

@ -27,13 +27,24 @@ export class ProjectsComponent implements OnInit {
})
.subscribe((server: Server) => {
this.server = server;
this.projectService
.list(server)
.subscribe((projects: Project[]) => {
this.projects = projects;
});
this.reload();
});
}
reload() {
this.projectService
.list(this.server)
.subscribe((projects: Project[]) => {
this.projects = projects;
});
}
delete(project: Project) {
this.projectService.delete(this.server, project.project_id).subscribe(() => {
this.reload();
});
}
}

View File

@ -45,6 +45,11 @@ export class ProjectService {
.map(response => response.json() as Link[]);
}
delete(server: Server, project_id: string): Observable<any> {
return this.httpServer
.delete(server, `/projects/${project_id}`);
}
notificationsPath(server: Server, project_id: string): string {
return `ws://${server.ip}:${server.port}/v2/projects/${project_id}/notifications/ws`;
}