Skip to content

Commit

Permalink
Leaf 4571 - Allow removal orphaned tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jampaul3 committed Mar 6, 2025
1 parent 9f12b9e commit c5f0e4d
Showing 1 changed file with 25 additions and 42 deletions.
67 changes: 25 additions & 42 deletions LEAF_Nexus/templates/view_group.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ function confirmDeleteTag(inTag) {
let warning = '';
let domain = '<!--{$domain}-->' + '/';
let orgchart_path = '<!--{$orgchart_path}-->' + '/';
let tag_found = false;
orgchart_path = orgchart_path.replace('/orgchart', '');
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>';
Expand All @@ -370,6 +371,7 @@ function confirmDeleteTag(inTag) {
success: function (response) {
if (response.some(group => group.groupID === Number(validate.groupID))) {
// need to display a message that this can't be done
tag_found = true;
dialog_ok.setTitle('Warning');
dialog_ok.setContent('Corresponding portal tags must be removed prior to taking this action.');
dialog_ok.setSaveHandler(function() {
Expand All @@ -378,52 +380,36 @@ function confirmDeleteTag(inTag) {
dialog.hide();
});
dialog_ok.show();
} else {
// proceed with the delete
confirm_dialog.setSaveHandler(function() {
$.ajax({
type: 'DELETE',
url: './api/group/<!--{$groupID}-->/tag?' +
$.param({tag: inTag,
CSRFToken: '<!--{$CSRFToken}-->'}),
success: function(response) {
window.location.reload();
},
error: function (err) {
console.log(err);
},
cache: false
});
});
confirm_dialog.show();
}
},
error: function(err) {
console.log(err);
}
});
} else if (inTag == 'service' || inTag == 'ELT' || inTag == 'Quadrad') {
// tag was not found in any portal need to ask to delete
confirm_dialog.setSaveHandler(function() {
$.ajax({
type: 'DELETE',
url: './api/group/<!--{$groupID}-->/tag?' +
$.param({tag: inTag,
CSRFToken: '<!--{$CSRFToken}-->'}),
success: function(response) {
window.location.reload();
},
error: function (err) {
console.log(err);
},
cache: false
});
},
async: false
});
confirm_dialog.show();
}
})
})
});
if (!tag_found) {
// tag was not found in any portal need to ask to delete
confirm_dialog.setSaveHandler(function() {
$.ajax({
type: 'DELETE',
url: './api/group/<!--{$groupID}-->/tag?' +
$.param({tag: inTag,
CSRFToken: '<!--{$CSRFToken}-->'}),
success: function(response) {
window.location.reload();
},
error: function (err) {
console.log(err);
},
cache: false
});
});
confirm_dialog.show();
}
} else {
dialog_ok.setTitle('Warning');
dialog_ok.setContent(response);
Expand All @@ -440,9 +426,6 @@ function confirmDeleteTag(inTag) {
},
cache: false
});
}
function writeTag(input, groupID) {
Expand Down

0 comments on commit c5f0e4d

Please sign in to comment.