Close button added

This commit is contained in:
Piotr Pekala
2019-11-06 05:15:26 -08:00
parent 47cc51a68d
commit ffc3e02855
7 changed files with 93 additions and 20 deletions

View File

@ -62,6 +62,7 @@ import { EditProjectDialogComponent } from '../projects/edit-project-dialog/edit
import { EthernetLinkWidget } from '../../cartography/widgets/links/ethernet-link';
import { SerialLinkWidget } from '../../cartography/widgets/links/serial-link';
import { NavigationDialogComponent } from '../projects/navigation-dialog/navigation-dialog.component';
import { ConfirmationBottomSheetComponent } from '../projects/confirmation-bottomsheet/confirmation-bottomsheet.component';
@Component({
@ -771,14 +772,28 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}
public closeProject() {
this.projectService.close(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']);
this.bottomSheet.open(ConfirmationBottomSheetComponent);
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
bottomSheetRef.instance.message = 'Do you want to close the project?';
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
if (result) {
this.projectService.close(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']);
});
}
});
}
public deleteProject() {
this.projectService.delete(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']);
this.bottomSheet.open(ConfirmationBottomSheetComponent);
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
bottomSheetRef.instance.message = 'Do you want to delete the project?';
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
if (result) {
this.projectService.delete(this.server, this.project.project_id).subscribe(() => {
this.router.navigate(['/server', this.server.id, 'projects']);
});
}
});
}