Option to close project from map menu added

This commit is contained in:
Piotr Pekala 2019-11-06 03:30:43 -08:00
parent fabfff2e8f
commit 47cc51a68d
2 changed files with 11 additions and 0 deletions

View File

@ -71,6 +71,10 @@
<mat-icon>call_received</mat-icon> <mat-icon>call_received</mat-icon>
<span>Import portable project</span> <span>Import portable project</span>
</button> </button>
<button mat-menu-item (click)="closeProject()">
<mat-icon>close</mat-icon>
<span>Close project</span>
</button>
<button mat-menu-item (click)="deleteProject()"> <button mat-menu-item (click)="deleteProject()">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span>Delete project</span> <span>Delete project</span>

View File

@ -218,6 +218,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.subscriptions.push( this.subscriptions.push(
this.nodesDataSource.changes.subscribe((nodes: Node[]) => { this.nodesDataSource.changes.subscribe((nodes: Node[]) => {
if (!this.server) return;
nodes.forEach((node: Node) => { nodes.forEach((node: Node) => {
node.symbol_url = `http://${this.server.host}:${this.server.port}/v2/symbols/${node.symbol}/raw`; node.symbol_url = `http://${this.server.host}:${this.server.port}/v2/symbols/${node.symbol}/raw`;
}); });
@ -769,6 +770,12 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
imageToUpload.src = window.URL.createObjectURL(file); imageToUpload.src = window.URL.createObjectURL(file);
} }
public closeProject() {
this.projectService.close(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']);
});
}
public deleteProject() { public deleteProject() {
this.projectService.delete(this.server, this.project.project_id).subscribe(() => { this.projectService.delete(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']); this.router.navigate(['/server', this.server.id, 'projects']);