Tomas Jelinek has uploaded a new change for review.
Change subject: userportal,webadmin: add enable SPICE proxy checkbox
......................................................................
userportal,webadmin: add enable SPICE proxy checkbox
Added a new checkbox under SPICE options of the console
popup window named "Enable SPICE Proxy".
The behavior:
- if the SPICE proxy is configured on system level (SpiceProxyDefault)
+ the "Enable SPICE Proxy" checkbox is enabled and checked by default
+ if the selection is changed, than it is stored in the brower level
- if the SPICE proxy is NOT configured on system level (SpiceProxyDefault):
+ the "Enable SPICE Proxy" is not editable and has a title:
"No SPICE proxy defined on system level"
+ it is not checked
+ if it was previously checked and this preference stored on browser level,
this preference is ignored and the checkbox will be unchecked
Change-Id: I879a4976c649f1d568f42c2d72f9e995a618d874
Bug-Url: https://bugzilla.redhat.com/924605
Signed-off-by: Tomas Jelinek <[email protected]>
---
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/presenter/popup/ConsolePopupPresenterWidget.java
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/AbstractSpice.java
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleOptionsFrontendPersisterImpl.java
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtils.java
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.java
M
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.ui.xml
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ISpice.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
M
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
M
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java
12 files changed, 87 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/13328/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 eda2939..5dcce60 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
@@ -1159,9 +1159,15 @@
@DefaultStringValue("Open in Full Screen")
String openInFullScreen();
+ @DefaultStringValue("Enable SPICE Proxy")
+ String enableSpiceProxy();
+
@DefaultStringValue("Not supported for this client OS")
String ctrlAltDeletIsNotSupportedOnWindows();
+ @DefaultStringValue("No SPICE proxy defined on system level")
+ String spiceProxyCanBeEnabledOnlyWhenDefined();
+
@DefaultStringValue("Enable WAN Options")
String enableWanOptions();
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java
index ef71ebd..e3ad2ed 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java
@@ -66,6 +66,8 @@
void setCtrlAltDelEnabled(boolean enabled, String reason);
+ void setSpiceProxyEnabled(boolean enabled, String reason);
+
void setVmName(String name);
void flushToPrivateModel();
@@ -196,6 +198,9 @@
boolean ctrlAltDelEnabled = consoleUtils.isCtrlAltDelEnabled();
getView().setCtrlAltDelEnabled(ctrlAltDelEnabled,
constants.ctrlAltDeletIsNotSupportedOnWindows());
+
+ boolean spiceProxyEnabled = consoleUtils.isSpiceProxyDefined();
+ getView().setSpiceProxyEnabled(spiceProxyEnabled,
constants.spiceProxyCanBeEnabledOnlyWhenDefined());
}
@Override
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/AbstractSpice.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/AbstractSpice.java
index a620a9e..0efcd98 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/AbstractSpice.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/AbstractSpice.java
@@ -62,6 +62,9 @@
// disabled
protected boolean smartcardEnabledOverridden = false;
+ // even the spice proxy is globally configured, user can choose to disable
it for specific VM
+ private boolean spiceProxyEnabled;
+
public AbstractSpice() {
setWANDisableEffects(new ArrayList<WANDisableEffects>());
setWanOptionsEnabled(false);
@@ -410,4 +413,12 @@
this.spiceProxy = spiceProxy;
}
+ public void setSpiceProxyEnabled(boolean enabled) {
+ this.spiceProxyEnabled = enabled;
+ }
+
+ public boolean isSpiceProxyEnabled() {
+ return spiceProxyEnabled;
+ }
+
}
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleOptionsFrontendPersisterImpl.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleOptionsFrontendPersisterImpl.java
index 7886ed8..f2266b3 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleOptionsFrontendPersisterImpl.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleOptionsFrontendPersisterImpl.java
@@ -23,6 +23,7 @@
private static final String SMARTCARD_ENABLED_OVERRIDDEN =
"_smartcardEnabledOverridden"; //$NON-NLS-1$
private static final String WAN_OPTIONS = "_wanOptions"; //$NON-NLS-1$
private static final String USB_AUTOSHARE = "_usbAutoshare"; //$NON-NLS-1$
+ private static final String SPICE_PROXY_ENABLED = "_spiceProxyEnabled";
//$NON-NLS-1$
// rdp options
private static final String USE_LOCAL_DRIVES = "_useLocalDrives";
//$NON-NLS-1$
@@ -89,6 +90,7 @@
storeBool(keyMaker.make(SMARTCARD_ENABLED_OVERRIDDEN),
spice.isSmartcardEnabledOverridden());
storeBool(keyMaker.make(WAN_OPTIONS), spice.isWanOptionsEnabled());
storeBool(keyMaker.make(USB_AUTOSHARE), spice.getUsbAutoShare());
+ storeBool(keyMaker.make(SPICE_PROXY_ENABLED),
spice.isSpiceProxyEnabled());
}
protected void loadRdpData(HasConsoleModel model, KeyMaker keyMaker) {
@@ -122,6 +124,10 @@
spice.setWanOptionsEnabled(readBool(keyMaker.make(WAN_OPTIONS)));
}
+ if (consoleUtils.isSpiceProxyDefined()) {
+
spice.setSpiceProxyEnabled(readBool(keyMaker.make(SPICE_PROXY_ENABLED)));
+ }
+
spice.setFullScreen(readBool(keyMaker.make(OPEN_IN_FULL_SCREEN)));
spice.setOverrideEnabledSmartcard(readBool(keyMaker.make(SMARTCARD_ENABLED_OVERRIDDEN)));
spice.setUsbAutoShare(readBool(keyMaker.make(USB_AUTOSHARE)));
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtils.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtils.java
index 4c053fa..b5a6291 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtils.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtils.java
@@ -2,8 +2,10 @@
import org.ovirt.engine.core.common.businessentities.DisplayType;
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.uicommon.ClientAgentType;
+import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
import org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol;
import org.ovirt.engine.ui.uicommonweb.models.HasConsoleModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel;
@@ -209,6 +211,11 @@
return spiceAvailable && isWindowsVm && spiceGuestAgentInstalled;
}
+ public boolean isSpiceProxyDefined() {
+ String spiceProxy = (String)
AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.SpiceProxyDefault);
+ return spiceProxy != null && !"".equals(spiceProxy); //$NON-NLS-1$
+ }
+
public native String getUserAgentString() /*-{
var userAgent =
navigator.userAgent;
return userAgent;
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.java
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.java
index df8bd79..80fdf0b 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.java
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.java
@@ -76,6 +76,10 @@
@UiField(provided = true)
@WithElementId
+ EntityModelValueCheckBoxEditor<ConsoleModel> enableSpiceProxy;
+
+ @UiField(provided = true)
+ @WithElementId
EntityModelValueCheckBoxEditor<ConsoleModel> useLocalDrives;
@UiField(provided = true)
@@ -187,6 +191,20 @@
});
openInFullScreen.setLabel(constants.openInFullScreen());
+ enableSpiceProxy = new
EntityModelValueCheckBoxEditor<ConsoleModel>(Align.RIGHT, new SpiceRenderer() {
+
+ @Override
+ protected void updateModel(ISpice spice, boolean value) {
+ spice.setSpiceProxyEnabled(value);
+ }
+
+ @Override
+ protected boolean extractBoolean(ISpice spice) {
+ return spice.isSpiceProxyEnabled();
+ }
+ });
+ enableSpiceProxy.setLabel(constants.enableSpiceProxy());
+
useLocalDrives =
new EntityModelValueCheckBoxEditor<ConsoleModel>(Align.RIGHT,
new ValueCheckboxRenderer<ConsoleModel>() {
@@ -233,11 +251,12 @@
this.model = model;
ConsoleModel defaultConsole =
- model.getModel().getDefaultConsoleModel();
+ model.getModel().getDefaultConsoleModel();
editCheckBoxes(defaultConsole,
ctrlAltDel,
enableUsbAutoshare,
openInFullScreen,
+ enableSpiceProxy,
wanEnabled,
disableSmartcard);
@@ -260,6 +279,7 @@
ctrlAltDel,
enableUsbAutoshare,
openInFullScreen,
+ enableSpiceProxy,
useLocalDrives,
wanEnabled,
disableSmartcard);
@@ -411,4 +431,12 @@
disableSmartcardPanel.setVisible(visible);
}
+ @Override
+ public void setSpiceProxyEnabled(boolean enabled, String reason) {
+ enableSpiceProxy.setEnabled(enabled);
+ if (!enabled) {
+ enableSpiceProxy.setTitle(reason);
+ }
+ }
+
}
diff --git
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.ui.xml
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.ui.xml
index a026cdb..a2d4159 100644
---
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.ui.xml
+++
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/ConsolePopupView.ui.xml
@@ -46,6 +46,7 @@
<w:EntityModelValueCheckBoxEditor
ui:field="ctrlAltDel" />
<w:EntityModelValueCheckBoxEditor
ui:field="enableUsbAutoshare" />
<w:EntityModelValueCheckBoxEditor
ui:field="openInFullScreen" />
+ <w:EntityModelValueCheckBoxEditor
ui:field="enableSpiceProxy" />
</g:FlowPanel>
<g:FlowPanel ui:field="rdpPanel"
addStyleNames="{style.fullWidth}">
diff --git
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java
index 435f73d..5a11575 100644
---
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java
+++
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java
@@ -312,6 +312,7 @@
updateIsUsbEnabled();
isInitialized = true;
}
+
}
private void updateIsUsbEnabled() {
diff --git
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ISpice.java
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ISpice.java
index cce2ece..5c5887c 100644
---
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ISpice.java
+++
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ISpice.java
@@ -156,4 +156,8 @@
boolean isSmartcardEnabledOverridden();
void setSpiceProxy(String spiceProxy);
+
+ void setSpiceProxyEnabled(boolean enabled);
+
+ boolean isSpiceProxyEnabled();
}
diff --git
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
index 2c41aa9..0c6fd76 100644
---
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
+++
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
@@ -402,9 +402,10 @@
.pressKeyToReleaseCursor(releaseCursorKeysTranslated))));
- // setup spice proxy - for now always the default
String spiceProxy = (String)
AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.SpiceProxyDefault);
- spiceProxy = "".equals(spiceProxy) ? null : spiceProxy; //$NON-NLS-1$
+ boolean spiceProxyGloballyConfigured = spiceProxy != null &&
!"".equals(spiceProxy);
+ boolean spiceProxyEnabledForThisVm = getspice().isSpiceProxyEnabled();
+ spiceProxy = spiceProxyGloballyConfigured &&
spiceProxyEnabledForThisVm ? spiceProxy : null; //$NON-NLS-1$
getspice().setSpiceProxy(spiceProxy);
// If 'AdminConsole' is true, send true; otherwise, false should be
sent only for VMs with SPICE driver
diff --git
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
index baf39a6..4ea8c95 100644
---
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
+++
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java
@@ -7,6 +7,7 @@
import org.ovirt.engine.ui.common.uicommon.DocumentationPathTranslator;
import org.ovirt.engine.ui.common.uicommon.model.UiCommonInitEvent;
import
org.ovirt.engine.ui.common.uicommon.model.UiCommonInitEvent.UiCommonInitHandler;
+import org.ovirt.engine.ui.common.utils.ConsoleUtils;
import org.ovirt.engine.ui.frontend.AsyncQuery;
import org.ovirt.engine.ui.frontend.INewAsyncCallback;
import org.ovirt.engine.ui.uicommonweb.Configurator;
@@ -43,10 +44,13 @@
private static final ClientAgentType clientAgentType = new
ClientAgentType();
+ private final ConsoleUtils consoleUtils;
+
@Inject
- public UserPortalConfigurator(UserPortalPlaceManager placeManager,
EventBus eventBus) {
+ public UserPortalConfigurator(UserPortalPlaceManager placeManager,
EventBus eventBus, ConsoleUtils consoleUtils) {
super();
this.placeManager = placeManager;
+ this.consoleUtils = consoleUtils;
eventBus.addHandler(UiCommonInitEvent.getType(), this);
// This means that it is UserPortal application.
@@ -75,6 +79,8 @@
updateWanColorDepthOptions(spice);
updateWANDisableEffects(spice);
+
+ spice.setSpiceProxyEnabled(consoleUtils.isSpiceProxyDefined());
}
private void updateWANDisableEffects(final ISpice spice) {
diff --git
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java
index 09e11b0..65b8284 100644
---
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java
+++
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java
@@ -7,6 +7,7 @@
import org.ovirt.engine.ui.common.uicommon.DocumentationPathTranslator;
import org.ovirt.engine.ui.common.uicommon.model.UiCommonInitEvent;
import
org.ovirt.engine.ui.common.uicommon.model.UiCommonInitEvent.UiCommonInitHandler;
+import org.ovirt.engine.ui.common.utils.ConsoleUtils;
import org.ovirt.engine.ui.uicommonweb.Configurator;
import org.ovirt.engine.ui.uicommonweb.models.vms.ISpice;
import org.ovirt.engine.ui.uicommonweb.models.vms.WANDisableEffects;
@@ -32,9 +33,12 @@
private static final ClientAgentType clientAgentType = new
ClientAgentType();
+ private final ConsoleUtils consoleUtils;
+
@Inject
- public WebAdminConfigurator(EventBus eventBus) {
+ public WebAdminConfigurator(EventBus eventBus, ConsoleUtils consoleUtils) {
super();
+ this.consoleUtils = consoleUtils;
eventBus.addHandler(UiCommonInitEvent.getType(), this);
// This means that this is WebAdmin application.
@@ -65,6 +69,8 @@
super.Configure(spice);
spice.setWANDisableEffects(new ArrayList<WANDisableEffects>());
spice.setWanOptionsEnabled(false);
+
+ spice.setSpiceProxyEnabled(consoleUtils.isSpiceProxyDefined());
}
@Override
--
To view, visit http://gerrit.ovirt.org/13328
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I879a4976c649f1d568f42c2d72f9e995a618d874
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches