cloudStack 3.0 new UI - zone chart - security group - implement Enable, Disable button.

This commit is contained in:
Jessica Wang 2011-11-29 13:40:14 -08:00
parent ffc8f807c9
commit a95ccdf8bd
1 changed files with 70 additions and 2 deletions

View File

@ -1950,10 +1950,78 @@
}
},
// Security groups list view
// Security groups list view ???
securityGroups: {
id: 'securityGroup-providers',
label: 'Security Groups',
label: 'Security Groups',
providerActionFilter: function(args) {
var allowedActions = [];
var jsonObj = nspMap["securityGroups"];
if(jsonObj.state == "Enabled")
allowedActions.push("disable");
else if(jsonObj.state == "Disabled")
allowedActions.push("enable");
return allowedActions;
},
providerActions: {
enable: {
label: 'Enable',
action: function(args) {
$.ajax({
url: createURL("updateNetworkServiceProvider&id=" + nspMap["securityGroups"].id + "&state=Enabled"),
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["securityGroups"] = item;
return item;
}
}
}
);
}
});
},
messages: {
notification: function() { return 'Enabled Netscaler provider'; }
},
notification: { poll: pollAsyncJobResult }
},
disable: {
label: 'Disable',
action: function(args) {
$.ajax({
url: createURL("updateNetworkServiceProvider&id=" + nspMap["securityGroups"].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["securityGroups"] = item;
return item;
}
}
}
);
}
});
},
messages: {
notification: function() { return 'Disabled Netscaler provider'; }
},
notification: { poll: pollAsyncJobResult }
}
},
fields: {
id: { label: 'ID' },
name: { label: 'Name' },