mirror of https://github.com/apache/cloudstack.git
cloudStack 3.0 new UI - System VM page - detail view - add actions.
This commit is contained in:
parent
8134cfb4c8
commit
1565d2c659
|
|
@ -3111,7 +3111,239 @@
|
|||
}
|
||||
},
|
||||
detailView: {
|
||||
name: 'System VM details',
|
||||
name: 'System VM details',
|
||||
actions: {
|
||||
start: {
|
||||
label: 'Start system VM',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to start system VM?';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Starting system VM';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('startSystemVm&id=' + args.context.systemvms[0].id),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.startsystemvmresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.systemvm;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return systemvmActionfilter;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
stop: {
|
||||
label: 'Stop system VM',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to stop system VM?';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Stopping system VM';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('stopSystemVm&id=' + args.context.systemvms[0].id),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.stopsystemvmresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.systemvm;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return systemvmActionfilter;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
restart: {
|
||||
label: 'reboot system VM',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to reboot system VM?';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'rebooting system VM';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('rebootSystemVm&id=' + args.context.systemvms[0].id),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.rebootsystemvmresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.systemvm;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return systemvmActionfilter;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
'delete': {
|
||||
label: 'Destroy system VM',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to destroy this system VM?';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Destroyping system VM';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('destroySystemVm&id=' + args.context.systemvms[0].id),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.destroysystemvmresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
//return {}; //nothing in this systemVM needs to be updated, in fact, this whole systemVM has being destroyed
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return systemvmActionfilter;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
migrate: {
|
||||
label: 'Migrate system VM',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to migrate system VM?';
|
||||
},
|
||||
success: function(args) {
|
||||
return 'System VM is being migrated.';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Migrating system VM';
|
||||
},
|
||||
complete: function(args) {
|
||||
return 'System VM has been migrated.';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'Migrate system VM',
|
||||
desc: '',
|
||||
fields: {
|
||||
hostId: {
|
||||
label: 'Host',
|
||||
validation: { required: true },
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.systemvms[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||
args.response.error(errorMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
if(args.data.hostId == null) {
|
||||
args.response.error("Host field is required");
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.systemvms[0].id),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.migratesystemvmresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
//return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance
|
||||
$.ajax({
|
||||
url: createURL("listSystemVms&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listsystemvmsresponse.systemvm;
|
||||
if(items != null && items.length > 0) {
|
||||
return items[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return systemvmActionfilter;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
},
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'Details',
|
||||
|
|
|
|||
Loading…
Reference in New Issue