diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 500b3518..331687b8 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -50,6 +50,7 @@ import { LinkService } from "./services/link.service"; import { ProjectsComponent } from './components/projects/projects.component'; import { ImportProjectDialogComponent } from './components/projects/import-project-dialog/import-project-dialog.component'; +import { ImportProjectConfirmationDialogComponent} from './components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component'; import { DefaultLayoutComponent } from './layouts/default-layout/default-layout.component'; import { ProgressDialogComponent } from './common/progress-dialog/progress-dialog.component'; import { AppComponent } from './app.component'; @@ -109,6 +110,7 @@ if (environment.production) { CreateSnapshotDialogComponent, ProjectsComponent, ImportProjectDialogComponent, + ImportProjectConfirmationDialogComponent, DefaultLayoutComponent, ProgressDialogComponent, NodeContextMenuComponent, @@ -191,7 +193,8 @@ if (environment.production) { CreateSnapshotDialogComponent, ProgressDialogComponent, ApplianceListDialogComponent, - ImportProjectDialogComponent + ImportProjectDialogComponent, + ImportProjectConfirmationDialogComponent ], bootstrap: [ AppComponent ] }) diff --git a/src/app/components/appliance/appliance.component.ts b/src/app/components/appliance/appliance.component.ts index 6eb7801f..aaed1faa 100644 --- a/src/app/components/appliance/appliance.component.ts +++ b/src/app/components/appliance/appliance.component.ts @@ -34,4 +34,3 @@ export class ApplianceComponent implements OnInit { }); } } - diff --git a/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.css b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.html b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.html new file mode 100644 index 00000000..74d874d7 --- /dev/null +++ b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.html @@ -0,0 +1,10 @@ + + {{confirmationMessage}} + +
+ + +
+
+ +
diff --git a/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.spec.ts b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.spec.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.ts b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.ts new file mode 100644 index 00000000..b6b8fe4e --- /dev/null +++ b/src/app/components/projects/import-project-dialog/import-project-confirmation-dialog/import-project-confirmation-dialog.component.ts @@ -0,0 +1,40 @@ +import { Component, OnInit, Inject, ViewChild } from '@angular/core'; +import { MatStepper, MatDialogRef, MAT_DIALOG_DATA } from "@angular/material"; +import { FileUploader, ParsedResponseHeaders, FileItem } from 'ng2-file-upload'; +import { v4 as uuid } from 'uuid'; +import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; +import { Project } from '../../../../models/project'; + +@Component({ + selector: 'app-import-project-dialog', + templateUrl: 'import-project-confirmation-dialog.component.html', + styleUrls: ['import-project-confirmation-dialog.component.css'] +}) +export class ImportProjectConfirmationDialogComponent implements OnInit { + private existingProject : Project; + private confirmationMessage : string; + private isOpen : boolean; + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any + ){ + this.existingProject = data['existingProject'] + } + + ngOnInit(){ + if(this.existingProject.status === "opened"){ + this.confirmationMessage = `Project ${this.existingProject.name} is open. You can not overwrite it.` + this.isOpen = true; + } else { + this.confirmationMessage = `Project ${this.existingProject.name} already exist, overwrite it?` + } + } + + onNoClick() : void { + this.dialogRef.close(false); + } + + onYesClick() : void { + this.dialogRef.close(true); + } +} diff --git a/src/app/models/serverResponse.ts b/src/app/models/serverResponse.ts new file mode 100644 index 00000000..faf8e621 --- /dev/null +++ b/src/app/models/serverResponse.ts @@ -0,0 +1,4 @@ +export class ServerResponse { + message: string; + status: number; +}