You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/06/11 08:41:24 UTC

[48/50] incubator-ignite git commit: # 843 WIP

# 843 WIP


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

Branch: refs/heads/ignite-843
Commit: 640c7d7498545e9c8e62ec62a123c031e1bb141b
Parents: d12580e
Author: Andrey <an...@gridgain.com>
Authored: Thu Jun 11 09:17:29 2015 +0300
Committer: Andrey <an...@gridgain.com>
Committed: Thu Jun 11 09:17:29 2015 +0300

----------------------------------------------------------------------
 .../nodejs/public/form-models/clusters.json     |  4 +-
 .../public/javascripts/controllers/clusters.js  | 29 ++++++++++--
 .../public/javascripts/controllers/common.js    |  7 +++
 .../nodejs/public/stylesheets/style.less        |  4 ++
 modules/webconfig/nodejs/routes/pages.js        |  8 +---
 modules/webconfig/nodejs/views/discovery.jade   | 46 --------------------
 .../nodejs/views/includes/controls.jade         | 18 +++-----
 modules/webconfig/nodejs/views/simplePopup.jade | 33 ++++++++++++++
 8 files changed, 80 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/public/form-models/clusters.json
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/form-models/clusters.json b/modules/webconfig/nodejs/public/form-models/clusters.json
index 270e332..ed0f5d8 100644
--- a/modules/webconfig/nodejs/public/form-models/clusters.json
+++ b/modules/webconfig/nodejs/public/form-models/clusters.json
@@ -18,8 +18,8 @@
       "details": {
         "Vm": [
           {
-            "label": "Addresses",
-            "type": "addresses",
+            "label": "address",
+            "type": "table-simple",
             "model": "addresses"
           }
         ],

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
index ec9105b..156aea3 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
@@ -85,12 +85,33 @@ configuratorModule.controller('clustersController', ['$scope', '$modal', '$http'
                 $scope.advanced = data.advanced;
             });
 
+        $scope.createSimpleItem = function(desc, rows) {
+            $scope.simplePopup = {
+                rows: rows,
+                desc: desc
+            };
 
-        // Create popup for discovery advanced settings.
-        var discoveryModal = $modal({scope: $scope, template: '/discovery', show: false});
+            $scope.pupup = $modal({scope: $scope, template: '/simplePopup', show: true});
+        };
+
+        $scope.saveSimpleItem = function(row) {
+            if ($scope.simplePopup.index)
+                angular.extend($scope.simplePopup.rows[$scope.simplePopup.index], row);
+            else
+                $scope.simplePopup.rows.push(row);
+
+            $scope.pupup.hide();
+        };
+
+        $scope.editSimpleItem = function(desc, rows, idx) {
+            $scope.simplePopup = {
+                desc: desc,
+                rows: rows,
+                index: index,
+                row: angular.copy(rows[idx])
+            };
 
-        $scope.editDiscovery = function(cluster) {
-            discoveryModal.$promise.then(discoveryModal.show);
+            $modal({scope: $scope, template: '/simplePopup', show: true});
         };
 
         // When landing on the page, get clusters and show them.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/public/javascripts/controllers/common.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/common.js b/modules/webconfig/nodejs/public/javascripts/controllers/common.js
index f383b91..d589428 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/common.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/common.js
@@ -50,6 +50,13 @@ configuratorModule.filter('displayValue', function () {
     }
 });
 
+// Capitalize first char.
+configuratorModule.filter('capitalize', function() {
+    return function(input, all) {
+        return (!!input) ? input.replace(/([^\W_]+[^\s-]*) */g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}) : '';
+    }
+});
+
 configuratorModule.controller('activeLink', ['$scope', function($scope) {
     $scope.isActive = function(path) {
         return window.location.pathname.substr(0, path.length) == path;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/public/stylesheets/style.less
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/stylesheets/style.less b/modules/webconfig/nodejs/public/stylesheets/style.less
index 4135b92..c806cae 100644
--- a/modules/webconfig/nodejs/public/stylesheets/style.less
+++ b/modules/webconfig/nodejs/public/stylesheets/style.less
@@ -1018,4 +1018,8 @@ label {
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
+}
+
+.fa-remove {
+  margin-left: 10px;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/routes/pages.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/routes/pages.js b/modules/webconfig/nodejs/routes/pages.js
index da26276..d795d56 100644
--- a/modules/webconfig/nodejs/routes/pages.js
+++ b/modules/webconfig/nodejs/routes/pages.js
@@ -28,8 +28,8 @@ router.get('/login', function(req, res) {
 });
 
 /* GET page for discovery advanced settings. */
-router.get('/discovery', function(req, res) {
-    res.render('discovery');
+router.get('/simplePopup', function(req, res) {
+    res.render('simplePopup');
 });
 
 /* GET page for indexedTypes popup. */
@@ -55,10 +55,6 @@ router.get('/clusters', function(req, res) {
     res.render('clusters', { user: req.user });
 });
 
-router.get('/discovery', function(req, res) {
-    res.render('discovery');
-});
-
 /* GET advanced options for TcpDiscoveryVmIpFinder page. */
 router.get('/tcpDiscoveryVmIpFinder', function(req, res) {
     res.render('tcpDiscoveryVmIpFinder');

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/views/discovery.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/discovery.jade b/modules/webconfig/nodejs/views/discovery.jade
deleted file mode 100644
index 5a12a05..0000000
--- a/modules/webconfig/nodejs/views/discovery.jade
+++ /dev/null
@@ -1,46 +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.
-
-div(class=['modal', 'center'] tabindex='-1' role='dialog')
-    .modal-dialog
-        .modal-content
-            .modal-header
-                button.close(type='button', ng-click='$hide()', aria-hidden='true') &times;
-                h4.modal-title Configure Static IPs
-            .modal-body
-                .block-edit-parameters
-                    .btn-group
-                        button(ng-click='add()' class=['btn', 'btn-default', 'fa', 'fa-plus'] ) &nbspAdd
-                table(ng-table='tcpDiscoveryVmIpFinderTable' class=['table', 'table-bordered', 'table-hover'])
-                    tr(ng-repeat='address in $data')
-                        td(data-title="'#'" class=['text-center', 'vcenter'] style='width: 50px') {{$index + 1}}
-                        td.text-center(data-title="'IP Address with ports range'")
-                            div(ng-if='!(editColumn == "ip" && currentRow == cluster)')
-                                span(ng-if='cluster.name') {{'127.0.0.1:47500..47509'}}
-                                span.pull-right(type='button' ng-click='beginEditStaticIps(cluster);')
-                                    i(class=['fa', 'fa-pencil'])
-                            .input-group(ng-if='editColumn == "name" && currentRow == cluster')
-                                input.form-control(type='text' ng-model='cluster.name')
-                                span.input-group-addon
-                                    i(class=['fa', 'fa-repeat'] ng-click='revert();')
-                                    i(class=['fa', 'fa-save'] ng-click='submit();' style='margin-left: 10px;')
-                        td.col-sm-1(data-title="'Delete'")
-                            center
-                                span(type='button' ng-click='delete(cluster)')
-                                    i(class=['fa', 'fa-remove'])
-            .modal-footer
-                button.btn.btn-primary(ng-click='saveDiscovery(disco_info)' ng-disabled='discoveryForm.$invalid') Save
-                button.btn.btn-primary(ng-click='$hide()') Cancel

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/includes/controls.jade b/modules/webconfig/nodejs/views/includes/controls.jade
index ad1db58..874297d 100644
--- a/modules/webconfig/nodejs/views/includes/controls.jade
+++ b/modules/webconfig/nodejs/views/includes/controls.jade
@@ -50,21 +50,17 @@ mixin details-row
             .col-sm-4
                 button.form-control(bs-select ng-model=detailMdl data-multiple='1' data-template='/select' data-placeholder='{{detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}')
             +tip-detail
-        div(ng-switch-when='addresses')
+        div(ng-switch-when='table-simple')
             .details-label
-                button.btn.btn-primary(ng-click='addAddress()') Add address
+                button.btn.btn-primary(ng-click='createSimpleItem(detail, #{detailMdl})') Add {{detail.label}}
                 //+tip
             .col-sm-10.links.details-row(style='margin-bottom: 0px;')
-                table
+                table(st-table=detailMdl)
                     tbody
-                        tr
+                        tr(ng-repeat='row in #{detailMdl}')
                             td
-                                a 1. 127.0.0.1:47500..47510&nbsp;
-                                label.fa.fa-remove
-                        tr
-                            td
-                                a 2. 9.9.9.9:47501&nbsp;
-                                label.fa.fa-remove
+                                a(ng-click='editSimpleItem(#{detailMdl}, $index)') {{index + 1}}. {{row}}
+                                label.fa.fa-remove(ng-click='removeSimpleItem(#{detailMdl}, $index)')
 
 mixin form-row
     - var masterMdl = 'backupItem[field.group][field.model]'
@@ -112,5 +108,5 @@ mixin form-row
                         tr(ng-repeat='idxType in #{idxTypes}')
                             td
                                 a(ng-click='editIndexedTypes($index)') {{$index + 1}}. {{idxType.keyClass}}, {{idxType.valueClass}}
-                                label.fa.fa-remove(style='margin-left: 10px', ng-click='removeIndexedType($index)')
+                                label.fa.fa-remove(ng-click='removeIndexedType($index)')
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/640c7d74/modules/webconfig/nodejs/views/simplePopup.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/simplePopup.jade b/modules/webconfig/nodejs/views/simplePopup.jade
new file mode 100644
index 0000000..59cb650
--- /dev/null
+++ b/modules/webconfig/nodejs/views/simplePopup.jade
@@ -0,0 +1,33 @@
+//-
+    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
+            .modal-header
+                button.close(type='button', ng-click='$hide()', aria-hidden='true') &times;
+                h4.modal-title(ng-hide='simplePopup.row') Add {{simplePopup.desc.label}}
+                h4.modal-title(ng-hide='!simplePopup.row') Edit {{simplePopup.desc.label}}
+            form.form-horizontal(name='popupForm')
+                .modal-body.row
+                    .col-sm-10.login.col-sm-offset-1
+                        .form-group
+                            label.col-sm-3.control-label {{simplePopup.desc.label | capitalize}}:
+                            .controls.col-sm-9
+                                input.form-control(type='text' ng-model='simplePopup.row' required)
+                            i.tip.fa.fa-question-circle(ng-if='simplePopup.desc.tip' bs-tooltip='field.tip.join("")' type='button')
+                .modal-footer
+                    button.btn.btn-primary(ng-click='saveSimpleItem(simplePopup.row)' ng-disabled='popupForm.$invalid') Save
+                    button.btn.btn-primary(ng-click='$hide()') Cancel