Implement 'add region' action

This commit is contained in:
Brian Federle 2013-02-26 13:27:59 -08:00
parent 142a5a8fba
commit 8831b2920c
3 changed files with 35 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#new labels (begin) **********************************************************************************************
label.menu.regions=Regions
label.region=Region
label.add.region=Add Region
message.add.region=Please specify the required information to add a new region.
label.endpoint=Endpoint
label.plugins=Plugins
label.plugin.details=Plugin details

View File

@ -25,6 +25,8 @@ under the License.
<% long now = System.currentTimeMillis(); %>
<script language="javascript">
dictionary = {
'label.add.region': '<fmt:message key="label.add.region"/>',
'message.add.region': '<fmt:message key="message.add.region"/>',
'label.region': '<fmt:message key="label.region"/>',
'label.endpoint': '<fmt:message key="label.endpoint"/>',
'label.menu.regions': '<fmt:message key="label.menu.regions"/>',

View File

@ -24,6 +24,37 @@
name: { label: 'label.name' },
endpoint: { label: 'label.endpoint' }
},
actions: {
add: {
label: 'label.add.region',
messages: {
notification: function() { return 'label.add.region'; }
},
createForm: {
title: 'label.add.region',
desc: 'message.add.region',
fields: {
name: { label: 'label.name', validation: { required: true } },
endpoint: { label: 'label.endpoint', validation: { url: true, required: true } },
userapikey: { label: 'label.api.key' },
userapisecretkey: { label: 'label.s3.secret_key' }
}
},
action: function(args) {
$.ajax({
url: createURL('addRegion'),
data: args.data,
success: function(json) {
var jobID = json.addregionresponse.jobid;
args.response.success({ _custom: { jobId: jobID }});
}
});
args.response.success();
},
notification: { poll: pollAsyncJobResult }
}
},
dataProvider: function(args) {
$.ajax({
url: createURL('listRegions&listAll=true'),