Update network section

-Pull real data after add network action, to avoid having to refresh

-Update list view indicator

-Use correct destroy UI action for delete network
This commit is contained in:
bfederle 2011-12-20 12:56:46 -08:00
parent 127136b94b
commit 9b20c827fc

View File

@ -141,7 +141,8 @@
url: createURL('listNetworkOfferings'), url: createURL('listNetworkOfferings'),
data: { data: {
supportedServices: 'SourceNat', supportedServices: 'SourceNat',
type: 'isolated' type: 'isolated',
state: 'Enabled'
}, },
success: function(json) { success: function(json) {
var networkOfferings = json.listnetworkofferingsresponse.networkoffering; var networkOfferings = json.listnetworkofferingsresponse.networkoffering;
@ -165,8 +166,11 @@
data: args.data, data: args.data,
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
data: { state: 'Allocated' } data: json.createnetworkresponse.network
}); });
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
} }
}); });
}, },
@ -183,7 +187,8 @@
vlan: { label: 'VLAN' }, vlan: { label: 'VLAN' },
cidr: { label: 'CIDR' }, cidr: { label: 'CIDR' },
state: { label: 'State', indicator: { state: { label: 'State', indicator: {
'Implemented': 'on', 'Setup': 'on', 'Allocated': 'on' 'Implemented': 'on', 'Setup': 'on', 'Allocated': 'on',
'Destroyed': 'off'
} } } }
}, },
dataProvider: function(args) { dataProvider: function(args) {
@ -291,14 +296,8 @@
confirm: function(args) { confirm: function(args) {
return 'Please confirm that you want to restart network'; return 'Please confirm that you want to restart network';
}, },
success: function(args) {
return 'Network is being restarted';
},
notification: function(args) { notification: function(args) {
return 'Restarting network'; return 'Restarting network';
},
complete: function(args) {
return 'Network has been restarted';
} }
}, },
notification: { notification: {
@ -306,20 +305,14 @@
} }
}, },
'delete': { destroy: {
label: 'Delete network', label: 'Delete network',
messages: { messages: {
confirm: function(args) { confirm: function(args) {
return 'Are you sure you want to delete network ?'; return 'Are you sure you want to delete network ?';
}, },
success: function(args) {
return 'Network is being deleted.';
},
notification: function(args) { notification: function(args) {
return 'Deleting network'; return 'Deleting network';
},
complete: function(args) {
return 'Network has been deleted.';
} }
}, },
action: function(args) { action: function(args) {
@ -333,7 +326,7 @@
{_custom: {_custom:
{jobId: jid, {jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return {}; //nothing in this network needs to be updated, in fact, this whole template has being deleted return { state: 'Destroyed' }; //nothing in this network needs to be updated, in fact, this whole template has being deleted
} }
} }
} }