mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-09 20:12:53 +00:00
Delete a project
This commit is contained in:
parent
7968368b81
commit
a4525a67f1
@ -6,13 +6,16 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let project of projects">
|
<tr *ngFor="let project of projects">
|
||||||
<td><a [routerLink]="['/server', server.id, 'project', project.project_id]">{{ project.name }}</a></td>
|
<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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -27,13 +27,24 @@ export class ProjectsComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
.subscribe((server: Server) => {
|
.subscribe((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
this.reload();
|
||||||
this.projectService
|
|
||||||
.list(server)
|
|
||||||
.subscribe((projects: Project[]) => {
|
|
||||||
this.projects = projects;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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[]);
|
.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 {
|
notificationsPath(server: Server, project_id: string): string {
|
||||||
return `ws://${server.ip}:${server.port}/v2/projects/${project_id}/notifications/ws`;
|
return `ws://${server.ip}:${server.port}/v2/projects/${project_id}/notifications/ws`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user