File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ <h2 mat-dialog-title>Add Label</h2>
44 < form class ="mat-dialog-content " #formControl ="ngForm ">
55 < div class ="form ">
66 < mat-form-field color ="primary ">
7- < input matInput #input class ="form-control " placeholder ="Label name " [(ngModel)] ="labelName " name ="labelName " required >
7+ < input matInput #input class ="form-control " (keydown.enter) =" onKeydown($event) " placeholder ="Label name " [(ngModel)] ="labelName " name ="labelName " required >
88 < mat-error *ngIf ="formControl.invalid "> {{getErrorMessage()}}</ mat-error >
99 </ mat-form-field >
1010 </ div >
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ export class LabelDialogComponent implements OnInit {
3636
3737 onCloseCancelLabel ( ) {
3838 this . thislabelDialogRef . close ( 'CancelLabel' ) ;
39-
4039 }
40+
41+ onKeydown ( event ) {
42+ this . thislabelDialogRef . close ( {
43+ status : 'Add' ,
44+ labelName : this . labelName
45+ } ) ;
46+ }
4147}
Original file line number Diff line number Diff line change @@ -92,20 +92,19 @@ export class TableAllComponent implements OnInit {
9292 } ) ;
9393
9494 dialogRef . afterClosed ( ) . subscribe ( result => {
95- console . log ( 'delete state' , instance . instanceState ) ;
95+
9696 if ( result === 'Confirm' && instance . instanceState === 'Running' ) {
97- console . log ( 'alert working' ) ;
9897 alert ( 'Please Stop the Instance before you try to delete' ) ;
99- console . log ( 'data' , this . dataSource . data ) ;
100-
10198 } else {
10299 if ( result !== 'Cancel' ) {
103100 this . apiService . deleteInstance ( id ) . subscribe ( ( deleteResult : HttpEvent < number > ) => {
104- console . log ( 'result' , deleteResult ) ;
101+ this . removeAt ( i ) ;
105102 } , err => {
106103 console . log ( 'error delete Instance' , err ) ;
104+ if ( err . status === 400 ) {
105+ alert ( 'Cannot delete this instance, other running instances are depending on it' ) ;
106+ }
107107 } ) ;
108- this . removeAt ( i ) ;
109108 }
110109 }
111110 this . dialogResult = result ;
You can’t perform that action at this time.
0 commit comments