Blame SOURCES/bz1231858-02-web-UI-don-t-change-current-resource-in-URL-if-not-i.patch

15f218
From 590157ae3e595560632ddc25c725b67c42a3f2ab Mon Sep 17 00:00:00 2001
15f218
From: Ondrej Mular <omular@redhat.com>
15f218
Date: Wed, 27 Jul 2016 09:56:55 +0200
15f218
Subject: [PATCH] web UI: don't change current resource in URL if not in
15f218
 resources tab
15f218
15f218
---
15f218
 pcsd/public/js/nodes-ember.js |  6 ++----
15f218
 pcsd/public/js/pcsd.js        | 11 +++++------
15f218
 2 files changed, 7 insertions(+), 10 deletions(-)
15f218
15f218
diff --git a/pcsd/public/js/nodes-ember.js b/pcsd/public/js/nodes-ember.js
15f218
index 2b43559..efc0192 100644
15f218
--- a/pcsd/public/js/nodes-ember.js
15f218
+++ b/pcsd/public/js/nodes-ember.js
15f218
@@ -210,16 +210,14 @@ Pcs = Ember.Application.createWithMixins({
15f218
           Ember.run.scheduleOnce('afterRender', Pcs, function () {
15f218
             if (self.get('cur_fence')) {
15f218
               if (fence_change) {
15f218
-                tree_view_onclick(self.get('cur_fence').get('id'), first_run);
15f218
+                tree_view_onclick(self.get('cur_fence').get('id'));
15f218
               } else {
15f218
                 tree_view_select(self.get('cur_fence').get('id'));
15f218
               }
15f218
             }
15f218
             if (self.get('cur_resource')) {
15f218
               if (resource_change) {
15f218
-                tree_view_onclick(
15f218
-                  self.get('cur_resource').get('id'), first_run
15f218
-                );
15f218
+                tree_view_onclick(self.get('cur_resource').get('id'));
15f218
               } else {
15f218
                 tree_view_select(self.get('cur_resource').get('id'));
15f218
               }
15f218
diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
15f218
index c8ed340..a646bed 100644
15f218
--- a/pcsd/public/js/pcsd.js
15f218
+++ b/pcsd/public/js/pcsd.js
15f218
@@ -1134,8 +1134,8 @@ function hover_out(o) {
15f218
 }
15f218
 
15f218
 function reload_current_resource() {
15f218
-  tree_view_onclick(curResource(), true);
15f218
-  tree_view_onclick(curStonith(), true);
15f218
+  tree_view_onclick(curResource());
15f218
+  tree_view_onclick(curStonith());
15f218
 }
15f218
 
15f218
 function load_row(node_row, ac, cur_elem, containing_elem, also_set, initial_load){
15f218
@@ -2112,20 +2112,19 @@ function update_instance_attributes(resource_id) {
15f218
   }, res_obj.get("stonith"));
15f218
 }
15f218
 
15f218
-function tree_view_onclick(resource_id, first_run) {
15f218
-  first_run = typeof first_run !== 'undefined' ? first_run : false;
15f218
+function tree_view_onclick(resource_id) {
15f218
   var resource_obj = Pcs.resourcesContainer.get_resource_by_id(resource_id);
15f218
   if (!resource_obj) {
15f218
     console.log("Resource " + resource_id + "not found.");
15f218
     return;
15f218
   }
15f218
   if (resource_obj.get('stonith')) {
15f218
-    if (!first_run) {
15f218
+    if (window.location.hash.startsWith("#/fencedevices")) {
15f218
       window.location.hash = "/fencedevices/" + resource_id;
15f218
     }
15f218
     Pcs.resourcesContainer.set('cur_fence', resource_obj);
15f218
   } else {
15f218
-    if (!first_run) {
15f218
+    if (window.location.hash.startsWith("#/resources")) {
15f218
       window.location.hash = "/resources/" + resource_id;
15f218
     }
15f218
     Pcs.resourcesContainer.set('cur_resource', resource_obj);
15f218
-- 
15f218
1.8.3.1
15f218