Francesco Romani has uploaded a new change for review. Change subject: frontend: spice: allow to disable the clipboard ......................................................................
frontend: spice: allow to disable the clipboard spice supports clipboard copy-paste. This feature is enabled by default, but can be turned off. This patch adds support on the frontend to control this feature and allows to disable them whenever it is needed. Change-Id: I124d6e8c391e66cca1b77935f5ad9d42a8d1828d Bug-Url: https://bugzilla.redhat.com/1082479 Signed-off-by: Francesco Romani <from...@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/AbstractVmPopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java M frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java 16 files changed, 93 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/28150/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 c362db0..84a5543 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 @@ -1853,4 +1853,7 @@ @DefaultStringValue("Enables/disables Random Number Generator device. If 'period' and 'bytes' are empty, libvirt default is used. If you specify 'period' you need to specify 'bytes' as well.") String rngDevExplanation(); + + @DefaultStringValue("Enable SPICE clipboard copy and paste") + String spiceCopyPasteEnabled(); } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java index 0724c8c..af82049 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java @@ -496,6 +496,11 @@ @WithElementId public EntityModelCheckBoxOnlyEditor spiceProxyOverrideEnabledEditor; + @UiField(provided = true) + @Path("spiceCopyPasteEnabled.entity") + @WithElementId("spiceCopyPasteEnabled") + public EntityModelCheckBoxEditor spiceCopyPasteEnabledEditor; + // == Rng Tab == @UiField protected DialogTab rngDeviceTab; @@ -867,6 +872,7 @@ (Resources) GWT.create(ButtonCellTableResources.class)); disksAllocationView = new DisksAllocationView(constants); serialNumberPolicyEditor = new SerialNumberPolicyWidget(eventBus, applicationTemplates, messages, resources, new ModeSwitchingVisibilityRenderer()); + spiceCopyPasteEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT, new ModeSwitchingVisibilityRenderer()); initPoolSpecificWidgets(resources, messages); initTextBoxEditors(); @@ -1294,6 +1300,7 @@ ssoMethodNone.setLabel(constants.none()); ssoMethodGuestAgent.setLabel(constants.guestAgent()); spiceProxyEditor.setLabel(constants.overriddenSpiceProxyAddress()); + spiceCopyPasteEnabledEditor.setLabel(constants.spiceCopyPasteEnabled()); // Host Tab hostTab.setLabel(constants.hostVmPopup()); @@ -1807,6 +1814,7 @@ isConsoleDeviceEnabledEditor.setTabIndex(nextTabIndex++); spiceProxyOverrideEnabledEditor.setTabIndex(nextTabIndex++); spiceProxyEditor.setTabIndex(nextTabIndex++); + spiceCopyPasteEnabledEditor.setTabIndex(nextTabIndex++); // ==Host Tab== nextTabIndex = hostTab.setTabIndexes(nextTabIndex); @@ -1871,7 +1879,8 @@ update(numOfMonitorsEditor, simpleField()). update(isSingleQxlEnabledEditor, simpleField()). putOne(isSoundcardEnabledEditor, simpleField().visibleInAdvancedModeOnly()). - putOne(isConsoleDeviceEnabledEditor, simpleField().visibleInAdvancedModeOnly()); + putOne(isConsoleDeviceEnabledEditor, simpleField().visibleInAdvancedModeOnly()). + putOne(spiceCopyPasteEnabledEditor, simpleField().visibleInAdvancedModeOnly()); } protected List<Widget> consoleTabWidgets() { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml index 4e51116..ccdffa3 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml @@ -540,6 +540,7 @@ <w:EntityModelWidgetWithInfo ui:field="spiceProxyEnabledCheckboxWithInfoIcon" /> <ge:StringEntityModelTextBoxEditor ui:field="spiceProxyEditor"/> + <ge:EntityModelCheckBoxEditor ui:field="spiceCopyPasteEnabledEditor" addStyleNames="{style.checkbox}" /> </g:FlowPanel> </t:content> </t:DialogTab> diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java index 701d306..65e63c5 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java @@ -214,6 +214,11 @@ @WithElementId("displayConsoleSpice") EntityModelRadioButtonEditor displayConsoleSpiceEditor; + @UiField(provided = true) + @Path(value = "spiceCopyPasteEnabled.entity") + @WithElementId("spiceCopyPasteEnabled") + public EntityModelCheckBoxEditor spiceCopyPasteEnabledEditor; + @UiField @WithElementId ButtonBase bootSequenceUpButton; @@ -311,6 +316,7 @@ vncKeyboardLayoutEditor.setLabel(constants.vncKeyboardLayoutVmPopup()); displayConsoleSpiceEditor.setLabel(constants.runOncePopupDisplayConsoleSpiceLabel()); + spiceCopyPasteEnabledEditor.setLabel(constants.spiceCopyPasteEnabled()); // Host Tab isAutoAssignEditor.setLabel(constants.anyHostInClusterVmPopup()); @@ -323,6 +329,7 @@ runAsStatelessEditor = new EntityModelCheckBoxEditor(Align.RIGHT); runAndPauseEditor = new EntityModelCheckBoxEditor(Align.RIGHT); useAlternateCredentialsEditor = new EntityModelCheckBoxEditor(Align.RIGHT); + spiceCopyPasteEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); } void initListBoxEditors() { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml index 19ffb1c..1f48035 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml @@ -229,6 +229,7 @@ <ge:EntityModelRadioButtonEditor ui:field="displayConsoleVncEditor" /> <e:ListModelListBoxEditor ui:field="vncKeyboardLayoutEditor" /> <ge:EntityModelRadioButtonEditor ui:field="displayConsoleSpiceEditor" /> + <ge:EntityModelCheckBoxEditor ui:field="spiceCopyPasteEnabledEditor" /> </g:VerticalPanel> </g:DisclosurePanel> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java index 750fabd..90dfb32 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java @@ -30,5 +30,6 @@ vm.setSerialNumberPolicy(model.getSerialNumberPolicy().getSelectedSerialNumberPolicy()); vm.setCustomSerialNumber(model.getSerialNumberPolicy().getCustomSerialNumber().getEntity()); vm.setBootMenuEnabled(model.getBootMenuEnabled().getEntity()); + vm.setSpiceCopyPasteEnabled(model.getSpiceCopyPasteEnabled().getEntity()); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java index 60cf2e3..1123372 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java @@ -3767,6 +3767,10 @@ return (Boolean) getConfigValuePreConverted(ConfigurationValues.BootMenuSupported, version); } + public static boolean isSpiceCopyPasteToggleSupported(String version) { + return (Boolean) getConfigValuePreConverted(ConfigurationValues.SpiceCopyPasteToggleSupported, version); + } + public static List<IStorageModel> getDataStorageModels() { ArrayList<IStorageModel> models = new ArrayList<IStorageModel>(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java index 3b05ccc..a5971e2 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java @@ -182,6 +182,8 @@ }), vm.getRunOnVds()); } + getModel().getSpiceCopyPasteEnabled().setEntity(vm.isSpiceCopyPasteEnabled()); + BuilderExecutor.build(vm.getStaticData(), getModel(), new SerialNumberPolicyVmBaseToUnitBuilder()); getModel().getBootMenuEnabled().setEntity(vm.isBootMenuEnabled()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java index 407fa04..8cd76bf 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java @@ -343,6 +343,8 @@ initPriority(this.vm.getPriority()); + getModel().getSpiceCopyPasteEnabled().setEntity(vm.isSpiceCopyPasteEnabled()); + BuilderExecutor.build(vm.getStaticData(), getModel(), new SerialNumberPolicyVmBaseToUnitBuilder()); getModel().getBootMenuEnabled().setEntity(vm.isBootMenuEnabled()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java index 0d31e28..cfd112f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java @@ -151,6 +151,8 @@ getModel().getVmInitModel().init(template); getModel().getVmInitEnabled().setEntity(template.getVmInit() != null); + getModel().getSpiceCopyPasteEnabled().setEntity(template.isSpiceCopyPasteEnabled()); + BuilderExecutor.build(template, getModel(), new SerialNumberPolicyVmBaseToUnitBuilder()); getModel().getBootMenuEnabled().setEntity(template.isBootMenuEnabled()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java index f673bd2..e4a03cf 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java @@ -165,6 +165,8 @@ getModel().getVmInitModel().init(vmBase); getModel().getVmInitEnabled().setEntity(vmBase.getVmInit() != null); + getModel().getSpiceCopyPasteEnabled().setEntity(vmBase.isSpiceCopyPasteEnabled()); + BuilderExecutor.build(vmBase, getModel(), new SerialNumberPolicyVmBaseToUnitBuilder()); getModel().getBootMenuEnabled().setEntity(vmBase.isBootMenuEnabled()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java index 39a63e2..fc0b787 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java @@ -384,6 +384,16 @@ privateDisplayConsole_Spice_IsSelected = value; } + private EntityModel<Boolean> spiceCopyPasteEnabled; + + public EntityModel<Boolean> getSpiceCopyPasteEnabled() { + return spiceCopyPasteEnabled; + } + + public void setSpiceCopyPasteEnabled(EntityModel<Boolean> spiceCopyPasteEnabled) { + this.spiceCopyPasteEnabled = spiceCopyPasteEnabled; + } + // Misc private boolean privateIsLinuxOS; @@ -599,6 +609,12 @@ initVncKeyboardLayout(); getVncKeyboardLayout().setSelectedItem(vm.getDefaultVncKeyboardLayout()); + setSpiceCopyPasteEnabled(new EntityModel<Boolean>()); + getSpiceCopyPasteEnabled().setEntity(vm.isSpiceCopyPasteEnabled()); + boolean spiceCopyPasteToggle = AsyncDataProvider.isSpiceCopyPasteToggleSupported(vm.getVdsGroupCompatibilityVersion().toString()); + getSpiceCopyPasteEnabled().setIsChangable(spiceCopyPasteToggle); + getSpiceCopyPasteEnabled().setIsAvailable(spiceCopyPasteToggle); + // Host tab setDefaultHost(new ListModel<VDS>()); getDefaultHost().getSelectedItemChangedEvent().addListener(this); @@ -679,6 +695,7 @@ getDisplayProtocol().setSelectedItem(vm.getDefaultDisplayType() == DisplayType.vnc ? vncProtocol : qxlProtocol); + getSpiceCopyPasteEnabled().setEntity(vm.isSpiceCopyPasteEnabled()); } private void initVmInitEnabled(VmInit vmInit, boolean isInitialized) { @@ -753,6 +770,8 @@ if (!StringHelper.isNullOrEmpty(selectedDomain)) { params.setSysPrepDomainName(selectedDomain); } + + params.setSpiceCopyPasteEnabled(getSpiceCopyPasteEnabled().getEntity()); return params; } @@ -949,11 +968,13 @@ { getDisplayConsole_Spice_IsSelected().setEntity(false); getVncKeyboardLayout().setIsChangable(true); + getSpiceCopyPasteEnabled().setIsChangable(false); } else if (sender == getDisplayConsole_Spice_IsSelected() && ((EntityModel<Boolean>) sender).getEntity()) { getDisplayConsole_Vnc_IsSelected().setEntity(false); getVncKeyboardLayout().setIsChangable(false); + getSpiceCopyPasteEnabled().setIsChangable(true); } else if (sender == getIsAutoAssign()) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java index f7e8b05..f3628f1 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java @@ -220,6 +220,8 @@ getModel().getVmInitModel().init(template); getModel().getTemplateVersionName().setEntity(template.getTemplateVersionName()); + getModel().getSpiceCopyPasteEnabled().setEntity(template.isSpiceCopyPasteEnabled()); + initPriority(template.getPriority()); BuilderExecutor.build(template, getModel(), new SerialNumberPolicyVmBaseToUnitBuilder()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index fed99f3..09798bb 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -1351,6 +1351,16 @@ this.bootMenuEnabled = bootMenuEnabled; } + private NotChangableForVmInPoolEntityModel<Boolean> spiceCopyPasteEnabled; + + public EntityModel<Boolean> getSpiceCopyPasteEnabled() { + return spiceCopyPasteEnabled; + } + + public void setSpiceCopyPasteEnabled(NotChangableForVmInPoolEntityModel<Boolean> spiceCopyPasteEnabled) { + this.spiceCopyPasteEnabled = spiceCopyPasteEnabled; + } + public UnitVmModel(VmModelBehaviorBase behavior) { Frontend.getInstance().getQueryStartedEvent().addListener(this); Frontend.getInstance().getQueryCompleteEvent().addListener(this); @@ -1450,6 +1460,7 @@ setPriority(new NotChangableForVmInPoolListModel<EntityModel<Integer>>()); setVmInitEnabled(new EntityModel<Boolean>(false)); setCloudInitEnabled(new EntityModel<Boolean>()); + setSpiceCopyPasteEnabled(new NotChangableForVmInPoolEntityModel<Boolean>()); setSysprepEnabled(new EntityModel<Boolean>()); getVmInitEnabled().getEntityChangedEvent().addListener(this); setVmInitModel(new VmInitModel()); @@ -2062,6 +2073,22 @@ Version.v3_3.compareTo(getSelectedCluster().getcompatibility_version()) <= 0; getBehavior().enableSinglePCI(isLinux && isQxl && clusterSupportsSinglePci); + + boolean spiceCopyPasteToggle = isQxl && getSelectedCluster() != null + && AsyncDataProvider.isSpiceCopyPasteToggleSupported(getSelectedCluster().getcompatibility_version().toString()); + if (!spiceCopyPasteToggle) { + handleQxlChangeProhibitionReason(getSpiceCopyPasteEnabled(), getSelectedCluster().getcompatibility_version().toString(), isQxl); + } + getSpiceCopyPasteEnabled().setIsChangable(spiceCopyPasteToggle); + } + + private void handleQxlChangeProhibitionReason(EntityModel<Boolean> checkbox, String version, boolean isQxl) + { + if (isQxl) { + checkbox.setChangeProhibitionReason(ConstantsManager.getInstance().getMessages().optionNotSupportedClusterVersionTooOld(version)); + } else { + checkbox.setChangeProhibitionReason(ConstantsManager.getInstance().getMessages().optionRequiresSpiceEnabled()); + } } private void template_SelectedItemChanged(Object sender, EventArgs args) diff --git a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java index 88204f9..6a0e397 100644 --- a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java +++ b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java @@ -119,6 +119,7 @@ when(model.getMigrationMode().getSelectedItem()).thenReturn(MIGRATION_SUPPORT); when(model.getSelectedMigrationDowntime()).thenReturn(MIGRATION_DOWNTIME); when(model.getBootMenuEnabled().getEntity()).thenReturn(true); + when(model.getSpiceCopyPasteEnabled().getEntity()).thenReturn(true); } protected void setUpOrigVm(VM origVm) { @@ -153,6 +154,7 @@ assertTrue(vm.isDeleteProtected()); assertEquals(VNC_KEYBOARD_LAYOUT, vm.getVncKeyboardLayout()); assertEquals(DISPLAY_TYPE, vm.getDefaultDisplayType()); + assertTrue(vm.isSpiceCopyPasteEnabled()); } /** diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java index 9d535ec..597c7ce 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java @@ -361,4 +361,10 @@ @DefaultMessage("Disk {0} from Snapshot {1}") String diskSnapshotLabel(String diskAlias, String snapshotDescription); + + @DefaultMessage("This option is not supported in Cluster version {0}") + String optionNotSupportedClusterVersionTooOld(String clusterVersion); + + @DefaultMessage("This option requires SPICE display protocol to be used") + String optionRequiresSpiceEnabled(); } -- To view, visit http://gerrit.ovirt.org/28150 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I124d6e8c391e66cca1b77935f5ad9d42a8d1828d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Francesco Romani <from...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches