You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/07/15 05:39:23 UTC

incubator-ignite git commit: IGNITE-843 Remember selected cluster on summary screen.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 9b6c2420a -> dbc6b5bc5


IGNITE-843 Remember selected cluster on summary screen.


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

Branch: refs/heads/ignite-843
Commit: dbc6b5bc54a87ffd9de1f025c1c4dcc15df48fec
Parents: 9b6c242
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Jul 15 10:39:24 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Jul 15 10:39:24 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/summary-controller.js    | 23 ++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dbc6b5bc/modules/web-control-center/nodejs/controllers/summary-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/summary-controller.js b/modules/web-control-center/nodejs/controllers/summary-controller.js
index a5b5a68..e4f5039 100644
--- a/modules/web-control-center/nodejs/controllers/summary-controller.js
+++ b/modules/web-control-center/nodejs/controllers/summary-controller.js
@@ -100,7 +100,26 @@ controlCenterModule.controller('summaryController', ['$scope', '$http', 'commonF
     $http.post('clusters/list').success(function (data) {
         $scope.clusters = data.clusters;
 
-        if ($scope.clusters.length > 0)
-            $scope.generate($scope.clusters[0]);
+        if ($scope.clusters.length > 0) {
+            var restoredItem = angular.fromJson(sessionStorage.summaryBackupItem);
+
+            var selectIdx = 0;
+
+            if (restoredItem && restoredItem._id) {
+                var idx = _.findIndex($scope.clusters, function (clusters) {
+                    return clusters._id == restoredItem._id;
+                });
+
+                if (idx >= 0)
+                    selectIdx = idx;
+            }
+
+            $scope.generate($scope.clusters[selectIdx]);
+        }
+
+        $scope.$watch('selectedItem', function (val) {
+            if (val)
+                sessionStorage.summaryBackupItem = angular.toJson(val);
+        }, true);
     });
 }]);