Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Disable Host/Interfaces subtab refresh pre-3.1
......................................................................

webadmin: Disable Host/Interfaces subtab refresh pre-3.1

In pre-3.1 clusters, host networking is setup through the subtab, and
refreshing the subtab (for the statistics) makes that hard to do as it
resets the row selection.

Change-Id: Idb1d14be079936eac2fb302320eb7000e970bc32
Bug-Url: https://bugzilla.redhat.com/1027597
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/SimpleActionTable.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostInterfacePresenter.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostInterfaceView.java
4 files changed, 36 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/21154/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/SimpleActionTable.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/SimpleActionTable.java
index 5d6af14..d800eee 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/SimpleActionTable.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/SimpleActionTable.java
@@ -126,6 +126,10 @@
         refreshPanel.setVisible(true);
     }
 
+    public void hideRefreshButton() {
+        refreshPanel.setVisible(false);
+    }
+
     public void showItemsCount() {
         itemsCountLabel.setVisible(true);
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
index 307e912..7005d97 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
@@ -2245,8 +2245,7 @@
         // Setup Networks is only available on 3.1 Clusters, all the other 
commands (except save network configuration)
         // available only on less than 3.1 Clusters
         if (host != null) {
-            Version v31 = new Version(3, 1);
-            boolean isLessThan31 = 
host.getVdsGroupCompatibilityVersion().compareTo(v31) < 0;
+            boolean isLessThan31 = 
host.getVdsGroupCompatibilityVersion().compareTo(Version.v3_1) < 0;
 
             getSetupNetworksCommand().setIsAvailable(!isLessThan31);
 
@@ -2258,6 +2257,14 @@
             getEditManagementNetworkCommand().setIsAvailable(isLessThan31);
 
             setSelectionAvailable(isLessThan31);
+
+            // disable subtab refresh for pre-3.1 clusters, to avoid 
interfering with row selection
+            setIsTimerDisabled(isLessThan31);
+            if (isLessThan31) {
+                getTimer().stop();
+            } else {
+                getTimer().start();
+            }
         }
     }
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostInterfacePresenter.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostInterfacePresenter.java
index db0a622..46dbbd2 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostInterfacePresenter.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostInterfacePresenter.java
@@ -12,6 +12,8 @@
 import org.ovirt.engine.ui.webadmin.place.ApplicationPlaces;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.tab.HostSelectionChangeEvent;
 
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
 import com.gwtplatform.mvp.client.TabData;
@@ -31,6 +33,7 @@
     }
 
     public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VDS> {
+        void setRefreshButtonVisibility(boolean visible);
     }
 
     @TabInfo(container = HostSubTabPanelPresenter.class)
@@ -52,6 +55,17 @@
         return PlaceRequestFactory.get(ApplicationPlaces.hostMainTabPlace);
     }
 
+    @Override
+    protected void onBind() {
+        super.onBind();
+        getModelProvider().getModel().getTimer().addValueChangeHandler(new 
ValueChangeHandler<String>() {
+            @Override
+            public void onValueChange(ValueChangeEvent<String> event) {
+                
getView().setRefreshButtonVisibility(!getModelProvider().getModel().getTimer().isActive());
+            }
+        });
+    }
+
     @ProxyEvent
     public void onHostSelectionChange(HostSelectionChangeEvent event) {
         updateMainTabSelection(event.getSelectedItems());
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostInterfaceView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostInterfaceView.java
index 7324ace..6943614 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostInterfaceView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostInterfaceView.java
@@ -125,7 +125,6 @@
             }
         });
 
-        table.showRefreshButton();
         //The table items are in the form, so the table itself will never have 
items, so don't display the 'empty message'
         table.table.setEmptyTableWidget(null);
     }
@@ -138,4 +137,13 @@
         contentPanel.add(hostInterfaceForm);
     }
 
+    @Override
+    public void setRefreshButtonVisibility(boolean visible) {
+        if (visible) {
+            table.showRefreshButton();
+        } else {
+            table.hideRefreshButton();
+        }
+    }
+
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb1d14be079936eac2fb302320eb7000e970bc32
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