Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 a02148f41 -> cd2048eb4


# IGNITE-1257 Added download dialog.


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

Branch: refs/heads/ignite-843
Commit: cd2048eb4aa318e666501362720091d0b0d54b2a
Parents: a02148f
Author: Andrey <anovi...@gridgain.com>
Authored: Tue Aug 18 09:58:25 2015 +0700
Committer: Andrey <anovi...@gridgain.com>
Committed: Tue Aug 18 09:58:25 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js    | 26 +++++++++++++++++
 .../main/js/controllers/metadata-controller.js  | 14 ++++-----
 .../src/main/js/controllers/sql-controller.js   |  5 ++--
 .../src/main/js/public/stylesheets/style.scss   |  4 +--
 .../src/main/js/routes/agent.js                 |  7 ++++-
 .../js/views/configuration/metadata-load.jade   |  9 ------
 .../main/js/views/templates/agent-download.jade | 30 ++++++++++++++++++++
 7 files changed, 72 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/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 41526c5..0c2ff72 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
@@ -1111,6 +1111,32 @@ controlCenterModule.controller('auth', [
         }
     }]);
 
+// Download agent controller.
+controlCenterModule.controller('agent-download', [
+    '$scope', '$modal', function ($scope, $modal) {
+        // Pre-fetch modal dialogs.
+        var _agentDownloadModal = $modal({scope: $scope, templateUrl: 
'/agent/agent-download', show: false});
+
+        $scope.downloadAgent = function () {
+            _agentDownloadModal.hide();
+
+            var lnk = document.createElement('a');
+
+            lnk.setAttribute('href', '/agent/agent.zip');
+            lnk.style.display = 'none';
+
+            document.body.appendChild(lnk);
+
+            lnk.click();
+
+            document.body.removeChild(lnk);
+        };
+
+        $scope.showDownloadAgent = function () {
+            _agentDownloadModal.$promise.then(_agentDownloadModal.show);
+        };
+}]);
+
 // Navigation bar controller.
 controlCenterModule.controller('notebooks', [
     '$scope', '$http', '$common', function ($scope, $http, $common) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git 
a/modules/control-center-web/src/main/js/controllers/metadata-controller.js 
b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index a460be7..cf69262 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -16,8 +16,11 @@
  */
 
 controlCenterModule.controller('metadataController', [
-        '$scope', '$http', '$modal', '$common', '$timeout', '$focus', 
'$confirm', '$copy', '$table',
-        function ($scope, $http, $modal, $common, $timeout, $focus, $confirm, 
$copy, $table) {
+        '$scope', '$controller', '$http', '$modal', '$common', '$timeout', 
'$focus', '$confirm', '$copy', '$table',
+        function ($scope, $controller, $http, $modal, $common, $timeout, 
$focus, $confirm, $copy, $table) {
+            // Initialize the super class and extend it.
+            angular.extend(this, $controller('agent-download', {$scope: 
$scope}));
+
             $scope.joinTip = $common.joinTip;
             $scope.getModel = $common.getModel;
             $scope.javaBuildInClasses = $common.javaBuildInClasses;
@@ -216,12 +219,7 @@ controlCenterModule.controller('metadataController', [
                     })
                     .error(function (errMsg, status) {
                         if (status == 503)
-                            loadMetaModal.$promise.then(function () {
-                                $scope.loadMeta.action = 'download';
-                                $scope.loadMeta.tables = [];
-
-                                loadMetaModal.show();
-                            });
+                            $scope.showDownloadAgent();
                         else
                             $common.showError(errMsg);
                     });

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/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 c5f5a4a..8ef5bff 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
@@ -19,6 +19,7 @@ controlCenterModule.controller('sqlController', ['$scope', 
'$controller', '$http
     function ($scope, $controller, $http, $common) {
     // Initialize the super class and extend it.
     angular.extend(this, $controller('notebooks', {$scope: $scope}));
+    angular.extend(this, $controller('agent-download', {$scope: $scope}));
 
     $scope.joinTip = $common.joinTip;
 
@@ -84,7 +85,7 @@ controlCenterModule.controller('sqlController', ['$scope', 
'$controller', '$http
         .error(function (errMsg) {
             $scope.caches = undefined;
 
-            $common.showError(errMsg);
+            $scope.showDownloadAgent();
         });
 
     $scope.execute = function(tab) {
@@ -130,7 +131,7 @@ controlCenterModule.controller('sqlController', ['$scope', 
'$controller', '$http
     };
 
     $scope.nextPage = function(tab) {
-        $http.post('/agent/next_page', {queryId: tab.queryId, pageSize: 
tab.pageSize, cacheName: tab.selectedItem.name})
+        $http.post('/agent/query_fetch', {queryId: tab.queryId, pageSize: 
tab.pageSize, cacheName: tab.selectedItem.name})
             .success(function (res) {
                 tab.page++;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/modules/control-center-web/src/main/js/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git 
a/modules/control-center-web/src/main/js/public/stylesheets/style.scss 
b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
index b142597..2b4a878 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
@@ -551,12 +551,10 @@ a:hover, .link:hover .title {
     background-color: #fff;
     text-align: center;
     color: #555;
-    padding: 15px;
-    font-family: "myriad-pro", sans-serif;
+    padding: 15px 25px 15px 15px;
 }
 
 .modal .modal-content .modal-header h4 {
-    font-family: "myriad-pro", sans-serif;
     font-size: 22px;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/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 1b0e8bb..342675d 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -34,6 +34,11 @@ function _client(req, res) {
 }
 
 /* Get grid topology. */
+router.get('/agent-download', function (req, res) {
+    res.render('templates/agent-download');
+});
+
+/* Get grid topology. */
 router.post('/topology', function (req, res) {
     var client = _client(req, res);
 
@@ -73,7 +78,7 @@ router.post('/query', function (req, res) {
 });
 
 /* Get next query page. */
-router.post('/next_page', function (req, res) {
+router.post('/query_fetch', function (req, res) {
     var client = _client(req, res);
 
     if (client) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
----------------------------------------------------------------------
diff --git 
a/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade 
b/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
index 05ae0e4..9eaeba6 100644
--- 
a/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
+++ 
b/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
@@ -22,14 +22,6 @@ include ../includes/controls
             #errors-container.modal-header.header
                 button.close(type='button' ng-click='$hide()' 
aria-hidden='true') &times;
                 h4.modal-title Load metadata from database
-            .metadata-download(ng-show='loadMeta.action == "download"')
-                |Connection to Web Agent is not established!<br/><br/>
-                |How to load metadata from database:
-                ul
-                    li Download Web Agent.
-                    li Unzip Web Agent to some folder.
-                    li Please refer to the README.txt how to configure and 
start Web Agent.
-
             div(ng-show='loadMeta.action == "connect"')
                 form.form-horizontal(name='loadForm' novalidate)
                     .modal-body
@@ -59,7 +51,6 @@ include ../includes/controls
                                 div(st-pagination st-items-by-page='10' 
st-displayed-pages='5')
 
             .modal-footer
-                button.btn.btn-primary(ng-show='loadMeta.action == "download"' 
ng-click='downloadAgent()') Download
                 button.btn.btn-primary(ng-show='loadMeta.action == "connect"' 
ng-disabled='loadForm.$invalid' ng-click='loadMetadataFromDb()') Load metadata
                 button.btn.btn-primary(ng-show='loadMeta.action == "tables"' 
ng-click='loadMeta.action = "connect"') Prev
                 button.btn.btn-primary(ng-show='loadMeta.action == "tables"' 
ng-click='saveSelectedMetadata()') Save

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd2048eb/modules/control-center-web/src/main/js/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git 
a/modules/control-center-web/src/main/js/views/templates/agent-download.jade 
b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
new file mode 100644
index 0000000..617b053
--- /dev/null
+++ b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
@@ -0,0 +1,30 @@
+//-
+    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.center(role='dialog')
+    .modal-dialog
+        .modal-content
+           #errors-container.modal-header.header
+              button.close(type='button' ng-click='$hide()' 
aria-hidden='true') &times;
+              h4.modal-title Connection to Control Center Agent is not 
established
+           .metadata-download
+              p Please install and run agent for use this functionality.
+              p For installation:
+              ul
+                 li Download zip file distribution.
+                 li Unzip agent to some folder.
+                 li Specify the agent's properties, refer to the README.txt 
how to configure and start Control Center Agent.
+                 li Run the executable file.
+            .modal-footer
+                button.btn.btn-primary(ng-click='downloadAgent()') Download zip
\ No newline at end of file

Reply via email to