ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: IGNITE-843 Implemented selection of first item.
Date Wed, 15 Jul 2015 03:08:06 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 c64b19e28 -> 974b408be


IGNITE-843 Implemented selection of first item.


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

Branch: refs/heads/ignite-843
Commit: 974b408becf958732bb481445a0cb40b269db7b2
Parents: c64b19e
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Wed Jul 15 10:08:06 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Wed Jul 15 10:08:06 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/caches-controller.js     | 21 ++++----------
 .../nodejs/controllers/clusters-controller.js   | 29 ++++++++++----------
 .../nodejs/controllers/summary-controller.js    | 12 +++++---
 3 files changed, 28 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/974b408b/modules/web-control-center/nodejs/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/caches-controller.js b/modules/web-control-center/nodejs/controllers/caches-controller.js
index 714ab43..fa308da 100644
--- a/modules/web-control-center/nodejs/controllers/caches-controller.js
+++ b/modules/web-control-center/nodejs/controllers/caches-controller.js
@@ -85,7 +85,6 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', 'commonFu
                 commonFunctions.showError(errMsg);
             });
 
-        $scope.firstTime = true;
         $scope.caches = [];
 
         $scope.required = function (field) {
@@ -115,21 +114,10 @@ controlCenterModule.controller('cachesController', ['$scope', '$http',
'commonFu
                 $scope.spaces = data.spaces;
                 $scope.caches = data.caches;
 
-                if ($scope.firstTime) {
-                    console.log("firstTime");
-                    $scope.firstTime = false;
+                var restoredItem = angular.fromJson(sessionStorage.cacheBackupItem);
 
-                    if ($scope.caches.length > 0)
-                        $scope.selectItem($scope.caches[0]);
-
-                    sessionStorage.removeItem('cacheBackupItem');
-                }
-                else {
-                    console.log("not firstTime");
-
-                    var restoredItem = angular.fromJson(sessionStorage.cacheBackupItem);
-
-                    if (restoredItem && restoredItem._id) {
+                if (restoredItem) {
+                    if (restoredItem._id) {
                         var idx = _.findIndex($scope.caches, function (cache) {
                             return cache._id == restoredItem._id;
                         });
@@ -143,8 +131,9 @@ controlCenterModule.controller('cachesController', ['$scope', '$http',
'commonFu
                     }
                     else
                         $scope.backupItem = restoredItem;
-
                 }
+                else if ($scope.caches.length > 0)
+                    $scope.selectItem($scope.caches[0]);
 
                 $scope.$watch('backupItem', function (val) {
                     if (val)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/974b408b/modules/web-control-center/nodejs/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/clusters-controller.js b/modules/web-control-center/nodejs/controllers/clusters-controller.js
index c8d3181..8485de1 100644
--- a/modules/web-control-center/nodejs/controllers/clusters-controller.js
+++ b/modules/web-control-center/nodejs/controllers/clusters-controller.js
@@ -107,21 +107,24 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'common
 
                 var restoredItem = angular.fromJson(sessionStorage.clusterBackupItem);
 
-                if (restoredItem && restoredItem._id) {
-                    var idx = _.findIndex($scope.clusters, function (cluster) {
-                        return cluster._id == restoredItem._id;
-                    });
-
-                    if (idx >= 0) {
-                        $scope.selectedItem = $scope.clusters[idx];
-
-                        $scope.backupItem = restoredItem;
+                if (restoredItem) {
+                    if (restoredItem._id) {
+                        var idx = _.findIndex($scope.clusters, function (cluster) {
+                            return cluster._id == restoredItem._id;
+                        });
+
+                        if (idx >= 0) {
+                            $scope.selectedItem = $scope.clusters[idx];
+                            $scope.backupItem = restoredItem;
+                        }
+                        else
+                            sessionStorage.removeItem('clusterBackupItem');
                     }
                     else
-                        sessionStorage.removeItem('clusterBackupItem');
+                        $scope.backupItem = restoredItem;
                 }
-                else
-                    $scope.backupItem = restoredItem;
+                else if ($scope.clusters.length > 0)
+                    $scope.selectItem($scope.clusters[0]);
 
                 $scope.$watch('backupItem', function (val) {
                     if (val)
@@ -134,14 +137,12 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'common
 
         $scope.selectItem = function (item) {
             $scope.selectedItem = item;
-
             $scope.backupItem = angular.copy(item);
         };
 
         // Add new cluster.
         $scope.createItem = function () {
             $scope.backupItem = angular.copy($scope.create.template);
-
             $scope.backupItem.space = $scope.spaces[0]._id;
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/974b408b/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 6a5443e..a5b5a68 100644
--- a/modules/web-control-center/nodejs/controllers/summary-controller.js
+++ b/modules/web-control-center/nodejs/controllers/summary-controller.js
@@ -39,10 +39,7 @@ controlCenterModule.controller('summaryController', ['$scope', '$http',
'commonF
     $scope.os = undefined;
 
     $scope.generated = undefined;
-
-    $http.post('clusters/list').success(function (data) {
-        $scope.clusters = data.clusters;
-    });
+    $scope.clusters = [];
 
     $scope.reload = function() {
         $("<pre class='brush:java' />").text($scope.javaClass ? $scope.generated.javaClass
: $scope.generated.javaSnippet).appendTo($('#javaResultDiv').empty());
@@ -99,4 +96,11 @@ controlCenterModule.controller('summaryController', ['$scope', '$http',
'commonF
                 $scope.generateError = "Failed to generate zip: " + data;
             });
     };
+
+    $http.post('clusters/list').success(function (data) {
+        $scope.clusters = data.clusters;
+
+        if ($scope.clusters.length > 0)
+            $scope.generate($scope.clusters[0]);
+    });
 }]);


Mime
View raw message