ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [1/2] ignite git commit: IGNITE-843 WIP.
Date Mon, 18 Jan 2016 11:15:03 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 b120b052b -> 42e126770


IGNITE-843 WIP.


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

Branch: refs/heads/ignite-843-rc2
Commit: c644cbe04c9354cb25c48eda5afcd3155aa002f0
Parents: 009067c
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Jan 18 18:14:40 2016 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Jan 18 18:14:40 2016 +0700

----------------------------------------------------------------------
 .../console/agent/handlers/RestExecutor.java    |  2 +-
 .../main/js/app/modules/QueryNotebooks/index.js | 38 +++++++++++++---
 .../src/main/js/controllers/common-module.js    | 31 +++++++------
 .../src/main/js/controllers/sql-controller.js   | 47 +++++++++-----------
 .../src/main/js/views/sql/sql.jade              |  4 +-
 5 files changed, 73 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c644cbe0/modules/control-center-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestExecutor.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestExecutor.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestExecutor.java
index 9b4c3a5..22aae18 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestExecutor.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestExecutor.java
@@ -89,7 +89,7 @@ public class RestExecutor {
     @Remote
     public RestResult executeRest(String uri, Map<String, String> params, boolean demo,
         String mtd, Map<String, String> headers, String body) throws IOException, URISyntaxException
{
-        log.info("Start execute REST command [method=" + mtd + ", uri=/" + uri + ", parameters="
+ params + "]");
+        log.debug("Start execute REST command [method=" + mtd + ", uri=/" + uri + ", parameters="
+ params + "]");
 
         if (demo)
             AgentSqlDemo.testDrive(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c644cbe0/modules/control-center-web/src/main/js/app/modules/QueryNotebooks/index.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/QueryNotebooks/index.js b/modules/control-center-web/src/main/js/app/modules/QueryNotebooks/index.js
index fdc7bcb..8b73230 100644
--- a/modules/control-center-web/src/main/js/app/modules/QueryNotebooks/index.js
+++ b/modules/control-center-web/src/main/js/app/modules/QueryNotebooks/index.js
@@ -31,6 +31,7 @@ angular
                     pageSize: 50,
                     query: 'SELECT * FROM "CarCache".Car',
                     result: 'table',
+                    timeLineSpan: '1',
                     rate: {
                         value: 30,
                         unit: 1000,
@@ -43,6 +44,7 @@ angular
                     pageSize: 50,
                     query: 'SELECT p.name, count(*) AS cnt\nFROM "ParkingCache".Parking p\nINNER
JOIN "CarCache".Car c\n  ON (p.id) = (c.parkingId)\nGROUP BY P.NAME',
                     result: 'table',
+                    timeLineSpan: '1',
                     rate: {
                         value: 30,
                         unit: 1000,
@@ -53,10 +55,11 @@ angular
                     name: 'Query with refresh rate',
                     cacheName: 'CarCache',
                     pageSize: 50,
-                    query: 'SELECT * FROM "CarCache".Car',
-                    result: 'table',
+                    query: 'SELECT count(*)\nFROM "CarCache".Car',
+                    result: 'line',
+                    timeLineSpan: '1',
                     rate: {
-                        value: 5,
+                        value: 3,
                         unit: 1000,
                         installed: true
                     }
@@ -65,7 +68,7 @@ angular
             expandedParagraphs: [0, 1, 2]
         };
 
-        this.$get = ['$q', '$http', ($q, $http) => {
+        this.$get = ['$q', '$http', '$rootScope', ($q, $http, $rootScope) => {
             return {
                 read(demo, noteId) {
                     if (demo)
@@ -78,11 +81,34 @@ angular
                 },
                 save(demo, notebook) {
                     if (demo)
-                        return $http.post('/api/v1/notebooks/save', notebook);
+                        return $q.when();
 
-                    return $q.when();
+                    return $http.post('/api/v1/notebooks/save', notebook).then(({data}) =>
{
+                        return data;
+                    });
                 },
                 remove(demo, nodeId) {
+                    if (demo)
+                        return $q.reject('Removing "SQL demo" notebook is not supported.');
+
+                    return $http.post('/api/v1/notebooks/remove', {_id: nodeId})
+                        .then(() => {
+                            const idx = _.findIndex($rootScope.notebooks, (item) => {
+                                return item._id === nodeId;
+                            });
+
+                            if (idx >= 0) {
+                                $rootScope.notebooks.splice(idx, 1);
+
+                                $rootScope.rebuildDropdown();
+
+                                if (idx < $rootScope.notebooks.length)
+                                    return $rootScope.notebooks[idx];
+                            }
+
+                            if ($rootScope.notebooks.length > 0)
+                                return $rootScope.notebooks[$rootScope.notebooks.length -
1];
+                        });
                 }
             };
         }];

http://git-wip-us.apache.org/repos/asf/ignite/blob/c644cbe0/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index cccce7b..5d11a0b 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -2113,17 +2113,20 @@ consoleModule.service('$agentDownload', [
             }, _timeout);
 
             $http.post(_modal.check.url, _modal.check.params, {timeout: _timeout})
-                .then(function (result) {
-                    _modal.skipSingleError = true;
-
+                .success(function (data) {
                     if (_modal.awaitFirstSuccess)
                         _stopInterval();
 
                     $loading.finish('loading');
 
-                    _modal.check.cb(result.data, _modalAlertHide, _handleException);
+                    _modal.check.cb(data, _modalAlertHide, _handleException);
+
+                    if (!_modal.skipSingleError)
+                        _modal.check.onConnect();
+
+                    _modal.skipSingleError = true;
                 })
-                .catch(function (errMsg, status) {
+                .error(function (errMsg, status) {
                     _handleException(errMsg, status, _timedOut);
                 });
         }
@@ -2132,16 +2135,18 @@ consoleModule.service('$agentDownload', [
             /**
              * Start listening topology from node.
              *
-             * @param success Function to execute by timer when agent available.
-             * @param demo
-             * @param attr
-             * @param mtr
+             * @param cb Function to execute by timer when topology received.
+             * @param onConnect Function to execute when agent connected to a grid.
+             * @param demo True if need work with demo grid.
+             * @param attr True if need receive nodes attributes.
+             * @param mtr True if need receive nodes metrics.
              */
-            startTopologyListening: function (success, demo, attr, mtr) {
+            startTopologyListening: function (cb, onConnect, demo, attr, mtr) {
                 _modal.check = {
                     url: '/api/v1/agent/topology',
                     params: {demo: !!demo,  attr: !!attr, mtr: !!mtr},
-                    cb: success
+                    onConnect: onConnect,
+                    cb: cb
                 };
 
                 _modal.backState = 'base.configuration.clusters';
@@ -2222,12 +2227,12 @@ consoleModule.controller('notebooks', ['$scope', '$modal', '$state',
'$http', '$
 
     $scope.$root.createNewNotebook = function(name) {
         $http.post('/api/v1/notebooks/new', {name: name})
-            .success(function (id) {
+            .success(function (noteId) {
                 _notebookNewModal.hide();
 
                 $scope.$root.reloadNotebooks();
 
-                $state.go('base.sql', {id: id});
+                $state.go('base.sql.notebook', {noteId: noteId});
             })
             .error(function (message) {
                 $common.showError(message);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c644cbe0/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 16b34fa..5876ca1 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
@@ -247,10 +247,6 @@ consoleModule.controller('sqlController', function ($http, $timeout,
$interval,
             });
     };
 
-    $scope.goToConfiguration = function () {
-        $state.go('/configuration/clusters');
-    };
-
     var loadNotebook = function (notebook) {
         $scope.notebook = notebook;
 
@@ -273,7 +269,7 @@ consoleModule.controller('sqlController', function ($http, $timeout, $interval,
         else
             $scope.rebuildScrollParagraphs();
 
-        $agentDownload.startTopologyListening(getTopology, $scope.demo);
+        $agentDownload.startTopologyListening(getTopology, _onConnect, $scope.demo);
     };
 
     $loading.start('loading');
@@ -282,6 +278,8 @@ consoleModule.controller('sqlController', function ($http, $timeout, $interval,
         .then(loadNotebook)
         .catch(function(err) {
             $scope.notebook = undefined;
+
+            $loading.finish('loading');
         });
 
     $scope.renameNotebook = function (name) {
@@ -314,26 +312,16 @@ consoleModule.controller('sqlController', function ($http, $timeout,
$interval,
     $scope.removeNotebook = function () {
         $confirm.confirm('Are you sure you want to remove: "' + $scope.notebook.name + '"?')
             .then(function () {
-                $http.post('/api/v1/notebooks/remove', {_id: $scope.notebook._id})
-                    .success(function () {
-                        var idx = _.findIndex($scope.$root.notebooks, function (item) {
-                            return item._id == $scope.notebook._id;
-                        });
-
-                        if (idx >= 0) {
-                            $scope.$root.notebooks.splice(idx, 1);
-
-                            $scope.$root.rebuildDropdown();
-
-                            if ($scope.$root.notebooks.length > 0)
-                                $state.go('base.sql', {id: $scope.$root.notebooks[Math.min(idx,
 $scope.$root.notebooks.length - 1)]._id});
-                            else
-                                $state.go('base.configuration.clusters');
-                        }
-                    })
-                    .error(function (errMsg) {
-                        $common.showError(errMsg);
-                    });
+                return QueryNotebooks.remove($scope.demo, $scope.notebook._id);
+            })
+            .then(function (notebook) {
+                if (notebook)
+                    $state.go('base.sql.notebook', {noteId: notebook._id});
+                else
+                    $state.go('base.configuration.clusters');
+            })
+            .catch(function (errMsg) {
+                $common.showError(errMsg);
             });
     };
 
@@ -453,11 +441,16 @@ consoleModule.controller('sqlController', function ($http, $timeout,
$interval,
 
         _setActiveCache();
 
-        $scope.loaded = true;
-
         $loading.finish('loading');
     }
 
+    function _onConnect() {
+        if (!$scope.demo)
+            return;
+
+        _.forEach($scope.notebook.paragraphs, $scope.execute);
+    }
+
     var _columnFilter = function(paragraph) {
         return paragraph.disabledSystemColumns || paragraph.systemColumns ? _allColumn :
_hideColumn;
     };

http://git-wip-us.apache.org/repos/asf/ignite/blob/c644cbe0/modules/control-center-web/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/sql.jade b/modules/control-center-web/src/main/js/views/sql/sql.jade
index 811ffd3..f9566b0 100644
--- a/modules/control-center-web/src/main/js/views/sql/sql.jade
+++ b/modules/control-center-web/src/main/js/views/sql/sql.jade
@@ -57,11 +57,11 @@ mixin chart-settings(mdl)
     ignite-loading
         .docs-content(ng-controller='sqlController')
             hr
-            div(ng-if='loaded && !notebook' style='text-align: center')
+            div(ng-if='!notebook' style='text-align: center')
                 h2 Failed to load notebook
                 label.col-sm-12 Notebook not accessible any more. Go back to configuration
or open to another notebook.
                 button.h3.btn.btn-primary(ui-sref='base.configuration.clusters') Back to
configuration
-            div(ng-if='loaded && notebook')
+            div(ng-if='notebook')
                 .row(bs-affix style='margin-bottom: 10px')
                     .docs-header.notebook-header
                         h1.col-sm-6(ng-hide='notebook.edit')


Mime
View raw message