Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 8f4607fe0 -> ea8ec7c80
IGNITE-843 Fix for available space calculation and WIP on table on-going editing. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ea8ec7c8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ea8ec7c8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ea8ec7c8 Branch: refs/heads/ignite-843 Commit: ea8ec7c807fcb6896e5a092924886a4820607ec3 Parents: 8f4607f Author: AKuznetsov <akuznet...@gridgain.com> Authored: Tue Aug 11 18:34:22 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Tue Aug 11 18:34:22 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/common-module.js | 42 ++++++++++++++------ .../src/main/js/views/configuration/caches.jade | 2 +- 2 files changed, 31 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea8ec7c8/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 4563e96..6b95291 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 @@ -379,7 +379,7 @@ controlCenterModule.service('$common', [ * @returns {*[]} First element is length of class for single value, second element is length for pair vlaue. */ availableWidth: function (id) { - var div = $('#' + id).find('div')[0]; + var div = $('#' + id).find('tr')[0]; var width = div.clientWidth; if (width > 0) { @@ -492,7 +492,7 @@ controlCenterModule.service('$copy', function ($modal, $rootScope, $q) { // Tables support service. controlCenterModule.service('$table', [ - '$common', function ($common) { + '$common', '$focus', function ($common, $focus) { function _swapSimpleItems(a, ix1, ix2) { var tmp = a[ix1]; @@ -516,6 +516,16 @@ controlCenterModule.service('$table', [ table.editIndex = editIndex; } + function _tableStartEdit(item, field, index) { + _tableState(field.model, index); + + return _model(item, field)[field.model][index]; + } + + function _tableNewItem(field) { + _tableState(field.model, -1); + } + return { tableState: function (name, editIndex) { _tableState(name, editIndex); @@ -523,20 +533,14 @@ controlCenterModule.service('$table', [ tableReset: function () { _tableReset(); }, - tableNewItem: function (field) { - _tableState(field.model, -1); - }, + tableNewItem: _tableNewItem, tableNewItemActive: function (field) { return table.name == field.model && table.editIndex < 0; }, tableEditing: function (field, index) { return table.name == field.model && table.editIndex == index; }, - tableStartEdit: function (item, field, index) { - _tableState(field.model, index); - - return _model(item, field)[field.model][index]; - }, + tableStartEdit: _tableStartEdit, tableRemove: function (item, field, index) { _tableReset(); @@ -574,8 +578,6 @@ controlCenterModule.service('$table', [ }, tablePairSave: function (pairValid, item, field, newKey, newValue, index) { if (pairValid(item, field, newKey, newValue, index)) { - _tableReset(); - var pair = {}; if (index < 0) { @@ -586,12 +588,28 @@ controlCenterModule.service('$table', [ item[field.model].push(pair); else item[field.model] = [pair]; + + _tableNewItem(field); + + $focus('newKey' + field.focusId); } else { pair = item[field.model][index]; pair[field.keyName] = newKey; pair[field.valueName] = newValue; + + if (index < item[field.model].length - 1) { + _tableReset(); + //_tableStartEdit(item, field, index + 1); + + //$focus('curKey' + field.focusId); + } + else { + _tableNewItem(field); + + $focus('newKey' + field.focusId); + } } } }, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea8ec7c8/modules/control-center-web/src/main/js/views/configuration/caches.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/caches.jade b/modules/control-center-web/src/main/js/views/configuration/caches.jade index 5301d5a..197b3d6 100644 --- a/modules/control-center-web/src/main/js/views/configuration/caches.jade +++ b/modules/control-center-web/src/main/js/views/configuration/caches.jade @@ -39,7 +39,7 @@ block content button.btn.btn-primary(event-focus='defaultFocusId' ng-click='createItem()') Add cache hr form.form-horizontal(name='inputForm' ng-if='backupItem' novalidate) - .panel-group(bs-collapse ng-model='panels.activePanels' data-allow-multiple='true' ng-click='triggerDigest = true') + .panel-group(bs-collapse ng-model='panels.activePanels' data-allow-multiple='true') .panel.panel-default .panel-heading h3