ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-3928. Config Groups: Navi tab wrong when going back from host config page. (onechiporenko)
Date Fri, 29 Nov 2013 13:09:37 GMT
Updated Branches:
  refs/heads/trunk 35024a0e7 -> bd5311003


AMBARI-3928. Config Groups: Navi tab wrong when going back from host config page. (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bd531100
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bd531100
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bd531100

Branch: refs/heads/trunk
Commit: bd53110038271255c6a0c4028c7b5c842e3487b7
Parents: 35024a0
Author: Oleg Nechiporenko <cv_github@yahoo.com>
Authored: Fri Nov 29 15:02:03 2013 +0200
Committer: Oleg Nechiporenko <cv_github@yahoo.com>
Committed: Fri Nov 29 15:09:31 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 12 +++------
 ambari-web/app/routes/main.js                   | 28 +++++++++-----------
 2 files changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bd531100/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index f4c48ba..0f7dcc4 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -24,6 +24,10 @@ App.MainHostDetailsController = Em.Controller.extend({
   isFromHosts: false,
 
   /**
+   * path to page visited before
+   */
+  referer: '',
+  /**
    * open dashboard page
    */
   routeHome: function () {
@@ -40,14 +44,6 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
-   * set new value to isFromHosts property
-   * @param isFromHosts new value
-   */
-  setBack: function(isFromHosts){
-    this.set('isFromHosts', isFromHosts);
-  },
-
-  /**
    * Send specific command to server
    * @param url
    * @param _method

http://git-wip-us.apache.org/repos/asf/ambari/blob/bd531100/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 1101d92..f35c3ff 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -522,12 +522,13 @@ module.exports = Em.Route.extend({
     }),
 
     back: function (router, event) {
-      window.history.back();
-    },
-
-    showDetails: function (router, event) {
-      router.get('mainHostDetailsController').setBack(true);
-      router.transitionTo('hostDetails.summary', event.context)
+      var referer = router.get('mainHostDetailsController.referer');
+      if (referer) {
+        router.route(referer);
+      }
+      else {
+        window.history.back();
+      }
     },
 
     addHost: function (router) {
@@ -815,10 +816,6 @@ module.exports = Em.Route.extend({
     route: '/dashboard',
     connectOutlets: function (router, context) {
       router.get('mainController').connectOutlet('mainDashboard');
-    },
-    showDetails: function (router, event) {
-      router.get('mainHostDetailsController').setBack(true);
-      router.transitionTo('hosts.hostDetails.summary', event.context);
     }
   }),
 
@@ -885,10 +882,6 @@ module.exports = Em.Route.extend({
         parent.deactivateChildViews();
         event.view.set('active', "active");
         router.transitionTo(event.context);
-      },
-      showDetails: function (router, event) {
-        router.get('mainHostDetailsController').setBack(true);
-        router.transitionTo('hosts.hostDetails.summary', event.context);
       }
     }),
     showService: Em.Router.transitionTo('service'),
@@ -901,7 +894,7 @@ module.exports = Em.Route.extend({
 
   selectService: Em.Route.transitionTo('services.service.summary'),
   selectHost: function (router, event) {
-    router.get('mainHostDetailsController').setBack(false);
+    router.get('mainHostDetailsController').set('isFromHosts', false);
     router.transitionTo('hosts.hostDetails.index', event.context);
   },
   filterHosts: function (router, component) {
@@ -909,5 +902,10 @@ module.exports = Em.Route.extend({
       return;
     router.get('mainHostController').filterByComponent(component.context);
     router.transitionTo('hosts.index');
+  },
+  showDetails: function (router, event) {
+    router.get('mainHostDetailsController').set('referer', router.location.lastSetURL);
+    router.get('mainHostDetailsController').set('isFromHosts', true);
+    router.transitionTo('hosts.hostDetails.summary', event.context);
   }
 });


Mime
View raw message