Frank Kobzik has uploaded a new change for review.

Change subject: userportal: auto-connect selected only works once per browser 
session
......................................................................

userportal: auto-connect selected only works once per browser session

Steps to Reproduce:
1. Go to the user portal, where the user only has one VM that is up, have the
   Connect Automatically checkbox selected, and login.
2. Logout and repeat.

The console pops up only once in the extended view (with basic view it works as
expected).

The bug depended on the order of initializing MainTabBasicPresenter and
MainTabExtendedPresenter classes. These classes handle unregistering and
registering listeners for auto-connect on UserPortalModelInit event.
When the MTExtendedPresenter was loaded first, the MTBasicPresenter
unregistered its listeners, so the auto-connect logic could't be invoked (the
auto-connection occured when user clicked on "basic" tab).

There was a flaw in ConnectAutomaticManager. It tried to auto-connect to a
machine, that was strictly in up state, which is correct for basic view. For
extended view, however, the feature must also work when there is a single
running machine (that cannot be strictly in the up state [can be also powering
up, rebooting...]). This patch changes this behavior of
ConnectAutomaticallyManager - now it auto-connects to the machine, which
is running.

Change-Id: If93181166d2e3f63c0074594cb94002802499414
Bug-Url: https://bugzilla.redhat.com/867134
Signed-off-by: Frantisek Kobzik <[email protected]>
---
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/MainTabBasicPresenter.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/utils/ConnectAutomaticallyManager.java
2 files changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/13015/1

diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/MainTabBasicPresenter.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/MainTabBasicPresenter.java
index 05f2b00..6c88034 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/MainTabBasicPresenter.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/tab/MainTabBasicPresenter.java
@@ -75,7 +75,6 @@
 
             @Override
             public void onUserPortalModelInit(UserPortalModelInitEvent event) {
-                connectAutomaticallyManager.unregisterModels();
                 connectAutomaticallyManager.registerModel(provider.getModel());
             }
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/utils/ConnectAutomaticallyManager.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/utils/ConnectAutomaticallyManager.java
index 11d2f6d..3d1d60d 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/utils/ConnectAutomaticallyManager.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/utils/ConnectAutomaticallyManager.java
@@ -83,7 +83,7 @@
         @Override
         public void eventRaised(Event ev, Object sender, EventArgs args) {
             if (connectAutomatically.readConnectAutomatically() && 
model.getCanConnectAutomatically() && !alreadyOpened) {
-                UserPortalItemModel userPortalItemModel = 
model.GetStatusUpVms(model.getItems()).get(0);
+                UserPortalItemModel userPortalItemModel = 
model.GetUpVms(model.getItems()).get(0);
                 if (userPortalItemModel != null) {
                     
userPortalItemModel.getDefaultConsole().getConnectCommand().Execute();
                     alreadyOpened = true;


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

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

Reply via email to