Yaniv Bronhaim has uploaded a new change for review.

Change subject: Enable json rpc based on cluster level when deploying foreman's 
hosts
......................................................................

Enable json rpc based on cluster level when deploying foreman's hosts

Better to reuse the code in
hostModel.getCluster().getSelectedItemChangedEvent() or in
AddVdsStaticToDb , but I just can't do it as it is and I don't want
to chance those 2 calls as part of this patch.

So this patch copies cluster level check cluster logic and set appropriate
value for jsonrpc checkbox.

Change-Id: Ia7eadb533dd02698f07103fa61e076b46d054522
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1178009
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/36550/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
index cf65d59..78526d5 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.businessentities.ExternalComputeResource;
 import org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost;
 import org.ovirt.engine.core.common.businessentities.ExternalHostGroup;
@@ -10,7 +11,9 @@
 import org.ovirt.engine.core.common.businessentities.StoragePool;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import org.ovirt.engine.core.common.businessentities.VdsProtocol;
 import org.ovirt.engine.core.common.mode.ApplicationMode;
+import org.ovirt.engine.core.common.queries.ConfigurationValues;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.Linq;
@@ -87,6 +90,7 @@
             if (vds == null) {
                 vds = new VDS();
             }
+            setProtocolValue();
             updateModelFromVds(vds, null, false, null);
         }
     }
@@ -101,6 +105,7 @@
                 vds.setHostName(dhost.getName() + "." + //$NON-NLS-1$
                         (dhg.getDomainName() != null ? dhg.getDomainName() : 
"")); //$NON-NLS-1$
             }
+            setProtocolValue();
             updateModelFromVds(vds, null, false, null);
         }
     }
@@ -113,6 +118,7 @@
             vds.setHostName(getName().getEntity() + "." + //$NON-NLS-1$
                     (dhg.getDomainName() != null ? dhg.getDomainName() : "")); 
//$NON-NLS-1$
         }
+        setProtocolValue();
         updateModelFromVds(vds, null, false, null);
     }
 
@@ -206,6 +212,22 @@
         }
     }
 
+    public void setProtocolValue() {
+        ListModel<VDSGroup> clusterModel = getCluster();
+        if (clusterModel.getSelectedItem() != null) {
+            VDSGroup cluster = clusterModel.getSelectedItem();
+            Boolean jsonSupported =
+                    (Boolean) 
AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.JsonProtocolSupported,
+                            cluster.getcompatibility_version().toString());
+            if (jsonSupported) {
+                getProtocol().setEntity(true);
+            } else {
+                getProtocol().setEntity(false);
+                getProtocol().setIsChangable(false);
+            }
+        }
+    }
+
     private void updateExternalHostModels() {
         AsyncQuery getProvidersQuery = new AsyncQuery();
         getProvidersQuery.asyncCallback = new INewAsyncCallback() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7eadb533dd02698f07103fa61e076b46d054522
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to