mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 4556: instance page - localize middle menu action Start Instance.
This commit is contained in:
parent
720399b155
commit
c9e03ebd4f
@ -420,6 +420,9 @@ label.vm.stop=Stop
|
|||||||
label.vm.reboot=Reboot
|
label.vm.reboot=Reboot
|
||||||
label.vm.destroy=Destroy
|
label.vm.destroy=Destroy
|
||||||
|
|
||||||
|
label.action.start.instance=Start Instance
|
||||||
|
label.action.start.instance.processing=Starting Instance....
|
||||||
|
|
||||||
label.action.edit.account=Edit account
|
label.action.edit.account=Edit account
|
||||||
label.action.resource.limits=Resource limits
|
label.action.resource.limits=Resource limits
|
||||||
label.action.disable.account=Disable account
|
label.action.disable.account=Disable account
|
||||||
@ -443,6 +446,8 @@ label.action.delete.user.processing=Deleting User....
|
|||||||
|
|
||||||
|
|
||||||
#Messages
|
#Messages
|
||||||
|
message.action.start.instance=Please confirm you want to start instance
|
||||||
|
|
||||||
message.edit.limits=Please specify limits to the following resources. A "-1" indicates no limit to the amount of resources create.
|
message.edit.limits=Please specify limits to the following resources. A "-1" indicates no limit to the amount of resources create.
|
||||||
message.disable.account=Please confirm you want to disable this account. By disabling the account, all users for this account will no longer have access to their cloud resources. All running virtual machines will be immediately shut down.
|
message.disable.account=Please confirm you want to disable this account. By disabling the account, all users for this account will no longer have access to their cloud resources. All running virtual machines will be immediately shut down.
|
||||||
message.lock.account=Please confirm you want to lock this account. By locking the account, all users for this account will no longer be able to manage their cloud resources. Existing resources can still be accessed.
|
message.lock.account=Please confirm you want to lock this account. By locking the account, all users for this account will no longer be able to manage their cloud resources. Existing resources can still be accessed.
|
||||||
|
|||||||
@ -5,6 +5,14 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
<fmt:setBundle basename="resources/messages"/>
|
<fmt:setBundle basename="resources/messages"/>
|
||||||
|
|
||||||
|
<script language="javascript">
|
||||||
|
dictionary = {
|
||||||
|
'label.action.start.instance' : '<fmt:message key="label.action.start.instance"/>',
|
||||||
|
'label.action.start.instance.processing' : '<fmt:message key="label.action.start.instance.processing"/>',
|
||||||
|
'message.action.start.instance' : '<fmt:message key="message.action.start.instance"/>',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- VM detail panel (begin) -->
|
<!-- VM detail panel (begin) -->
|
||||||
<div class="main_title" id="right_panel_header">
|
<div class="main_title" id="right_panel_header">
|
||||||
<div class="main_titleicon">
|
<div class="main_titleicon">
|
||||||
|
|||||||
@ -159,9 +159,9 @@ function bindStartVMButton() {
|
|||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
|
|
||||||
var apiInfo = {
|
var apiInfo = {
|
||||||
label: "Start Instance",
|
label: "label.action.start.instance",
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
inProcessText: "Starting Instance....",
|
inProcessText: "label.action.start.instance.processing",
|
||||||
asyncJobResponse: "startvirtualmachineresponse",
|
asyncJobResponse: "startvirtualmachineresponse",
|
||||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||||
|
|||||||
@ -356,67 +356,34 @@ function handleErrorInSubgridItem(XMLHttpResponse, $subgridItem, label) {
|
|||||||
//***** actions for middle menu (begin) ************************************************************************
|
//***** actions for middle menu (begin) ************************************************************************
|
||||||
var selectedItemsInMidMenu = {};
|
var selectedItemsInMidMenu = {};
|
||||||
|
|
||||||
function buildActionLinkForMidMenu(label, actionMap, $actionMenu) {
|
|
||||||
var apiInfo = actionMap[label];
|
|
||||||
var $listItem = $("#action_list_item_middle_menu").clone();
|
|
||||||
$actionMenu.find("#action_list").append($listItem.show());
|
|
||||||
var $link = $listItem.find("#link").text(label);
|
|
||||||
$link.data("apiInfo", apiInfo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
$link.data("label", label);
|
|
||||||
$link.data("api",apiInfo .api);
|
|
||||||
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
|
||||||
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
|
||||||
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
|
||||||
$link.data("dialogBeforeActionFn", apiInfo.dialogBeforeActionFn);
|
|
||||||
*/
|
|
||||||
|
|
||||||
$link.bind("click", function(event) {
|
|
||||||
$actionMenu.hide();
|
|
||||||
|
|
||||||
var itemCounts = 0;
|
|
||||||
for(var id in selectedItemsInMidMenu) {
|
|
||||||
itemCounts ++;
|
|
||||||
}
|
|
||||||
if(itemCounts == 0) {
|
|
||||||
$("#dialog_info_please_select_one_item_in_middle_menu").dialog("open");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var $actionLink = $(this);
|
|
||||||
var dialogBeforeActionFn = $actionLink.data("dialogBeforeActionFn");
|
|
||||||
if(dialogBeforeActionFn == null) {
|
|
||||||
for(var id in selectedItemsInMidMenu) {
|
|
||||||
var apiCommand = "command="+$actionLink.data("api")+"&id="+id;
|
|
||||||
doActionToMidMenu(id, apiInfo, apiCommand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dialogBeforeActionFn(apiInfo, selectedItemsInMidMenu);
|
|
||||||
|
|
||||||
}
|
|
||||||
selectedItemsInMidMenu = {}; //clear selected items for action
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function doActionToMidMenu(id, apiInfo, apiCommand) {
|
function doActionToMidMenu(id, apiInfo, apiCommand) {
|
||||||
var label = apiInfo.label;
|
var label = apiInfo.label;
|
||||||
var isAsyncJob = apiInfo.isAsyncJob;
|
var label2;
|
||||||
|
if(label in dictionary)
|
||||||
|
label2 = dictionary[label];
|
||||||
|
else
|
||||||
|
label2 = label;
|
||||||
|
|
||||||
var inProcessText = apiInfo.inProcessText;
|
var inProcessText = apiInfo.inProcessText;
|
||||||
|
var inProcessText2;
|
||||||
|
if(inProcessText in dictionary)
|
||||||
|
inProcessText2 = dictionary[inProcessText];
|
||||||
|
else
|
||||||
|
inProcessText2 = inProcessText;
|
||||||
|
|
||||||
|
var isAsyncJob = apiInfo.isAsyncJob;
|
||||||
var asyncJobResponse = apiInfo.asyncJobResponse;
|
var asyncJobResponse = apiInfo.asyncJobResponse;
|
||||||
var afterActionSeccessFn = apiInfo.afterActionSeccessFn;
|
var afterActionSeccessFn = apiInfo.afterActionSeccessFn;
|
||||||
|
|
||||||
var $midmenuItem1 = $("#midmenuItem_"+id);
|
var $midmenuItem1 = $("#midmenuItem_"+id);
|
||||||
$midmenuItem1.find("#content").removeClass("selected").addClass("inaction");
|
$midmenuItem1.find("#content").removeClass("selected").addClass("inaction");
|
||||||
$midmenuItem1.find("#spinning_wheel").addClass("midmenu_addingloader").show();
|
$midmenuItem1.find("#spinning_wheel").addClass("midmenu_addingloader").show();
|
||||||
$midmenuItem1.find("#spinning_wheel").data("inProcessText", inProcessText);
|
$midmenuItem1.find("#spinning_wheel").data("inProcessText", inProcessText2);
|
||||||
$midmenuItem1.find("#info_icon").hide();
|
$midmenuItem1.find("#info_icon").hide();
|
||||||
|
|
||||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||||
var $spinningWheel = $detailsTab.find("#spinning_wheel");
|
var $spinningWheel = $detailsTab.find("#spinning_wheel");
|
||||||
$spinningWheel.find("#description").text(inProcessText);
|
$spinningWheel.find("#description").text(inProcessText2);
|
||||||
$spinningWheel.show();
|
$spinningWheel.show();
|
||||||
|
|
||||||
//Async job (begin) *****
|
//Async job (begin) *****
|
||||||
@ -442,20 +409,20 @@ function doActionToMidMenu(id, apiInfo, apiCommand) {
|
|||||||
$("body").stopTime(timerKey);
|
$("body").stopTime(timerKey);
|
||||||
$midmenuItem1.find("#content").removeClass("inaction");
|
$midmenuItem1.find("#content").removeClass("inaction");
|
||||||
$midmenuItem1.find("#spinning_wheel").hide();
|
$midmenuItem1.find("#spinning_wheel").hide();
|
||||||
hideDetailsTabActionSpinningWheel(id, inProcessText, $midmenuItem1);
|
hideDetailsTabActionSpinningWheel(id, inProcessText2, $midmenuItem1);
|
||||||
if (result.jobstatus == 1) { // Succeeded
|
if (result.jobstatus == 1) { // Succeeded
|
||||||
$midmenuItem1.find("#info_icon").removeClass("error").show();
|
$midmenuItem1.find("#info_icon").removeClass("error").show();
|
||||||
$midmenuItem1.data("afterActionInfo", (label + " action succeeded."));
|
$midmenuItem1.data("afterActionInfo", (label2 + " action succeeded."));
|
||||||
afterActionSeccessFn(json, $midmenuItem1, id);
|
afterActionSeccessFn(json, $midmenuItem1, id);
|
||||||
} else if (result.jobstatus == 2) { // Failed
|
} else if (result.jobstatus == 2) { // Failed
|
||||||
var errorMsg = label + " action failed. Reason: " + fromdb(result.jobresult.errortext);
|
var errorMsg = label2 + " action failed. Reason: " + fromdb(result.jobresult.errortext);
|
||||||
handleErrorInMidMenu2(errorMsg, $midmenuItem1, id, inProcessText);
|
handleErrorInMidMenu2(errorMsg, $midmenuItem1, id, inProcessText2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpResponse) {
|
error: function(XMLHttpResponse) {
|
||||||
$("body").stopTime(timerKey);
|
$("body").stopTime(timerKey);
|
||||||
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText);
|
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -464,7 +431,7 @@ function doActionToMidMenu(id, apiInfo, apiCommand) {
|
|||||||
},
|
},
|
||||||
error: function(XMLHttpResponse) {
|
error: function(XMLHttpResponse) {
|
||||||
handleError(XMLHttpResponse);
|
handleError(XMLHttpResponse);
|
||||||
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText);
|
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -480,12 +447,12 @@ function doActionToMidMenu(id, apiInfo, apiCommand) {
|
|||||||
$midmenuItem1.find("#content").removeClass("inaction");
|
$midmenuItem1.find("#content").removeClass("inaction");
|
||||||
$midmenuItem1.find("#spinning_wheel").hide();
|
$midmenuItem1.find("#spinning_wheel").hide();
|
||||||
$midmenuItem1.find("#info_icon").removeClass("error").show();
|
$midmenuItem1.find("#info_icon").removeClass("error").show();
|
||||||
$midmenuItem1.data("afterActionInfo", (label + " action succeeded."));
|
$midmenuItem1.data("afterActionInfo", (label2 + " action succeeded."));
|
||||||
hideDetailsTabActionSpinningWheel(id, inProcessText, $midmenuItem1);
|
hideDetailsTabActionSpinningWheel(id, inProcessText2, $midmenuItem1);
|
||||||
afterActionSeccessFn(json, $midmenuItem1, id);
|
afterActionSeccessFn(json, $midmenuItem1, id);
|
||||||
},
|
},
|
||||||
error: function(XMLHttpResponse) {
|
error: function(XMLHttpResponse) {
|
||||||
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText);
|
handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1, id, inProcessText2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user