mirror of https://github.com/apache/cloudstack.git
bug 8296: show action complete(success/fail) info in a dialog box even users have navigated to a different page. This change applies to all actions in details tab in all pages.
This commit is contained in:
parent
963db44482
commit
d0174a22f9
|
|
@ -766,6 +766,8 @@
|
|||
</div>
|
||||
<div id="dialog_info" title='<fmt:message key="label.info"/>' style="display: none">
|
||||
</div>
|
||||
<div id="dialog_action_complete" title='<fmt:message key="label.info"/>' style="display: none">
|
||||
</div>
|
||||
<div id="dialog_alert" title='<fmt:message key="label.alert"/>' style="display: none">
|
||||
</div>
|
||||
<div id="dialog_error" title='<fmt:message key="label.error"/>' style="display: none; color: red">
|
||||
|
|
|
|||
|
|
@ -707,7 +707,8 @@ $(document).ready(function() {
|
|||
$("#main_username").text(g_username);
|
||||
$("#login_wrapper").hide();
|
||||
showLeftNavigationBasedOnRole();
|
||||
initUI();
|
||||
initUI();
|
||||
periodicallyCheckNonCompleteAsyncJob();
|
||||
$("#main").show();
|
||||
},
|
||||
error: function(xmlHTTP) {
|
||||
|
|
@ -731,7 +732,8 @@ $(document).ready(function() {
|
|||
|
||||
// Dialogs
|
||||
initDialog("dialog_confirmation", 350, false);
|
||||
initDialogWithOK("dialog_info", 350, false);
|
||||
initDialogWithOK("dialog_info", 350, false);
|
||||
initDialogWithOK("dialog_action_complete", 350, false);
|
||||
|
||||
initDialogWithOK("dialog_alert", 350, false);
|
||||
$("#dialog_alert").siblings(".ui-widget-header").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
|
||||
|
|
|
|||
|
|
@ -16,6 +16,66 @@
|
|||
*
|
||||
*/
|
||||
|
||||
// ***** periodically check non-complete async job (begin)***************************************************************
|
||||
var g_nonCompleteAsyncJob = {};
|
||||
function periodicallyCheckNonCompleteAsyncJob() {
|
||||
var timerKey = "checkNonCompleteAsyncJob";
|
||||
$("#dialog_action_complete").everyTime(
|
||||
20000,
|
||||
timerKey,
|
||||
function() {
|
||||
for(var jobId in g_nonCompleteAsyncJob) {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
var label2 = g_nonCompleteAsyncJob[jobId];
|
||||
delete g_nonCompleteAsyncJob[jobId];
|
||||
var afterActionInfo;
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
afterActionInfo = (label2 + " - " + g_dictionary["label.succeeded"]);
|
||||
}
|
||||
else if (result.jobstatus == 2) { // Failed
|
||||
afterActionInfo = label2 + " - " + g_dictionary["label.failed"] + " - " + fromdb(result.jobresult.errortext);
|
||||
}
|
||||
|
||||
$("#dialog_action_complete")
|
||||
.text(afterActionInfo)
|
||||
.dialog("open");
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
var label2 = g_nonCompleteAsyncJob[jobId];
|
||||
delete g_nonCompleteAsyncJob[jobId];
|
||||
|
||||
var errorMsg = "";
|
||||
if(XMLHttpResponse.responseText != null & XMLHttpResponse.responseText.length > 0) {
|
||||
errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||
}
|
||||
|
||||
var afterActionInfo;
|
||||
if(errorMsg.length > 0)
|
||||
afterActionInfo = label2 + " - " + g_dictionary["label.failed"] + " - " + errorMsg;
|
||||
else
|
||||
afterActionInfo = label2 + " - " + g_dictionary["label.failed"];
|
||||
|
||||
$("#dialog_action_complete")
|
||||
.text(afterActionInfo)
|
||||
.dialog("open");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
0
|
||||
);
|
||||
}
|
||||
//***** periodically check non-complete async job (end)*****************************************************************
|
||||
|
||||
//***** actions for a tab in right panel (begin) ************************************************************************
|
||||
function buildActionLinkForTab(label, actionMap, $actionMenu, $midmenuItem1, $thisTab) {
|
||||
var apiInfo = actionMap[label];
|
||||
|
|
@ -90,7 +150,8 @@ function doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $thisTab) {
|
|||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json[asyncJobResponse].jobid;
|
||||
var timerKey = "asyncJob_" + jobId;
|
||||
var timerKey = "asyncJob_" + jobId;
|
||||
g_nonCompleteAsyncJob[jobId] = label2;
|
||||
$("body").everyTime(
|
||||
10000,
|
||||
timerKey,
|
||||
|
|
@ -103,7 +164,8 @@ function doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $thisTab) {
|
|||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
$("body").stopTime(timerKey);
|
||||
delete g_nonCompleteAsyncJob[jobId];
|
||||
$spinningWheel.hide();
|
||||
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
|
|
|
|||
Loading…
Reference in New Issue