diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 9190283bce9..7131e0fb989 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -6428,7 +6428,7 @@ div.panel.ui-dialog div.list-view div.fixed-header { background: url(../images/bg-gradients.png) 0px -271px; border: 1px solid #B7B7B7; color: #485867; - font-size: 11px; + font-size: 10px; /*+text-shadow:0px 1px #FFFFFF;*/ -moz-text-shadow: 0px 1px #FFFFFF; -webkit-text-shadow: 0px 1px #FFFFFF; diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 35969c1aa73..ebc9fda6bae 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1,4 +1,64 @@ (function($, cloudStack) { + cloudStack.publicIpRangeAccount = { + dialog: function(args) { + return function(args) { + var data = args.data ? args.data : {}; + var fields = { + account: { label: 'Account', defaultValue: data.account }, + domainid: { + label: 'Domain', + defaultValue: data.domainid, + select: function(args) { + $.ajax({ + url: createURL('listDomains'), + data: { listAll: true }, + success: function(json) { + args.response.success({ + data: $.map(json.listdomainsresponse.domain, function(domain) { + return { + id: domain.id, + description: domain.path + }; + }) + }); + } + }); + } + } + }; + var success = args.response.success; + + if (args.$item) { // Account data is read-only after creation + $.ajax({ + url: createURL('listDomains'), + data: { id: data.domainid, listAll: true }, + success: function(json) { + var domain = json.listdomainsresponse.domain[0]; + + cloudStack.dialog.notice({ + message: '' + }); + } + }); + } else { + cloudStack.dialog.createForm({ + form: { + title: 'label.add.account', + desc: '(optional) Please specify an account to be associated with this IP range.', + fields: fields + }, + after: function(args) { + var data = cloudStack.serializeForm(args.$form); + + success({ data: data }); + } + }); + } + }; + } + }; + var zoneObjs, podObjs, clusterObjs, domainObjs, networkOfferingObjs, physicalNetworkObjs; var selectedClusterObj, selectedZoneObj, selectedPublicNetworkObj, selectedManagementNetworkObj, selectedPhysicalNetworkObj, selectedGuestNetworkObj; @@ -345,6 +405,13 @@ 'vlan': { edit: true, label: 'label.vlan', isOptional: true }, 'startip': { edit: true, label: 'label.start.IP' }, 'endip': { edit: true, label: 'label.end.IP' }, + 'account': { + label: 'label.account', + custom: { + buttonLabel: 'label.add.account', + action: cloudStack.publicIpRangeAccount.dialog() + } + }, 'add-rule': { label: 'label.add', addButton: true } }, add: { @@ -364,6 +431,11 @@ if(args.data.endip != null && args.data.endip.length > 0) array1.push("&endip=" + args.data.endip); + if (args.data.account) { + array1.push("&account=" + args.data.account.account); + array1.push("&domainid=" + args.data.account.domainid); + } + array1.push("&forVirtualNetwork=true"); //indicates this new IP range is for public network, not guest network $.ajax({ @@ -419,7 +491,18 @@ dataType: "json", success: function(json) { var items = json.listvlaniprangesresponse.vlaniprange; - args.response.success({data: items}); + + args.response.success({ + data: $.map(items, function(item) { + return $.extend(item, { + account: { + _buttonLabel: item.account, + account: item.account, + domainid: item.domainid + } + }); + }) + }); } }); }