Noam Slomianko has uploaded a new change for review.

Change subject: webadmin: Stay in the same tab if possible
......................................................................

webadmin: Stay in the same tab if possible

Suggested behaviour for the system tree:
 - Dont change the selected main tab if the new tree item can show that tab

Example case:
Hosts tab is selected -> select spesific storage in system tree
old behaviour: switch to clusters tab
new behaviour: stay in hosts tab (because it is possible)

Change-Id: I2c27536ecb5ef9a8f48205c217fbdf295860e363
Signed-off-by: noam slomianko <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
1 file changed, 35 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/13516/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
index c279bac..665363b 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
@@ -598,6 +598,41 @@
 
         // Do not Change Tab if the Selection is the Reports
         if (!reportsList.getIsAvailable() || getSelectedItem() != reportsList) 
{
+            changeSelectedTabIfNeeded(model);
+        } else {
+            reportsList.refreshReportModel();
+        }
+
+        // Update search string if selected item was not changed. If it is,
+        // search string will be updated in OnSelectedItemChanged method.
+        if (getSelectedItem() == oldSelectedItem)
+        {
+            String prefix = ""; //$NON-NLS-1$
+            String search = ""; //$NON-NLS-1$
+            RefObject<String> tempRef_prefix = new RefObject<String>(prefix);
+            RefObject<String> tempRef_search = new RefObject<String>(search);
+            SplitSearchString(getSelectedItem().getDefaultSearchString(), 
tempRef_prefix, tempRef_search);
+            prefix = tempRef_prefix.argvalue;
+            search = tempRef_search.argvalue;
+
+            setSearchStringPrefix(prefix);
+            setSearchString(search);
+
+            getSearchCommand().Execute();
+
+            if (getSelectedItem() instanceof ISupportSystemTreeContext)
+            {
+                ISupportSystemTreeContext treeContext = 
(ISupportSystemTreeContext) getSelectedItem();
+                treeContext.setSystemTreeSelectedItem((SystemTreeItemModel) 
getSystemTree().getSelectedItem());
+            }
+        }
+    }
+
+    private void changeSelectedTabIfNeeded(SystemTreeItemModel model) {
+        if (getSelectedItem() != null && getSelectedItem().getIsAvailable()) {
+            // Do not change tab if we can show it
+            return;
+        } else {
             switch (model.getType())
             {
             case DataCenter:
@@ -640,32 +675,6 @@
                     setSelectedItem(getDefaultItem());
                 }
                 break;
-            }
-        } else {
-            reportsList.refreshReportModel();
-        }
-
-        // Update search string if selected item was not changed. If it is,
-        // search string will be updated in OnSelectedItemChanged method.
-        if (getSelectedItem() == oldSelectedItem)
-        {
-            String prefix = ""; //$NON-NLS-1$
-            String search = ""; //$NON-NLS-1$
-            RefObject<String> tempRef_prefix = new RefObject<String>(prefix);
-            RefObject<String> tempRef_search = new RefObject<String>(search);
-            SplitSearchString(getSelectedItem().getDefaultSearchString(), 
tempRef_prefix, tempRef_search);
-            prefix = tempRef_prefix.argvalue;
-            search = tempRef_search.argvalue;
-
-            setSearchStringPrefix(prefix);
-            setSearchString(search);
-
-            getSearchCommand().Execute();
-
-            if (getSelectedItem() instanceof ISupportSystemTreeContext)
-            {
-                ISupportSystemTreeContext treeContext = 
(ISupportSystemTreeContext) getSelectedItem();
-                treeContext.setSystemTreeSelectedItem((SystemTreeItemModel) 
getSystemTree().getSelectedItem());
             }
         }
     }


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

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

Reply via email to