Skip to content

Commit fdaa5b4

Browse files
committed
User accounts UI: Support for regions
-Add region select to add account form -Show account's region in detail view
1 parent 79bfbe3 commit fdaa5b4

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

‎ui/scripts/accounts.js‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,31 @@
113113
validation: { required: true },
114114
docID: 'helpAccountLastName'
115115
},
116+
regionid: {
117+
label: 'label.region',
118+
select: function(args) {
119+
$.ajax({
120+
url: createURL('listRegions&listAll=true'),
121+
success: function(json) {
122+
var regions = json.listregionsresponse.region;
123+
var regionOptions;
124+
125+
if (!regions) {
126+
regionOptions = [{ id: 0, description: '0 - Default' }];
127+
} else {
128+
regionOptions = $(regions).map(function(index, region) {
129+
return {
130+
id: region.id,
131+
description: region.id + ' - ' + region.name
132+
};
133+
});
134+
}
135+
136+
args.response.success({ data: regionOptions });
137+
}
138+
});
139+
}
140+
},
116141
domainid: {
117142
label: 'label.domain',
118143
docID: 'helpAccountDomain',
@@ -181,7 +206,7 @@
181206

182207
action: function(args) {
183208
var data = {
184-
username: args.data.username
209+
username: args.data.username,
185210
};
186211

187212
var password = args.data.password;
@@ -196,6 +221,7 @@
196221
email: args.data.email,
197222
firstname: args.data.firstname,
198223
lastname: args.data.lastname,
224+
regionid: args.data.regionid,
199225
domainid: args.data.domainid
200226
});
201227

@@ -290,7 +316,8 @@
290316
domainid: accountObj.domainid,
291317
account: accountObj.name,
292318
newname: args.data.name,
293-
networkdomain: args.data.networkdomain
319+
networkdomain: args.data.networkdomain,
320+
regionid: accountObj.regionid ? accountObj.regionid : 0
294321
};
295322

296323
$.ajax({
@@ -634,6 +661,7 @@
634661
return cloudStack.converters.toRole(args);
635662
}
636663
},
664+
regionid: { label: 'label.region' },
637665
domain: { label: 'label.domain' },
638666
state: { label: 'label.state' },
639667
networkdomain: {

0 commit comments

Comments
 (0)