Gives a popup message if libraries are still being referenced on delete

This commit is contained in:
alicia pritchett 2022-02-11 10:14:44 -05:00
parent 760864131b
commit 7380032dcf
1 changed files with 8 additions and 4 deletions

View File

@ -191,15 +191,21 @@ export class WorkflowSpecListComponent implements OnInit {
canDeleteWorkflowSpec(wfs){ canDeleteWorkflowSpec(wfs){
// TODO: put the popup back in for this
let references = [] let references = []
if (wfs.library){ if (wfs.library){
this.workflowSpecs.forEach(spec => { this.workflowSpecs.forEach(spec => {
if (spec.libraries.indexOf(wfs.id) >= 0 ) { if (spec.libraries.indexOf(wfs.id) >= 0 ) {
references.push(wfs.id); references.push(spec.id);
} }
}); });
if (references.length > 0) { if (references.length > 0) {
let message = '';
references.forEach(ref => {
message += ref.toString() + ', ';
});
message = message.substr(0, message.length-2);
this.snackBar.open('The Library ' + '\'' + wfs.display_name + '\'' +
' is still being referenced by these workflows: ' + message, 'Ok');
return false; return false;
} }
} }
@ -221,8 +227,6 @@ export class WorkflowSpecListComponent implements OnInit {
if (typeof this.masterStatusSpec !== 'undefined') { if (typeof this.masterStatusSpec !== 'undefined') {
this.selectSpec(this.masterStatusSpec); this.selectSpec(this.masterStatusSpec);
} }
} else {
// TODO: the library is being referenced elsewhere still
} }
}); });
} }