mirror of https://github.com/apache/cloudstack.git
bug 9426: Deleting an ISO will no longer cause the UI to continue to poll for download process
merge from master
This commit is contained in:
parent
c3c80006ca
commit
714914d21d
|
|
@ -317,7 +317,10 @@ function isoToRightPanel($midmenuItem1) {
|
|||
isoJsonToDetailsTab();
|
||||
}
|
||||
|
||||
function isoJsonToDetailsTab() {
|
||||
function isoJsonToDetailsTab() {
|
||||
var timerKey = "isoDownloadProgress";
|
||||
$("body").stopTime(timerKey); //stop timer on previously selected middle menu item in ISO page
|
||||
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
if($midmenuItem1 == null) {
|
||||
isoClearDetailsTab();
|
||||
|
|
@ -332,7 +335,9 @@ function isoJsonToDetailsTab() {
|
|||
|
||||
var strCmd = "command=listIsos&isofilter=self&id="+jsonObj.id;
|
||||
if(jsonObj.zoneid != null)
|
||||
strCmd = strCmd + "&zoneid="+jsonObj.zoneid;
|
||||
strCmd = strCmd + "&zoneid="+jsonObj.zoneid;
|
||||
|
||||
var itemExists = true;
|
||||
$.ajax({
|
||||
data: createURL(strCmd),
|
||||
dataType: "json",
|
||||
|
|
@ -342,9 +347,20 @@ function isoJsonToDetailsTab() {
|
|||
if(items != null && items.length > 0) {
|
||||
jsonObj = items[0];
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
}
|
||||
else {
|
||||
itemExists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
,
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
itemExists = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
if(itemExists == false)
|
||||
return;
|
||||
|
||||
var $thisTab = $("#right_panel_content #tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
|
|
@ -368,13 +384,12 @@ function isoJsonToDetailsTab() {
|
|||
|
||||
|
||||
//refresh status field every 2 seconds if ISO is in download progress
|
||||
var timerKey = "isoDownloadProgress";
|
||||
$("body").stopTime(timerKey); //stop timer on previously selected middle menu item in ISO page
|
||||
|
||||
if(jsonObj.isready == true){
|
||||
setTemplateStateInRightPanel("Ready", $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
}
|
||||
else {
|
||||
else if(jsonObj.status == null || jsonObj.status == "" || jsonObj.status.indexOf("%") != -1) { //ISO is downloading....
|
||||
$("#progressbar_container").show();
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
|
|
@ -396,7 +411,10 @@ function isoJsonToDetailsTab() {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
else { //error status
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
}
|
||||
|
||||
if(jsonObj.size != null)
|
||||
$thisTab.find("#size").text(convertBytes(parseInt(jsonObj.size)));
|
||||
|
|
@ -502,18 +520,25 @@ function isoRefreshStatusDownloadProgress(oldJsonObj, $thisTab, $midmenuItem1, t
|
|||
$("#progressbar_container").hide();
|
||||
$("body").stopTime(timerKey);
|
||||
}
|
||||
else {
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
if(jsonObj.status != null && jsonObj.status.indexOf("%") != -1) { //e.g. jsonObj.status == "95% Downloaded"
|
||||
var s = jsonObj.status.substring(0, jsonObj.status.indexOf("%")); //e.g. s == "95"
|
||||
if(isNaN(s) == false) {
|
||||
progressBarValue = parseInt(s); //e.g. progressBarValue == 95
|
||||
}
|
||||
}
|
||||
$("#progressbar").progressbar({
|
||||
value: progressBarValue //e.g. progressBarValue == 95
|
||||
});
|
||||
else {
|
||||
if(jsonObj.status != null && jsonObj.status != "" && jsonObj.status.indexOf("%") == -1) { //error state
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
$("body").stopTime(timerKey);
|
||||
}
|
||||
else {
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
if(jsonObj.status != null && jsonObj.status.indexOf("%") != -1) { //e.g. jsonObj.status == "95% Downloaded"
|
||||
var s = jsonObj.status.substring(0, jsonObj.status.indexOf("%")); //e.g. s == "95"
|
||||
if(isNaN(s) == false) {
|
||||
progressBarValue = parseInt(s); //e.g. progressBarValue == 95
|
||||
}
|
||||
}
|
||||
$("#progressbar").progressbar({
|
||||
value: progressBarValue //e.g. progressBarValue == 95
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -714,7 +739,8 @@ function doDeleteIso($actionLink, $detailsTab, $midmenuItem1) {
|
|||
$dialog1
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog("close");
|
||||
$("body").stopTime("isoDownloadProgress");
|
||||
var apiCommand = "command=deleteIso&id="+id+moreCriteria.join("");
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -327,7 +327,10 @@ function templateToRightPanel($midmenuItem1) {
|
|||
}
|
||||
|
||||
function templateJsonToDetailsTab() {
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
var timerKey = "templateDownloadProgress";
|
||||
$("body").stopTime(timerKey); //stop timer on previously selected middle menu item in template page
|
||||
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
if($midmenuItem1 == null) {
|
||||
templateClearDetailsTab();
|
||||
return;
|
||||
|
|
@ -341,7 +344,9 @@ function templateJsonToDetailsTab() {
|
|||
|
||||
var strCmd = "command=listTemplates&templatefilter=self&id="+jsonObj.id;
|
||||
if(jsonObj.zoneid != null)
|
||||
strCmd = strCmd +"&zoneid="+jsonObj.zoneid;
|
||||
strCmd = strCmd +"&zoneid="+jsonObj.zoneid;
|
||||
|
||||
var itemExists = true;
|
||||
$.ajax({
|
||||
data: createURL(strCmd),
|
||||
dataType: "json",
|
||||
|
|
@ -352,9 +357,20 @@ function templateJsonToDetailsTab() {
|
|||
jsonObj = items[0];
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
}
|
||||
}
|
||||
else {
|
||||
itemExists = false;
|
||||
}
|
||||
}
|
||||
,
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
itemExists = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(itemExists == false)
|
||||
return;
|
||||
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
|
@ -375,14 +391,12 @@ function templateJsonToDetailsTab() {
|
|||
$thisTab.find("#templatetype").text(fromdb(jsonObj.templatetype));
|
||||
|
||||
|
||||
//refresh status field every 2 seconds if template is in download progress
|
||||
var timerKey = "templateDownloadProgress";
|
||||
$("body").stopTime(timerKey); //stop timer on previously selected middle menu item in template page
|
||||
//refresh status field every 2 seconds if template is in download progress
|
||||
if(jsonObj.isready == true){
|
||||
setTemplateStateInRightPanel("Ready", $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
}
|
||||
else {
|
||||
else if(jsonObj.status == null || jsonObj.status == "" || jsonObj.status.indexOf("%") != -1) { //template is downloading....
|
||||
$("#progressbar_container").show();
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
|
|
@ -404,7 +418,10 @@ function templateJsonToDetailsTab() {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
else { //error status
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
}
|
||||
|
||||
if(jsonObj.size != null)
|
||||
$thisTab.find("#size").text(convertBytes(parseInt(jsonObj.size)));
|
||||
|
|
@ -498,18 +515,25 @@ function templateRefreshStatusDownloadProgress(oldJsonObj, $thisTab, $midmenuIte
|
|||
$("#progressbar_container").hide();
|
||||
$("body").stopTime(timerKey);
|
||||
}
|
||||
else {
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
if(jsonObj.status != null && jsonObj.status.indexOf("%") != -1) { //e.g. jsonObj.status == "95% Downloaded"
|
||||
var s = jsonObj.status.substring(0, jsonObj.status.indexOf("%")); //e.g. s == "95"
|
||||
if(isNaN(s) == false) {
|
||||
progressBarValue = parseInt(s); //e.g. progressBarValue == 95
|
||||
}
|
||||
else {
|
||||
if(jsonObj.status != null && jsonObj.status != "" && jsonObj.status.indexOf("%") == -1) { //error state
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
$("#progressbar_container").hide();
|
||||
$("body").stopTime(timerKey);
|
||||
}
|
||||
else {
|
||||
setTemplateStateInRightPanel(fromdb(jsonObj.status), $thisTab.find("#status"));
|
||||
var progressBarValue = 0;
|
||||
if(jsonObj.status != null && jsonObj.status.indexOf("%") != -1) { //e.g. jsonObj.status == "95% Downloaded"
|
||||
var s = jsonObj.status.substring(0, jsonObj.status.indexOf("%")); //e.g. s == "95"
|
||||
if(isNaN(s) == false) {
|
||||
progressBarValue = parseInt(s); //e.g. progressBarValue == 95
|
||||
}
|
||||
}
|
||||
$("#progressbar").progressbar({
|
||||
value: progressBarValue //e.g. progressBarValue == 95
|
||||
});
|
||||
}
|
||||
$("#progressbar").progressbar({
|
||||
value: progressBarValue //e.g. progressBarValue == 95
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -588,7 +612,7 @@ var templateActionMap = {
|
|||
if((jsonObj.id == $("#right_panel_content").find("#tab_content_details").find("#id").text())
|
||||
&& ((jsonObj.zoneid == null) || (jsonObj.zoneid != null && jsonObj.zoneid == $("#right_panel_content").find("#tab_content_details").find("#zoneid").text()))) {
|
||||
clearRightPanel();
|
||||
isoClearRightPanel();
|
||||
isoClearRightPanel();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -742,7 +766,8 @@ function doDeleteTemplate($actionLink, $detailsTab, $midmenuItem1) {
|
|||
$dialog1
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog("close");
|
||||
$("body").stopTime("templateDownloadProgress");
|
||||
var apiCommand = "command=deleteTemplate&id="+id+moreCriteria.join("");
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue