Alexander Wels has uploaded a new change for review.

Change subject: webadmin: Host network interface refresh
......................................................................

webadmin: Host network interface refresh

- Fixed issue where the refresh button on the Host interface
  sub tab would disappear if you clicked out side of the browser.

Change-Id: I681d79feef2b2fba47ce1ba065cac03b9409c343
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1066827
Signed-off-by: Alexander Wels <aw...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/GridTimer.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
3 files changed, 25 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/24796/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/GridTimer.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/GridTimer.java
index 81cf77d..4bd54e3 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/GridTimer.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/GridTimer.java
@@ -212,12 +212,34 @@
         scheduleRepeating(getRefreshRate());
     }
 
+    /**
+     * This is a special start that also fires a value change event to let 
other people know the timer state
+     * changed. If we always fire the event in the normal start, it will spam 
a ton of events and slow down
+     * the application. There are only a few cases where we actually need to 
know if a timer started
+     * and this method is for those cases.
+     */
+    public void startWithEvent() {
+        start();
+        ValueChangeEvent.fire(this, getRefreshRate());
+    }
+
     public void stop() {
         logger.fine("GridTimer[" + name + "].stop()"); //$NON-NLS-1$ 
//$NON-NLS-2$
         active = false;
         doStop();
     }
 
+    /**
+     * This is a special stop that also fires a value change event to let 
other people know the timer state
+     * changed. If we always fire the event in the normal stop, it will spam a 
ton of events and slow down
+     * the application. There are only a few cases where we actually need to 
know if a timer stopped
+     * and this method is for those cases.
+     */
+    public void stopWithEvent() {
+        stop();
+        ValueChangeEvent.fire(this, getRefreshRate());
+    }
+
     public void pause() {
         logger.fine("GridTimer[" + name + "].pause()"); //$NON-NLS-1$ 
//$NON-NLS-2$
         if (active) {
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 7ee0d9a..3254735 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
@@ -2271,9 +2271,9 @@
             // disable subtab refresh for pre-3.1 clusters, to avoid 
interfering with row selection
             setIsTimerDisabled(isLessThan31);
             if (isLessThan31) {
-                getTimer().stop();
+                getTimer().stopWithEvent();
             } else {
-                getTimer().start();
+                getTimer().startWithEvent();
             }
         }
     }
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 1ac529b..af016d1 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
@@ -73,7 +73,7 @@
         getModelProvider().getModel().getTimer().addValueChangeHandler(new 
ValueChangeHandler<Integer>() {
             @Override
             public void onValueChange(ValueChangeEvent<Integer> event) {
-                
getView().setRefreshButtonVisibility(!getModelProvider().getModel().getTimer().isActive());
+                
getView().setRefreshButtonVisibility(getModelProvider().getModel().getTimer().isActive());
             }
         });
     }


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

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

Reply via email to