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/07/17 13:18:47 UTC

[1/2] incubator-ignite git commit: IGNITE-843 Implemented global handling for table-simple and table-pair.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 334ef95e6 -> 8326a4209


IGNITE-843 Implemented global handling for table-simple and table-pair.


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

Branch: refs/heads/ignite-843
Commit: 85021e61268d56085193bdb0236b17a017b83ebf
Parents: 9cabdf6
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Jul 17 18:18:23 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Jul 17 18:18:23 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/caches-controller.js     | 194 +++++++++++++++----
 .../nodejs/controllers/metadata-controller.js   | 144 ++++++++++++--
 .../nodejs/controllers/models/caches.json       |   2 +
 .../nodejs/controllers/models/metadata.json     |  10 +
 .../nodejs/public/stylesheets/style.less        |   9 +-
 .../nodejs/views/includes/controls.jade         |  88 +++++----
 6 files changed, 345 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/caches-controller.js b/modules/web-control-center/nodejs/controllers/caches-controller.js
index 7af388f..e95890e 100644
--- a/modules/web-control-center/nodejs/controllers/caches-controller.js
+++ b/modules/web-control-center/nodejs/controllers/caches-controller.js
@@ -108,6 +108,158 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$saveAs'
             return false;
         };
 
+        $scope.tableSimple = {name: 'none', editIndex: -1};
+
+        $scope.tablePair = {name: 'none', editIndex: -1};
+
+        function tableSimpleReset() {
+            $scope.tableSimple.name = 'none';
+            $scope.tableSimple.editIndex = -1;
+        }
+
+        function tablePairReset() {
+            $scope.tablePair.name = 'none';
+            $scope.tablePair.editIndex = -1;
+        }
+
+        function tableSimpleState(name, editIndex) {
+            $scope.tableSimple.name = name;
+            $scope.tableSimple.editIndex = editIndex;
+
+            tablePairReset();
+        }
+
+        function tablePairState(name, editIndex) {
+            $scope.tablePair.name = name;
+            $scope.tablePair.editIndex = editIndex;
+
+            tableSimpleReset();
+        }
+
+        $scope.tableSimpleNewItem = function (field) {
+            tableSimpleState(field.model, -1);
+        };
+
+        $scope.tablePairNewItem = function (field) {
+            tablePairState(field.model, -1);
+        };
+
+        $scope.tableSimpleNewItemActive = function (field) {
+            return $scope.tableSimple.name == field.model && $scope.tableSimple.editIndex < 0;
+        };
+
+        $scope.tablePairNewItemActive = function (field) {
+            return $scope.tablePair.name == field.model && $scope.tablePair.editIndex < 0;
+        };
+
+        $scope.tableSimpleSave = function (field, newValue, index) {
+            tableSimpleReset();
+
+            var item = $scope.backupItem;
+
+            if (index < 0) {
+                if (item[field.model])
+                    item[field.model].push(newValue);
+                else
+                    item[field.model] = [newValue];
+            }
+            else
+                item[field.model][index] = newValue;
+        };
+
+        function tablePairValid(keyCls, valCls) {
+            if (!keyCls) {
+                commonFunctions.showError('Key class name should be non empty!');
+
+                return false;
+            }
+
+            if (!valCls) {
+                commonFunctions.showError('Value class name should be non empty!');
+
+                return false;
+            }
+
+            return true;
+        }
+
+        $scope.tablePairSave = function (field, newKey, newValue, index) {
+            if (tablePairValid(newKey, newValue)) {
+                tableSimpleReset();
+                tablePairReset();
+
+                var item = $scope.backupItem;
+
+                var pair = {};
+
+                if (index < 0) {
+                    pair[field.keyName] = newKey;
+                    pair[field.valueName] = newValue;
+
+                    if (item[field.model])
+                        item[field.model].push(pair);
+                    else
+                        item[field.model] = [pair];
+                }
+                else {
+                    pair = item[field.model][index];
+
+                    pair[field.keyName] = newKey;
+                    pair[field.valueName] = newValue;
+                }
+            }
+        };
+
+        $scope.tableSimpleStartEdit = function (field, index) {
+            tableSimpleState(field.model, index);
+
+            return $scope.backupItem[field.model][index];
+        };
+
+        $scope.tablePairStartEdit = function (field, index) {
+            tablePairState(field.model, index);
+
+            return $scope.backupItem[field.model][index];
+        };
+
+        $scope.tableSimpleEditing = function (field, index) {
+            return $scope.tableSimple.name == field.model && $scope.tableSimple.editIndex == index;
+        };
+
+        $scope.tablePairEditing = function (field, index) {
+            return $scope.tablePair.name == field.model && $scope.tablePair.editIndex == index;
+        };
+
+        $scope.tableSimpleRemove = function (field, index) {
+            tableSimpleReset();
+            tablePairReset();
+
+            $scope.backupItem[field.model].splice(index, 1);
+        };
+
+        $scope.tablePairRemove = function (field, index) {
+            tableSimpleReset();
+            tablePairReset();
+
+            $scope.backupItem[field.model].splice(index, 1);
+        };
+
+        $scope.tableSimpleUp = function (field, index) {
+            tableSimpleReset();
+
+            swapSimpleItems($scope.backupItem[field.model], index, index - 1);
+        };
+
+        $scope.tableSimpleDown = function (field, index) {
+            tableSimpleReset();
+
+            swapSimpleItems($scope.backupItem[field.model], index, index + 1);
+        };
+
+        $scope.tableSimpleDownVisible = function (field, index) {
+            return index < $scope.backupItem[field.model].length - 1;
+        };
+
         // When landing on the page, get caches and show them.
         $http.post('caches/list')
             .success(function (data) {
@@ -261,47 +413,5 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$saveAs'
                 }
             );
         };
-
-        function tablePairValid(keyCls, valCls) {
-            if (!keyCls) {
-                commonFunctions.showError('Key class name should be non empty!');
-
-                return false;
-            }
-
-            if (!valCls) {
-                commonFunctions.showError('Value class name should be non empty!');
-
-                return false;
-            }
-
-            return true;
-        }
-
-        $scope.tablePairAdd = function (fld, keyCls, valCls) {
-            if (!tablePairValid(keyCls, valCls))
-                return;
-
-            var idxTypes = $scope.backupItem.indexedTypes;
-
-            var newItem = {keyClass: keyCls, valueClass: valCls};
-
-            if (idxTypes)
-                idxTypes.push(newItem);
-            else
-                $scope.backupItem.indexedTypes = [newItem];
-        };
-
-        $scope.tablePairSave = function (idx, fld, keyCls, valCls) {
-            if (!tablePairValid(keyCls, valCls))
-                return idx;
-
-            var idxType = $scope.backupItem.indexedTypes[idx];
-
-            idxType.keyClass = keyCls;
-            idxType.valueClass = valCls;
-
-            return -1;
-        };
     }]
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/metadata-controller.js b/modules/web-control-center/nodejs/controllers/metadata-controller.js
index c23da07..2ff419f 100644
--- a/modules/web-control-center/nodejs/controllers/metadata-controller.js
+++ b/modules/web-control-center/nodejs/controllers/metadata-controller.js
@@ -296,7 +296,66 @@ controlCenterModule.controller('metadataController', ['$scope', '$http', 'common
                 });
         };
 
-        function fieldValid(fld, cls) {
+        $scope.tableSimple = {name: 'none', editIndex: -1};
+
+        $scope.tablePair = {name: 'none', editIndex: -1};
+
+        function tableSimpleReset() {
+            $scope.tableSimple.name = 'none';
+            $scope.tableSimple.editIndex = -1;
+        }
+
+        function tablePairReset() {
+            $scope.tablePair.name = 'none';
+            $scope.tablePair.editIndex = -1;
+        }
+
+        function tableSimpleState(name, editIndex) {
+            $scope.tableSimple.name = name;
+            $scope.tableSimple.editIndex = editIndex;
+
+            tablePairReset();
+        }
+
+        function tablePairState(name, editIndex) {
+            $scope.tablePair.name = name;
+            $scope.tablePair.editIndex = editIndex;
+
+            tableSimpleReset();
+        }
+
+        $scope.tableSimpleNewItem = function (field) {
+            tableSimpleState(field.model, -1);
+        };
+
+        $scope.tablePairNewItem = function (field) {
+            tablePairState(field.model, -1);
+        };
+
+        $scope.tableSimpleNewItemActive = function (field) {
+            return $scope.tableSimple.name == field.model && $scope.tableSimple.editIndex < 0;
+        };
+
+        $scope.tablePairNewItemActive = function (field) {
+            return $scope.tablePair.name == field.model && $scope.tablePair.editIndex < 0;
+        };
+
+        $scope.tableSimpleSave = function (field, newValue, index) {
+            tableSimpleReset();
+
+            var item = $scope.backupItem;
+
+            if (index < 0) {
+                if (item[field.model])
+                    item[field.model].push(newValue);
+                else
+                    item[field.model] = [newValue];
+            }
+            else
+                item[field.model][index] = newValue;
+        };
+
+        function tablePairValid(fld, cls) {
             if (!fld) {
                 commonFunctions.showError('Field name should be non empty!');
 
@@ -312,30 +371,81 @@ controlCenterModule.controller('metadataController', ['$scope', '$http', 'common
             return true;
         }
 
-        $scope.tablePairAdd = function (mdl, fld, cls) {
-            if (!fieldValid(fld, cls))
-                return;
+        $scope.tablePairSave = function (field, newKey, newValue, index) {
+            if (tablePairValid(newKey, newValue)) {
+                tableSimpleReset();
+                tablePairReset();
 
-            var fields = $scope.backupItem[mdl.model];
+                var item = $scope.backupItem;
 
-            var newItem = {name: fld, className: cls};
+                var pair = {};
 
-            if (fields)
-                fields.push(newItem);
-            else
-                $scope.backupItem[mdl.model] = [newItem];
+                if (index < 0) {
+                    pair[field.keyName] = newKey;
+                    pair[field.valueName] = newValue;
+
+                    if (item[field.model])
+                        item[field.model].push(pair);
+                    else
+                        item[field.model] = [pair];
+                }
+                else {
+                    pair = item[field.model][index];
+
+                    pair[field.keyName] = newKey;
+                    pair[field.valueName] = newValue;
+                }
+            }
+        };
+
+        $scope.tableSimpleStartEdit = function (field, index) {
+            tableSimpleState(field.model, index);
+
+            return $scope.backupItem[field.model][index];
         };
 
-        $scope.tablePairSave = function (idx, mdl, fld, cls) {
-            if (!fieldValid(fld, cls))
-                return idx;
+        $scope.tablePairStartEdit = function (field, index) {
+            tablePairState(field.model, index);
 
-            var field = $scope.backupItem[mdl.model][idx];
+            return $scope.backupItem[field.model][index];
+        };
+
+        $scope.tableSimpleEditing = function (field, index) {
+            return $scope.tableSimple.name == field.model && $scope.tableSimple.editIndex == index;
+        };
 
-            field.name = fld;
-            field.className = cls;
+        $scope.tablePairEditing = function (field, index) {
+            return $scope.tablePair.name == field.model && $scope.tablePair.editIndex == index;
+        };
+
+        $scope.tableSimpleRemove = function (field, index) {
+            tableSimpleReset();
+            tablePairReset();
+
+            $scope.backupItem[field.model].splice(index, 1);
+        };
+
+        $scope.tablePairRemove = function (field, index) {
+            tableSimpleReset();
+            tablePairReset();
+
+            $scope.backupItem[field.model].splice(index, 1);
+        };
+
+        $scope.tableSimpleUp = function (field, index) {
+            tableSimpleReset();
+
+            swapSimpleItems($scope.backupItem[field.model], index, index - 1);
+        };
+
+        $scope.tableSimpleDown = function (field, index) {
+            tableSimpleReset();
+
+            swapSimpleItems($scope.backupItem[field.model], index, index + 1);
+        };
 
-            return -1;
+        $scope.tableSimpleDownVisible = function (field, index) {
+            return index < $scope.backupItem[field.model].length - 1;
         };
 
         $scope.selectSchema = function (idx) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/controllers/models/caches.json
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/models/caches.json b/modules/web-control-center/nodejs/controllers/models/caches.json
index 7becbdd..290013a 100644
--- a/modules/web-control-center/nodejs/controllers/models/caches.json
+++ b/modules/web-control-center/nodejs/controllers/models/caches.json
@@ -357,6 +357,8 @@
         {
           "type": "indexedTypes",
           "model": "indexedTypes",
+          "keyName": "keyClass",
+          "valueName": "valueClass",
           "tip": [
             "Collection of types to index."
           ]

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/controllers/models/metadata.json
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/models/metadata.json b/modules/web-control-center/nodejs/controllers/models/metadata.json
index 63710e0..dc28d59 100644
--- a/modules/web-control-center/nodejs/controllers/models/metadata.json
+++ b/modules/web-control-center/nodejs/controllers/models/metadata.json
@@ -63,6 +63,8 @@
       "label": "Key fields",
       "type": "fieldsMetadata",
       "model": "keyFields",
+      "keyName": "name",
+      "valueName": "className",
       "hide": "backupItem.kind == 'query'",
       "tip": ["Collection of key fields descriptions."]
     },
@@ -70,6 +72,8 @@
       "label": "Value fields",
       "type": "fieldsMetadata",
       "model": "valueFields",
+      "keyName": "name",
+      "valueName": "className",
       "hide": "backupItem.kind == 'query'",
       "tip": ["Collection of value fields descriptions."]
     },
@@ -77,6 +81,8 @@
       "label": "Query fields",
       "type": "fieldsMetadata",
       "model": "queryFields",
+      "keyName": "name",
+      "valueName": "className",
       "hide": "backupItem.kind != 'query'",
       "tip": ["TODO."]
     },
@@ -84,6 +90,8 @@
       "label": "Ascending fields",
       "type": "fieldsMetadata",
       "model": "ascendingFields",
+      "keyName": "name",
+      "valueName": "className",
       "hide": "backupItem.kind != 'query'",
       "tip": ["TODO."]
     },
@@ -91,6 +99,8 @@
       "label": "Descending fields",
       "type": "fieldsMetadata",
       "model": "descendingFields",
+      "keyName": "name",
+      "valueName": "className",
       "hide": "backupItem.kind != 'query'",
       "tip": ["TODO."]
     },

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/public/stylesheets/style.less
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/public/stylesheets/style.less b/modules/web-control-center/nodejs/public/stylesheets/style.less
index 595e4da..9187aef 100644
--- a/modules/web-control-center/nodejs/public/stylesheets/style.less
+++ b/modules/web-control-center/nodejs/public/stylesheets/style.less
@@ -21,7 +21,6 @@
 @ignite-block-callout-background: #f3f8f3;
 @ignite-block-callout-border: #50af51;
 
-
 .main-header .logo {
   height: auto;
 }
@@ -58,7 +57,7 @@
   position: fixed;
   top: 50%;
   left: 50%;
-  -webkit-transform:translateX(-50%) translateY(-50%);
+  -webkit-transform: translateX(-50%) translateY(-50%);
   transform: translateX(-50%) translateY(-50%);
 }
 
@@ -192,7 +191,7 @@
   border-bottom: 4px solid #888;
 }
 
-.theme-line .navbar-nav, .theme-line  .sidebar-nav {
+.theme-line .navbar-nav, .theme-line .sidebar-nav {
   ul li > a.active {
     cursor: default;
     pointer-events: none;
@@ -1035,11 +1034,11 @@ a {
   cursor: pointer;
 }
 
-.st-sort-ascent:after{
+.st-sort-ascent:after {
   content: '\25B2';
 }
 
-.st-sort-descent:after{
+.st-sort-descent:after {
   content: '\25BC';
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/85021e61/modules/web-control-center/nodejs/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/includes/controls.jade b/modules/web-control-center/nodejs/views/includes/controls.jade
index 302e7a3..6afb1e6 100644
--- a/modules/web-control-center/nodejs/views/includes/controls.jade
+++ b/modules/web-control-center/nodejs/views/includes/controls.jade
@@ -22,36 +22,48 @@ mixin tipLabel(lines)
     i.tipLabel.fa.fa-question-circle(ng-if=lines bs-tooltip='joinTip(#{lines})' type='button')
     i.tipLabel.fa.fa-question-circle.blank(ng-if='!#{lines}')
 
-mixin exclamation(mdl, err, msg)
+mixin ico-exclamation(mdl, err, msg)
     i.fa.fa-exclamation-triangle.form-control-feedback(ng-show='inputForm["#{mdl}"].$error.#{err}' bs-tooltip data-title='#{msg}' type='button')
 
+mixin btn-save(click)
+    i.tipField.fa.fa-floppy-o(ng-click=click)
+
+mixin btn-remove(click)
+    i.tipField.fa.fa-remove(ng-click=click)
+
+mixin btn-up(iff, show, click)
+    i.fa.fa-arrow-up(ng-if=iff ng-show=show ng-click=click)
+
+mixin btn-down(iff, show, click)
+    i.fa.fa-arrow-down(ng-if=iff ng-show=show ng-click=click)
+
 mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder)
     .col-sm-6
         label.table-header #{header}:
         +tipLabel('field.tip')
-        button.btn.btn-primary.fieldButton(ng-click='field.editIdx = -2') Add
+        button.btn.btn-primary.fieldButton(ng-click='tablePairNewItem(field)') Add
     table.links-edit.col-sm-12(st-table=tblMdl ng-show='#{tblMdl}.length > 0')
         tbody
             tr.col-sm-12(ng-repeat='item in #{tblMdl}')
                 td.col-sm-6
-                    div(ng-show='field.editIdx != {{$index}}')
-                        a(ng-click='field.editIdx = $index; curKey = #{tblMdl}[$index].#{keyFld}; curValue = #{tblMdl}[$index].#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}}
-                        i.tipField.fa.fa-remove(ng-click='field.editIdx = -1; #{tblMdl}.splice($index, 1)')
-                    div(ng-show='field.editIdx == {{$index}}')
+                    div(ng-show='!tablePairEditing(field, $index)')
+                        a(ng-click='curPair = tablePairStartEdit(field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}}
+                        +btn-remove('tablePairRemove(field, $index)')
+                    div(ng-show='tablePairEditing(field, $index)')
                         label.labelField {{$index + 1}})
-                        i.tipField.fa.fa-floppy-o(ng-click='field.editIdx = tablePairSave($index, field, curKey, curValue)')
+                        +btn-save('tablePairSave(field, curKey, curValue, $index)')
                         .input-tip
                             .col-sm-12
                                 input.form-control.table-form-control(type='text' ng-model='curKey' placeholder=keyPlaceholder)
                                 label &nbsp;/&nbsp;
                                 input.form-control.table-form-control(type='text' ng-model='curValue' placeholder=valPlaceholder)
-    .settings-row(ng-show='field.editIdx < -1')
+    .settings-row(ng-show='tablePairNewItemActive(field)')
         .col-sm-6
-            i.tipField.fa.fa-floppy-o(ng-click='field.editIdx = tablePairAdd(field, newKey, newValue)')
+            +btn-save('tablePairSave(field, newKey, newValue, -1)')
             .input-tip
-                input.form-control.table-form-control(type='text' ng-model='newKey' ng-focus='field.editIdx = -2' placeholder=keyPlaceholder)
+                input.form-control.table-form-control(type='text' ng-model='newKey' placeholder=keyPlaceholder)
                 label &nbsp;/&nbsp;
-                input.form-control.table-form-control(type='text' ng-model='newValue' ng-focus='field.editIdx = -2' placeholder=valPlaceholder)
+                input.form-control.table-form-control(type='text' ng-model='newValue' placeholder=valPlaceholder)
 
 
 mixin details-row
@@ -82,9 +94,9 @@ mixin details-row
                 +tipField('detail.tip')
                 .input-tip
                     input.form-control(name='{{detail.model}}' type='number' placeholder='{{detail.placeholder}}' min='{{detail.min ? detail.min : 0}}' max='{{detail.max ? detail.max : Number.MAX_VALUE}}')&attributes(detailCommon)
-                    +exclamation('{{detail.model}}', 'min', 'Value is less than allowable minimum.')
-                    +exclamation('{{detail.model}}', 'max', 'Value is more than allowable maximum.')
-                    +exclamation('{{detail.model}}', 'number', 'Invalid value. Only numbers allowed.')
+                    +ico-exclamation('{{detail.model}}', 'min', 'Value is less than allowable minimum.')
+                    +ico-exclamation('{{detail.model}}', 'max', 'Value is more than allowable maximum.')
+                    +ico-exclamation('{{detail.model}}', 'number', 'Invalid value. Only numbers allowed.')
         div(ng-switch-when='dropdown')
             label(class=lblDetailClasses ng-class='{required: detail.required}') {{detail.label}}:
             .col-sm-8
@@ -104,23 +116,23 @@ mixin details-row
                 tbody
                     tr(ng-repeat='item in #{detailMdl} track by $index')
                         td
-                            div(ng-show='detail.editIdx != {{$index}}')
-                                i.tipField.fa.fa-remove(ng-click='detail.editIdx = -1; #{detailMdl}.splice($index, 1)')
-                                i.tipField.fa.fa-arrow-down(ng-if='detail.reordering' ng-show='$index < #{detailMdl}.length - 1' ng-click='swapSimpleItems(#{detailMdl}, $index, $index + 1); detail.editIdx = -1;')
-                                i.tipField.fa.fa-arrow-up(ng-if='detail.reordering' ng-show='$index > 0' ng-click='swapSimpleItems(#{detailMdl}, $index, $index - 1); detail.editIdx = -1;')
+                            div(ng-show='!tableSimpleEditing(detail, $index)')
+                                +btn-remove(ng-click='tableSimpleRemove(detail, $index)')
+                                +btn-down('detail.reordering', 'tableSimpleDownVisible(detail, $index)', 'tableSimpleDown(detail, $index)')
+                                +btn-up('detail.reordering', '$index > 0', 'tableSimpleUp(detail, $index)')
                                 .input-tip
                                     a(ng-click='detail.editIdx = $index; curValue = #{detailMdl}[$index]') {{$index + 1}}) {{item}}
-                            div(ng-show='detail.editIdx == {{$index}}')
+                            div(ng-show='tableSimpleEditing(detail, $index)')
                                 label.labelField {{$index + 1}})
-                                i.tipField.fa.fa-floppy-o(ng-click='#{detailMdl}[$index] = curValue ? curValue : #{detailMdl}[$index]; detail.editIdx = curValue ? -1 : detail.editIdx')
+                                +btn-save('tableSimpleSave(detail, curValue, $index)')
                                 .input-tip.form-group.has-feedback
                                     input.form-control(name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{detail.placeholder}}')&attributes(customValidators)
-                                    +exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.')
-            button.btn.btn-primary.fieldButton(ng-disabled='!newValue || #{detailMdl}.indexOf(newValue) >= 0' ng-click='detail.editIdx = -1; #{detailMdl} ? #{detailMdl}.push(newValue) : #{detailMdl} = [newValue];') Add
+                                    +ico-exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.')
+            button.btn.btn-primary.fieldButton(ng-disabled='!newValue || #{detailMdl}.indexOf(newValue) >= 0' ng-click='tableSimpleSave(detail, newValue, -1)') Add
             +tipField('detail.tip')
             .input-tip.form-group.has-feedback
-                input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='detail.editIdx = -1' placeholder='{{detail.placeholder}}')&attributes(customValidators)
-                +exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.')
+                input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableSimpleNewItem(detail)' placeholder='{{detail.placeholder}}')&attributes(customValidators)
+                +ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.')
 
 mixin form-row
     +form-row-custom(['col-sm-2'], ['col-sm-4'])
@@ -157,9 +169,9 @@ mixin form-row-custom(lblClasses, fieldClasses)
                 +tipField('field.tip')
                 .input-tip
                     input.form-control(name='{{field.model}}' type='number' placeholder='{{field.placeholder}}' min='{{field.min ? field.min : 0}}' max='{{field.max ? field.max : Number.MAX_VALUE}}')&attributes(fieldCommon)
-                    +exclamation('{{field.model}}', 'min', 'Value is less than allowable minimum.')
-                    +exclamation('{{field.model}}', 'max', 'Value is more than allowable maximum.')
-                    +exclamation('{{field.model}}', 'number', 'Invalid value. Only numbers allowed.')
+                    +ico-exclamation('{{field.model}}', 'min', 'Value is less than allowable minimum.')
+                    +ico-exclamation('{{field.model}}', 'max', 'Value is more than allowable maximum.')
+                    +ico-exclamation('{{field.model}}', 'number', 'Invalid value. Only numbers allowed.')
         div(ng-switch-when='dropdown' ng-hide=fieldHide)
             label(class=lblClasses ng-class=fieldRequiredClass) {{field.label}}:
             div(class=fieldClasses)
@@ -189,27 +201,27 @@ mixin form-row-custom(lblClasses, fieldClasses)
             .col-sm-6
                 label.table-header {{field.label}}:
                 +tipLabel('field.tableTip')
-                button.btn.btn-primary.fieldButton(ng-click='field.editIdx = -2;') Add
+                button.btn.btn-primary.fieldButton(ng-click='tableSimpleNewItem(field)') Add
             table.links-edit.col-sm-12(st-table='#{fieldMdl}' ng-show='#{fieldMdl}.length > 0')
                 tbody
                     tr.col-sm-12(ng-repeat='item in #{fieldMdl} track by $index')
                         td.col-sm-6
-                            div(ng-show='field.editIdx != {{$index}}')
-                                a(ng-click='field.editIdx = $index; curValue = #{fieldMdl}[$index]') {{$index + 1}}) {{item | compact}}
-                                i.tipField.fa.fa-remove(ng-click='field.editIdx = -1; #{fieldMdl}.splice($index, 1)')
-                            div(ng-show='field.editIdx == {{$index}}')
+                            div(ng-show='!tableSimpleEditing(field, $index)')
+                                a(ng-click='curValue = tableSimpleStartEdit(field, $index)') {{$index + 1}}) {{item | compact}}
+                                +btn-remove('tableSimpleRemove(field, $index)')
+                            div(ng-show='tableSimpleEditing(field, $index)')
                                 label.labelField {{$index + 1}})
-                                i.tipField.fa.fa-floppy-o(ng-click='#{fieldMdl}[$index] = curValue ? curValue : #{fieldMdl}[$index]; field.editIdx = curValue ? -1 : field.editIdx')
+                                +btn-save('tableSimpleSave(field, curValue, $index)')
                                 .input-tip
                                     input.form-control(type='text' ng-model='curValue' placeholder='{{field.placeholder}}')
                         td.col-sm-1(ng-if='field.reordering')
-                            i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index - 1); field.editIdx = -1;')
-                            i.fa.fa-arrow-down(ng-show='$index < #{fieldMdl}.length - 1' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index + 1); field.editIdx = -1;')
-            .settings-row(ng-show='field.editIdx < -1')
+                            +btn-up(true, '$index > 0', 'tableSimpleUp(field, $index)')
+                            +btn-down(true, 'tableSimpleDownVisible(field, $index)', 'tableSimpleDown(field, $index)')
+            .settings-row(ng-show='tableSimpleNewItemActive(field)')
                 .col-sm-6
-                    i.tipField.fa.fa-floppy-o(ng-click='field.editIdx = -1; #{fieldMdl} ? #{fieldMdl}.push(newValue) : #{fieldMdl} = [newValue];')
+                    +btn-save('tableSimpleSave(field, newValue, -1)')
                     .input-tip
-                        input.form-control(type='text' ng-model='newValue' ng-focus='field.editIdx = -2'  placeholder='{{field.placeholder}}')
+                        input.form-control(type='text' ng-model='newValue' placeholder='{{field.placeholder}}')
         div(ng-switch-when='fieldsMetadata' ng-hide=fieldHide)
             +table-pair('{{field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field class full name')
         div(ng-switch-when='groupsMetadata' ng-hide=fieldHide)&attributes(fieldCommon)


[2/2] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-843' into ignite-843

Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/ignite-843' into ignite-843


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

Branch: refs/heads/ignite-843
Commit: 8326a420961fb370a8afaca323ad6d9640f37319
Parents: 85021e6 334ef95
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Jul 17 18:18:42 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Jul 17 18:18:42 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/common-module.js         |  2 +-
 .../nodejs/controllers/summary-controller.js    | 50 +++++---------
 modules/web-control-center/nodejs/package.json  | 12 +++-
 .../nodejs/public/stylesheets/style.less        |  5 ++
 .../nodejs/views/configuration/summary.jade     | 73 +++++++-------------
 .../nodejs/views/templates/layout.jade          |  5 +-
 6 files changed, 63 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8326a420/modules/web-control-center/nodejs/public/stylesheets/style.less
----------------------------------------------------------------------