Yaniv Bronhaim has uploaded a new change for review.

Change subject: ui: Fix search button logic
......................................................................

ui: Fix search button logic

Commit 60331c40535c95950274984d89177643df5686db broke the search button
logic. This patch returns the same refresh logic that was next to the
current changes.

Change-Id: Ia86fa287a050e030d28ab96eeecfb888dd1cb22b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1165669
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/EditHostModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java
3 files changed, 37 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/35384/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/EditHostModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/EditHostModel.java
index b19d65a..ab38281 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/EditHostModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/EditHostModel.java
@@ -59,6 +59,10 @@
     }
 
     @Override
+    protected void updateProvisionedHosts() {
+    }
+
+    @Override
     public boolean showExternalProviderPanel() {
         return false;
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
index 5121163..0f287794 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
@@ -916,12 +916,12 @@
         setUpdateHostsCommand(new UICommand("", new ICommandTarget() { 
//$NON-NLS-1$
             @Override
             public void executeCommand(UICommand command) {
-                updateHosts();
+                updateProvisionedHosts();
             }
 
             @Override
             public void executeCommand(UICommand uiCommand, Object... 
parameters) {
-                updateHosts();
+                updateProvisionedHosts();
             }
         }));
         setProxyUpCommand(new UICommand("Up", new ICommandTarget() {    
//$NON-NLS-1$
@@ -1913,6 +1913,8 @@
 
     public abstract void updateHosts();
 
+    protected abstract void updateProvisionedHosts();
+
     protected abstract void setPort(VDS vds);
 
     public abstract boolean showNetworkProviderTab();
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 76557a1..1afde55 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
@@ -149,6 +149,30 @@
         
AsyncDataProvider.getExternalProviderComputeResourceList(getComputeResourceQuery,
 provider);
     }
 
+    private void updateDiscoveredHostList(String searchFilter) {
+        Provider provider = getProviders().getSelectedItem();
+        if (provider != null ) {
+            AsyncQuery getHostsQuery = new AsyncQuery();
+            getHostsQuery.asyncCallback = new INewAsyncCallback() {
+                @Override
+                public void onSuccess(Object model, Object result)
+                {
+                    ArrayList<VDS> hosts = (ArrayList<VDS>) result;
+                    ListModel<VDS> hostNameListModel = getExternalHostName();
+                    hosts.add(0, null);
+                    hostNameListModel.setItems(hosts);
+                    hostNameListModel.setIsChangable(true);
+                    setEnableSearchHost(true);
+                }
+            };
+            
AsyncDataProvider.getInstance().getExternalProviderHostList(getHostsQuery, 
provider.getId(), true, searchFilter);
+        } else {
+            getExternalHostName().setItems(null);
+            getExternalHostName().setIsChangable(false);
+            setEnableSearchHost(false);
+        }
+    }
+
     private void updateExternalHostModels() {
         AsyncQuery getProvidersQuery = new AsyncQuery();
         getProvidersQuery.asyncCallback = new INewAsyncCallback() {
@@ -196,6 +220,11 @@
     }
 
     @Override
+    protected void updateProvisionedHosts() {
+        updateDiscoveredHostList(getProviderSearchFilter().getEntity());
+    }
+
+    @Override
     public boolean showExternalProviderPanel() {
         return ApplicationModeHelper.getUiMode() != 
ApplicationMode.GlusterOnly;
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia86fa287a050e030d28ab96eeecfb888dd1cb22b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
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