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>
4
4
< form class ="mat-dialog-content " #formControl ="ngForm ">
5
5
< div class ="form ">
6
6
< 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 >
8
8
< mat-error *ngIf ="formControl.invalid "> {{getErrorMessage()}}</ mat-error >
9
9
</ mat-form-field >
10
10
</ div >
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ export class LabelDialogComponent implements OnInit {
36
36
37
37
onCloseCancelLabel ( ) {
38
38
this . thislabelDialogRef . close ( 'CancelLabel' ) ;
39
-
40
39
}
40
+
41
+ onKeydown ( event ) {
42
+ this . thislabelDialogRef . close ( {
43
+ status : 'Add' ,
44
+ labelName : this . labelName
45
+ } ) ;
46
+ }
41
47
}
Original file line number Diff line number Diff line change @@ -92,20 +92,19 @@ export class TableAllComponent implements OnInit {
92
92
} ) ;
93
93
94
94
dialogRef . afterClosed ( ) . subscribe ( result => {
95
- console . log ( 'delete state' , instance . instanceState ) ;
95
+
96
96
if ( result === 'Confirm' && instance . instanceState === 'Running' ) {
97
- console . log ( 'alert working' ) ;
98
97
alert ( 'Please Stop the Instance before you try to delete' ) ;
99
- console . log ( 'data' , this . dataSource . data ) ;
100
-
101
98
} else {
102
99
if ( result !== 'Cancel' ) {
103
100
this . apiService . deleteInstance ( id ) . subscribe ( ( deleteResult : HttpEvent < number > ) => {
104
- console . log ( 'result' , deleteResult ) ;
101
+ this . removeAt ( i ) ;
105
102
} , err => {
106
103
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
+ }
107
107
} ) ;
108
- this . removeAt ( i ) ;
109
108
}
110
109
}
111
110
this . dialogResult = result ;
You can’t perform that action at this time.
0 commit comments