mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-18 02:39:50 +00:00
Delete a project
This commit is contained in:
parent
7968368b81
commit
a4525a67f1
@ -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>
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user