mirror of https://github.com/apache/cloudstack.git
CS-15015: cloudstack 3.0 UI - detailView widget - add new property "pollAgainIfValueIsIn" to keep polling newest info from server when a column has a specific value (e.g. volume state column has value 'UploadNotStarted')
This commit is contained in:
parent
77e914bc0a
commit
3b51b1865f
|
|
@ -33,14 +33,17 @@
|
|||
fields: {
|
||||
name: { label: 'label.name' },
|
||||
type: { label: 'label.type' },
|
||||
//hypervisor: { label: 'label.hypervisor' },
|
||||
//vmdisplayname: { label: 'label.vm.display.name' },
|
||||
state: {
|
||||
hypervisor: { label: 'label.hypervisor' },
|
||||
vmdisplayname: { label: 'label.vm.display.name' },
|
||||
|
||||
/*
|
||||
state: {
|
||||
label: 'State',
|
||||
indicator: {
|
||||
'Ready': 'on'
|
||||
}
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
// List view actions
|
||||
|
|
@ -943,7 +946,12 @@
|
|||
{
|
||||
id: { label: 'ID' },
|
||||
zonename: { label: 'label.zone' },
|
||||
state: { label: 'label.state' },
|
||||
state: {
|
||||
label: 'label.state',
|
||||
pollAgainIfValueIsIn: {
|
||||
'UploadNotStarted': 1
|
||||
}
|
||||
},
|
||||
type: { label: 'label.type' },
|
||||
storagetype: { label: 'label.storage.type' },
|
||||
hypervisor: { label: 'label.hypervisor' },
|
||||
|
|
|
|||
|
|
@ -680,7 +680,29 @@
|
|||
} else if (key != 'name') {
|
||||
isOddRow = true;
|
||||
}
|
||||
|
||||
|
||||
//???
|
||||
if("pollAgainIfValueIsIn" in value) {
|
||||
if (content in value.pollAgainIfValueIsIn) {
|
||||
//poll again
|
||||
var intervalKey = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("listVolumes&id=" + context.volumes[0].id),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jsonObj = json.listvolumesresponse.volume[0];
|
||||
if(jsonObj[key] != content) {
|
||||
//if(jsonObj[key] == content) { //for testing, remove it before check in
|
||||
clearInterval(intervalKey);
|
||||
$('.detail-view .toolbar .button.refresh').click(); //click Refresh button to refresh detailView
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
$name.html(_l(value.label));
|
||||
$value.html(_s(content));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue