Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 00b3ac0e0 -> a1baac27a
IGNITE-843: Implemented items reordering. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a1baac27 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a1baac27 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a1baac27 Branch: refs/heads/ignite-843 Commit: a1baac27a00684001793042780e62f285dbede84 Parents: 00b3ac0 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed Jun 17 23:10:27 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed Jun 17 23:10:27 2015 +0700 ---------------------------------------------------------------------- .../nodejs/public/javascripts/controllers/caches.js | 1 + .../nodejs/public/javascripts/controllers/clusters.js | 1 + .../nodejs/public/javascripts/controllers/common.js | 13 ++++++------- modules/webconfig/nodejs/views/includes/controls.jade | 8 ++++---- 4 files changed, 12 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1baac27/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 5fb3f92..43d3e98 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js @@ -18,6 +18,7 @@ configuratorModule.controller('cachesController', ['$scope', '$alert', '$http', 'commonFunctions', function ($scope, $alert, $http, commonFunctions) { $scope.addSimpleItem = commonFunctions.addSimpleItem; $scope.addDetailSimpleItem = commonFunctions.addDetailSimpleItem; + $scope.swapSimpleItems = commonFunctions.swapSimpleItems; $scope.templates = [ {value: {mode: 'PARTITIONED', atomicityMode: 'ATOMIC'}, label: 'partitioned'}, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1baac27/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 0cb573e..6e75313 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js @@ -18,6 +18,7 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http', 'commonFunctions', function($scope, $alert, $http, commonFunctions) { $scope.addSimpleItem = commonFunctions.addSimpleItem; $scope.addDetailSimpleItem = commonFunctions.addDetailSimpleItem; + $scope.swapSimpleItems = commonFunctions.swapSimpleItems; $scope.templates = [ {value: {}, label: 'none'}, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1baac27/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 bdfc938..16e7855 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/common.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/common.js @@ -34,6 +34,12 @@ configuratorModule.service('commonFunctions', function() { master[detailMdl] = [item]; else detailRows.push(item); + }, + swapSimpleItems: function(a, ix1, ix2) { + var tmp = a[ix1]; + + a[ix1] = a[ix2]; + a[ix2] = tmp; } } }); @@ -83,13 +89,6 @@ 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/a1baac27/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 7b6f3be..897f899 100644 --- a/modules/webconfig/nodejs/views/includes/controls.jade +++ b/modules/webconfig/nodejs/views/includes/controls.jade @@ -65,8 +65,8 @@ mixin details-row .input-tip input.form-control(type='text' ng-model='curValue' placeholder='{{detail.placeholder}}') td.col-sm-1(ng-if='detail.reordering') - 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') + i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='swapSimpleItems(#{detailMdl}, $index, $index - 1); detail.editIdx = -1;') + i.fa.fa-arrow-down(ng-show='$index < #{detailMdl}.length - 1' ng-click='swapSimpleItems(#{detailMdl}, $index, $index + 1); detail.editIdx = -1;') .details-label .col-sm-8 input.form-control(type='text' ng-model='newValue' placeholder='{{detail.placeholder}}') @@ -148,8 +148,8 @@ mixin form-row .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='field.editIdx = -1') - i.fa.fa-arrow-down(ng-show='$index < #{tblMdl}.length - 1' ng-click='field.editIdx = -1') + i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='swapSimpleItems(#{tblMdl}, $index, $index - 1); field.editIdx = -1;') + i.fa.fa-arrow-down(ng-show='$index < #{tblMdl}.length - 1' ng-click='swapSimpleItems(#{tblMdl}, $index, $index + 1); field.editIdx = -1;') .col-sm-5 input.form-control(type='text' ng-model='newValue' placeholder='{{field.placeholder}}') button.btn.btn-primary.btn-second(ng-disabled='!newValue || #{tblMdl}.indexOf(newValue) >= 0' ng-click='field.editIdx = -1; addSimpleItem(backupItem, field.model, newValue)') Add {{field.label}}