Skip to content

Commit d127b84

Browse files
authored
Merge pull request #2690 from department-of-veterans-affairs/enhancement/Leaf-4571/nexus_tags_only_delete_when_not_used
Leaf 4571 - fix orgchart path
2 parents a071c59 + 9f12b9e commit d127b84

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

LEAF_Nexus/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ function customTemplate($tpl)
256256
$t_form->assign('CSRFToken', $_SESSION['CSRFToken']);
257257
$t_form->assign('userDomain', $oc_login->getDomain());
258258
$t_form->assign('orgchart_path', trim(PORTAL_PATH, '/'));
259+
$t_form->assign('domain', trim(LEAF_DOMAIN, '/'));
259260
$t_form->assign('timeZone', $tz);
260261

261262
if (count($resGroup) > 0)

LEAF_Nexus/sources/Platform.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public function __construct(Db $db, Login $login, Db $launchpad_db)
3535

3636
public function getLaunchpadSites(string $orgchart_path): array
3737
{
38-
$vars = array(':orgchart_path' => '/' . $orgchart_path);
38+
$path = strpos(LEAF_NEXUS_URL, 'host.docker.internal') ? '' : '/orgchart';
39+
$vars = array(':orgchart_path' => '/' . $orgchart_path . $path);
3940
$sql = 'SELECT `launchpadID`, `site_path`, `portal_database`
4041
FROM `sites`
4142
WHERE `orgchart_path` = :orgchart_path

LEAF_Nexus/templates/view_group.tpl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,18 @@ function confirmUnlinkEmployee(empUID) {
346346
function confirmDeleteTag(inTag) {
347347
let validate = {'groupID': '<!--{$groupID}-->'};
348348
let warning = '';
349+
let domain = '<!--{$domain}-->' + '/';
350+
let orgchart_path = '<!--{$orgchart_path}-->' + '/';
351+
orgchart_path = orgchart_path.replace('/orgchart', '');
352+
349353
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>';
350354
351355
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);
352356
confirm_dialog.setTitle('Confirmation');
353357
354358
$.ajax({
355359
type: 'GET',
356-
url: './api/platform/portal/_<!--{$orgchart_path}-->',
360+
url: './api/platform/portal/_' + orgchart_path,
357361
success: function(response) {
358362
if (response.constructor === Array) {
359363
response.forEach(function (item, index) {
@@ -362,7 +366,7 @@ function confirmDeleteTag(inTag) {
362366
// need to check the portal for this tag in this group
363367
$.ajax({
364368
type: 'GET',
365-
url: '..' + item.site_path + '/api/group/list',
369+
url: domain + item.site_path + '/api/group/list',
366370
success: function (response) {
367371
if (response.some(group => group.groupID === Number(validate.groupID))) {
368372
// need to display a message that this can't be done
@@ -399,7 +403,7 @@ function confirmDeleteTag(inTag) {
399403
console.log(err);
400404
}
401405
});
402-
} else {
406+
} else if (inTag == 'service' || inTag == 'ELT' || inTag == 'Quadrad') {
403407
// tag was not found in any portal need to ask to delete
404408
confirm_dialog.setSaveHandler(function() {
405409
$.ajax({

0 commit comments

Comments
 (0)