mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-21 13:03:10 +01:00
cloudStack 3.0 new UI - zone chart - virtual router provider - implement enable/disable action.
This commit is contained in:
parent
8903c2394d
commit
535c8669b6
@ -1054,38 +1054,85 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
types: {
|
types: {
|
||||||
// Virtual router list view
|
// Virtual router provider
|
||||||
virtualRouter: {
|
virtualRouter: {
|
||||||
id: 'virtualRouterProviders',
|
id: 'virtualRouterProviders',
|
||||||
label: 'Virtual Router',
|
label: 'Virtual Router',
|
||||||
fields: {
|
providerActionFilter: function(args) {
|
||||||
name: { label: 'Name' },
|
var allowedActions = [];
|
||||||
ipaddress: { label: 'IP Address' },
|
var jsonObj = nspMap["virtualRouter"];
|
||||||
state: { label: 'Status' }
|
if(jsonObj.state == "Enabled")
|
||||||
|
allowedActions.push("disable");
|
||||||
|
else if(jsonObj.state == "Disabled")
|
||||||
|
allowedActions.push("enable");
|
||||||
|
return allowedActions;
|
||||||
},
|
},
|
||||||
dataProvider: function(args) {
|
providerActions: {
|
||||||
setTimeout(function() {
|
enable: {
|
||||||
args.response.success({
|
label: 'Enable',
|
||||||
data: [
|
action: function(args) {
|
||||||
{
|
$.ajax({
|
||||||
name: 'Router0001S',
|
url: createURL("updateNetworkServiceProvider&id=" + nspMap["virtualRouter"].id + "&state=Enabled"),
|
||||||
ipaddress: '192.168.1.1',
|
dataType: "json",
|
||||||
state: 'Enabled'
|
success: function(json) {
|
||||||
},
|
var jid = json.updatenetworkserviceproviderresponse.jobid;
|
||||||
{
|
args.response.success(
|
||||||
name: 'Router0001B',
|
{_custom:
|
||||||
ipaddress: '192.168.1.155',
|
{
|
||||||
state: 'Enabled'
|
jobId: jid,
|
||||||
},
|
getUpdatedItem: function(json) {
|
||||||
{
|
var item = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
|
||||||
name: 'Router0002',
|
nspMap["virtualRouter"] = item;
|
||||||
ipaddress: '192.168.1.13',
|
return item;
|
||||||
state: 'Enabled'
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
]
|
});
|
||||||
});
|
},
|
||||||
}, 500);
|
messages: {
|
||||||
}
|
notification: function() { return 'Enabled Netscaler provider'; }
|
||||||
|
},
|
||||||
|
notification: { poll: pollAsyncJobResult }
|
||||||
|
},
|
||||||
|
disable: {
|
||||||
|
label: 'Disable',
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("updateNetworkServiceProvider&id=" + nspMap["virtualRouter"].id + "&state=Disabled"),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var jid = json.updatenetworkserviceproviderresponse.jobid;
|
||||||
|
args.response.success(
|
||||||
|
{_custom:
|
||||||
|
{
|
||||||
|
jobId: jid,
|
||||||
|
getUpdatedItem: function(json) {
|
||||||
|
var item = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
|
||||||
|
nspMap["virtualRouter"] = item;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
notification: function() { return 'Disabled Netscaler provider'; }
|
||||||
|
},
|
||||||
|
notification: { poll: pollAsyncJobResult }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
id: { label: 'ID' },
|
||||||
|
name: { label: 'Name' }//,
|
||||||
|
//state: { label: 'Status' } //comment it for now, since dataProvider below doesn't get called by widget code after action is done
|
||||||
|
},
|
||||||
|
dataProvider: function(args) {
|
||||||
|
args.response.success({data: nspMap["virtualRouter"]});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// NetScaler list view
|
// NetScaler list view
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user