Vojtech Szocs has posted comments on this change.

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


Patch Set 1:

(2 comments)

http://gerrit.ovirt.org/#/c/35251/1/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalItemModel.java:

Line 384:             VM thisVm = (VM) getEntity();
Line 385:             VM otherVm = (VM) other.getEntity();
Line 386:             boolean consoleUsersEqual = 
(thisVm.getConsoleCurentUserName() != null
Line 387:                     && 
thisVm.getConsoleCurentUserName().equals(otherVm.getConsoleCurentUserName())) ||
Line 388:                     (thisVm.getConsoleCurentUserName() == null && 
otherVm.getConsoleCurentUserName() == null);
Consider using Java 7's static Objects.equals() API to make code more readable.
Line 389: 
Line 390:             return  
thisVm.getDynamicData().getStatus().equals(otherVm.getDynamicData().getStatus())
Line 391:                     && consoleUsersEqual
Line 392:                     && 
thisVm.getStaticData().equals(otherVm.getStaticData());


http://gerrit.ovirt.org/#/c/35251/1/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java
File 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/extended/SideTabExtendedVirtualMachinePresenter.java:

Line 74: 
Line 75:     @Override
Line 76:     public void onHide() {
Line 77:         super.onHide();
Line 78:         
((AbstractUserPortalListProvider<UserPortalListModel>)modelProvider).clearCurrentItems();
I think we should avoid explicit type casts whenever possible.

If we need to cast, it means that our dependency has wrong type; we should fix 
the root cause (working with correct type) instead of fixing the consequence 
(casting to correct type).

Modifying existing Presenter classes to accomodate UserPortal-specific model 
provider interface (containing "clearCurrentItems" method) would be too complex 
due to complexity of Presenter hierarchy itself. 

Consider the following idea:

* create UserPortalSearchableTableModelProvider

 // package org.ovirt.engine.ui.userportal.uicommon.model
 public interface UserPortalSearchableTableModelProvider<T, M extends 
SearchableListModel> extends SearchableTableModelProvider<T,M> {
   void clearCurrentItems();
 }

* modify AbstractSideTabWithDetailsPresenter constructor to accept 
UserPortalSearchableTableModelProvider (instead of 
SearchableTableModelProvider) & remember that instance via private final field

* in AbstractSideTabWithDetailsPresenter override onHide() and call 
modelProvider.clearCurrentItems()

This way, the issue addressed by this patch will also impact "Templates" 
side-tab, not only "VMs" side-tab.
Line 79:     }
Line 80: 
Line 81:     /**
Line 82:      * This method is a hack which enables to have pool and VM subtabs 
to be bound with the same title


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iae7bc8fcf9b4d875e99f7b4a6264a54ceed9fb7e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Einav Cohen <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to