Skip to content

Commit

Permalink
Merge pull request #2690 from department-of-veterans-affairs/enhancem…
Browse files Browse the repository at this point in the history
…ent/Leaf-4571/nexus_tags_only_delete_when_not_used

Leaf 4571 - fix orgchart path
  • Loading branch information
Pelentan authored Mar 6, 2025
2 parents a071c59 + 9f12b9e commit d127b84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions LEAF_Nexus/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ function customTemplate($tpl)
$t_form->assign('CSRFToken', $_SESSION['CSRFToken']);
$t_form->assign('userDomain', $oc_login->getDomain());
$t_form->assign('orgchart_path', trim(PORTAL_PATH, '/'));
$t_form->assign('domain', trim(LEAF_DOMAIN, '/'));
$t_form->assign('timeZone', $tz);

if (count($resGroup) > 0)
Expand Down
3 changes: 2 additions & 1 deletion LEAF_Nexus/sources/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function __construct(Db $db, Login $login, Db $launchpad_db)

public function getLaunchpadSites(string $orgchart_path): array
{
$vars = array(':orgchart_path' => '/' . $orgchart_path);
$path = strpos(LEAF_NEXUS_URL, 'host.docker.internal') ? '' : '/orgchart';
$vars = array(':orgchart_path' => '/' . $orgchart_path . $path);
$sql = 'SELECT `launchpadID`, `site_path`, `portal_database`
FROM `sites`
WHERE `orgchart_path` = :orgchart_path
Expand Down
10 changes: 7 additions & 3 deletions LEAF_Nexus/templates/view_group.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,18 @@ function confirmUnlinkEmployee(empUID) {
function confirmDeleteTag(inTag) {
let validate = {'groupID': '<!--{$groupID}-->'};
let warning = '';
let domain = '<!--{$domain}-->' + '/';
let orgchart_path = '<!--{$orgchart_path}-->' + '/';
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>';
confirm_dialog.setContent('<img src="dynicons/?img=help-browser.svg&amp;w=48" alt="" style="float: left; padding-right: 16px" /> <span style="font-size: 150%">Are you sure you want to delete this tag?</span>'+ warning);
confirm_dialog.setTitle('Confirmation');
$.ajax({
type: 'GET',
url: './api/platform/portal/_<!--{$orgchart_path}-->',
url: './api/platform/portal/_' + orgchart_path,
success: function(response) {
if (response.constructor === Array) {
response.forEach(function (item, index) {
Expand All @@ -362,7 +366,7 @@ function confirmDeleteTag(inTag) {
// need to check the portal for this tag in this group
$.ajax({
type: 'GET',
url: '..' + item.site_path + '/api/group/list',
url: domain + item.site_path + '/api/group/list',
success: function (response) {
if (response.some(group => group.groupID === Number(validate.groupID))) {
// need to display a message that this can't be done
Expand Down Expand Up @@ -399,7 +403,7 @@ function confirmDeleteTag(inTag) {
console.log(err);
}
});
} else {
} 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({
Expand Down

0 comments on commit d127b84

Please sign in to comment.