Skip to content

Commit 60ab5f8

Browse files
author
Anurag Awasthi
committed
Allow project id to be passed in even if no account name is specified
1 parent b865490 commit 60ab5f8

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

ui/scripts/templates.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,36 +1480,36 @@
14801480
var accounts = args.data.accounts;
14811481
var accountList = args.data.accountlist;
14821482

1483-
if ((accounts !== undefined || accountList !== undefined) && projects !== undefined) {
1484-
//Let API throw Runtime Exception
1485-
} else {
1486-
if ((accounts !== undefined || accountList !== undefined) && projects === undefined) {
1487-
var accountNames = "";
1488-
if (accountList !== undefined && accounts === undefined) {
1489-
accountNames = accountList;
1490-
} else {
1491-
if (Object.prototype.toString.call(accounts) === '[object Array]') {
1492-
accountNames = accounts.join(",");
1493-
} else {
1494-
accountNames = accounts;
1495-
}
1496-
}
1497-
$.extend(data, {
1498-
accounts: accountNames
1499-
});
1500-
} else if ((accounts === undefined || accountList === undefined) && projects !== undefined) {
1501-
var projectIds = "";
1502-
if (Object.prototype.toString.call(projects) === '[object Array]') {
1503-
projectIds = projects.join(",");
1483+
if (accounts !== undefined || (accountList !== undefined && accountList.length > 0)) {
1484+
var accountNames = "";
1485+
if (accountList !== undefined && accounts === undefined) {
1486+
accountNames = accountList;
1487+
} else {
1488+
if (Object.prototype.toString.call(accounts) === '[object Array]') {
1489+
accountNames = accounts.join(",");
15041490
} else {
1505-
projectIds = projects;
1491+
accountNames = accounts;
15061492
}
1507-
$.extend(data, {
1508-
projectids: projectIds
1509-
});
15101493
}
1494+
$.extend(data, {
1495+
accounts: accountNames
1496+
});
1497+
}
1498+
1499+
if (projects !== undefined) {
1500+
var projectIds = "";
1501+
if (Object.prototype.toString.call(projects) === '[object Array]') {
1502+
projectIds = projects.join(",");
1503+
} else {
1504+
projectIds = projects;
1505+
}
1506+
1507+
$.extend(data, {
1508+
projectids: projectIds
1509+
});
15111510
}
15121511
}
1512+
15131513
$.ajax({
15141514
url: createURL('updateTemplatePermissions'),
15151515
data: data,

0 commit comments

Comments
 (0)