Skip to content

Commit c5f0e4d

Browse files
committed
Leaf 4571 - Allow removal orphaned tags
1 parent 9f12b9e commit c5f0e4d

File tree

1 file changed

+25
-42
lines changed

1 file changed

+25
-42
lines changed

LEAF_Nexus/templates/view_group.tpl

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ function confirmDeleteTag(inTag) {
348348
let warning = '';
349349
let domain = '<!--{$domain}-->' + '/';
350350
let orgchart_path = '<!--{$orgchart_path}-->' + '/';
351+
let tag_found = false;
351352
orgchart_path = orgchart_path.replace('/orgchart', '');
352353
353354
warning = '<br /><br /><span style="color: red">WARNING!! removal of service would potentially impact your org chart structure, if you are trying to grant service chief access go to Request Portal->Admin panel-> Service Chief</span>';
@@ -370,6 +371,7 @@ function confirmDeleteTag(inTag) {
370371
success: function (response) {
371372
if (response.some(group => group.groupID === Number(validate.groupID))) {
372373
// need to display a message that this can't be done
374+
tag_found = true;
373375
dialog_ok.setTitle('Warning');
374376
dialog_ok.setContent('Corresponding portal tags must be removed prior to taking this action.');
375377
dialog_ok.setSaveHandler(function() {
@@ -378,52 +380,36 @@ function confirmDeleteTag(inTag) {
378380
dialog.hide();
379381
});
380382
dialog_ok.show();
381-
382-
} else {
383-
// proceed with the delete
384-
confirm_dialog.setSaveHandler(function() {
385-
$.ajax({
386-
type: 'DELETE',
387-
url: './api/group/<!--{$groupID}-->/tag?' +
388-
$.param({tag: inTag,
389-
CSRFToken: '<!--{$CSRFToken}-->'}),
390-
success: function(response) {
391-
window.location.reload();
392-
},
393-
error: function (err) {
394-
console.log(err);
395-
},
396-
cache: false
397-
});
398-
});
399-
confirm_dialog.show();
400383
}
401384
},
402385
error: function(err) {
403386
console.log(err);
404-
}
405-
});
406-
} else if (inTag == 'service' || inTag == 'ELT' || inTag == 'Quadrad') {
407-
// tag was not found in any portal need to ask to delete
408-
confirm_dialog.setSaveHandler(function() {
409-
$.ajax({
410-
type: 'DELETE',
411-
url: './api/group/<!--{$groupID}-->/tag?' +
412-
$.param({tag: inTag,
413-
CSRFToken: '<!--{$CSRFToken}-->'}),
414-
success: function(response) {
415-
window.location.reload();
416-
},
417-
error: function (err) {
418-
console.log(err);
419-
},
420-
cache: false
421-
});
387+
},
388+
async: false
422389
});
423-
confirm_dialog.show();
424390
}
425391
})
426-
})
392+
});
393+
394+
if (!tag_found) {
395+
// tag was not found in any portal need to ask to delete
396+
confirm_dialog.setSaveHandler(function() {
397+
$.ajax({
398+
type: 'DELETE',
399+
url: './api/group/<!--{$groupID}-->/tag?' +
400+
$.param({tag: inTag,
401+
CSRFToken: '<!--{$CSRFToken}-->'}),
402+
success: function(response) {
403+
window.location.reload();
404+
},
405+
error: function (err) {
406+
console.log(err);
407+
},
408+
cache: false
409+
});
410+
});
411+
confirm_dialog.show();
412+
}
427413
} else {
428414
dialog_ok.setTitle('Warning');
429415
dialog_ok.setContent(response);
@@ -440,9 +426,6 @@ function confirmDeleteTag(inTag) {
440426
},
441427
cache: false
442428
});
443-
444-
445-
446429
}
447430
448431
function writeTag(input, groupID) {

0 commit comments

Comments
 (0)