mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 6873: CloudStack UI - Cluster page - implement Enable/Disable Cluster action.
This commit is contained in:
parent
fd08ebfb57
commit
36d0132950
@ -11,6 +11,22 @@ label.PING.CIFS.username=PING CIFS username
|
||||
label.PING.CIFS.password=PING CIFS password
|
||||
label.CPU.cap=CPU Cap
|
||||
|
||||
label.action.enable.zone=Enable Zone
|
||||
message.action.enable.zone=Please confirm that you want to enable this zone.
|
||||
label.action.disable.zone=Disable Zone
|
||||
message.action.disable.zone=Please confirm that you want to disable this zone.
|
||||
|
||||
label.action.enable.pod=Enable Pod
|
||||
message.action.enable.pod=Please confirm that you want to enable this pod.
|
||||
label.action.disable.pod=Disable Pod
|
||||
message.action.disable.pod=Please confirm that you want to diable this pod.
|
||||
|
||||
label.action.enable.cluster=Enable Cluster
|
||||
message.action.enable.cluster=Please confirm that you want to enable this cluster.
|
||||
label.action.disable.cluster=Disable Cluster
|
||||
message.action.disable.cluster=Please confirm that you want to disable this cluster.
|
||||
|
||||
|
||||
#Labels
|
||||
label.PreSetup=PreSetup
|
||||
label.SR.name = SR Name-Label
|
||||
|
||||
@ -9,7 +9,13 @@
|
||||
dictionary = {
|
||||
'label.action.delete.cluster' : '<fmt:message key="label.action.delete.cluster"/>',
|
||||
'label.action.delete.cluster.processing' : '<fmt:message key="label.action.delete.cluster.processing"/>',
|
||||
'message.action.delete.cluster' : '<fmt:message key="message.action.delete.cluster"/>'
|
||||
'message.action.delete.cluster' : '<fmt:message key="message.action.delete.cluster"/>',
|
||||
'label.action.enable.cluster' : '<fmt:message key="label.action.enable.cluster"/>',
|
||||
'label.action.enable.cluster.processing' : '<fmt:message key="label.action.enable.cluster.processing"/>',
|
||||
'message.action.enable.cluster' : '<fmt:message key="message.action.enable.cluster"/>',
|
||||
'label.action.disable.cluster' : '<fmt:message key="label.action.disable.cluster"/>',
|
||||
'label.action.disable.cluster.processing' : '<fmt:message key="label.action.disable.cluster.processing"/>',
|
||||
'message.action.disable.cluster' : '<fmt:message key="message.action.disable.cluster"/>'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@ -64,33 +64,35 @@ function clusterJsonToDetailsTab() {
|
||||
}
|
||||
});
|
||||
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
clusterJsonToDetailsTab2(jsonObj);
|
||||
}
|
||||
|
||||
function clusterJsonToDetailsTab2(jsonObj) {
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
$thisTab.find("#podname").text(fromdb(jsonObj.podname));
|
||||
$thisTab.find("#hypervisortype").text(fromdb(jsonObj.hypervisortype));
|
||||
$thisTab.find("#clustertype").text(fromdb(jsonObj.clustertype));
|
||||
$thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
|
||||
|
||||
//actions ***
|
||||
//actions ***
|
||||
var $actionLink = $thisTab.find("#action_link");
|
||||
bindActionLink($actionLink);
|
||||
/*
|
||||
$actionLink.bind("mouseover", function(event) {
|
||||
$(this).find("#action_menu").show();
|
||||
return false;
|
||||
});
|
||||
$actionLink.bind("mouseout", function(event) {
|
||||
$(this).find("#action_menu").hide();
|
||||
return false;
|
||||
});
|
||||
*/
|
||||
|
||||
var $actionMenu = $actionLink.find("#action_menu");
|
||||
$actionMenu.find("#action_list").empty();
|
||||
buildActionLinkForTab("label.action.delete.cluster", clusterActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
|
||||
var $actionMenu = $actionLink.find("#action_menu");
|
||||
$actionMenu.find("#action_list").empty();
|
||||
|
||||
if(jsonObj.allocationstate == "Disabled")
|
||||
buildActionLinkForTab("label.action.enable.cluster", clusterActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
else if(jsonObj.allocationstate == "Enabled")
|
||||
buildActionLinkForTab("label.action.disable.cluster", clusterActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
|
||||
buildActionLinkForTab("label.action.delete.cluster", clusterActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
}
|
||||
|
||||
function clusterClearDetailsTab() {
|
||||
@ -109,8 +111,28 @@ function clusterClearDetailsTab() {
|
||||
$actionMenu.find("#action_list").append($("#no_available_actions").clone().show());
|
||||
}
|
||||
|
||||
var clusterActionMap = {
|
||||
"label.action.delete.cluster": {
|
||||
var clusterActionMap = {
|
||||
"label.action.enable.cluster": {
|
||||
isAsyncJob: false,
|
||||
dialogBeforeActionFn : doEnableCluster,
|
||||
inProcessText: "label.action.enable.cluster.processing",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.updateclusterresponse.cluster;
|
||||
clusterJsonToDetailsTab2(jsonObj);
|
||||
}
|
||||
}
|
||||
,
|
||||
"label.action.disable.cluster": {
|
||||
isAsyncJob: false,
|
||||
dialogBeforeActionFn : doDisableCluster,
|
||||
inProcessText: "label.action.disable.cluster.processing",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.updateclusterresponse.cluster;
|
||||
clusterJsonToDetailsTab2(jsonObj);
|
||||
}
|
||||
}
|
||||
,
|
||||
"label.action.delete.cluster": {
|
||||
api: "deleteCluster",
|
||||
isAsyncJob: false,
|
||||
dialogBeforeActionFn : doDeleteCluster,
|
||||
@ -127,6 +149,42 @@ var clusterActionMap = {
|
||||
}
|
||||
}
|
||||
|
||||
function doEnableCluster($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
var id = jsonObj.id;
|
||||
|
||||
$("#dialog_confirmation")
|
||||
.text(dictionary["message.action.enable.cluster"])
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var apiCommand = "command=updateCluster&id="+id+"&allocationstate=Enabled";
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doDisableCluster($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
var id = jsonObj.id;
|
||||
|
||||
$("#dialog_confirmation")
|
||||
.text(dictionary["message.action.disable.cluster"])
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var apiCommand = "command=updateCluster&id="+id+"&allocationstate=Disabled";
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doDeleteCluster($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
var id = jsonObj.id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user