You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/09/24 06:16:49 UTC

ignite git commit: # IGNITE-843 Fixed active cache on sql.

Repository: ignite
Updated Branches:
  refs/heads/ignite-843 e5b7d5a30 -> 7405b125a


# IGNITE-843 Fixed active cache on sql.


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

Branch: refs/heads/ignite-843
Commit: 7405b125a6636ab070461731a997d91bc64e25a1
Parents: e5b7d5a
Author: Andrey <an...@gridgain.com>
Authored: Thu Sep 24 11:16:59 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Sep 24 11:16:59 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 20 +++++++++++++-------
 modules/control-center-web/src/main/js/db.js    |  5 +----
 2 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7405b125/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index 26d77a0..aad0eb0 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -96,6 +96,14 @@ controlCenterModule.controller('sqlController',
         }
     };
 
+    var _setActiveCache = function () {
+        if ($scope.caches.length > 0)
+            _.forEach($scope.notebook.paragraphs, function (paragraph) {
+                if (!paragraph.cacheName || !_.find($scope.caches, {name: paragraph.cacheName}))
+                    paragraph.cacheName = $scope.caches[0].name;
+            });
+    };
+
     var loadNotebook = function () {
         $http.post('/notebooks/get', {noteId: $scope.noteId})
             .success(function (notebook) {
@@ -111,6 +119,8 @@ controlCenterModule.controller('sqlController',
 
                 if (!notebook.paragraphs || notebook.paragraphs.length == 0)
                     $scope.addParagraph();
+
+                _setActiveCache();
             })
             .error(function (errMsg) {
                 $common.showError(errMsg);
@@ -213,7 +223,7 @@ controlCenterModule.controller('sqlController',
         enhanceParagraph(paragraph);
 
         if ($scope.caches && $scope.caches.length > 0)
-            paragraph.cache = $scope.caches[0];
+            paragraph.cacheName = $scope.caches[0].name;
 
         $scope.notebook.expandedParagraphs.push($scope.notebook.paragraphs.length);
 
@@ -255,11 +265,7 @@ controlCenterModule.controller('sqlController',
         .success(function (caches) {
             $scope.caches = _.sortBy(caches, 'name');
 
-            if ($scope.caches.length > 0)
-                _.forEach($scope.notebook.paragraphs, function (paragraph) {
-                    if (!paragraph.cacheName || !_.find($scope.caches, {name: paragraph.cacheName}))
-                        paragraph.cacheName = $scope.caches[0].name;
-                });
+            _setActiveCache();
         })
         .error(function (err, status) {
             if (status == 503)
@@ -702,7 +708,7 @@ controlCenterModule.controller('sqlController',
     }
 
     $scope.actionAvailable = function (paragraph, needQuery) {
-        return $scope.caches.length > 0 && paragraph.cache && (!needQuery || paragraph.query);
+        return $scope.caches.length > 0 && paragraph.cacheName && (!needQuery || paragraph.query);
     };
 
     $scope.actionTooltip = function (paragraph, action, needQuery) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7405b125/modules/control-center-web/src/main/js/db.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js
index 321637b..8d86bc7 100644
--- a/modules/control-center-web/src/main/js/db.js
+++ b/modules/control-center-web/src/main/js/db.js
@@ -352,10 +352,7 @@ var NotebookSchema = new Schema({
         result: {type: String, enum: ['none', 'table', 'bar', 'pie', 'line', 'area']},
         pageSize: Number,
         hideSystemColumns: Boolean,
-        cache: {
-            name: String,
-            mode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL']}
-        },
+        cacheName: String,
         rate: {
             value: Number,
             unit: Number