ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [2/2] ignite git commit: IGNITE-843 WIP on chart settings + move templates to proper place.
Date Sun, 06 Sep 2015 15:54:00 GMT
IGNITE-843 WIP on chart settings + move templates to proper place.


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

Branch: refs/heads/ignite-843
Commit: e2fc78ee02c234253a915dd8d4c5df7638eaac4f
Parents: ae9450d
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Sun Sep 6 22:53:54 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Sun Sep 6 22:53:54 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 38 +++++++++++++-------
 .../src/main/js/routes/notebooks.js             |  2 +-
 .../src/main/js/routes/sql.js                   |  6 +++-
 .../src/main/js/views/sql/chart-settings.jade   | 34 ++++++++++++++++++
 .../src/main/js/views/sql/notebook-new.jade     | 31 ++++++++++++++++
 .../src/main/js/views/sql/paragraph-rate.jade   | 31 ++++++++++++++++
 .../src/main/js/views/sql/sql.jade              |  2 +-
 .../main/js/views/templates/notebook-new.jade   | 31 ----------------
 .../main/js/views/templates/paragraph-rate.jade | 31 ----------------
 9 files changed, 128 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/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 4032399..f94ec20 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
@@ -258,32 +258,44 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
             $scope.addParagraph();
     };
 
-    var _processQueryResult = function (item) {
+    $scope.chartColumns = [];
+
+    var _processQueryResult = function (paragraph) {
         return function (res) {
-            item.meta = [];
+            paragraph.meta = [];
+
+            if (res.meta) {
+                paragraph.meta = res.meta;
+
+                var idx = 0;
+
+                _.forEach(paragraph.meta, function (meta) {
+                    $scope.chartColumns.push({value: meta.fieldName, label: meta.fieldName,
index: idx++});
+                });
 
-            if (res.meta)
-                item.meta = res.meta;
+                paragraph.chartX = paragraph.meta.length > 0 ? paragraph.meta[0] : null;
+                paragraph.chartY = paragraph.meta.length > 1 ? paragraph.meta[1] : null;
+            }
 
-            item.page = 1;
+            paragraph.page = 1;
 
-            item.total = 0;
+            paragraph.total = 0;
 
-            item.queryId = res.queryId;
+            paragraph.queryId = res.queryId;
 
-            item.rows = res.rows;
+            paragraph.rows = res.rows;
 
-            item.result = 'table';
+            paragraph.result = 'table';
         }
     };
 
-    $scope.execute = function (item) {
+    $scope.execute = function (paragraph) {
         _saveNotebook();
 
-        _appendOnLast(item);
+        _appendOnLast(paragraph);
 
-        $http.post('/agent/query', {query: item.query, pageSize: item.pageSize, cacheName:
item.cache.name})
-            .success(_processQueryResult(item))
+        $http.post('/agent/query', {query: paragraph.query, pageSize: paragraph.pageSize,
cacheName: paragraph.cache.name})
+            .success(_processQueryResult(paragraph))
             .error(function (errMsg) {
                 $common.showError(errMsg);
             });

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/routes/notebooks.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/notebooks.js b/modules/control-center-web/src/main/js/routes/notebooks.js
index 9f5a5a8..364d688 100644
--- a/modules/control-center-web/src/main/js/routes/notebooks.js
+++ b/modules/control-center-web/src/main/js/routes/notebooks.js
@@ -21,7 +21,7 @@ var db = require('../db');
 var utils = require('./../helpers/common-utils');
 
 router.get('/new', function (req, res) {
-    res.render('templates/notebook-new', {});
+    res.render('sql/notebook-new', {});
 });
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/routes/sql.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/sql.js b/modules/control-center-web/src/main/js/routes/sql.js
index eb333e5..88297ca 100644
--- a/modules/control-center-web/src/main/js/routes/sql.js
+++ b/modules/control-center-web/src/main/js/routes/sql.js
@@ -19,7 +19,11 @@ var router = require('express').Router();
 var db = require('../db');
 
 router.get('/rate', function (req, res) {
-    res.render('templates/paragraph-rate', {});
+    res.render('sql/paragraph-rate', {});
+});
+
+router.get('/chart-settings', function (req, res) {
+    res.render('sql/chart-settings', {});
 });
 
 router.get('/:noteId', function (req, res) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/views/sql/chart-settings.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/chart-settings.jade b/modules/control-center-web/src/main/js/views/sql/chart-settings.jade
new file mode 100644
index 0000000..c7dc641
--- /dev/null
+++ b/modules/control-center-web/src/main/js/views/sql/chart-settings.jade
@@ -0,0 +1,34 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+.popover(tabindex='-1' style='width: 200px')
+    .arrow
+    h3.popover-title(style='color: black') Chart settings
+    button.close(id='chart-settings-close' type='button' ng-click='$hide()') &times;
+    .popover-content
+        form(name='chartSettingsForm')
+            .form-group
+                .col-sm-2
+                    label X:
+                .col-sm-10
+                    button.form-control(id='chart-settings-X' ng-model='colX' data-placeholder='Col
X' bs-select bs-options='item.value as item.label for item in chartColumns' tabindex='0')
+                .col-sm-2
+                    label Y:
+                .col-sm-10
+                    button.form-control(id='chart-settings-Y' ng-model='colY' data-placeholder='Col
Y' bs-select bs-options='item.value as item.label for item in chartColumns' tabindex='1')
+            .form-actions(style='margin-top: 30px; padding: 5px')
+                button.btn.btn-primary(id='chart-settings-apply' ng-disabled='chartSettingsForm.$invalid'
type='button' ng-click='$hide()') Apply
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/notebook-new.jade b/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
new file mode 100644
index 0000000..de2e731
--- /dev/null
+++ b/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
@@ -0,0 +1,31 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+.modal(tabindex='-1' role='dialog')
+    .modal-dialog
+        .modal-content
+            .modal-header
+                button.close(type='button' ng-click='$hide()') &times;
+                h4.modal-title New notebook
+            form.form-horizontal(name='ui.inputForm' novalidate)
+                .modal-body.row
+                    .col-sm-9.login.col-sm-offset-1
+                        label.required.labelFormField Name:&nbsp;
+                        .col-sm-9
+                            input.form-control(id='create-notebook' type='text' ng-model='name'
required auto-focus)
+            .modal-footer
+                button.btn.btn-default(id='copy-btn-cancel' type='button' ng-click='$hide()')
Cancel
+                button.btn.btn-primary(id='copy-btn-confirm' type='button' ng-disabled='ui.inputForm.$invalid'
ng-click='createNewNotebook(name)') Create

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/views/sql/paragraph-rate.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/paragraph-rate.jade b/modules/control-center-web/src/main/js/views/sql/paragraph-rate.jade
new file mode 100644
index 0000000..d9d8cdf
--- /dev/null
+++ b/modules/control-center-web/src/main/js/views/sql/paragraph-rate.jade
@@ -0,0 +1,31 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+.popover(tabindex='-1' style='width: 200px')
+    .arrow
+    h3.popover-title(style='color: black') Refresh rate
+    button.close(id='paragraph-rate-close' type='button' ng-click='$hide()') &times;
+    .popover-content
+        form(name='popoverForm')
+            .form-group(style='margin: 0; padding: 5px')
+                .col-sm-4(style='padding: 0')
+                    input.form-control(id='paragraph-rate' ng-init='value = paragraph.rate.value'
ng-model='value' type='number' required auto-focus)
+                .col-sm-8(style='padding-left: 5px; padding-right: 0')
+                    button.form-control(id='paragraph-unit' ng-init='unit = paragraph.rate.unit'
ng-model='unit' required placeholder='Time unit' bs-select bs-options='item.value as item.label
for item in timeUnit' tabindex='0')
+            .form-actions(style='margin-top: 30px; padding: 5px')
+                button.btn.btn-primary(id='paragraph-rate-start' ng-disabled='popoverForm.$invalid'
type='button' ng-click='startRefresh(paragraph, value, unit); $hide()') Start
+                button.btn.btn-primary.btn-default(id='paragraph-rate-stop' type='button'
ng-click='stopRefresh(paragraph); $hide()') Stop
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/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 7650aee..bc81041 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
@@ -114,7 +114,7 @@ block container
                                                 tr(ng-repeat='row in displayedCollection
track by $index')
                                                     td(ng-repeat='val in row track by $index')
{{ val }}
                                 .panel-body(ng-show='paragraph.rows && paragraph.result
!= "table" && paragraph.result != "none"')
-                                    +btn-toolbar('chart-btn fa-cog', 'console.log("zzz")',
'Chart settings')
+                                    button.btn.btn-default.chart-btn.fa.fa-cog(bs-popover
data-template-url='chart-settings' data-placement='top-right' data-auto-close='1' data-trigger='click')
                                     div(id='chart-{{paragraph.id}}')
                                         svg
                                 .panel-body(ng-show='!paragraph.rows')

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/views/templates/notebook-new.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/notebook-new.jade b/modules/control-center-web/src/main/js/views/templates/notebook-new.jade
deleted file mode 100644
index de2e731..0000000
--- a/modules/control-center-web/src/main/js/views/templates/notebook-new.jade
+++ /dev/null
@@ -1,31 +0,0 @@
-//-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
-.modal(tabindex='-1' role='dialog')
-    .modal-dialog
-        .modal-content
-            .modal-header
-                button.close(type='button' ng-click='$hide()') &times;
-                h4.modal-title New notebook
-            form.form-horizontal(name='ui.inputForm' novalidate)
-                .modal-body.row
-                    .col-sm-9.login.col-sm-offset-1
-                        label.required.labelFormField Name:&nbsp;
-                        .col-sm-9
-                            input.form-control(id='create-notebook' type='text' ng-model='name'
required auto-focus)
-            .modal-footer
-                button.btn.btn-default(id='copy-btn-cancel' type='button' ng-click='$hide()')
Cancel
-                button.btn.btn-primary(id='copy-btn-confirm' type='button' ng-disabled='ui.inputForm.$invalid'
ng-click='createNewNotebook(name)') Create

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2fc78ee/modules/control-center-web/src/main/js/views/templates/paragraph-rate.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/paragraph-rate.jade b/modules/control-center-web/src/main/js/views/templates/paragraph-rate.jade
deleted file mode 100644
index d9d8cdf..0000000
--- a/modules/control-center-web/src/main/js/views/templates/paragraph-rate.jade
+++ /dev/null
@@ -1,31 +0,0 @@
-//-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
-.popover(tabindex='-1' style='width: 200px')
-    .arrow
-    h3.popover-title(style='color: black') Refresh rate
-    button.close(id='paragraph-rate-close' type='button' ng-click='$hide()') &times;
-    .popover-content
-        form(name='popoverForm')
-            .form-group(style='margin: 0; padding: 5px')
-                .col-sm-4(style='padding: 0')
-                    input.form-control(id='paragraph-rate' ng-init='value = paragraph.rate.value'
ng-model='value' type='number' required auto-focus)
-                .col-sm-8(style='padding-left: 5px; padding-right: 0')
-                    button.form-control(id='paragraph-unit' ng-init='unit = paragraph.rate.unit'
ng-model='unit' required placeholder='Time unit' bs-select bs-options='item.value as item.label
for item in timeUnit' tabindex='0')
-            .form-actions(style='margin-top: 30px; padding: 5px')
-                button.btn.btn-primary(id='paragraph-rate-start' ng-disabled='popoverForm.$invalid'
type='button' ng-click='startRefresh(paragraph, value, unit); $hide()') Start
-                button.btn.btn-primary.btn-default(id='paragraph-rate-stop' type='button'
ng-click='stopRefresh(paragraph); $hide()') Stop
-


Mime
View raw message