change & delete for command modal

This commit is contained in:
Yubing325
2020-06-12 14:33:50 -05:00
parent dc0ec0cd9d
commit 4d73c7c608
13 changed files with 85 additions and 41 deletions
@@ -42,7 +42,6 @@ export class CommandModalComponent implements OnInit, OnDestroy {
}
attemptSave() {
debugger;
this.loading = true;
this.dataSource.executeCommandByName(this.command, this.commandModel)
.pipe(
@@ -20,13 +20,14 @@ export class CommandModalDirective {
@Input() commandText: string;
@Input() cancelText: string;
@Input() animated: boolean;
@Input() isConfirmModal: boolean;
@HostListener('click')
wasClicked() {
this.dataSource.resolveCommandModelByName({
command: this.command,
model: this.model
}).subscribe(commandModel => {
}).subscribe(commandModel => {
const initialState = {
dataSource: this.dataSource,
command: this.command,
@@ -37,6 +38,12 @@ export class CommandModalDirective {
commandText: this.commandText || 'OK',
cancelText: this.cancelText || 'Cancel'
};
if(this.isConfirmModal){
this.modalService.show(CommandModalComponent, {
animated: this.animated === undefined ? true : this.animated,
initialState
});
}
this.modalService.show(CommandModalComponent, {
animated: this.animated === undefined ? true : this.animated,
initialState
@@ -21,7 +21,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-light" (click)="modalRef.hide()"
[attr.disabled]="loading">{{ cancelText }}</button>
<button type="button" class="btn btn-primary" (click)="attemptSave()" [attr.disabled]="loading">Creat</button>
<button type="button" class="btn btn-primary" (click)="attemptSave()" [attr.disabled]="loading">Create</button>
<br>
<div class="progress" style="width: 100%" *ngIf="loading">
@@ -48,7 +48,6 @@ export class FormGroupCommandModalComponent implements OnInit {
}
attemptSave() {
this.errorMessage = null;
if (!this.modelForm.valid)
{