}
remove() {
- this.delConfirm.open().subscribe(
- ok => {
- this.pcrud.remove(this.selected.callerData.aout)
- .subscribe(
- ok2 => {},
- err => {
- this.errorString.current()
- .then(str => this.toast.danger(str));
- },
- () => {
- // Avoid updating until we know the entire
- // pcrud action/transaction completed.
- this.loadAoutTree(); // since the tree is never going to
- // be large, just reload the whole
- // thing
- this.selected = null;
- this.postUpdate(this.editString);
- }
- );
- }
- );
+ this.delConfirm.open().subscribe(confirmed => {
+ if (!confirmed) { return; }
+
+ this.pcrud.remove(this.selected.callerData.aout)
+ .subscribe(
+ ok2 => {},
+ err => {
+ this.errorString.current()
+ .then(str => this.toast.danger(str));
+ },
+ () => {
+ // Avoid updating until we know the entire
+ // pcrud action/transaction completed.
+ this.loadAoutTree(); // since the tree is never going to
+ // be large, just reload the whole
+ // thing
+ this.selected = null;
+ this.postUpdate(this.editString);
+ }
+ );
+ });
}
addChild() {
this.idsToUnlink = rows.map(r => r.target_copy().id());
if (this.idsToUnlink.length === 0) { return; }
- try { // rejects on dismiss, which results in an Error
- // TODO this will change with LP #1823041
- await this.confirmUnlink.open({size: 'sm'});
- } catch (dismissed) { return; }
-
- const maps = [];
- this.pcrud.search('bpbcm',
- {target_copy: this.idsToUnlink, peer_record: this.recordId})
- .subscribe(
- map => maps.push(map),
- err => {},
- () => {
- this.pcrud.remove(maps).subscribe(
- ok => console.debug('deleted map ', ok),
- err => console.error(err),
- () => {
- this.idsToUnlink = [];
- this.grid.reload();
- }
- );
- }
- );
+ this.confirmUnlink.open({size: 'sm'}).subscribe(confirmed => {
+
+ if (!confirmed) { return; }
+
+ const maps = [];
+ this.pcrud.search('bpbcm',
+ {target_copy: this.idsToUnlink, peer_record: this.recordId})
+ .subscribe(
+ map => maps.push(map),
+ err => {},
+ () => {
+ this.pcrud.remove(maps).subscribe(
+ ok => console.debug('deleted map ', ok),
+ err => console.error(err),
+ () => {
+ this.idsToUnlink = [];
+ this.grid.reload();
+ }
+ );
+ }
+ );
+ });
}
openConjoinedDialog() {
import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
-import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
/**
* Dialog for managing copy alerts.
@ViewChild('successMsg') private successMsg: StringComponent;
@ViewChild('errorMsg') private errorMsg: StringComponent;
- @ViewChild('confirmDeleteDialog')
- private confirmDeleteDialog: ConfirmDialogComponent;
constructor(
private modal: NgbModal, // required for passing to parent