explicit Dedication - Pod action filter for releasing dedicated pod (API Call)

This commit is contained in:
Pranav Saxena 2013-05-28 16:52:43 +05:30
parent 1c9a34abcc
commit cee82eca55
2 changed files with 51 additions and 6 deletions

View File

@ -11725,11 +11725,13 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
background-position: 0px -613px;
}
.restart .icon {
.restart .icon,
.release .icon {
background-position: 0px -63px;
}
.restart:hover .icon {
.restart:hover .icon,
.release:hover .icon {
background-position: 0px -645px;
}

View File

@ -8805,6 +8805,43 @@
},
release:{
label:'Release Dedicated Pod',
messages:{
confirm: function(args) {
return 'Do you want to release this dedicated pod ?';
},
notification: function(args) {
return 'Pod dedication released';
}
},
action:function(args){
$.ajax({
url:createURL("releaseDedicatedPod&podid=" + args.context.pods[0].id),
dataType:"json",
async:true,
success:function(json){
var jid = json.releasededicatedpodresponse.jobid;
args.response.success({
_custom:
{ jobId: jid
},
notification: {
poll: pollAsyncJobResult
},
actionFilter:podActionfilter
});
},
error:function(args){
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
}
});
}
},
disable: {
label: 'label.action.disable.pod',
messages: {
@ -12763,20 +12800,26 @@
var podActionfilter = function(args) {
var podObj = args.context.item;
var allowedActions = [];
var flag = 0;
$.ajax({
url:createURL("listDedicatedPods&podId=" + args.context.pods[0].id),
success:function(json){
if(json.listdedicatedpodsresponse.dedicatedpod != undefined){
var dedicatedPodObj = json.listdedicatedpodsresponse.dedicatedpod[0];
if(dedicatedPodObj.domainid != null)
allowedActions.push("release");
}
flag =1;
}
else
allowedActions.push("dedicate");
flag =0;
}
});
// if(flag == 0)
allowedActions.push("dedicate");
// if(flag == 1)
allowedActions.push("release");
allowedActions.push("edit");
if(podObj.allocationstate == "Disabled")
allowedActions.push("enable");