Alexander Wels has uploaded a new change for review.

Change subject: userportal: VM endless loading
......................................................................

userportal: VM endless loading

- Fixed issue where if there were no VMs available and you went to
  another tab and then back to the VMs the loading would never end.
- Fixed equals to properly take console user into account instead of
  always returning false even if both VMs had null console users.
- Fixed 'old' grid content from flashing when switching between tabs.

Change-Id: Iae7bc8fcf9b4d875e99f7b4a6264a54ceed9fb7e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1156103
Signed-off-by: Alexander Wels <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractSideTabWithDetailsPresenter.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java
4 files changed, 24 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/35251/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
index a690891..490f1e23 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+
 import org.ovirt.engine.core.common.businessentities.IVdcQueryable;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
@@ -382,9 +383,9 @@
         else if (getEntity() instanceof VM && other.getEntity() instanceof VM) 
{
             VM thisVm = (VM) getEntity();
             VM otherVm = (VM) other.getEntity();
-
-            boolean consoleUsersEqual = thisVm.getConsoleCurentUserName() != 
null
-                    && 
thisVm.getConsoleCurentUserName().equals(otherVm.getConsoleCurentUserName());
+            boolean consoleUsersEqual = (thisVm.getConsoleCurentUserName() != 
null
+                    && 
thisVm.getConsoleCurentUserName().equals(otherVm.getConsoleCurentUserName())) ||
+                    (thisVm.getConsoleCurentUserName() == null && 
otherVm.getConsoleCurentUserName() == null);
 
             return  
thisVm.getDynamicData().getStatus().equals(otherVm.getDynamicData().getStatus())
                     && consoleUsersEqual
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractSideTabWithDetailsPresenter.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractSideTabWithDetailsPresenter.java
index 37c4e79..19fa9f7 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractSideTabWithDetailsPresenter.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AbstractSideTabWithDetailsPresenter.java
@@ -10,11 +10,12 @@
 import 
org.ovirt.engine.ui.userportal.section.main.presenter.tab.MainTabExtendedPresenter;
 
 import com.google.gwt.event.shared.EventBus;
+import 
com.google.gwt.user.cellview.client.LoadingStateChangeEvent.LoadingState;
 import com.google.gwt.view.client.SelectionChangeEvent;
 import com.gwtplatform.mvp.client.View;
 import com.gwtplatform.mvp.client.proxy.PlaceManager;
-import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
 import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
 
 /**
  * Base class for side tab presenters that work with {@link 
ListWithDetailsModel}.
@@ -78,7 +79,7 @@
     @Override
     protected void onReveal() {
         super.onReveal();
-
+        getView().getTable().setLoadingState(LoadingState.LOADING);
         // Clear table selection and update sub tab panel visibility
         if (hasSelection()) {
             clearSelection();
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
index af6bc75..edd9c189 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
@@ -13,6 +13,7 @@
 import org.ovirt.engine.ui.userportal.place.ApplicationPlaces;
 import 
org.ovirt.engine.ui.userportal.section.main.presenter.AbstractSideTabWithDetailsPresenter;
 import 
org.ovirt.engine.ui.userportal.section.main.presenter.tab.MainTabExtendedPresenter;
+import 
org.ovirt.engine.ui.userportal.uicommon.model.AbstractUserPortalListProvider;
 import org.ovirt.engine.ui.userportal.uicommon.model.vm.UserPortalListProvider;
 
 import com.google.gwt.event.shared.EventBus;
@@ -26,9 +27,9 @@
 import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
 import com.gwtplatform.mvp.client.annotations.TabInfo;
 import com.gwtplatform.mvp.client.proxy.PlaceManager;
-import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
 import com.gwtplatform.mvp.client.proxy.RevealContentHandler;
 import com.gwtplatform.mvp.client.proxy.TabContentProxyPlace;
+import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
 
 public class SideTabExtendedVirtualMachinePresenter extends 
AbstractSideTabWithDetailsPresenter<UserPortalItemModel, UserPortalListModel, 
SideTabExtendedVirtualMachinePresenter.ViewDef, 
SideTabExtendedVirtualMachinePresenter.ProxyDef> {
 
@@ -71,6 +72,12 @@
         return 
PlaceRequestFactory.get(ApplicationPlaces.extendedVirtualMachineSideTabPlace);
     }
 
+    @Override
+    public void onHide() {
+        super.onHide();
+        
((AbstractUserPortalListProvider<UserPortalListModel>)modelProvider).clearCurrentItems();
+    }
+
     /**
      * This method is a hack which enables to have pool and VM subtabs to be 
bound with the same title
      */
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java
index 4a6bdc5..484ee7d 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java
@@ -58,11 +58,18 @@
     }
 
     private void clearReferences() {
-        for(UserPortalItemModel itemModel: currentItems) {
-            itemModel.clearReferences();
+        if (currentItems != null) {
+            for(UserPortalItemModel itemModel: currentItems) {
+                itemModel.clearReferences();
+            }
         }
     }
 
+    public void clearCurrentItems() {
+        clearReferences();
+        currentItems = null;
+    }
+
     /**
      * Instead of clearing the items in the model, just mark a flag that 
forces the
      * view to update the grid when updateProvider is called.


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

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

Reply via email to