IGNITE-843 Fixed table inplace edit.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/76738eae Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/76738eae Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/76738eae Branch: refs/heads/ignite-843 Commit: 76738eae9eb1ac960158f621369e6ef815d1e396 Parents: b60737c Author: AKuznetsov <akuznet...@gridgain.com> Authored: Mon Jul 20 13:25:52 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Mon Jul 20 13:25:52 2015 +0700 ---------------------------------------------------------------------- .../nodejs/controllers/caches-controller.js | 4 +-- .../nodejs/controllers/metadata-controller.js | 4 +-- .../nodejs/public/stylesheets/style.less | 26 +++++++++++++++----- .../nodejs/views/includes/controls.jade | 19 ++++++++------ 4 files changed, 35 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76738eae/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 9a7a11b..505ecc0 100644 --- a/modules/web-control-center/nodejs/controllers/caches-controller.js +++ b/modules/web-control-center/nodejs/controllers/caches-controller.js @@ -129,7 +129,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' var idx = _.indexOf(model, fx); // Found itself. - if (index > 0 && index == idx) + if (index >= 0 && index == idx) return true; // Found duplicate. @@ -150,7 +150,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' var idx = _.findIndex(model, function (pair) {return pair.keyClass == keyCls}); // Found itself. - if (index > 0 && index == idx) + if (index >= 0 && index == idx) return true; // Found duplicate. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76738eae/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 3fae5c0..017b316 100644 --- a/modules/web-control-center/nodejs/controllers/metadata-controller.js +++ b/modules/web-control-center/nodejs/controllers/metadata-controller.js @@ -317,7 +317,7 @@ controlCenterModule.controller('metadataController', ['$scope', '$http', '$commo var idx = _.indexOf(model, name); // Found itself. - if (index > 0 && index == idx) + if (index >= 0 && index == idx) return true; // Found duplicate. @@ -338,7 +338,7 @@ controlCenterModule.controller('metadataController', ['$scope', '$http', '$commo var idx = _.findIndex(model, function (pair) {return pair.name == name}); // Found itself. - if (index > 0 && index == idx) + if (index >= 0 && index == idx) return true; // Found duplicate. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76738eae/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 6165838..2323b9f 100644 --- a/modules/web-control-center/nodejs/public/stylesheets/style.less +++ b/modules/web-control-center/nodejs/public/stylesheets/style.less @@ -680,10 +680,6 @@ button .caret, .btn .caret { } } -.table-form-control { - width: auto; -} - .theme-line .panel-heading { padding: 10px 10px; margin: 0; @@ -837,7 +833,7 @@ label { .labelField { float: left; - margin-right: 4px; + margin-right: 5px; } .labelFormField { @@ -1058,4 +1054,22 @@ a { .ace_editor, #ace_document { width: 100%; height: 400px; -} \ No newline at end of file +} + +.grid { + display: flex; + flex-wrap: nowrap; + list-style: none; + margin: 0; + padding: 0; +} + +.grid-cell { + flex-basis: 50%; +} + +.grid-fixed-cell { + flex-basis: 10px; +} + + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76738eae/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 4685fb4..9da9d49 100644 --- a/modules/web-control-center/nodejs/views/includes/controls.jade +++ b/modules/web-control-center/nodejs/views/includes/controls.jade @@ -37,6 +37,15 @@ mixin btn-up(show, click) mixin btn-down(show, click) i.tipField.fa.fa-arrow-down(ng-show=show ng-click=click) +mixin table-pair-edit(keyModel, valModel, keyPlaceholder, valPlaceholder) + .grid + .grid-cell + input.form-control(type='text' ng-model=keyModel placeholder=keyPlaceholder) + div + label / + .grid-cell + input.form-control(type='text' ng-model=valModel placeholder=valPlaceholder) + mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder) .col-sm-6 label.table-header #{header}: @@ -53,18 +62,12 @@ mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder) label.labelField {{$index + 1}}) +btn-save('tablePairSaveVisible(curKey, curValue)', 'tablePairSave(tablePairValid, backupItem, field, curKey, curValue, $index)') .input-tip - .col-sm-12 - input.form-control.table-form-control(type='text' ng-model='curKey' placeholder=keyPlaceholder) - label / - input.form-control.table-form-control(type='text' ng-model='curValue' placeholder=valPlaceholder) + +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder) .settings-row(ng-show='tableNewItemActive(field)') .col-sm-6 +btn-save('tablePairSaveVisible(newKey, newValue)', 'tablePairSave(tablePairValid, backupItem, field, newKey, newValue, -1)') .input-tip - input.form-control.table-form-control(type='text' ng-model='newKey' placeholder=keyPlaceholder) - label / - input.form-control.table-form-control(type='text' ng-model='newValue' placeholder=valPlaceholder) - + +table-pair-edit('newKey', 'newValue', keyPlaceholder, valPlaceholder) mixin details-row - var lblDetailClasses = ['col-sm-4', 'details-label']