Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 d119b714b -> fe0507955
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/fe050795 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fe050795 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fe050795 Branch: refs/heads/ignite-843 Commit: fe05079550157b0ed3b01450cfcc5c0a7035c789 Parents: d119b71 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed Aug 12 17:38:28 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed Aug 12 17:38:28 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/common-module.js | 94 +++++++-- .../main/js/controllers/metadata-controller.js | 12 +- .../src/main/js/controllers/models/caches.json | 1 + .../main/js/controllers/models/clusters.json | 2 + .../main/js/controllers/models/metadata.json | 9 +- .../src/main/js/public/stylesheets/style.scss | 22 +- .../src/main/js/views/configuration/caches.jade | 4 +- .../main/js/views/configuration/clusters.jade | 4 +- .../main/js/views/configuration/metadata.jade | 4 +- .../src/main/js/views/includes/controls.jade | 203 ++++++++++--------- .../src/main/js/views/login.jade | 8 +- 11 files changed, 229 insertions(+), 134 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 6b95291..3aa17b0 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 @@ -516,14 +516,63 @@ controlCenterModule.service('$table', [ table.editIndex = editIndex; } + function _tableUI(field) { + var ui = field.ui; + + return ui ? ui : field.type; + } + + function _tableFocus(focusId, index) { + $focus((index < 0 ? 'new' : 'cur') + focusId); + } + function _tableStartEdit(item, field, index) { _tableState(field.model, index); - return _model(item, field)[field.model][index]; + var val = _model(item, field)[field.model][index]; + + var ui = _tableUI(field); + + if (ui == 'table-simple') { + field.curValue = val; + + _tableFocus(field.focusId, index); + } + else if (ui == 'table-pair') { + field.curKey = val[field.keyName]; + field.curValue = val[field.valueName]; + + _tableFocus('Key' + field.focusId, index); + } + else if (ui == 'table-db-fields') { + field.curDatabaseName = val.databaseName; + field.curDatabaseType = val.databaseType; + field.curJavaName = val.javaName; + field.curJavaType = val.javaType; + + _tableFocus('DatabaseName' + field.focusId, index); + } + else if (ui == 'table-query-groups') { + field.curGroupName = val.name; + field.curFields = val.fields; + + _tableFocus('GroupName', index); + } } function _tableNewItem(field) { _tableState(field.model, -1); + + var ui = _tableUI(field); + + if (ui == 'table-simple') + _tableFocus(field.focusId, -1); + else if (ui == 'table-pair') + _tableFocus('Key' + field.focusId, -1); + else if (ui == 'table-db-fields') + _tableFocus('DatabaseName' + field.focusId, -1); + else if (ui == 'table-query-groups') + _tableFocus('GroupName', -1); } return { @@ -546,18 +595,30 @@ controlCenterModule.service('$table', [ _model(item, field)[field.model].splice(index, 1); }, - tableSimpleSave: function (valueValid, item, field, newValue, index) { - if (valueValid(item, field, newValue, index)) { + tableSimpleSave: function (valueValid, item, field, index) { + var simpleValue = index < 0 ? field.newValue : field.curValue; + + if (valueValid(item, field, simpleValue, index)) { _tableReset(); if (index < 0) { if (_model(item, field)[field.model]) - _model(item, field)[field.model].push(newValue); + _model(item, field)[field.model].push(simpleValue); else - _model(item, field)[field.model] = [newValue]; + _model(item, field)[field.model] = [simpleValue]; + + _tableNewItem(field); + } + else { + var arr = _model(item, field)[field.model]; + + arr[index] = simpleValue; + + if (index < arr.length - 1) + _tableStartEdit(item, field, index + 1); + else + _tableNewItem(field); } - else - _model(item, field)[field.model][index] = newValue; } }, tableSimpleSaveVisible: function (newValue) { @@ -590,8 +651,6 @@ controlCenterModule.service('$table', [ item[field.model] = [pair]; _tableNewItem(field); - - $focus('newKey' + field.focusId); } else { pair = item[field.model][index]; @@ -599,17 +658,10 @@ controlCenterModule.service('$table', [ 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 { + if (index < item[field.model].length - 1) + _tableStartEdit(item, field, index + 1); + else _tableNewItem(field); - - $focus('newKey' + field.focusId); - } } } }, @@ -787,10 +839,10 @@ controlCenterModule.directive('enterFocusNext', function ($focus) { }); // Directive to mark elements to focus. -controlCenterModule.directive('eventFocus', function ($focus) { +controlCenterModule.directive('onClickFocus', function ($focus) { return function (scope, elem, attr) { elem.on('click', function () { - $focus(attr.eventFocus); + $focus(attr.onClickFocus); }); // Removes bound events in the element itself when the scope is destroyed http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 1e146ef..dcfd5e4 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 @@ -35,6 +35,7 @@ controlCenterModule.controller('metadataController', [ $scope.tableSimpleDown = $table.tableSimpleDown; $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible; + $scope.tablePairStartEdit = $table.tablePairStartEdit; $scope.tablePairSave = $table.tablePairSave; $scope.tablePairSaveVisible = $table.tablePairSaveVisible; @@ -480,7 +481,14 @@ controlCenterModule.controller('metadataController', [ return true; }; - $scope.tableDbFieldSaveVisible = function (databaseName, databaseType, javaName, javaType) { + $scope.tableDbFieldSaveVisible = function (field, index) { + var isNew = index < 0; + + var databaseName = isNew ? field.newDatabaseName : field.curDatabaseName; + var databaseType = isNew ? field.newDatabaseType : field.curDatabaseType; + 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); }; @@ -490,7 +498,7 @@ controlCenterModule.controller('metadataController', [ valueFields: {msg: 'Value field', id: 'ValueField'} }; - $scope.tableDbFieldSave = function (field, newDatabaseName, newDatabaseType, newJavaName, newJavaType, index) { + $scope.tableDbFieldSave = function (field, index) { var dbField = dbFields[field.model]; if (dbField) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 9d74986..7561d7b 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 @@ -383,6 +383,7 @@ } } , { + "ui": "table-pair", "type": "indexedTypes", "model": "indexedTypes", "keyName": "keyClass", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 21012f7..31e5553 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 @@ -214,6 +214,7 @@ }, { "label": "Regions", + "ui": "table-simple", "type": "table-simple-with-border", "path": "discovery.Cloud", "model": "regions", @@ -232,6 +233,7 @@ }, { "label": "Zones", + "ui": "table-simple", "type": "table-simple-with-border", "path": "discovery.Cloud", "model": "zones", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 63b2202..13cc2ec 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 @@ -68,6 +68,7 @@ "fields": [ { "label": "Not indexed fields", + "ui": "table-pair", "type": "queryFieldsFirst", "model": "queryFields", "keyName": "name", @@ -81,6 +82,7 @@ }, { "label": "Ascending indexed fields", + "ui": "table-pair", "type": "queryFields", "model": "ascendingFields", "keyName": "name", @@ -94,6 +96,7 @@ }, { "label": "Descending indexed fields", + "ui": "table-pair", "type": "queryFields", "model": "descendingFields", "keyName": "name", @@ -122,7 +125,7 @@ }, { "label": "Group indexes", - "type": "queryGroups", + "type": "table-query-groups", "model": "groups", "addTip": "Add new group.", "removeTip": "Remove group.", @@ -158,7 +161,7 @@ }, { "label": "Key fields", - "type": "dbFields", + "type": "table-db-fields", "model": "keyFields", "keyName": "name", "valueName": "className", @@ -172,7 +175,7 @@ }, { "label": "Value fields", - "type": "dbFields", + "type": "table-db-fields", "model": "valueFields", "keyName": "name", "valueName": "className", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/modules/control-center-web/src/main/js/public/stylesheets/style.scss ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss index 447122d..d761ef1 100644 --- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss +++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss @@ -867,34 +867,46 @@ button .caret, .btn .caret { padding-right: 5px; } -.fieldset { +.group { border-radius: 5px; border: thin dotted lightgrey; text-align: left; } -.legend { +.group-legend { top: -10px; margin-left: 10px; - margin-right: 10px; + margin-right: 5px; overflow: visible; position: relative; label { + padding: 0 5px 0 5px; background: white; } } -.legend-btn { +.group-legend-tip { + background: white; + padding-right: 5px; +} + +.group-legend-btn { + background: white; float: right; line-height: 20px; + padding: 0 5px 0 5px; } -.fieldset-content { +.group-content { margin: 0 10px 10px 10px; } +.group-content-empty { + padding-top: 10px; +} + .tooltip.right .tooltip-arrow { border-right-color: $ignite-red; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 197b3d6..49d20ed 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 @@ -34,9 +34,9 @@ block content tbody tr(ng-repeat='row in caches track by row._id') td(ng-class='{active: row._id == selectedItem._id}') - a(event-focus='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'}} + a(on-click-focus='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='defaultFocusId' ng-click='createItem()') Add cache + button.btn.btn-primary(on-click-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') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 3d210ed..2b30afd 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 @@ -34,9 +34,9 @@ block content tbody tr(ng-repeat='row in clusters track by row._id') td(ng-class='{active: row._id == selectedItem._id}') - a(event-focus='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.discovery.kind | displayValue:discoveries:'Discovery not set'}} + a(on-click-focus='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='defaultFocusId' ng-click='createItem()') Add cluster + button.btn.btn-primary(on-click-focus='defaultFocusId' ng-click='createItem()') Add cluster label(style='margin-left: 10px; margin-right: 10px') Use template: select.form-control.line-control(ng-model='template' ng-options='item.value as item.label for item in templates') i.tipLabel.fa.fa-question-circle(bs-tooltip data-title='{{joinTip(templateTip)}}' type='button') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 a5ad39a..57d73d1 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 @@ -34,9 +34,9 @@ block content tbody tr(ng-repeat='row in metadatas track by row._id') td(ng-class='{active: row._id == selectedItem._id}') - a(event-focus='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}} + a(on-click-focus='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}} .padding-top-dflt - button.btn.btn-primary(ng-click='createItem()' event-focus='defaultFocusId') Add metadata + button.btn.btn-primary(ng-click='createItem()' on-click-focus='defaultFocusId') Add metadata button.btn.btn-primary(ng-click='showLoadMetadataModal()') Load from database hr form.form-horizontal(name='inputForm' ng-if='backupItem' novalidate) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/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 86db992..5c97418 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 @@ -40,8 +40,11 @@ mixin ico-exclamation(mdl, err, msg) mixin btn-save(show, click) i.tipField.fa.fa-floppy-o(ng-show=show ng-click=click bs-tooltip data-title='Save item' data-trigger='hover') -mixin btn-add(click, tip, focusId) - i.legend-btn.fa.fa-plus(ng-click=click bs-tooltip=tip event-focus=focusId) +mixin group-tip(lines) + i.group-legend-tip.fa.fa-question-circle(ng-if=lines bs-tooltip='joinTip(#{lines})' type='button') + +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) @@ -55,50 +58,54 @@ mixin btn-up(show, click) 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 focusIdKey = keyModel + focusId - -var focusIdVal = valModel + focusId +mixin table-pair-edit(prefix, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, focusId, index) + -var keyModel = 'field.' + prefix + 'Key' + -var valModel = 'field.' + prefix + 'Value' + + -var keyFocusId = prefix + 'Key' + focusId + -var valFocusId = prefix + 'Value' + focusId .col-xs-6.col-sm-6.col-md-6 label.fieldSep / .input-tip if keyJavaBuildInTypes - input.form-control(id=focusIdKey enter-focus-next=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()') + input.form-control(id=keyFocusId enter-focus-next=valFocusId 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=focusIdKey enter-focus-next=focusIdVal type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()') + input.form-control(id=keyFocusId enter-focus-next=valFocusId type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()') .col-xs-6.col-sm-6.col-md-6 -var arg = keyModel + ', ' + valModel - -var btnVisible = 'tablePairSaveVisible(' + arg + ')' - -var btnSave = 'tablePairSave(tablePairValid, backupItem, field, '+ arg +', ' + index + ')' + -var btnVisible = 'tablePairSaveVisible(field)' + -var btnSave = 'tablePairSave(tablePairValid, backupItem, field, ' + index + ')' -var btnVisibleAndSave = btnVisible + ' && ' + btnSave +btn-save(btnVisible, btnSave) .input-tip if valueJavaBuildInTypes - 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()') + input.form-control(id=valFocusId 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=focusIdVal type='text' ng-model=valModel placeholder=valPlaceholder on-enter=btnVisibleAndSave on-escape='tableReset()') + input.form-control(id=valFocusId 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-7.fieldset - .legend + .col-sm-7.group + .group-legend label #{header}: - +tipLabel('field.tip') - +btn-add('tableNewItem(field)', 'field.addTip', 'newKey{{::field.focusId}}') - .fieldset-content(ng-show='(#{tblMdl} && #{tblMdl}.length > 0) || tableNewItemActive(field)') + +group-tip('field.tip') + +group-btn-add('tableNewItem(field)', 'field.addTip') + .group-content-empty(ng-if='!((#{tblMdl} && #{tblMdl}.length > 0) || tableNewItemActive(field))') + .group-content(ng-show='(#{tblMdl} && #{tblMdl}.length > 0) || tableNewItemActive(field)') table.col-sm-12.links-edit(id='{{::field.model}}' st-table=tblMdl) tbody tr(ng-repeat='item in #{tblMdl}') td.col-sm-12 div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='curKey{{::field.focusId}}' ng-click='curPair = tableStartEdit(backupItem, field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{compactJavaName(item.#{keyFld}, 25, availableWidth(field.model)[1])}} / {{compactJavaName(item.#{valFld}, 25, availableWidth(field.model)[1])}} + a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{compactJavaName(item.#{keyFld}, 25, availableWidth(field.model)[1])}} / {{compactJavaName(item.#{valFld}, 25, availableWidth(field.model)[1])}} +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') div(ng-if='tableEditing(field, $index)') - +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '$index') + +table-pair-edit('cur', 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.focusId}}', '-1') + +table-pair-edit('new', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '-1') mixin details-row - var lblDetailClasses = ['col-sm-4', 'details-label'] @@ -127,7 +134,7 @@ mixin details-row .col-sm-8 +tipField('detail.tip') .input-tip - 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) + input.form-control(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.') @@ -152,49 +159,59 @@ mixin details-row tr(ng-repeat='item in #{detailMdl} track by $index') td div(ng-show='!tableEditing(detail, $index)') - a.labelFormField(event-focus='cur{{::detail.focusId}}' 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, curValue, $index)') + +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, $index)') .input-tip.form-group.has-feedback - 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) + 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, newValue, -1)') Add + 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}}' 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}}' type='text' ng-model='detail.newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, newValue, -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) - .fieldset - .legend + .group + .group-legend label {{::detail.label}}: - +tipLabel('detail.tableTip') - .fieldset-content + +group-tip('detail.tableTip') + .group-content 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(event-focus='cur{{::detail.focusId}}' ng-click='curValue = tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}} + a.labelFormField(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)') div(ng-if='tableEditing(detail, $index)') label.labelField {{$index + 1}}) - +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)') + +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, $index)') .input-tip.form-group.has-feedback - 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) + 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, newValue, -1)') Add + 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}}' 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}}' 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.') -mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, focusId, index) +mixin table-db-field-edit(prefix, focusId, index) + -var databaseName = prefix + 'DatabaseName' + -var databaseType = prefix + 'DatabaseType' + -var javaName = prefix + 'JavaName' + -var javaType = prefix + 'JavaType' + + -var databaseNameModel = 'field.' + databaseName + -var databaseTypeModel = 'field.' + databaseType + -var javaNameModel = 'field.' + javaName + -var javaTypeModel = 'field.' + javaType + -var databaseNameId = databaseName + focusId -var databaseTypeId = databaseType + focusId -var javaNameId = javaName + focusId @@ -203,24 +220,23 @@ mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, focusI .col-xs-3.col-sm-3.col-md-3 label.fieldSep / .input-tip - input.form-control(id=databaseNameId enter-focus-next=databaseTypeId type='text' ng-model=databaseName placeholder='DB name' on-escape='tableReset()') + input.form-control(id=databaseNameId enter-focus-next=databaseTypeId type='text' ng-model=databaseNameModel placeholder='DB name' on-escape='tableReset()') .col-xs-3.col-sm-3.col-md-3 label.fieldSep / .input-tip - select.form-control(id=databaseTypeId enter-focus-next=javaNameId ng-model=databaseType ng-options='item.value as item.label for item in {{jdbcTypes}}' on-escape='tableReset()') + select.form-control(id=databaseTypeId enter-focus-next=javaNameId ng-model=databaseTypeModel ng-options='item.value as item.label for item in {{jdbcTypes}}' on-escape='tableReset()') .col-xs-3.col-sm-3.col-md-3 label.fieldSep / .input-tip - input.form-control(id=javaNameId enter-focus-next=javaTypeId type='text' ng-model=javaName placeholder='Java name' on-escape='tableReset()') + input.form-control(id=javaNameId enter-focus-next=javaTypeId type='text' ng-model=javaNameModel placeholder='Java name' on-escape='tableReset()') .col-xs-3.col-sm-3.col-md-3 - -var args = databaseName + ', ' + databaseType + ', ' + javaName + ', ' + javaType - -var btnVisible = 'tableDbFieldSaveVisible(' + args + ')' - -var btnSave = 'tableDbFieldSave(field, ' + args + ', ' + index +')' + -var btnVisible = 'tableDbFieldSaveVisible(field, ' + index +')' + -var btnSave = 'tableDbFieldSave(field, ' + index +')' -var btnVisibleAndSave = btnVisible + ' && ' + btnSave +btn-save(btnVisible, btnSave) .input-tip - select.form-control(id=javaTypeId ng-model=javaType ng-options='item.value as item.label for item in {{javaTypes}}' on-enter=btnVisibleAndSave on-escape='tableReset()') + 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 @@ -281,7 +297,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) div(class=fieldClasses) +tipField('field.tip') .input-tip - 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) + 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) +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.') @@ -317,93 +333,94 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) .details-row(ng-repeat='detail in field.details[#{fieldMdl}].fields') +details-row .section(ng-switch-when='table-simple' ng-hide=fieldHide)&attributes(fieldCommon) - .col-sm-7.fieldset - .legend + .col-sm-7.group + .group-legend label {{::field.label}}: - +tipLabel('field.tableTip') - +btn-add('tableNewItem(field)', 'field.addTip', 'new{{::field.focusId}}') - .fieldset-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') + +group-tip('field.tableTip') + +group-btn-add('tableNewItem(field)', 'field.addTip') + .group-content-empty(ng-show='!((#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field))') + .group-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') table.col-sm-12.links-edit(id='{{::field.model}}' st-table='#{fieldMdl}') tbody tr(ng-repeat='item in #{fieldMdl} track by $index') td div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='cur{{::field.focusId}}' ng-click='curValue = tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{compactJavaName(item, 55, availableWidth(field.model)[0])}} + a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{compactJavaName(item, 55, availableWidth(field.model)[0])}} +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)') div(ng-if='tableEditing(field, $index)') label.labelField {{$index + 1}}) - +btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)') + +btn-save('tableSimpleSaveVisible(field.curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, $index)') .input-tip - 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()') + input.form-control(id='cur{{::field.focusId}}' type='text' ng-model='field.curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field.curValue) && tableSimpleSave(tableSimpleValid, backupItem, field, $index)' on-escape='tableReset()') tfoot(ng-show='tableNewItemActive(field)') tr td - +btn-save('tableSimpleSaveVisible(newValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)') + +btn-save('tableSimpleSaveVisible(field.newValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, -1)') .input-tip - 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()') + input.form-control(id='new{{::field.focusId}}' type='text' ng-model='field.newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field.newValue) && 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, false) + +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) +table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field class full name', false, true) .section(ng-switch-when='queryFields' ng-hide=fieldHide) +table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field class full name', false, true) - .section(ng-switch-when='dbFields' ng-hide=fieldHide) - .col-sm-7.fieldset - .legend + .section(ng-switch-when='table-db-fields' ng-hide=fieldHide) + .col-sm-7.group + .group-legend label {{::field.label}}: - +tipLabel('field.tip') - +btn-add('tableNewItem(field)', 'field.addTip', 'newDatabaseName{{::field.focusId}}') - .fieldset-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') + +group-tip('field.tip') + +group-btn-add('tableNewItem(field)', 'field.addTip') + .group-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') table.col-sm-12.links-edit(st-table=fieldMdl) tbody tr(ng-repeat='item in #{fieldMdl}') td.col-sm-12 div(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='curDatabaseName{{::field.focusId}}' 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(ng-click='tableStartEdit(backupItem, field, $index)') {{$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.focusId}}', '$index') + +table-db-field-edit('cur', '{{::field.focusId}}', '$index') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12(ng-init='newDatabaseType="INTEGER"; newJavaType="Integer"') - +table-db-field-edit('newDatabaseName', 'newDatabaseType', 'newJavaName', 'newJavaType', '{{::field.focusId}}', '-1') - .section(ng-switch-when='queryGroups' ng-hide=fieldHide) - .col-sm-7.fieldset - .legend + +table-db-field-edit('new', '{{::field.focusId}}', '-1') + .section(ng-switch-when='table-query-groups' ng-hide=fieldHide) + .col-sm-7.group + .group-legend label {{::field.label}}: - +tipLabel('field.tip') - +btn-add('tableNewItem(field)', 'field.addTip', 'newGroupName') - .fieldset-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') + +group-tip('field.tip') + +group-btn-add('tableNewItem(field)', 'field.addTip') + .group-content-empty(ng-show='!((#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field))') + .group-content(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)') table.links-edit.col-sm-12(st-table=fieldMdl ng-init='newDirection = false') tbody tr(ng-repeat='group in #{fieldMdl}') td.col-sm-12 - div - .col-sm-12(ng-show='!tableEditing(field, $index)') - a.labelFormField(event-focus='curGroupName' ng-click='curGroup = tableStartEdit(backupItem, field, $index); curGroupName = curGroup.name; curFields = curGroup.fields') {{$index + 1}}) {{group.name}} - +btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip') - +btn-add2('tableGroupNewItem($index)', 'field.addItemTip', 'newFieldName') - div(ng-if='tableEditing(field, $index)') - label.labelField {{$index + 1}}) - +btn-save('tableGroupSaveVisible(curGroupName)', 'tableGroupSave(curGroupName, $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()') - .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(event-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"}} - +btn-remove('tableRemoveGroupItem(group, $index)', 'field.removeItemTip') - div(ng-if='tableGroupItemEditing(groupIndex, $index)') - +table-group-item-edit('curFieldName', 'curClassName', 'curDirection', '$index') - tfoot(ng-if='tableGroupNewItemActive(groupIndex)') - tr.col-sm-12(style='padding-left: 18px') - td - +table-group-item-edit('newFieldName', 'newClassName', 'newDirection', '-1') + .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') + div(ng-if='tableEditing(field, $index)') + label.labelField {{$index + 1}}) + +btn-save('tableGroupSaveVisible(curGroupName)', 'tableGroupSave(curGroupName, $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()') + .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"}} + +btn-remove('tableRemoveGroupItem(group, $index)', 'field.removeItemTip') + div(ng-if='tableGroupItemEditing(groupIndex, $index)') + +table-group-item-edit('curFieldName', 'curClassName', 'curDirection', '$index') + tfoot(ng-if='tableGroupNewItemActive(groupIndex)') + tr.col-sm-12(style='padding-left: 18px') + td + +table-group-item-edit('newFieldName', 'newClassName', 'newDirection', '-1') tfoot(ng-show='tableNewItemActive(field)') tr td.col-sm-12 http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe050795/modules/control-center-web/src/main/js/views/login.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/login.jade b/modules/control-center-web/src/main/js/views/login.jade index 07f89a6..19979e2 100644 --- a/modules/control-center-web/src/main/js/views/login.jade +++ b/modules/control-center-web/src/main/js/views/login.jade @@ -46,10 +46,10 @@ mixin lbl(txt) .col-sm-9 input#user_confirm.form-control(type='password' ng-model='user_info.confirm' match='user_info.password' placeholder='Confirm password' ng-required='action == "register"' on-enter='loginForm.$valid && auth(action, user_info)') .modal-footer - a.labelField(ng-show='action != "request_password_reset"' ng-click='action = "request_password_reset"' event-focus='user_email') Forgot password? - a.labelField(ng-show='action == "request_password_reset"' ng-click='action = "login"' event-focus='user_email') Log In - a.labelLogin(ng-show='action == "register"' event-focus='user_email' ng-click='action = "login";') Log In - a.labelLogin(ng-show='action == "login"' event-focus='user_name' ng-click='action = "register"') Sign Up + a.labelField(ng-show='action != "request_password_reset"' ng-click='action = "request_password_reset"' on-click-focus='user_email') Forgot password? + a.labelField(ng-show='action == "request_password_reset"' ng-click='action = "login"' on-click-focus='user_email') Log In + a.labelLogin(ng-show='action == "register"' on-click-focus='user_email' ng-click='action = "login";') Log In + a.labelLogin(ng-show='action == "login"' on-click-focus='user_name' ng-click='action = "register"') Sign Up button.btn.btn-primary(ng-show='action == "login"' ng-disabled='loginForm.$invalid' ng-click='auth(action, user_info)') Log In button.btn.btn-primary(ng-show='action == "register"' ng-disabled='loginForm.$invalid' ng-click='auth(action, user_info)') Sign Up button.btn.btn-primary(ng-show='action == "request_password_reset"' ng-disabled='loginForm.$invalid' ng-click='auth(action, user_info)') Reset Password