Skip to content

Commit ff58100

Browse files
authored
Merge pull request #126 from delphi-hub/feature/deleteInstanceFeedback
Feature/delete instance feedback
2 parents e6b3c95 + 513d6e6 commit ff58100

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

client/src/app/dashboard/label-dialog/label-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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>

client/src/app/dashboard/label-dialog/label-dialog.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

client/src/app/dashboard/table-all/table-all.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)