Arik Hadas has uploaded a new change for review. Change subject: webadmin: add memory option to create snapshot popup ......................................................................
webadmin: add memory option to create snapshot popup If the user choose to create snapshot for running VM, the create snapshot popup will now provide an option whether to take snapshot for the memory as well or not (disks only) by a checkbox. Change-Id: Iab771d2f9ae18e7812fe8ee9806a65cbb6576a21 Bug-Url: https://bugzilla.redhat.com/960931 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.ui.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotModel.java 4 files changed, 54 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/15685/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index a2cafcb..3d60a87 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -154,6 +154,9 @@ @DefaultStringValue("Description") String virtualMachineSnapshotCreatePopupDescriptionLabel(); + @DefaultStringValue("Save Memory") + String virtualMachineSnapshotCreatePopupMemoryLabel(); + @DefaultStringValue("Loading...") String loadingLabel(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.java index aa84a25..0f57596 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.java @@ -1,10 +1,15 @@ package org.ovirt.engine.ui.common.widget.uicommon.popup.vm; +import org.ovirt.engine.core.common.businessentities.VM; +import org.ovirt.engine.core.common.queries.ConfigurationValues; import org.ovirt.engine.ui.common.CommonApplicationConstants; import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; import org.ovirt.engine.ui.common.idhandler.WithElementId; +import org.ovirt.engine.ui.common.widget.Align; +import org.ovirt.engine.ui.common.widget.editor.EntityModelCheckBoxEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxEditor; import org.ovirt.engine.ui.common.widget.uicommon.popup.AbstractModelBoundPopupWidget; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.vms.SnapshotModel; import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; @@ -37,6 +42,11 @@ @WithElementId("description") EntityModelTextBoxEditor descriptionEditor; + @UiField(provided = true) + @Path(value = "memory.entity") + @WithElementId("memory") + EntityModelCheckBoxEditor memoryEditor; + @UiField @Ignore FlowPanel messagePanel; @@ -44,6 +54,7 @@ private final Driver driver = GWT.create(Driver.class); public VmSnapshotCreatePopupWidget(CommonApplicationConstants constants) { + memoryEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(constants); ViewIdHandler.idHandler.generateAndSetIds(this); @@ -52,6 +63,7 @@ void localize(CommonApplicationConstants constants) { descriptionEditor.setLabel(constants.virtualMachineSnapshotCreatePopupDescriptionLabel()); + memoryEditor.setLabel(constants.virtualMachineSnapshotCreatePopupMemoryLabel()); } @Override @@ -65,6 +77,27 @@ if ("Message".equals(propName)) { //$NON-NLS-1$ appendMessage(model.getMessage()); } + else if ("VM".equals(propName)) { //$NON-NLS-1$ + updateMemoryBoxVisibility(); + } + } + + private void updateMemoryBoxVisibility() { + VM vm = model.getVm(); + if (vm == null) { + return; + } + + boolean memorySnapshotSupported = + (Boolean) AsyncDataProvider.getConfigValuePreConverted( + ConfigurationValues.MemorySnapshotSupported, + vm.getVdsGroupCompatibilityVersion().toString()); + memoryEditor.setVisible(memorySnapshotSupported && vm.isRunning()); + // The memory option is enabled by default, so in case its checkbox + // is not visible, we should disable it explicitly + if (!memoryEditor.isVisible()) { + model.getMemory().setEntity(false); + } } }); } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.ui.xml index 440fea7..96ec3f7 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCreatePopupWidget.ui.xml @@ -7,7 +7,7 @@ .content { } - .descriptionEditor { + .memoryEditor,.descriptionEditor { width: 100%; } @@ -20,6 +20,7 @@ <g:VerticalPanel verticalAlignment="ALIGN_MIDDLE" addStyleNames="{style.content}"> <e:EntityModelTextBoxEditor ui:field="descriptionEditor" addStyleNames="{style.descriptionEditor}" /> + <e:EntityModelCheckBoxEditor ui:field="memoryEditor" addStyleNames="{style.memoryEditor}" /> <g:FlowPanel ui:field="messagePanel" addStyleNames="{style.messagePanel}"> </g:FlowPanel> </g:VerticalPanel> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotModel.java index 214d563..4e9c390 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotModel.java @@ -109,6 +109,18 @@ privateDescription = value; } + private EntityModel memory; + + public EntityModel getMemory() + { + return memory; + } + + public void setMemory(EntityModel value) + { + memory = value; + } + private EntityModel isPropertiesUpdated; public EntityModel getIsPropertiesUpdated() @@ -155,6 +167,7 @@ public SnapshotModel() { setDescription(new EntityModel()); + setMemory(new EntityModel(true)); setDisks(new ArrayList<DiskImage>()); setNics(new ArrayList<VmNetworkInterface>()); setApps(new ArrayList<String>()); @@ -310,7 +323,9 @@ VM vm = getVm(); ArrayList<VdcActionParametersBase> params = new ArrayList<VdcActionParametersBase>(); CreateAllSnapshotsFromVmParameters param = - new CreateAllSnapshotsFromVmParameters(vm.getId(), (String) getDescription().getEntity()); + new CreateAllSnapshotsFromVmParameters(vm.getId(), + (String) getDescription().getEntity(), + (Boolean) getMemory().getEntity()); param.setQuotaId(vm.getQuotaId()); params.add(param); -- To view, visit http://gerrit.ovirt.org/15685 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iab771d2f9ae18e7812fe8ee9806a65cbb6576a21 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches