Blob Blame History Raw
From 590157ae3e595560632ddc25c725b67c42a3f2ab Mon Sep 17 00:00:00 2001
From: Ondrej Mular <omular@redhat.com>
Date: Wed, 27 Jul 2016 09:56:55 +0200
Subject: [PATCH] web UI: don't change current resource in URL if not in
 resources tab

---
 pcsd/public/js/nodes-ember.js |  6 ++----
 pcsd/public/js/pcsd.js        | 11 +++++------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/pcsd/public/js/nodes-ember.js b/pcsd/public/js/nodes-ember.js
index 2b43559..efc0192 100644
--- a/pcsd/public/js/nodes-ember.js
+++ b/pcsd/public/js/nodes-ember.js
@@ -210,16 +210,14 @@ Pcs = Ember.Application.createWithMixins({
           Ember.run.scheduleOnce('afterRender', Pcs, function () {
             if (self.get('cur_fence')) {
               if (fence_change) {
-                tree_view_onclick(self.get('cur_fence').get('id'), first_run);
+                tree_view_onclick(self.get('cur_fence').get('id'));
               } else {
                 tree_view_select(self.get('cur_fence').get('id'));
               }
             }
             if (self.get('cur_resource')) {
               if (resource_change) {
-                tree_view_onclick(
-                  self.get('cur_resource').get('id'), first_run
-                );
+                tree_view_onclick(self.get('cur_resource').get('id'));
               } else {
                 tree_view_select(self.get('cur_resource').get('id'));
               }
diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
index c8ed340..a646bed 100644
--- a/pcsd/public/js/pcsd.js
+++ b/pcsd/public/js/pcsd.js
@@ -1134,8 +1134,8 @@ function hover_out(o) {
 }
 
 function reload_current_resource() {
-  tree_view_onclick(curResource(), true);
-  tree_view_onclick(curStonith(), true);
+  tree_view_onclick(curResource());
+  tree_view_onclick(curStonith());
 }
 
 function load_row(node_row, ac, cur_elem, containing_elem, also_set, initial_load){
@@ -2112,20 +2112,19 @@ function update_instance_attributes(resource_id) {
   }, res_obj.get("stonith"));
 }
 
-function tree_view_onclick(resource_id, first_run) {
-  first_run = typeof first_run !== 'undefined' ? first_run : false;
+function tree_view_onclick(resource_id) {
   var resource_obj = Pcs.resourcesContainer.get_resource_by_id(resource_id);
   if (!resource_obj) {
     console.log("Resource " + resource_id + "not found.");
     return;
   }
   if (resource_obj.get('stonith')) {
-    if (!first_run) {
+    if (window.location.hash.startsWith("#/fencedevices")) {
       window.location.hash = "/fencedevices/" + resource_id;
     }
     Pcs.resourcesContainer.set('cur_fence', resource_obj);
   } else {
-    if (!first_run) {
+    if (window.location.hash.startsWith("#/resources")) {
       window.location.hash = "/resources/" + resource_id;
     }
     Pcs.resourcesContainer.set('cur_resource', resource_obj);
-- 
1.8.3.1