new UI - implement delete secondary storage action.

This commit is contained in:
Jessica Wang 2010-10-19 14:04:37 -07:00
parent 0267a306c8
commit 3372ad1fb4
3 changed files with 67 additions and 5 deletions

View File

@ -128,4 +128,5 @@ please.confirm.you.want.to.cancel.maintenance.for.the.host = Please confirm you
please.confirm.you.want.to.force.a.reconnection.for.the.host = Please confirm you want to force a reconnection for the host
please.confirm.you.want.to.remove.the.host.from.the.management.server = Please confirm you want to remove the host from the management server
Please.choose.a.OS.preference.for.this.host..Virtual.machines.will.always.be.allocated.to.hosts.with.an.OS.preference.that.matches.with.the.OS.type.of.the.template.chosen.for.the.virtual.machine.before.choosing.other.hosts. = Please choose a OS preference for this host. Virtual machines will always be allocated to hosts with an OS preference that matches with the OS type of the template chosen for the virtual machine before choosing other hosts.
please.confirm.you.want.to.delete_the_primary_storage = Please confirm you want to delete the primary storage
please.confirm.you.want.to.delete.the.primary.storage = Please confirm you want to delete the primary storage
please.confirm.you.want.to.delete.the.secondary.storage = Please confirm you want to delete the secondary storage

View File

@ -994,8 +994,8 @@
<div class="grid_header">
<div class="grid_header_title" id="title">
</div>
<div class="grid_actionbox" id="snapshot_action_link">
<div class="grid_actionsdropdown_box" id="snapshot_action_menu" style="display: none;">
<div class="grid_actionbox" id="secondarystorage_action_link">
<div class="grid_actionsdropdown_box" id="secondarystorage_action_menu" style="display: none;">
<ul class="actionsdropdown_boxlist" id="action_list">
</ul>
</div>
@ -1145,6 +1145,12 @@
<div id="dialog_confirmation_delete_primarystorage" title="Confirmation" style="display: none">
<p>
<%=t.t("please.confirm.you.want.to.delete_the_primary_storage")%>
<%=t.t("please.confirm.you.want.to.delete.the.primary.storage")%>
</p>
</div>
<div id="dialog_confirmation_delete_secondarystorage" title="Confirmation" style="display: none">
<p>
<%=t.t("please.confirm.you.want.to.delete.the.secondary.storage")%>
</p>
</div>

View File

@ -792,6 +792,7 @@ function afterLoadResourceJSP() {
initDialog("dialog_confirmation_remove_host");
initDialog("dialog_update_os");
initDialog("dialog_confirmation_delete_primarystorage");
initDialog("dialog_confirmation_delete_secondarystorage");
// if hypervisor is KVM, limit the server option to NFS for now
if (getHypervisorType() == 'kvm')
@ -1244,8 +1245,10 @@ function initAddPrimaryStorageButton($midmenuAddLink2) {
}
function secondaryStorageJSONToTemplate(json, template) {
template.data("jsonObj", json);
template.attr("id", "secondaryStorage_"+json.id).data("secondaryStorageId", json.id);
template.find("#id").text(json.id);
template.find("#title").text(fromdb(json.name));
template.find("#name").text(fromdb(json.name));
template.find("#zonename").text(fromdb(json.zonename));
template.find("#type").text(json.type);
@ -1253,6 +1256,21 @@ function secondaryStorageJSONToTemplate(json, template) {
template.find("#state").text(json.state);
template.find("#version").text(json.version);
setDateField(json.disconnected, template.find("#disconnected"));
var $actionLink = template.find("#secondarystorage_action_link");
$actionLink.bind("mouseover", function(event) {
$(this).find("#secondarystorage_action_menu").show();
return false;
});
$actionLink.bind("mouseout", function(event) {
$(this).find("#secondarystorage_action_menu").hide();
return false;
});
var $actionMenu = $actionLink.find("#secondarystorage_action_menu");
$actionMenu.find("#action_list").empty();
buildActionLinkForSubgridItem("Delete Secondary Storage", secondarystorageActionMap, $actionMenu, template);
}
function bindEventHandlerToDialogAddPool() {
@ -1514,4 +1532,41 @@ function doDeletePrimaryStorage($actionLink, $detailsTab, midmenuItemId){
$(this).dialog("close");
}
}).dialog("open");
}
}
var secondarystorageActionMap = {
"Delete Secondary Storage": {
isAsyncJob: false,
dialogBeforeActionFn : doDeleteSecondaryStorage,
inProcessText: "Deleting Secondary Storaget....",
afterActionSeccessFn: function(json, id, $subgridItem) {
$subgridItem.slideUp("slow", function() {
$(this).remove();
});
}
}
}
function doDeleteSecondaryStorage($actionLink, $subgridItem) {
var jsonObj = $subgridItem.data("jsonObj");
$("#dialog_confirmation_delete_secondarystorage")
.dialog('option', 'buttons', {
"Confirm": function() {
var thisDialog = $(this);
thisDialog.dialog("close");
var name = thisDialog.find("#name").val();
var id = jsonObj.id;
var apiCommand = "command=deleteHost&id="+id;
doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem);
},
"Cancel": function() {
$(this).dialog("close");
}
}).dialog("open");
}