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 <[email protected]>
---
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/50/20750/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 77f9381..503e1e7 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 854bae7..e5f68d3 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;
@@ -45,7 +43,6 @@
     private EntityModel description;
     private final EntityModel sourceModel;
     private Version dcCompatibilityVersion;
-    private boolean customPropertiesSupported;
     private ListModel network;
     private ListModel networkQoS;
     private VnicProfile vnicProfile = null;
@@ -164,20 +161,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() {
@@ -273,37 +258,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/20750
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3f942133f752f91a601b305191749832efcf6f6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to