IGNITE-843 Minor ui improvements and cleanup.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/240912dd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/240912dd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/240912dd Branch: refs/heads/ignite-843 Commit: 240912dd2ef8a6789c07ff1fcb1edf30f67a8440 Parents: 6884c06 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Aug 7 18:08:26 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Aug 7 18:08:26 2015 +0700 ---------------------------------------------------------------------- .../main/js/controllers/caches-controller.js | 10 +-- .../main/js/controllers/metadata-controller.js | 23 +++-- .../src/main/js/controllers/models/caches.json | 8 +- .../main/js/controllers/models/clusters.json | 14 ++-- .../main/js/controllers/models/metadata.json | 18 ++-- .../src/main/js/views/configuration/caches.jade | 6 +- .../main/js/views/configuration/clusters.jade | 6 +- .../main/js/views/configuration/metadata.jade | 8 +- .../main/js/views/configuration/summary.jade | 2 +- .../src/main/js/views/includes/controls.jade | 88 ++++++++++---------- 10 files changed, 89 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/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 3469ff8..942fb8e 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 @@ -134,7 +134,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' $scope.tableSimpleValid = function (item, field, fx, index) { if (!$common.isValidJavaClass('SQL function', fx, false)) - return focusInvalidField(index, 'SqlFxField'); + return focusInvalidField(index, 'SqlFx'); var model = item[field.model]; @@ -145,7 +145,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' if (idx >= 0 && idx != index) { $common.showError('SQL function with such class name already exists!'); - return focusInvalidField(index, 'SqlFxField'); + return focusInvalidField(index, 'SqlFx'); } } @@ -154,10 +154,10 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' $scope.tablePairValid = function (item, field, keyCls, valCls, index) { if (!$common.isValidJavaClass('Indexed type key', keyCls, true)) - return focusInvalidField(index, 'IndexedType'); + return focusInvalidField(index, 'KeyIndexedType'); if (!$common.isValidJavaClass('Indexed type value', valCls, true)) - return focusInvalidField(index, 'IndexedTypeNext'); + return focusInvalidField(index, 'ValueIndexedType'); var model = item[field.model]; @@ -170,7 +170,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' if (idx >= 0 && idx != index) { $common.showError('Indexed type with such key class already exists!'); - return focusInvalidField(index, 'IndexedType'); + return focusInvalidField(index, 'KeyIndexedType'); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/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 64ec7d2..15c48a1 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 @@ -564,7 +564,7 @@ controlCenterModule.controller('metadataController', [ if (pairField) { if (!$common.isValidJavaClass(pairField.msg, clsName, true)) - return focusInvalidField(index, pairField.id + 'Next'); + return focusInvalidField(index, 'Value' + pairField.id); var model = item[field.model]; @@ -577,7 +577,7 @@ controlCenterModule.controller('metadataController', [ if (idx >= 0 && idx != index) { $common.showError('Field with such name already exists!'); - return focusInvalidField(index, pairField.id); + return focusInvalidField(index, 'Key' + pairField.id); } } } @@ -611,7 +611,7 @@ controlCenterModule.controller('metadataController', [ }; if (!$common.isValidJavaIdentifier(dbField.msg + ' java name', newJavaName)) - return focusInvalidField(index, dbField.id + 'Next'); + return focusInvalidField(index, 'JavaName' + dbField.id); if ($common.isDefined(model)) { var idx = _.findIndex(model, function (dbMeta) { @@ -620,9 +620,20 @@ controlCenterModule.controller('metadataController', [ // Found duplicate. if (idx >= 0 && index != idx) { - $common.showError('DB field with such name already exists!'); + $common.showError('Field with such database name already exists!'); - return focusInvalidField(index, dbField.id); + return focusInvalidField(index, 'DatabaseName' + dbField.id); + } + + idx = _.findIndex(model, function (dbMeta) { + return dbMeta.javaName == newJavaName + }); + + // Found duplicate. + if (idx >= 0 && index != idx) { + $common.showError('Field with such java name already exists!'); + + return focusInvalidField(index, 'JavaName' + dbField.id); } if (index < 0) { @@ -738,7 +749,7 @@ controlCenterModule.controller('metadataController', [ function tableGroupItemValid(fieldName, className, groupIndex, index) { if (!$common.isValidJavaClass('Group field', className, true)) - return focusInvalidField(index, 'FieldNameNext'); + return focusInvalidField(index, 'FieldClassName'); var fields = $scope.backupItem.groups[groupIndex].fields; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/models/caches.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json index 09f668e..9d74986 100644 --- a/modules/control-center-web/src/main/js/controllers/models/caches.json +++ b/modules/control-center-web/src/main/js/controllers/models/caches.json @@ -387,8 +387,7 @@ "model": "indexedTypes", "keyName": "keyClass", "valueName": "valueClass", - "focusNewItemId": "newIndexedType", - "focusCurItemId": "curIndexedType", + "focusId": "IndexedType", "addTip": "Add new key and value classes to indexed types.", "removeTip": "Remove item from indexed types.", "tip": [ @@ -399,10 +398,8 @@ "label": "SQL functions", "type": "table-simple", "model": "sqlFunctionClasses", - "editIdx": -1, "placeholder": "SQL function full class name", - "focusNewItemId": "newSqlFxField", - "focusCurItemId": "curSqlFxField", + "focusId": "SqlFx", "addTip": "Add new user-defined functions for SQL queries.", "removeTip": "Remove user-defined function.", "tableTip": [ @@ -844,7 +841,6 @@ "type": "table-simple", "path": "cacheStoreFactory.CacheHibernateBlobStoreFactory", "model": "hibernateProperties", - "editIdx": -1, "placeholder": "key=value", "addTip": "Add new Hibernate property.", "removeTip": "Remove Hibernate property.", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/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 e95990d..0da0f58 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 @@ -65,12 +65,10 @@ "type": "table-simple", "path": "discovery.Vm", "model": "addresses", - "editIdx": -1, "reordering": true, "ipaddress": true, "placeholder": "IP address:port", - "focusNewItemId": "newIpAddress", - "focusCurItemId": "curIpAddress", + "focusId": "IpAddress", "addTip": "Add new address.", "removeTip": "Remove address.", "tip": [ @@ -219,9 +217,8 @@ "type": "table-simple", "path": "discovery.Cloud", "model": "regions", - "editIdx": -1, - "focusNewItemId": "newRegion", - "focusCurItemId": "curRegion", + "placeholder": "Region name", + "focusId": "Region", "addTip": "Add new region.", "removeTip": "Remove region.", "tableTip": [ @@ -238,9 +235,8 @@ "type": "table-simple", "path": "discovery.Cloud", "model": "zones", - "editIdx": -1, - "focusNewItemId": "newZone", - "focusCurItemId": "curZone", + "placeholder": "Zone name", + "focusId": "Zone", "addTip": "Add new zone.", "removeTip": "Remove zone.", "tableTip": [ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/models/metadata.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/metadata.json b/modules/control-center-web/src/main/js/controllers/models/metadata.json index 84ad9e4..ee73c11 100644 --- a/modules/control-center-web/src/main/js/controllers/models/metadata.json +++ b/modules/control-center-web/src/main/js/controllers/models/metadata.json @@ -95,8 +95,7 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind == 'query' || isJavaBuildInClass()", - "focusNewItemId": "newKeyField", - "focusCurItemId": "curKeyField", + "focusId": "KeyField", "addTip": "Add key field.", "removeTip": "Remove key field.", "tip": [ @@ -110,8 +109,7 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind != 'both' && backupItem.kind == 'query'", - "focusNewItemId": "newValueField", - "focusCurItemId": "curValueField", + "focusId": "ValueField", "addTip": "Add value field.", "removeTip": "Remove value field.", "tip": [ @@ -125,8 +123,7 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind == 'store'", - "focusNewItemId": "newQryField", - "focusCurItemId": "curQryField", + "focusId": "QryField", "addTip": "Add field to query.", "removeTip": "Remove field.", "tip": [ @@ -140,8 +137,7 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind == 'store'", - "focusNewItemId": "newAscField", - "focusCurItemId": "curAscField", + "focusId": "AscField", "addTip": "Add field to index in ascending order.", "removeTip": "Remove field.", "tip": [ @@ -155,8 +151,7 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind == 'store'", - "focusNewItemId": "newDescField", - "focusCurItemId": "curDescField", + "focusId": "DescField", "addTip": "Add field to index in descending order.", "removeTip": "Remove field.", "tip": [ @@ -169,8 +164,7 @@ "model": "textFields", "hide": "backupItem.kind == 'store'", "placeholder": "Field name", - "focusNewItemId": "newTextField", - "focusCurItemId": "curTextField", + "focusId": "TextField", "addTip": "Add field to index as text.", "removeTip": "Remove field.", "tableTip": [ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/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 4aeb740..92f98d0 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 @@ -33,7 +33,7 @@ block content table.links(st-table='caches') tbody tr(ng-repeat='row in caches track by row._id') - td.col-sm-6(ng-class='{active: row._id == selectedItem._id}') + td(ng-class='{active: row._id == selectedItem._id}') a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}, {{row.atomicityMode | displayValue:atomicities:'Cache atomicity not set'}} .padding-top-dflt button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='createItem()') Add cache @@ -47,7 +47,7 @@ block content .panel-collapse(bs-collapse-target) .panel-body .settings-row(ng-repeat='field in general') - +form-row(['col-sm-3'], ['col-sm-3']) + +form-row(['col-sm-3'], ['col-sm-3'], 'backupItem') .panel-group(bs-collapse data-allow-multiple='true') div(bs-collapse data-start-collapsed='true') .panel-title(ng-show='expanded') @@ -65,7 +65,7 @@ block content .panel-collapse(bs-collapse-target) .panel-body .settings-row(ng-repeat='field in group.fields') - +form-row + +form-row('backupItem') .panel-title h3 i.fa.fa-chevron-circle-up(ng-show='expanded' ng-click='expanded = !expanded') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/clusters.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/clusters.jade b/modules/control-center-web/src/main/js/views/configuration/clusters.jade index c9e4397..d2e05ce 100644 --- a/modules/control-center-web/src/main/js/views/configuration/clusters.jade +++ b/modules/control-center-web/src/main/js/views/configuration/clusters.jade @@ -33,7 +33,7 @@ block content table.links(st-table='clusters') tbody tr(ng-repeat='row in clusters track by row._id') - td.col-sm-6(ng-class='{active: row._id == selectedItem._id}') + td(ng-class='{active: row._id == selectedItem._id}') a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.discovery.kind | displayValue:discoveries:'Discovery not set'}} .padding-top-dflt button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='createItem()')  Add cluster @@ -50,7 +50,7 @@ block content .panel-collapse(bs-collapse-target) .panel-body .settings-row(ng-repeat='field in general') - +form-row + +form-row('backupItem') .panel-group(bs-collapse data-allow-multiple='true') div(bs-collapse data-start-collapsed='true') .panel-title(ng-show='expanded') @@ -68,7 +68,7 @@ block content .panel-collapse(bs-collapse-target) .panel-body .settings-row(ng-repeat='field in group.fields') - +form-row + +form-row('backupItem') .panel-title h3 i.fa.fa-chevron-circle-up(ng-show='expanded' ng-click='expanded = !expanded') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/metadata.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata.jade b/modules/control-center-web/src/main/js/views/configuration/metadata.jade index 0c90085..1ee1312 100644 --- a/modules/control-center-web/src/main/js/views/configuration/metadata.jade +++ b/modules/control-center-web/src/main/js/views/configuration/metadata.jade @@ -33,7 +33,7 @@ block content table.links(st-table='metadatas') tbody tr(ng-repeat='row in metadatas track by row._id') - td.col-sm-6(ng-class='{active: row._id == selectedItem._id}') + td(ng-class='{active: row._id == selectedItem._id}') a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}} .padding-top-dflt button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='panels.activePanel = [0]; createItem()')  Add metadata @@ -50,7 +50,7 @@ block content .panel-body form.form-horizontal(name='manualForm' ng-if='backupItem' novalidate) .settings-row(ng-repeat='field in metadataManual') - +form-row + +form-row('backupItem') button.btn.btn-primary(ng-disabled='manualForm.$invalid' ng-click='saveItem()') Save button.btn.btn-primary(ng-show='backupItem._id' ng-disabled='inputForm.$invalid' ng-click='saveItemAs()') Copy button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()') Remove @@ -62,12 +62,12 @@ block content .panel-body form.form-horizontal(name='dbForm' novalidate) .settings-row(ng-repeat='field in metadataDb') - +form-row + +form-row('backupItem') div(ng-hide='tables.length == 0') table.links(st-table='tables') tbody tr(ng-repeat='row in tables') - td.col-sm-6 + td a {{$index + 1}}) {{::row.schemaName}} / {{::row.tableName}} button.btn.btn-primary(ng-disabled='dbForm.$invalid' ng-click='saveItem()') Save button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()') Remove http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/summary.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/summary.jade b/modules/control-center-web/src/main/js/views/configuration/summary.jade index 07e177e..d9c5ebc 100644 --- a/modules/control-center-web/src/main/js/views/configuration/summary.jade +++ b/modules/control-center-web/src/main/js/views/configuration/summary.jade @@ -46,7 +46,7 @@ block content table.links(st-table='clusters') tbody tr(ng-repeat='row in clusters track by row._id') - td.col-sm-6(ng-class='{active: row._id == selectedItem._id}') + td(ng-class='{active: row._id == selectedItem._id}') a(ng-click='selectItem(row)') {{$index + 1}}) {{row.name}} div(ng-show='selectedItem' role='tab' method='post' action='summary/download') .padding-dflt(bs-collapse data-start-collapsed='false') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/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 3f4cd49..69564df 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 @@ -53,15 +53,16 @@ mixin btn-down(show, click) i.tipField.fa.fa-arrow-down(ng-show=show ng-click=click bs-tooltip data-title='Move item down') mixin table-pair-edit(keyModel, valModel, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, focusId, index) - -var focusIdNext = focusId + 'Next' + -var focusIdKey = keyModel + focusId + -var focusIdVal = valModel + focusId .col-sm-6 label.fieldSep / .input-tip if keyJavaBuildInTypes - input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()') + input.form-control(id=focusIdKey enter-focus-next enter-focus-next-id=focusIdVal type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()') else - input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()') + input.form-control(id=focusIdKey enter-focus-next enter-focus-next-id=focusIdVal type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()') .col-sm-6 -var arg = keyModel + ', ' + valModel -var btnVisible = 'tablePairSaveVisible(' + arg + ')' @@ -71,29 +72,29 @@ mixin table-pair-edit(keyModel, valModel, keyPlaceholder, valPlaceholder, keyJav +btn-save(btnVisible, btnSave) .input-tip if valueJavaBuildInTypes - input.form-control(id=focusIdNext type='text' ng-model=valModel placeholder=valPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-enter=btnVisibleAndSave on-escape='tableReset()') + input.form-control(id=focusIdVal type='text' ng-model=valModel placeholder=valPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-enter=btnVisibleAndSave on-escape='tableReset()') else - input.form-control(id=focusIdNext type='text' ng-model=valModel placeholder=valPlaceholder on-enter=btnVisibleAndSave on-escape='tableReset()') + input.form-control(id=focusIdVal type='text' ng-model=valModel placeholder=valPlaceholder on-enter=btnVisibleAndSave on-escape='tableReset()') mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes) - .col-sm-6 + .col-sm-7 label.table-header #{header}: +tipLabel('field.tip') - +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}') + +btn-add('tableNewItem(field)', 'field.addTip', 'newKey{{::field.focusId}}') .table-details(ng-show='(#{tblMdl} && #{tblMdl}.length > 0) || tableNewItemActive(field)') table.links-edit.col-sm-12(st-table=tblMdl) tbody tr(ng-repeat='item in #{tblMdl}') td.col-sm-12 div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curPair = tableStartEdit(backupItem, field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}} + a.labelFormField(event-focus='click' event-focus-id='curKey{{::field.focusId}}' ng-click='curPair = tableStartEdit(backupItem, field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}} +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') div(ng-if='tableEditing(field, $index)') - +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusCurItemId}}', '$index') + +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '$index') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12 - +table-pair-edit('newKey', 'newValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusNewItemId}}', '-1') + +table-pair-edit('newKey', 'newValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '-1') mixin details-row - var lblDetailClasses = ['col-sm-4', 'details-label'] @@ -147,7 +148,7 @@ mixin details-row tr(ng-repeat='item in #{detailMdl} track by $index') td div(ng-show='!tableEditing(detail, $index)') - a.labelFormField(event-focus='click' event-focus-id='{{::detail.focusCurItemId}}' ng-click='curValue = tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}} + a.labelFormField(event-focus='click' event-focus-id='cur{{::detail.focusId}}' ng-click='curValue = 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)') @@ -155,41 +156,38 @@ mixin details-row label.labelField {{$index + 1}}) +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)') .input-tip.form-group.has-feedback - input.form-control(id='{{::detail.focusCurItemId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)' on-escape='tableReset()')&attributes(customValidators) + input.form-control(id='cur{{::detail.focusId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $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, newValue, -1)') Add +tipField('detail.tip') .input-tip.form-group.has-feedback - input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)' on-escape='tableReset()')&attributes(customValidators) + input.form-control(id='new{{::detail.focusId}}' name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)' on-escape='tableReset()')&attributes(customValidators) +ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.') -mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, focusId, index) - -var focusIdNext = focusId + 'Next' - +mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, index) .col-sm-3 label.fieldSep / .input-tip - input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=databaseName placeholder='DB name' on-escape='tableReset()') + input.form-control(id=databaseName enter-focus-next enter-focus-next-id=databaseType type='text' ng-model=databaseName placeholder='DB name' on-escape='tableReset()') .col-sm-3 label.fieldSep / .input-tip - button.form-control(ng-model=databaseType bs-select data-placeholder='JDBC type' bs-options='item.value as item.label for item in {{jdbcTypes}}') + select.form-control(id=databaseType enter-focus-next enter-focus-next-id=javaName ng-model=databaseType ng-options='item.value as item.label for item in {{jdbcTypes}}' on-escape='tableReset()') .col-sm-3 label.fieldSep / .input-tip - input.form-control(id=focusIdNext type='text' ng-model=javaName placeholder='Java name' on-escape='tableReset()') + input.form-control(id=javaName enter-focus-next enter-focus-next-id=javaType type='text' ng-model=javaName placeholder='Java name' on-escape='tableReset()') .col-sm-3 -var args = databaseName + ', ' + databaseType + ', ' + javaName + ', ' + javaType -var btnVisible = 'tableDbFieldSaveVisible(' + args + ')' -var btnSave = 'tableDbFieldSave(field, ' + args + ', ' + index +')' + -var btnVisibleAndSave = btnVisible + ' && ' + btnSave +btn-save(btnVisible, btnSave) .input-tip - button.form-control(ng-model=javaType bs-select data-placeholder='Java type' bs-options='item.value as item.label for item in {{javaTypes}}') + select.form-control(id=javaType ng-model=javaType 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 focusIdNext = fieldName + 'Next' - -var focusIdNext2 = fieldName + 'Next2' -var args = fieldName + ', ' + className -var btnVisible = 'tableGroupItemSaveVisible(' + args + ')' -var btnSave = 'tableGroupItemSave(' + args + ', ' + direction + ', groupIndex, ' + index +')' @@ -198,18 +196,18 @@ mixin table-group-item-edit(fieldName, className, direction, index) .col-sm-4 label.fieldSep / .input-tip - input.form-control(id=fieldName enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=fieldName placeholder='Field name' on-escape='tableReset()') + input.form-control(id=fieldName enter-focus-next enter-focus-next-id=className type='text' ng-model=fieldName placeholder='Field name' on-escape='tableReset()') .col-sm-5 label.fieldSep / .input-tip - input.form-control(id=focusIdNext enter-focus-next enter-focus-next-id=focusIdNext2 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 enter-focus-next-id=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()') .col-sm-3 +btn-save(btnVisible, btnSave) .input-tip - select.form-control(id=focusIdNext2 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=direction ng-options='item.value as item.label for item in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()') -mixin form-row - +form-row-custom(['col-sm-2'], ['col-sm-4'], 'backupItem') +mixin form-row(dataSource) + +form-row-custom(['col-sm-2'], ['col-sm-5'], dataSource) mixin form-row-custom(lblClasses, fieldClasses, dataSource) - var fieldMdl = 'getModel('+ dataSource + ', field)[field.model]'; @@ -218,9 +216,9 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) - var fieldHide = '{{field.hide}}' div(ng-switch='field.type') - div.col-sm-6(ng-switch-when='label') + div(ng-switch-when='label') label {{::field.label}} - div.checkbox.col-sm-6(ng-switch-when='check' ng-hide=fieldHide) + div.checkbox(ng-switch-when='check' ng-hide=fieldHide) label input(type='checkbox')&attributes(fieldCommon) | {{::field.label}} @@ -280,23 +278,23 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) .input-tip button.form-control(bs-select data-placeholder='{{::field.placeholder}}' bs-options='item.value as item.label for item in {{field.items}}')&attributes(fieldCommon) a.customize(ng-show='#{fieldMdl} && field.details[#{fieldMdl}].fields' ng-click='#{expanded} = !#{expanded}') {{#{expanded} ? "Hide settings" : "Show settings"}} - .col-sm-6.panel-details(ng-show='#{expanded} && #{fieldMdl}') + .col-sm-7.panel-details(ng-show='#{expanded} && #{fieldMdl}') .details-row(ng-repeat='detail in field.details[#{fieldMdl}].fields') +details-row div(ng-switch-when='table-simple' ng-hide=fieldHide)&attributes(fieldCommon) - .col-sm-6 + .col-sm-7 label.table-header {{::field.label}}: +tipLabel('field.tableTip') - +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}') + +btn-add('tableNewItem(field)', 'field.addTip', 'new{{::field.focusId}}') .col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') - .col-sm-6 + .col-sm-7 .table-details table.links-edit.col-sm-12(st-table='#{fieldMdl}') tbody tr(ng-repeat='item in #{fieldMdl} track by $index') td.col-sm-12 div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curValue = tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{item | compact}} + a.labelFormField(event-focus='click' event-focus-id='cur{{::field.focusId}}' ng-click='curValue = tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{item | compact}} +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') +btn-down('field.reordering && tableSimpleDownVisible(backupItem, field, $index)', 'tableSimpleDown(backupItem, field, $index)') +btn-up('field.reordering && $index > 0', 'tableSimpleUp(backupItem, field, $index)') @@ -304,45 +302,45 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) label.labelField {{$index + 1}}) +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)') .input-tip - input.form-control(id='{{::field.focusCurItemId}}' type='text' ng-model='curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(curValue) && tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)' on-escape='tableReset()') + input.form-control(id='cur{{::field.focusId}}' type='text' ng-model='curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(curValue) && tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)' on-escape='tableReset()') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12 +btn-save('tableSimpleSaveVisible(newValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)') .input-tip - input.form-control(id='{{::field.focusNewItemId}}' type='text' ng-model='newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(newValue) && tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)' on-escape='tableReset()') + input.form-control(id='new{{::field.focusId}}' type='text' ng-model='newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(newValue) && tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)' on-escape='tableReset()') div(ng-switch-when='indexedTypes') +table-pair('Index key-value type pairs', fieldMdl, 'keyClass', 'valueClass', 'Key class full name', 'Value class full name', true, false) div(ng-switch-when='queryFields' ng-hide=fieldHide) +table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field class full name', false, true) div(ng-switch-when='dbFields' ng-hide=fieldHide) - .col-sm-6 + .col-sm-7 label.table-header {{::field.label}}: +tipLabel('field.tip') - +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}') + +btn-add('tableNewItem(field)', 'field.addTip', 'newDatabaseName{{::field.focusId}}') .col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') - .col-sm-6 + .col-sm-7 .table-details table.links-edit.col-sm-12(st-table=fieldMdl) tbody tr(ng-repeat='item in #{fieldMdl}') td.col-sm-12 div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curField = tableStartEdit(backupItem, field, $index); curDatabaseName = curField.databaseName; curDatabaseType = curField.databaseType; curJavaName = curField.javaName; curJavaType = curField.javaType') {{$index + 1}}) {{item.databaseName}} / {{item.databaseType}} / {{item.javaName}} / {{item.javaType}} + a.labelFormField(event-focus='click' event-focus-id='curDatabaseName' ng-click='curField = tableStartEdit(backupItem, field, $index); curDatabaseName = curField.databaseName; curDatabaseType = curField.databaseType; curJavaName = curField.javaName; curJavaType = curField.javaType') {{$index + 1}}) {{item.databaseName}} / {{item.databaseType}} / {{item.javaName}} / {{item.javaType}} +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') div(ng-if='tableEditing(field, $index)') - +table-db-field-edit('curDatabaseName', 'curDatabaseType', 'curJavaName', 'curJavaType', '{{::field.focusCurItemId}}', '$index') + +table-db-field-edit('curDatabaseName', 'curDatabaseType', 'curJavaName', 'curJavaType', '$index') tfoot(ng-show='tableNewItemActive(field)') tr - td.col-sm-12 - +table-db-field-edit('newDatabaseName', 'newDatabaseType', 'newJavaName', 'newJavaType', '{{::field.focusNewItemId}}', '-1') + td.col-sm-12(ng-init='newDatabaseType="INTEGER"; newJavaType="Integer"') + +table-db-field-edit('newDatabaseName', 'newDatabaseType', 'newJavaName', 'newJavaType', '-1') div(ng-switch-when='queryGroups' ng-hide=fieldHide) - .col-sm-6 + .col-sm-7 label.table-header {{::field.label}}: +tipLabel('field.tip') +btn-add('tableNewItem(field)', 'field.addTip', 'newGroupName') .col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') - .col-sm-6 + .col-sm-7 .table-details table.links-edit.col-sm-12(st-table=fieldMdl ng-init='newDirection = false') tbody