-
- onDeployxApp(event): void {
- const dialogRef = this.dialog.open(AppCatalogDeployDialog, {
- width: '400px',
- data: { name: event.data.name }
- });
-
- dialogRef.afterClosed().subscribe(result => {
- console.log('The dialog was closed');
- });
- }
-
-}
-
-@Component({
- selector: 'app-catalog-deploy-dialog',
- templateUrl: 'catalog.component.deploy-dialog.html',
- styleUrls: ['./catalog.component.css']
-})
-
-export class AppCatalogDeployDialog{
-
- constructor(
- public dialogRef: MatDialogRef<AppCatalogDeployDialog>,
- private service: CatalogService,
- @Inject(MAT_DIALOG_DATA) public data: DialogData) { }
-
- onNoClick(): void {
- this.dialogRef.close();
- }
-
- deployXapp(): void {
- this.service.deployXapp(this.data.name).subscribe((val: any[]) => console.log(val));;
- this.dialogRef.close();
- }
+ onDeployApp(app: XMDeployableApp): void {
+ this.confirmDialogService.openConfirmDialog('Deploy application ' + app.name + '?')
+ .afterClosed().subscribe((res: boolean) => {
+ if (res) {
+ this.loadingDialogService.startLoading('Deploying ' + app.name);
+ this.appMgrService.deployXapp(app.name)
+ .pipe(
+ finalize(() => this.loadingDialogService.stopLoading())
+ )
+ .subscribe(
+ (response: HttpResponse<Object>) => {
+ this.notificationService.success('App deploy succeeded!');
+ },
+ ((her: HttpErrorResponse) => {
+ // the error field should have an ErrorTransport object
+ let msg = her.message;
+ if (her.error && her.error.message) {
+ msg = her.error.message;
+ }
+ this.notificationService.warn('App deploy failed: ' + msg);
+ })
+ );
+ }
+ }
+ );
+ }