Skip to content

Commit 3202fec

Browse files
author
Anurag Awasthi
committed
Allow project id to be passed in even if no account name is specified
1 parent 9407572 commit 3202fec

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
@@ -1491,36 +1491,36 @@
14911491
var accounts = args.data.accounts;
14921492
var accountList = args.data.accountlist;
14931493

1494-
if ((accounts !== undefined || accountList !== undefined) && projects !== undefined) {
1495-
//Let API throw Runtime Exception
1496-
} else {
1497-
if ((accounts !== undefined || accountList !== undefined) && projects === undefined) {
1498-
var accountNames = "";
1499-
if (accountList !== undefined && accounts === undefined) {
1500-
accountNames = accountList;
1501-
} else {
1502-
if (Object.prototype.toString.call(accounts) === '[object Array]') {
1503-
accountNames = accounts.join(",");
1504-
} else {
1505-
accountNames = accounts;
1506-
}
1507-
}
1508-
$.extend(data, {
1509-
accounts: accountNames
1510-
});
1511-
} else if ((accounts === undefined || accountList === undefined) && projects !== undefined) {
1512-
var projectIds = "";
1513-
if (Object.prototype.toString.call(projects) === '[object Array]') {
1514-
projectIds = projects.join(",");
1494+
if (accounts !== undefined || (accountList !== undefined && accountList.length > 0)) {
1495+
var accountNames = "";
1496+
if (accountList !== undefined && accounts === undefined) {
1497+
accountNames = accountList;
1498+
} else {
1499+
if (Object.prototype.toString.call(accounts) === '[object Array]') {
1500+
accountNames = accounts.join(",");
15151501
} else {
1516-
projectIds = projects;
1502+
accountNames = accounts;
15171503
}
1518-
$.extend(data, {
1519-
projectids: projectIds
1520-
});
15211504
}
1505+
$.extend(data, {
1506+
accounts: accountNames
1507+
});
1508+
}
1509+
1510+
if (projects !== undefined) {
1511+
var projectIds = "";
1512+
if (Object.prototype.toString.call(projects) === '[object Array]') {
1513+
projectIds = projects.join(",");
1514+
} else {
1515+
projectIds = projects;
1516+
}
1517+
1518+
$.extend(data, {
1519+
projectids: projectIds
1520+
});
15221521
}
15231522
}
1523+
15241524
$.ajax({
15251525
url: createURL('updateTemplatePermissions'),
15261526
data: data,

0 commit comments

Comments
 (0)