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/06/17 11:28:26 UTC

incubator-ignite git commit: # IGNITE-843 Implemented panel with table for detail rows.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 7793ee4cd -> e139662c8


# IGNITE-843 Implemented panel with table for detail rows.


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

Branch: refs/heads/ignite-843
Commit: e139662c8dc585556fa8e51c4d999c9aaebbbf98
Parents: 7793ee4
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Jun 17 16:28:19 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Jun 17 16:28:19 2015 +0700

----------------------------------------------------------------------
 .../public/javascripts/controllers/caches.js    | 16 ++++---------
 .../public/javascripts/controllers/clusters.js  | 12 ++++------
 .../public/javascripts/controllers/common.js    | 21 ++++++++++++++++
 .../nodejs/views/includes/controls.jade         | 25 ++++++++++++++------
 4 files changed, 47 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e139662c/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
index 734c564..235d4a1 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 
-configuratorModule.controller('cachesController', ['$scope', '$modal', '$alert', '$http', function ($scope, $modal, $alert, $http) {
+configuratorModule.controller('cachesController', ['$scope', '$alert', '$http', 'commonFunctions', function ($scope, $alert, $http, commonFunctions) {
+        $scope.addSimpleItem = commonFunctions.addSimpleItem;
+        $scope.addDetailSimpleItem = commonFunctions.addDetailSimpleItem;
+
         $scope.templates = [
             {value: {mode: 'PARTITIONED', atomicityMode: 'ATOMIC'}, label: 'partitioned'},
             {value: {mode: 'REPLICATED', atomicityMode: 'ATOMIC'}, label: 'replicated'},
@@ -134,13 +137,6 @@ configuratorModule.controller('cachesController', ['$scope', '$modal', '$alert',
                 });
         };
 
-        $scope.addSimpleItem = function(mdl, item) {
-            if (undefined == $scope.backupItem[mdl])
-                $scope.backupItem[mdl] = [item];
-            else
-                $scope.backupItem[mdl].push(item);
-        };
-
         $scope.editIndexedTypes = function (idx) {
             $scope.indexedTypeIdx = idx;
 
@@ -154,8 +150,6 @@ configuratorModule.controller('cachesController', ['$scope', '$modal', '$alert',
                 $scope.currKeyCls = idxType.keyClass;
                 $scope.currValCls = idxType.valueClass;
             }
-
-            $scope.indexedTypesModal = $modal({scope: $scope, template: '/indexedTypes', show: true});
         };
 
         $scope.saveIndexedType = function (k, v) {
@@ -177,8 +171,6 @@ configuratorModule.controller('cachesController', ['$scope', '$modal', '$alert',
                 idxType.keyClass = k;
                 idxType.valueClass = v;
             }
-
-            $scope.indexedTypesModal.hide();
         };
 
         $scope.removeIndexedType = function (idx) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e139662c/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 079b0b0..852711a 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 
-configuratorModule.controller('clustersController', ['$scope', '$modal', '$alert', '$http', function($scope, $modal, $alert, $http) {
+configuratorModule.controller('clustersController', ['$scope', '$alert', '$http', 'commonFunctions', function($scope, $alert, $http, commonFunctions) {
+        $scope.addSimpleItem = commonFunctions.addSimpleItem;
+        $scope.addDetailSimpleItem = commonFunctions.addDetailSimpleItem;
+
         $scope.templates = [
             {value: {}, label: 'none'},
             {value: {discovery: {kind: 'Vm', Vm: {addresses: ['127.0.0.1:47500..47510']}}}, label: 'local'},
@@ -151,12 +154,5 @@ configuratorModule.controller('clustersController', ['$scope', '$modal', '$alert
                     $alert({type: 'error', title: errorMessage});
                 });
         };
-
-        $scope.addSimpleItem = function(mdl, item) {
-            if (undefined == $scope.backupItem[mdl])
-                $scope.backupItem[mdl] = [item];
-            else
-                $scope.backupItem[mdl].push(item);
-        };
     }]
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e139662c/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 9235faa..ead1bd9 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/common.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/common.js
@@ -17,6 +17,27 @@
 
 var configuratorModule =  angular.module('ignite-web-configurator', ['smart-table', 'mgcrea.ngStrap', 'ngSanitize']);
 
+configuratorModule.service('commonFunctions', function() {
+   return {
+       addSimpleItem: function(backupItem, mdl, item) {
+           if (undefined == backupItem[mdl])
+               backupItem[mdl] = [item];
+           else
+               backupItem[mdl].push(item);
+       },
+       addDetailSimpleItem: function(backupItem, field, detailMdl, item) {
+           var master = backupItem[field.group][backupItem[field.group][field.model]];
+
+           var detailRows = master[detailMdl];
+
+           if (undefined == detailRows)
+               master[detailMdl] = [item];
+           else
+               detailRows.push(item);
+       }
+   }
+});
+
 configuratorModule.config(function($tooltipProvider) {
     angular.extend($tooltipProvider.defaults, {
         placement: 'right',

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e139662c/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 07cea14..de19f9f 100644
--- a/modules/webconfig/nodejs/views/includes/controls.jade
+++ b/modules/webconfig/nodejs/views/includes/controls.jade
@@ -51,15 +51,26 @@ mixin details-row
                 button.form-control(bs-select ng-model=detailMdl data-multiple='1' data-placeholder='{{detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}')
             +tipField('detail.tip')
         div(ng-switch-when='table-simple')
-            .details-label
-                button.btn.btn-primary(ng-click='createSimpleItem(detail, #{detailMdl})') Add {{detail.label}}
             .col-sm-10.links.details-row(style='margin-bottom: 0px;')
                 table(st-table=detailMdl)
                     tbody
-                        tr(ng-repeat='row in #{detailMdl}')
-                            td
-                                a(ng-click='editSimpleItem(detail, #{detailMdl}, $index)') {{$index + 1}}. {{row}}
-                                label.fa.fa-remove(ng-click='removeSimpleItem(#{detailMdl}, $index)')
+                        tr(ng-repeat='item in #{detailMdl}')
+                            td.col-sm-12
+                                div(ng-show='detail.editIdx != {{$index}}')
+                                    a(ng-click='detail.editIdx = $index; curValue = #{detailMdl}[$index]') {{$index + 1}}. {{item}}
+                                    i.tipField.fa.fa-remove(ng-click='detail.editIdx = -1; #{detailMdl}.splice($index, 1)')
+                                div(ng-show='detail.editIdx == {{$index}}')
+                                    label.labelField {{$index + 1}}.
+                                    i.tipField.fa.fa-floppy-o(ng-click='detail.editIdx = -1; #{detailMdl}[$index]=curValue')
+                                    .input-tip
+                                        input.form-control(type='text' ng-model='curValue' placeholder='{{detail.placeholder}}')
+                            td.col-sm-1
+                                i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='detail.editIdx = -1')
+                                i.fa.fa-arrow-down(ng-show='$index < #{detailMdl}.length - 1' ng-click='detail.editIdx = -1')
+            .details-label
+                .col-sm-8
+                    input.form-control(type='text' ng-model='newValue' placeholder='{{detail.placeholder}}')
+                button.btn.btn-primary(style='margin-left: 10px;' ng-disabled='!newValue || #{detailMdl}.indexOf(newValue) >= 0' ng-click='detail.editIdx = -1; addDetailSimpleItem(backupItem, field, detail.model, newValue)') Add {{detail.label}}
 
 mixin form-row
     - var lblClasses = ['col-sm-2']
@@ -141,5 +152,5 @@ mixin form-row
                                 i.fa.fa-arrow-down(ng-show='$index < #{tblMdl}.length - 1' ng-click='field.editIdx = -1')
             .col-sm-5
                 input.form-control(type='text' ng-model='newValue' placeholder='{{field.placeholder}}')
-            button.btn.btn-primary(style='margin-left: 10px;' ng-disabled='!newValue || #{tblMdl}.indexOf(newValue) >= 0' ng-click='field.editIdx = -1; addSimpleItem(field.model, newValue)') Add {{field.label}}
+            button.btn.btn-primary(style='margin-left: 10px;' ng-disabled='!newValue || #{tblMdl}.indexOf(newValue) >= 0' ng-click='field.editIdx = -1; addSimpleItem(backupItem, field.model, newValue)') Add {{field.label}}