ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [6/6] ignite git commit: IGNITE-843 WIP
Date Fri, 15 Jan 2016 11:04:07 GMT
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/d603a53a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d603a53a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d603a53a

Branch: refs/heads/ignite-843-rc2
Commit: d603a53a887b892b24702c5e3c0433553c755a72
Parents: 7812853
Author: Andrey <anovikov@gridgain.com>
Authored: Fri Jan 15 18:03:50 2016 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Fri Jan 15 18:03:50 2016 +0700

----------------------------------------------------------------------
 .../console/agent/handlers/RestExecutor.java    | 11 ++---
 .../ignite/console/demo/AgentSqlDemo.java       | 12 ++---
 .../main/js/app/modules/QueryNotebooks/index.js | 46 +++++---------------
 .../src/main/js/controllers/common-module.js    |  1 +
 .../src/main/js/controllers/sql-controller.js   | 14 ++----
 .../src/main/js/routes/agent.js                 | 17 --------
 6 files changed, 26 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/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 ee6742a..14252a1 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
@@ -91,6 +91,9 @@ public class RestExecutor {
         String mtd, Map<String, String> headers, String body) throws IOException, URISyntaxException
{
         log.debug("Start execute REST command [method=" + mtd + ", uri=/" + uri + ", parameters="
+ params + "]");
 
+        if (demo)
+            AgentSqlDemo.testDrive(cfg);
+
         URIBuilder builder = new URIBuilder(demo ? cfg.demoNodeUri() : cfg.nodeUri());
 
         if (builder.getPort() == -1)
@@ -166,14 +169,6 @@ public class RestExecutor {
     }
 
     /**
-     * Enable test-drive SQL.
-     */
-    @Remote
-    public boolean startDemoSQL() {
-        return AgentSqlDemo.testDrive(cfg);
-    }
-
-    /**
      * Request result.
      */
     public static class RestResult {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/modules/control-center-agent/src/main/java/org/apache/ignite/console/demo/AgentSqlDemo.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/console/demo/AgentSqlDemo.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/console/demo/AgentSqlDemo.java
index 1e63232..7e1d1ce 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/console/demo/AgentSqlDemo.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/console/demo/AgentSqlDemo.java
@@ -322,14 +322,14 @@ public class AgentSqlDemo {
 
         IgniteCache<Integer, Country> cacheCountry = ignite.cache(COUNTRY_CACHE_NAME);
 
-        for (int i = 0, n = i + 1; i < CNTR_CNT; i++)
+        for (int i = 0, n = 1; i < CNTR_CNT; i++, n++)
             cacheCountry.put(i, new Country(i, "Country #" + n, n * 10000000));
 
         IgniteCache<Integer, Department> cacheDepartment = ignite.cache(DEPARTMENT_CACHE_NAME);
 
         IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
 
-        for (int i = 0, n = i + 1; i < DEP_CNT; i++) {
+        for (int i = 0, n = 1; i < DEP_CNT; i++, n++) {
             cacheDepartment.put(i, new Department(n, rnd.nextInt(CNTR_CNT), "Department #"
+ n));
 
             double r = rnd.nextDouble();
@@ -339,7 +339,7 @@ public class AgentSqlDemo {
                 new java.sql.Date((long)(r * range)), "Job manager #" + n, 1000 + round(r
* 4000, 2)));
         }
 
-        for (int i = 0, n = i + 1; i < EMPL_CNT; i++) {
+        for (int i = 0, n = 1; i < EMPL_CNT; i++, n++) {
             Integer depId = rnd.nextInt(DEP_CNT);
 
             double r = rnd.nextDouble();
@@ -360,12 +360,12 @@ public class AgentSqlDemo {
 
         IgniteCache<Integer, Parking> cacheParking = ignite.cache(PARKING_CACHE_NAME);
 
-        for (int i = 0, n = i + 1; i < PARK_CNT; i++)
+        for (int i = 0, n = 1; i < PARK_CNT; i++, n++)
             cacheParking.put(i, new Parking(i, "Parking #" + n, n * 10));
 
         IgniteCache<Integer, Car> cacheCar = ignite.cache(CAR_CACHE_NAME);
 
-        for (int i = 0, n = i + 1; i < CAR_CNT; i++)
+        for (int i = 0, n = 1; i < CAR_CNT; i++, n++)
             cacheCar.put(i, new Car(i, rnd.nextInt(PARK_CNT), "Car #" + n));
 
         log.trace("DEMO: Finished cars population.");
@@ -419,7 +419,7 @@ public class AgentSqlDemo {
                     IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
 
                     if (cacheEmployee != null)
-                        for (int i = 0, n = i + 1; i < cnt; i++) {
+                        for (int i = 0, n = 1; i < cnt; i++, n++) {
                             Integer id = rnd.nextInt(EMPL_CNT);
 
                             Integer depId = rnd.nextInt(DEP_CNT);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/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 702b107..b87a506 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
@@ -29,17 +29,11 @@ angular
                     name: 'Simple query',
                     cacheName: 'CarCache',
                     pageSize: 50,
-                    query: 'SELECT * FROM Car',
+                    query: 'SELECT * FROM "CarCache".Car',
                     result: 'table',
-                    queryArgs: {
-                        type: 'QUERY',
-                        query: 'SELECT * FROM Car',
-                        pageSize: 50,
-                        cacheName: 'CarCache'
-                    },
                     rate: {
-                        value: 1,
-                        unit: 60000,
+                        value: 30,
+                        unit: 1000,
                         installed: false
                     }
                 },
@@ -47,17 +41,11 @@ angular
                     name: 'Query with aggregates',
                     cacheName: 'CarCache',
                     pageSize: 50,
-                    query: 'SELECT * FROM Car',
+                    query: 'SELECT p.name, count(*) AS cnt\nFROM "ParkingCache".Parking p\nINNER
JOIN "CarCache".Car c\nON (p.id) = (c.parkingId)\nGROUP BY P.NAME',
                     result: 'table',
-                    queryArgs: {
-                        type: 'QUERY',
-                        query: 'SELECT * FROM Car',
-                        pageSize: 50,
-                        cacheName: 'CarCache'
-                    },
                     rate: {
-                        value: 1,
-                        unit: 60000,
+                        value: 30,
+                        unit: 1000,
                         installed: false
                     }
                 },
@@ -65,18 +53,12 @@ angular
                     name: 'Query with refresh rate',
                     cacheName: 'CarCache',
                     pageSize: 50,
-                    query: 'SELECT * FROM Car',
+                    query: 'SELECT * FROM "CarCache".Car',
                     result: 'table',
-                    queryArgs: {
-                        type: 'QUERY',
-                        query: 'SELECT * FROM Car',
-                        pageSize: 50,
-                        cacheName: 'CarCache'
-                    },
                     rate: {
-                        value: 1,
-                        unit: 60000,
-                        installed: false
+                        value: 5,
+                        unit: 1000,
+                        installed: true
                     }
                 }
             ],
@@ -86,12 +68,8 @@ angular
         this.$get = ['$q', '$http', ($q, $http) => {
             return {
                 read(demo, noteId) {
-                    if (demo) {
-                        return $http.post('/api/v1/agent/demo/sql/start')
-                            .then(() => {
-                                return angular.copy(_demoNotebook);
-                            });
-                    }
+                    if (demo)
+                        return $q.when(angular.copy(_demoNotebook));
 
                     return $http.post('/api/v1/notebooks/get', {noteId})
                         .then(({data}) => {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/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 e995175..b5f3478 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
@@ -2140,6 +2140,7 @@ consoleModule.service('$agentDownload', [
              * Start listening topology from node.
              *
              * @param success Function to execute by timer when agent available.
+             * @param demo
              * @param attr
              * @param mtr
              */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/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 69fbc85..aeb6c35 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
@@ -282,18 +282,8 @@ consoleModule.controller('sqlController', function ($http, $timeout,
$interval,
         .then(loadNotebook)
         .catch(function(err) {
             $scope.notebook = undefined;
-        })
-        .finally(function() {
-            $scope.loaded = true;
-
-            $loading.finish('loading');
         });
 
-    var _saveNotebook = function (cb) {
-        QueryNotebooks.save(_demo, $scope.notebook)
-            .catch(_handleException);
-    };
-
     $scope.renameNotebook = function (name) {
         if (!name)
             return;
@@ -462,6 +452,10 @@ consoleModule.controller('sqlController', function ($http, $timeout,
$interval,
         }), 'name');
 
         _setActiveCache();
+
+        $scope.loaded = true;
+
+        $loading.finish('loading');
     }
 
     var _columnFilter = function(paragraph) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d603a53a/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
index 9229a3f..02d5c7a 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -268,23 +268,6 @@ router.post('/ping', function (req, res) {
         res.sendStatus(200);
 });
 
-/* Enable test-drive for sql. */
-router.post('/demo/sql/start', function (req, res) {
-    var client = _client(req, res);
-
-    if (client) {
-        client.startDemoSQL(function (err, enabled) {
-            if (err)
-                return res.status(500).send(err.message);
-
-            if (!enabled)
-                return res.status(500).send('Failed to start SQL demo');
-
-            res.sendStatus(200);
-        });
-    }
-});
-
 /* Get JDBC drivers list. */
 router.post('/drivers', function (req, res) {
     var client = _client(req, res);


Mime
View raw message