You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/08/13 12:05:01 UTC

incubator-ignite git commit: IGNITE-843 WIP on cluster validation.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 d220dec0d -> d91fcb310


IGNITE-843 WIP on cluster validation.


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

Branch: refs/heads/ignite-843
Commit: d91fcb3102f1304475686ebfc1bc7ba223d85721
Parents: d220dec
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Aug 13 17:05:11 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Aug 13 17:05:11 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js  | 30 ++++++++++++++++----
 .../src/main/js/controllers/common-module.js    | 10 +++++++
 .../main/js/controllers/models/clusters.json    |  2 +-
 .../src/main/js/public/stylesheets/style.scss   | 12 ++++++++
 .../src/main/js/routes/public.js                |  5 ++++
 .../main/js/views/configuration/clusters.jade   |  6 ++--
 .../src/main/js/views/templates/popover.jade    | 21 ++++++++++++++
 7 files changed, 76 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index bc97aa9..0f73806 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -15,7 +15,8 @@
  * limitations under the License.
  */
 
-controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', function ($scope, $http, $common, $focus, $confirm, $copy, $table) {
+controlCenterModule.controller('clustersController', ['$scope', '$http', '$popover', '$common', '$focus', '$confirm', '$copy', '$table',
+    function ($scope, $http, $popover, $common, $focus, $confirm, $copy, $table) {
         $scope.joinTip = $common.joinTip;
         $scope.getModel = $common.getModel;
 
@@ -221,8 +222,28 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
             });
         };
 
+        $scope.popover = {
+            "title": "Title",
+            "content": "Hello Popover<br />This is a multiline message!"
+        };
+
         // Check cluster logical consistency.
         function validate(item) {
+            if ($common.isEmptyString(item.name)) {
+                $focus('clusterName');
+
+                var el = $('body').find('#clusterName');
+
+                var myPopover = $popover(el, {content: 'Name should not be empty'});
+
+                myPopover.$promise.then(myPopover.show);
+
+                //window.setInterval(function() { myPopover.hide() }, 3000)
+
+                //return $common.showError('Name should not be empty!', 'zzz', '#div_to_show');
+                return false;
+            }
+
             if (!item.swapSpaceSpi || !item.swapSpaceSpi.kind && item.caches) {
                 for (var i = 0; i < item.caches.length; i++) {
                     var idx = $scope.indexOfCache(item.caches[i]);
@@ -230,11 +251,8 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
                     if (idx >= 0) {
                         var cache = $scope.caches[idx];
 
-                        if (cache.swapEnabled) {
-                            $common.showError('Swap space SPI is not configured, but cache "' + cache.label + '" configured to use swap!');
-
-                            return false;
-                        }
+                        if (cache.swapEnabled)
+                            return $common.showError('Swap space SPI is not configured, but cache "' + cache.label + '" configured to use swap!');
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/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 e596ea8..2ead841 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
@@ -24,6 +24,16 @@ controlCenterModule.config(function ($modalProvider) {
     });
 });
 
+// Comboboxes configuration.
+controlCenterModule.config(function ($popoverProvider) {
+    angular.extend($popoverProvider.defaults, {
+        trigger: 'manual',
+        placement: 'right',
+        container: 'body',
+        templateUrl: '/popover'
+    });
+});
+
 // Tooltips configuration.
 controlCenterModule.config(function ($tooltipProvider) {
     angular.extend($tooltipProvider.defaults, {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/modules/control-center-web/src/main/js/controllers/models/clusters.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json
index b254f6e..d6502c9 100644
--- a/modules/control-center-web/src/main/js/controllers/models/clusters.json
+++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json
@@ -30,7 +30,7 @@
       "model": "name",
       "required": true,
       "placeholder": "Input name",
-      "id": "defaultFocusId"
+      "id": "clusterName"
     },
     {
       "label": "Caches",

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/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 d761ef1..753bef0 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
@@ -917,6 +917,18 @@ button .caret, .btn .caret {
     background-color: $ignite-red;
 }
 
+.popover {
+    color: $ignite-red;
+}
+
+.popover-content {
+    padding: 5px;
+}
+
+.popover-content .close {
+    margin-left: 5px;
+}
+
 label {
     font-weight: normal;
     margin-bottom: 0;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/modules/control-center-web/src/main/js/routes/public.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/public.js b/modules/control-center-web/src/main/js/routes/public.js
index 483baa9..f3dfb26 100644
--- a/modules/control-center-web/src/main/js/routes/public.js
+++ b/modules/control-center-web/src/main/js/routes/public.js
@@ -26,6 +26,11 @@ router.get('/select', function (req, res) {
     res.render('templates/select', {});
 });
 
+// GET dropdown-menu template.
+router.get('/popover', function (req, res) {
+    res.render('templates/popover', {});
+});
+
 // GET dynamic tabs template.
 router.get('/tab', function (req, res) {
     res.render('templates/tab', {});

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/modules/control-center-web/src/main/js/views/configuration/clusters.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/clusters.jade b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
index 2b30afd..360ccc4 100644
--- a/modules/control-center-web/src/main/js/views/configuration/clusters.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
@@ -34,9 +34,9 @@ block content
                     tbody
                         tr(ng-repeat='row in clusters track by row._id')
                             td(ng-class='{active: row._id == selectedItem._id}')
-                                a(on-click-focus='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.discovery.kind | displayValue:discoveries:'Discovery not set'}}
+                                a(on-click-focus='clusterName' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.discovery.kind | displayValue:discoveries:'Discovery not set'}}
         .padding-top-dflt
-            button.btn.btn-primary(on-click-focus='defaultFocusId' ng-click='createItem()') Add cluster
+            button.btn.btn-primary(on-click-focus='clusterName' ng-click='createItem()') Add cluster
             label(style='margin-left: 10px; margin-right: 10px') Use template:
             select.form-control.line-control(ng-model='template' ng-options='item.value as item.label for item in templates')
             i.tipLabel.fa.fa-question-circle(bs-tooltip data-title='{{joinTip(templateTip)}}' type='button')
@@ -68,6 +68,6 @@ block content
                 i.fa.fa-chevron-circle-down(ng-show='!ui.expanded' ng-click='toggleExpanded()')
                 a(ng-click='toggleExpanded()') {{ui.expanded ? 'Hide advanced settings...' : 'Show advanced settings...'}}
             .section
-                button.btn.btn-primary(ng-disabled='inputForm.$invalid' ng-click='saveItem()') Save
+                button.btn.btn-primary(ng-click='saveItem()') Save
                 button.btn.btn-primary(ng-show='backupItem._id' ng-disabled='inputForm.$invalid' ng-click='saveItemAs()') Copy
                 button.btn.btn-primary(ng-show='backupItem._id' ng-click='removeItem()') Remove

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d91fcb31/modules/control-center-web/src/main/js/views/templates/popover.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/popover.jade b/modules/control-center-web/src/main/js/views/templates/popover.jade
new file mode 100644
index 0000000..cc5a884
--- /dev/null
+++ b/modules/control-center-web/src/main/js/views/templates/popover.jade
@@ -0,0 +1,21 @@
+//-
+    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
+    .arrow
+    .popover-content
+        label {{content}}
+        button.close(type='button' ng-click='$hide()') &times;