Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Enable vNIC profile fields independently of version
......................................................................

webadmin: Enable vNIC profile fields independently of version

Always enable the port mirroring and custom properties fields of the
vNIC profile dialog, independently of the DC compatibility
version. The vNIC profile is a DC-level entity and there could be
clusters inside the DC that do have a high enough compatibility
version, so the version compatibility should not be enforced here.

Change-Id: Id3f942133f752f91a601b305191749832efcf6f6
Bug-Url: https://bugzilla.redhat.com/1023952
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java
2 files changed, 23 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/21033/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index d91b78f..40bee48 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -88,7 +88,6 @@
     MigrationNetworkEnabled,
     VncKeyboardLayout(ConfigAuthType.User),
     VncKeyboardLayoutValidValues(ConfigAuthType.User),
-    SupportCustomDeviceProperties(ConfigAuthType.User),
     CustomDeviceProperties(ConfigAuthType.User),
     MultipleGatewaysSupported,
     VirtIoScsiEnabled(ConfigAuthType.User),
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java
index 15c7c00..8cc6b13 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java
@@ -12,7 +12,6 @@
 import org.ovirt.engine.core.common.businessentities.network.Network;
 import org.ovirt.engine.core.common.businessentities.network.NetworkQoS;
 import org.ovirt.engine.core.common.businessentities.network.VnicProfile;
-import org.ovirt.engine.core.common.queries.ConfigurationValues;
 import 
org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
@@ -24,7 +23,6 @@
 import org.ovirt.engine.ui.frontend.Frontend;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.UICommand;
-import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
 import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
 import org.ovirt.engine.ui.uicommonweb.models.ListModel;
 import org.ovirt.engine.ui.uicommonweb.models.Model;
@@ -47,7 +45,6 @@
     private EntityModel description;
     private final EntityModel sourceModel;
     private Version dcCompatibilityVersion;
-    private boolean customPropertiesSupported;
     private ListModel network;
     private ListModel networkQoS;
     private VnicProfile vnicProfile = null;
@@ -175,20 +172,8 @@
         this.dcCompatibilityVersion = dcCompatibilityVersion;
         this.dcId = dcId;
 
-        customPropertiesSupported =
-                (Boolean) 
AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.SupportCustomDeviceProperties,
-                        dcCompatibilityVersion.toString());
-
-        getPortMirroring().setIsChangable(isPortMirroringSupported());
         initCustomPropertySheet();
         initNetworkQoSList();
-    }
-
-    protected boolean isPortMirroringSupported() {
-        Version v31 = new Version(3, 1);
-        boolean isLessThan31 = getDcCompatibilityVersion().compareTo(v31) < 0;
-
-        return !isLessThan31;
     }
 
     protected void initCommands() {
@@ -284,37 +269,33 @@
             return;
         }
 
-        if (customPropertiesSupported) {
-            GetDeviceCustomPropertiesParameters params = new 
GetDeviceCustomPropertiesParameters();
-            params.setVersion(getDcCompatibilityVersion());
-            params.setDeviceType(VmDeviceGeneralType.INTERFACE);
-            startProgress(null);
-            Frontend.RunQuery(VdcQueryType.GetDeviceCustomProperties,
-                    params,
-                    new AsyncQuery(this,
-                            new INewAsyncCallback() {
-                                @Override
-                                public void onSuccess(Object target, Object 
returnValue) {
-                                    if (returnValue != null) {
-                                        Map<String, String> 
customPropertiesList =
-                                                ((Map<String, String>) 
((VdcQueryReturnValue) returnValue).getReturnValue());
+        GetDeviceCustomPropertiesParameters params = new 
GetDeviceCustomPropertiesParameters();
+        params.setVersion(getDcCompatibilityVersion());
+        params.setDeviceType(VmDeviceGeneralType.INTERFACE);
+        startProgress(null);
+        Frontend.RunQuery(VdcQueryType.GetDeviceCustomProperties,
+                params,
+                new AsyncQuery(this,
+                        new INewAsyncCallback() {
+                            @Override
+                            public void onSuccess(Object target, Object 
returnValue) {
+                                if (returnValue != null) {
+                                    Map<String, String> customPropertiesList =
+                                            ((Map<String, String>) 
((VdcQueryReturnValue) returnValue).getReturnValue());
 
-                                        List<String> lines = new 
ArrayList<String>();
+                                    List<String> lines = new 
ArrayList<String>();
 
-                                        for (Map.Entry<String, String> 
keyValue : customPropertiesList.entrySet()) {
-                                            lines.add(keyValue.getKey() + '=' 
+ keyValue.getValue());
-                                        }
-                                        
getCustomPropertySheet().setKeyValueString(lines);
-                                        
getCustomPropertySheet().setIsChangable(!lines.isEmpty());
-
-                                        initCustomProperties();
+                                    for (Map.Entry<String, String> keyValue : 
customPropertiesList.entrySet()) {
+                                        lines.add(keyValue.getKey() + '=' + 
keyValue.getValue());
                                     }
-                                    stopProgress();
+                                    
getCustomPropertySheet().setKeyValueString(lines);
+                                    
getCustomPropertySheet().setIsChangable(!lines.isEmpty());
+
+                                    initCustomProperties();
                                 }
-                            }));
-        } else {
-            getCustomPropertySheet().setIsChangable(false);
-        }
+                                stopProgress();
+                            }
+                        }));
     }
 
     private void initNetworkQoSList() {


-- 
To view, visit http://gerrit.ovirt.org/21033
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3f942133f752f91a601b305191749832efcf6f6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Lior Vernia <lver...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to