IGNITE-843 WIP on tables.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a9fd2676 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a9fd2676 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a9fd2676 Branch: refs/heads/ignite-843 Commit: a9fd2676aceea239dad22b6876b96386ff35adf6 Parents: d81ab79 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Thu Aug 13 08:10:00 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Thu Aug 13 08:10:00 2015 +0700 ---------------------------------------------------------------------- .../main/js/controllers/caches-controller.js | 8 +- .../main/js/controllers/clusters-controller.js | 4 +- .../src/main/js/controllers/common-module.js | 25 ++- .../main/js/controllers/metadata-controller.js | 162 +++++++------------ .../main/js/controllers/models/clusters.json | 8 +- .../src/main/js/views/includes/controls.jade | 103 ++++++------ 6 files changed, 139 insertions(+), 171 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/modules/control-center-web/src/main/js/controllers/caches-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js index 5c6ee17..bf1149b 100644 --- a/modules/control-center-web/src/main/js/controllers/caches-controller.js +++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js @@ -147,17 +147,19 @@ controlCenterModule.controller('cachesController', [ }; $scope.tablePairValid = function (item, field, index) { - if (!$common.isValidJavaClass('Indexed type key', keyCls, true)) + var pairValue = $table.tablePairValue(field, index); + + if (!$common.isValidJavaClass('Indexed type key', pairValue.key, true)) return focusInvalidField(index, 'KeyIndexedType'); - if (!$common.isValidJavaClass('Indexed type value', valCls, true)) + if (!$common.isValidJavaClass('Indexed type value', pairValue.value, true)) return focusInvalidField(index, 'ValueIndexedType'); var model = item[field.model]; if ($common.isDefined(model)) { var idx = _.findIndex(model, function (pair) { - return pair.keyClass == keyCls + return pair.keyClass == pairValue.key }); // Found duplicate. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/modules/control-center-web/src/main/js/controllers/clusters-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js index 0ea68a1..bc97aa9 100644 --- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js +++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js @@ -171,8 +171,8 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo // Remove deleted caches. restoredItem.caches = _.filter(restoredItem.caches, function (cacheId) { return _.findIndex($scope.caches, function (scopeCache) { - return scopeCache.value == cacheId; - }) >= 0; + return scopeCache.value == cacheId; + }) >= 0; }); $scope.selectedItem = $scope.clusters[idx]; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/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 7a22992..f7abf0c 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 @@ -662,14 +662,31 @@ controlCenterModule.service('$table', [ var ui = _tableUI(field); - if (ui == 'table-simple') + if (ui == 'table-simple') { + field.newValue = null; + _tableFocus(field.focusId, -1); - else if (ui == 'table-pair') + } + else if (ui == 'table-pair') { + field.newKey = null; + field.newValue = null; + _tableFocus('Key' + field.focusId, -1); - else if (ui == 'table-db-fields') + } + else if (ui == 'table-db-fields') { + field.newDatabaseName = null; + field.newDatabaseType = null; + field.newJavaName = null; + field.newJavaType = null; + _tableFocus('DatabaseName' + field.focusId, -1); - else if (ui == 'table-query-groups') + } + else if (ui == 'table-query-groups') { + field.newGroupName = null; + field.newFields = null; + _tableFocus('GroupName', -1); + } } return { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/modules/control-center-web/src/main/js/controllers/metadata-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js index c5a3019..7becb73 100644 --- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js +++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js @@ -148,7 +148,7 @@ controlCenterModule.controller('metadataController', [ $scope.loadMeta = {action: 'connect'}; $scope.loadMeta.tables = []; - $scope.loadMeta.selectAll = function() { + $scope.loadMeta.selectAll = function () { var allSelected = $scope.loadMeta.allSelected; _.forEach($scope.loadMeta.tables, function (table) { @@ -467,7 +467,7 @@ controlCenterModule.controller('metadataController', [ if ($common.isDefined(model)) { var idx = _.findIndex(model, function (pair) { - return pair.name == pairValue.name + return pair.name == pairValue.key }); // Found duplicate. @@ -490,8 +490,7 @@ controlCenterModule.controller('metadataController', [ var javaName = isNew ? field.newJavaName : field.curJavaName; var javaType = isNew ? field.newJavaType : field.curJavaType; - return !$common.isEmptyString(databaseName) && $common.isDefined(databaseType) && - !$common.isEmptyString(javaName) && $common.isDefined(javaType); + return !$common.isEmptyString(databaseName) && $common.isDefined(databaseType) && !$common.isEmptyString(javaName) && $common.isDefined(javaType); }; var dbFields = { @@ -562,11 +561,17 @@ controlCenterModule.controller('metadataController', [ } }; - $scope.tableGroupSaveVisible = function (group) { - return !$common.isEmptyString(group); + function tableGroupValue(field, index) { + return index < 0 ? field.newGroupName : field.curGroupName; + } + + $scope.tableGroupSaveVisible = function (field, index) { + return !$common.isEmptyString(tableGroupValue(field, index)); }; - function tableGroupValid(groupName, index) { + $scope.tableGroupSave = function (field, index) { + var groupName = tableGroupValue(field, index); + var groups = $scope.backupItem.groups; if ($common.isDefined(groups)) { @@ -582,26 +587,20 @@ controlCenterModule.controller('metadataController', [ } } - return true; - } - - $scope.tableGroupSave = function (groupName, index) { - if (tableGroupValid(groupName, index)) { - $table.tableReset(); + $table.tableReset(); - var item = $scope.backupItem; + var item = $scope.backupItem; - if (index < 0) { - var newGroup = {name: groupName}; + if (index < 0) { + var newGroup = {name: groupName}; - if (item.groups) - item.groups.push(newGroup); - else - item.groups = [newGroup]; - } + if (item.groups) + item.groups.push(newGroup); else - item.groups[index].name = groupName; + item.groups = [newGroup]; } + else + item.groups[index].name = groupName; }; $scope.tableGroupNewItem = function (groupIndex) { @@ -639,27 +638,45 @@ controlCenterModule.controller('metadataController', [ return false; }; - $scope.tableGroupItemStartEdit = function (groupIndex, index) { + function tableGroupItemValue(field, index) { + return index < 0 + ? {name: field.newFieldName, className: field.newClassName, direction: field.newDirection} + : {name: field.curFieldName, className: field.curClassName, direction: field.curDirection}; + } + + $scope.tableGroupItemStartEdit = function (field, groupIndex, index) { var groups = $scope.backupItem.groups; - $table.tableState(groups[groupIndex].name, index); + var group = groups[groupIndex]; + + $table.tableState(group.name, index); + + var groupItem = group.fields[index]; - return groups[groupIndex].fields[index]; + field.curFieldName = groupItem.name; + field.curClassName = groupItem.className; + field.curDirection = groupItem.direction; + + $focus('curFieldName'); }; - $scope.tableGroupItemSaveVisible = function (fieldName, className) { - return !$common.isEmptyString(fieldName) && !$common.isEmptyString(className); + $scope.tableGroupItemSaveVisible = function (field, index) { + var groupItemValue = tableGroupItemValue(field, index); + + return !$common.isEmptyString(groupItemValue.name) && !$common.isEmptyString(groupItemValue.className); }; - function tableGroupItemValid(fieldName, className, groupIndex, index) { - if (!$common.isValidJavaClass('Group field', className, true)) - return focusInvalidField(index, 'FieldClassName'); + $scope.tableGroupItemSave = function (field, groupIndex, index) { + var groupItemValue = tableGroupItemValue(field, index); + + if (!$common.isValidJavaClass('Group field', groupItemValue.className, true)) + return focusInvalidField(index, 'ClassName'); var fields = $scope.backupItem.groups[groupIndex].fields; if ($common.isDefined(fields)) { var idx = _.findIndex(fields, function (field) { - return field.name == fieldName; + return field.name == groupItemValue.name; }); // Found duplicate. @@ -670,30 +687,22 @@ controlCenterModule.controller('metadataController', [ } } - return true; - } - - $scope.tableGroupItemSave = function (fieldName, className, direction, groupIndex, index) { - if (tableGroupItemValid(fieldName, className, groupIndex, index)) { - $table.tableReset(); - - var group = $scope.backupItem.groups[groupIndex]; + $table.tableReset(); - if (index < 0) { - var newGroupItem = {name: fieldName, className: className, direction: direction}; + var group = $scope.backupItem.groups[groupIndex]; - if (group.fields) - group.fields.push(newGroupItem); - else - group.fields = [newGroupItem]; - } - else { - var groupItem = group.fields[index]; + if (index < 0) { + if (group.fields) + group.fields.push(groupItemValue); + else + group.fields = [groupItemValue]; + } + else { + var groupItem = group.fields[index]; - groupItem.name = fieldName; - groupItem.className = className; - groupItem.direction = direction; - } + groupItem.name = groupItemValue.name; + groupItem.className = groupItemValue.className; + groupItem.direction = groupItemValue.direction; } }; @@ -702,52 +711,5 @@ controlCenterModule.controller('metadataController', [ group.fields.splice(index, 1); }; - - //$scope.selectSchema = function (idx) { - // var data = $scope.data; - // var tables = data.tables; - // var schemaName = tables[idx].schemaName; - // var use = tables[idx].use; - // - // for (var i = idx + 1; i < tables.length; i++) { - // var item = tables[i]; - // - // if (item.schemaName == schemaName && item.tableName) - // item.use = use; - // else - // break; - // } - // - // data.curTableIdx = -1; - // data.curFieldIdx = -1; - //}; - - //$scope.selectTable = function (idx) { - // var data = $scope.data; - // - // data.curTableIdx = idx; - // data.curFieldIdx = -1; - // - // if (idx >= 0) { - // var tbl = data.tables[idx]; - // - // data.curKeyClass = tbl.keyClass; - // data.curValueClass = tbl.valueClass; - // } - //}; - // - //$scope.selectField = function (idx) { - // var data = $scope.data; - // - // data.curFieldIdx = idx; - // - // if (idx >= 0) { - // var fld = data.tables[data.curTableIdx].fields[idx]; - // - // data.curJavaName = fld.javaName; - // data.curJavaType = fld.javaType; - // } - //}; }] -) -; +); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/modules/control-center-web/src/main/js/controllers/models/clusters.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json index 31e5553..399d3e9 100644 --- a/modules/control-center-web/src/main/js/controllers/models/clusters.json +++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json @@ -62,6 +62,7 @@ "expanded": true, "fields": [ { + "label": "Addresses", "type": "table-simple", "path": "discovery.Vm", "model": "addresses", @@ -71,7 +72,7 @@ "focusId": "IpAddress", "addTip": "Add new address.", "removeTip": "Remove address.", - "tip": [ + "tableTip": [ "Addresses may be represented as follows:", "<ul>", " <li>IP address (e.g. 127.0.0.1, 9.9.9.9, etc);</li>", @@ -214,8 +215,7 @@ }, { "label": "Regions", - "ui": "table-simple", - "type": "table-simple-with-border", + "type": "table-simple", "path": "discovery.Cloud", "model": "regions", "placeholder": "Region name", @@ -234,7 +234,7 @@ { "label": "Zones", "ui": "table-simple", - "type": "table-simple-with-border", + "type": "table-simple", "path": "discovery.Cloud", "model": "zones", "placeholder": "Zone name", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9fd2676/modules/control-center-web/src/main/js/views/includes/controls.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade index 72167ba..648edc9 100644 --- a/modules/control-center-web/src/main/js/views/includes/controls.jade +++ b/modules/control-center-web/src/main/js/views/includes/controls.jade @@ -46,8 +46,8 @@ mixin group-tip(lines) mixin group-btn-add(click, tip) i.group-legend-btn.fa.fa-plus(ng-click=click bs-tooltip=tip) -mixin btn-add2(click, tip, focusId) - i.tipField.fa.fa-plus(ng-click=click bs-tooltip=tip event-focus=focusId) +mixin btn-add(click, tip) + i.tipField.fa.fa-plus(ng-click=click bs-tooltip=tip) mixin btn-remove(click, tip) i.tipField.fa.fa-remove(ng-click=click bs-tooltip=tip data-trigger='hover') @@ -129,12 +129,12 @@ mixin details-row +tipField('detail.tip') .input-tip input.form-control(type='text' placeholder='{{::detail.placeholder}}')&attributes(detailCommon) - div(ng-switch-when='number' ) + div(ng-switch-when='number') label(class=lblDetailClasses ng-class='{required: detail.required}') {{::detail.label}}: .col-sm-8 +tipField('detail.tip') .input-tip - input.form-control(type='number' placeholder='{{::detail.placeholder}}' min='{{detail.min ? detail.min : 0}}' max='{{detail.max ? detail.max : Number.MAX_VALUE}}')&attributes(detailCommon) + 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) +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.') @@ -150,56 +150,36 @@ mixin details-row +tipField('detail.tip') .input-tip button.form-control(bs-select data-multiple='1' data-placeholder='{{::detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}')&attributes(detailCommon) - div(ng-switch-when='table-simple')&attributes(detailCommon) - div(ng-if='detail.label') - label {{::detail.label}}: - +tipLabel('detail.tableTip') - table.col-sm-12.links-edit-details(st-table='#{detailMdl}') - tbody - tr(ng-repeat='item in #{detailMdl} track by $index') - td - div(ng-show='!tableEditing(detail, $index)') - a.labelFormField(ng-click='tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}} - +btn-remove('tableRemove(backupItem, detail, $index)', 'detail.removeTip') - +btn-down('detail.reordering && tableSimpleDownVisible(backupItem, detail, $index)', 'tableSimpleDown(backupItem, detail, $index)') - +btn-up('detail.reordering && $index > 0', 'tableSimpleUp(backupItem, detail, $index)') - div(ng-if='tableEditing(detail, $index)') - label.labelField {{$index + 1}}) - +btn-save('tableSimpleSaveVisible(detail, index)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, $index)') - .input-tip.form-group.has-feedback - input.form-control(id='cur{{::detail.focusId}}' type='text' ng-model='detail.curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, $index)' on-escape='tableReset()')&attributes(customValidators) - +ico-exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.') - button.btn.btn-primary.fieldButton(ng-disabled='!newValue' ng-click='tableSimpleSave(tableSimpleValid, backupItem, detail, -1)') Add - +tipField('detail.tip') - .input-tip.form-group.has-feedback - input.form-control(id='new{{::detail.focusId}}' type='text' ng-model='detail.newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, field, -1)' on-escape='tableReset()')&attributes(customValidators) - +ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.') - div(ng-switch-when='table-simple-with-border')&attributes(detailCommon) - .group + .section(ng-switch-when='table-simple')&attributes(detailCommon) + .col-sm-12.group .group-legend label {{::detail.label}}: +group-tip('detail.tableTip') - .group-content + +group-btn-add('tableNewItem(detail)', 'detail.addTip') + .group-content-empty(ng-show='!((#{detailMdl} && #{detailMdl}.length > 0) || tableNewItemActive(detail))') + .group-content(ng-show='(#{detailMdl} && #{detailMdl}.length > 0) || tableNewItemActive(detail)') table.col-sm-12.links-edit-details(st-table='#{detailMdl}') tbody tr(ng-repeat='item in #{detailMdl} track by $index') td div(ng-show='!tableEditing(detail, $index)') - a.labelFormField(ng-click='curValue = tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}} + a.labelFormField(ng-click='tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}} +btn-remove('tableRemove(backupItem, detail, $index)', 'detail.removeTip') +btn-down('detail.reordering && tableSimpleDownVisible(backupItem, detail, $index)', 'tableSimpleDown(backupItem, detail, $index)') +btn-up('detail.reordering && $index > 0', 'tableSimpleUp(backupItem, detail, $index)') div(ng-if='tableEditing(detail, $index)') label.labelField {{$index + 1}}) - +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, $index)') + +btn-save('tableSimpleSaveVisible(detail, index)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, $index)') .input-tip.form-group.has-feedback - input.form-control(id='cur{{::detail.focusId}}' type='text' ng-model='detail.curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, $index)' on-escape='tableReset()')&attributes(customValidators) + input.form-control(id='cur{{::detail.focusId}}' name='{{detail.model}}.edit' type='text' ng-model='detail.curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSaveVisible(detail, index) && tableSimpleSave(tableSimpleValid, backupItem, detail, $index)' on-escape='tableReset()')&attributes(customValidators) +ico-exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.') - button.btn.btn-primary.fieldButton(ng-disabled='!newValue' ng-click='tableSimpleSave(tableSimpleValid, backupItem, detail, -1)') Add - +tipField('detail.tip') - .input-tip.form-group.has-feedback - input.form-control(id='new{{::detail.focusId}}' type='text' ng-model='detail.newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, -1)' on-escape='tableReset()')&attributes(customValidators) - +ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.') + tfoot(ng-show='tableNewItemActive(detail)') + tr + td.col-sm-12 + +btn-save('tableSimpleSaveVisible(detail, -1)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, -1)') + .input-tip.form-group.has-feedback + input.form-control(id='new{{::detail.focusId}}' name='{{detail.model}}' type='text' ng-model='detail.newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSaveVisible(detail, -1) && tableSimpleSave(tableSimpleValid, backupItem, detail, -1)' on-escape='tableReset()')&attributes(customValidators) + +ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.') mixin table-db-field-edit(prefix, focusId, index) -var databaseName = prefix + 'DatabaseName' @@ -238,24 +218,31 @@ mixin table-db-field-edit(prefix, focusId, index) .input-tip select.form-control(id=javaTypeId ng-model=javaTypeModel ng-options='item.value as item.label for item in {{javaTypes}}' on-enter=btnVisibleAndSave on-escape='tableReset()') -mixin table-group-item-edit(fieldName, className, direction, index) - -var args = fieldName + ', ' + className - -var btnVisible = 'tableGroupItemSaveVisible(' + args + ')' - -var btnSave = 'tableGroupItemSave(' + args + ', ' + direction + ', groupIndex, ' + index +')' +mixin table-group-item-edit(prefix, index) + -var fieldName = prefix + 'FieldName' + -var className = prefix + 'ClassName' + -var direction = prefix + 'Direction' + + -var fieldNameModel = 'field.' + fieldName + -var classNameModel = 'field.' + className + -var directionModel = 'field.' + direction + + -var btnVisible = 'tableGroupItemSaveVisible(field, ' + index + ')' + -var btnSave = 'tableGroupItemSave(field, groupIndex, ' + index + ')' -var btnVisibleAndSave = btnVisible + ' && ' + btnSave .col-xs-4.col-sm-4.col-md-4 label.fieldSep / .input-tip - input.form-control(id=fieldName enter-focus-next=className type='text' ng-model=fieldName placeholder='Field name' on-escape='tableReset()') + input.form-control(id=fieldName enter-focus-next=className type='text' ng-model=fieldNameModel placeholder='Field name' on-escape='tableReset()') .col-xs-5.col-sm-5.col-md-5 label.fieldSep / .input-tip - input.form-control(id=className enter-focus-next=direction type='text' ng-model=className placeholder='Class name' bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()') + input.form-control(id=className enter-focus-next=direction type='text' ng-model=classNameModel placeholder='Class name' bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()') .col-xs-3.col-sm-3.col-md-3 +btn-save(btnVisible, btnSave) .input-tip - select.form-control(id=direction ng-model=direction ng-options='item.value as item.label for item in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()') + select.form-control(id=direction ng-model=directionModel ng-options='item.value as item.label for item in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()') mixin form-row(dataSource) +form-row-custom(['col-xs-3 col-sm-2 col-md-2'], ['col-xs-6 col-sm-5 col-md-5'], dataSource) @@ -297,7 +284,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) div(class=fieldClasses) +tipField('field.tip') .input-tip - input.form-control(type='number' placeholder='{{::field.placeholder}}' ng-focus='tableReset()' min='{{field.min ? field.min : 0}}' max='{{field.max ? field.max : Number.MAX_VALUE}}')&attributes(fieldCommon) + input.form-control(name='{{field.model}}' type='number' placeholder='{{::field.placeholder}}' ng-focus='tableReset()' min='{{field.min ? field.min : 0}}' max='{{field.max ? field.max : Number.MAX_VALUE}}')&attributes(fieldCommon) +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.') @@ -351,15 +338,15 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) +btn-up('field.reordering && $index > 0', 'tableSimpleUp(backupItem, field, $index)') div(ng-if='tableEditing(field, $index)') label.labelField {{$index + 1}}) - +btn-save('tableSimpleSaveVisible(field)', 'tableSimpleSave(tableSimpleValid, backupItem, field, $index)') + +btn-save('tableSimpleSaveVisible(field, $index)', 'tableSimpleSave(tableSimpleValid, backupItem, field, $index)') .input-tip input.form-control(id='cur{{::field.focusId}}' type='text' ng-model='field.curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field) && tableSimpleSave(tableSimpleValid, backupItem, field, $index)' on-escape='tableReset()') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12 - +btn-save('tableSimpleSaveVisible(field)', 'tableSimpleSave(tableSimpleValid, backupItem, field, -1)') + +btn-save('tableSimpleSaveVisible(field, -1)', 'tableSimpleSave(tableSimpleValid, backupItem, field, -1)') .input-tip - input.form-control(id='new{{::field.focusId}}' type='text' ng-model='field.newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field) && tableSimpleSave(tableSimpleValid, backupItem, field, -1)' on-escape='tableReset()') + input.form-control(id='new{{::field.focusId}}' type='text' ng-model='field.newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field, -1) && tableSimpleSave(tableSimpleValid, backupItem, field, -1)' on-escape='tableReset()') .section(ng-switch-when='indexedTypes') +table-pair('Index key-value type pairs', fieldMdl, 'keyClass', 'valueClass', 'Key class full name', 'Value class full name', true, true) div(ng-switch-when='queryFieldsFirst' ng-hide=fieldHide) @@ -401,29 +388,29 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) .col-sm-12(ng-show='!tableEditing(field, $index)') a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{group.name}} +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') - +btn-add2('tableGroupNewItem($index)', 'field.addItemTip', 'newFieldName') + +btn-add('tableGroupNewItem($index)', 'field.addItemTip') div(ng-if='tableEditing(field, $index)') label.labelField {{$index + 1}}) - +btn-save('tableGroupSaveVisible(curGroupName)', 'tableGroupSave(curGroupName, $index)') + +btn-save('tableGroupSaveVisible(field, $index)', 'tableGroupSave(field, $index)') .input-tip - input#curGroupName.form-control(type='text' ng-model='curGroupName' placeholder='Index name' on-enter='tableGroupSaveVisible(curGroupName) && tableGroupSave(curGroupName, $index)' on-escape='tableReset()') + input#curGroupName.form-control(type='text' ng-model='field.curGroupName' placeholder='Index name' on-enter='tableGroupSaveVisible(field, $index) && tableGroupSave(field, $index)' on-escape='tableReset()') .margin-left-dflt table.links-edit-sub.col-sm-12(st-table='group.fields' ng-init='groupIndex = $index') tbody tr(ng-repeat='groupItem in group.fields') td div(ng-show='!tableGroupItemEditing(groupIndex, $index)') - a.labelFormField(on-click-focus='curFieldName' ng-click='curGroupItem = tableGroupItemStartEdit(groupIndex, $index); curFieldName = curGroupItem.name; curClassName = curGroupItem.className; curDirection = curGroupItem.direction') {{$index + 1}}) {{groupItem.name}} / {{groupItem.className}} / {{groupItem.direction ? "DESC" : "ASC"}} + a.labelFormField(ng-click='tableGroupItemStartEdit(field, groupIndex, $index)') {{$index + 1}}) {{groupItem.name}} / {{groupItem.className}} / {{groupItem.direction ? "DESC" : "ASC"}} +btn-remove('tableRemoveGroupItem(group, $index)', 'field.removeItemTip') div(ng-if='tableGroupItemEditing(groupIndex, $index)') - +table-group-item-edit('curFieldName', 'curClassName', 'curDirection', '$index') + +table-group-item-edit('cur', '$index') tfoot(ng-if='tableGroupNewItemActive(groupIndex)') tr.col-sm-12(style='padding-left: 18px') td - +table-group-item-edit('newFieldName', 'newClassName', 'newDirection', '-1') + +table-group-item-edit('new', '-1') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12 - +btn-save('tableGroupSaveVisible(newGroupName)', 'tableGroupSave(newGroupName, -1)') + +btn-save('tableGroupSaveVisible(field, -1)', 'tableGroupSave(field, -1)') .input-tip - input#newGroupName.form-control(type='text' ng-model='newGroupName' placeholder='Group name' on-enter='tableGroupSaveVisible(newGroupName) && tableGroupSave(newGroupName, -1)' on-escape='tableReset()') + input#newGroupName.form-control(type='text' ng-model='field.newGroupName' placeholder='Group name' on-enter='tableGroupSaveVisible(field, -1) && tableGroupSave(field, -1)' on-escape='tableReset()')