Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc1 d5412a5f7 -> 6f795cef1


IGNITE-1892 Fixed tables.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6f795cef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6f795cef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6f795cef

Branch: refs/heads/ignite-843-rc1
Commit: 6f795cef12c03ee5f93c12545f8754f3e8d21d2c
Parents: d5412a5
Author: vsisko <[email protected]>
Authored: Fri Nov 13 15:35:23 2015 +0700
Committer: Alexey Kuznetsov <[email protected]>
Committed: Fri Nov 13 15:35:23 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  4 +-
 .../main/js/controllers/clusters-controller.js  |  2 +-
 .../src/main/js/controllers/common-module.js    | 10 ++---
 .../src/main/js/controllers/igfs-controller.js  |  2 +-
 .../main/js/controllers/metadata-controller.js  | 40 +++++++-------------
 .../src/main/js/views/includes/controls.jade    | 28 +++++++-------
 6 files changed, 37 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/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 547a8ed..0713df5 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
@@ -165,8 +165,8 @@ consoleModule.controller('cachesController', [
                         var exist = false;
 
                         if ($common.isDefined(model)) {
-                            model.forEach(function (val) {
-                                if (val.split('=')[0] == key)
+                            model.forEach(function (val, ix) {
+                                if (ix != index && val.split('=')[0] == key)
                                     exist = true;
                             })
                         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/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 e3bd651..a729f32 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
@@ -159,7 +159,7 @@ consoleModule.controller('clustersController', [
                     var simpleTable = simpleTables[field.model];
 
                     if (simpleTable) {
-                        $common.showPopoverMessage(null, null, 
$table.tableFieldId(index, 'trustManagers'), simpleTable.msg);
+                        $common.showPopoverMessage(null, null, 
$table.tableFieldId(index, simpleTable.id), simpleTable.msg);
 
                         return $table.tableFocusInvalidField(index, 
simpleTable.id);
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/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 5106132..99c0a37 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
@@ -1124,7 +1124,7 @@ consoleModule.service('$table', ['$common', '$focus', 
function ($common, $focus)
     }
 
     function _tableFocus(focusId, index) {
-        $focus((index < 0 ? 'new' : 'cur') + focusId);
+        $focus((index < 0 ? 'new' : 'cur') + focusId + (index >= 0 ? index : 
''));
     }
 
     function _tableSimpleValue(filed, index) {
@@ -1159,7 +1159,7 @@ consoleModule.service('$table', ['$common', '$focus', 
function ($common, $focus)
             field.curJavaFieldName = val.javaFieldName;
             field.curJavaFieldType = val.javaFieldType;
 
-            _tableFocus('DatabaseName' + field.focusId, index);
+            _tableFocus('DatabaseFieldName' + field.focusId, index);
         }
         else if (ui == 'table-indexes') {
             field.curIndexName = val.name;
@@ -1192,7 +1192,7 @@ consoleModule.service('$table', ['$common', '$focus', 
function ($common, $focus)
             field.newJavaFieldName = null;
             field.newJavaFieldType = null;
 
-            _tableFocus('DatabaseName' + field.focusId, -1);
+            _tableFocus('DatabaseFieldName' + field.focusId, -1);
         }
         else if (ui == 'table-indexes') {
             field.newIndexName = null;
@@ -1202,7 +1202,7 @@ consoleModule.service('$table', ['$common', '$focus', 
function ($common, $focus)
             _tableFocus(field.focusId, -1);
         }
         else if (ui == 'table-index-fields') {
-            _tableFocus('FieldName', -1);
+            _tableFocus('FieldName' + (field.sorted ? 'S' : '') + 
field.indexIdx, -1);
         }
     }
 
@@ -1313,7 +1313,7 @@ consoleModule.service('$table', ['$common', '$focus', 
function ($common, $focus)
             return false;
         },
         tableFieldId: function (index, id) {
-            return (index < 0 ? 'new' : 'cur') + id;
+            return (index < 0 ? 'new' : 'cur') + id + (index >= 0 ? index : 
'');
         }
     }
 }]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/modules/control-center-web/src/main/js/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git 
a/modules/control-center-web/src/main/js/controllers/igfs-controller.js 
b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
index 5743180..ff92b2b 100644
--- a/modules/control-center-web/src/main/js/controllers/igfs-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
@@ -107,7 +107,7 @@ consoleModule.controller('igfsController', [
 
                     // Found duplicate.
                     if (idx >= 0 && idx != index)
-                        return showPopoverMessage(null, null, 
$table.tableFieldId(index, 'KeyPathMode'), 'Such path already exists!');
+                        return showPopoverMessage($scope.panels, 'misc', 
$table.tableFieldId(index, 'KeyPathMode'), 'Such path already exists!');
                 }
 
                 return true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/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 0ec42d9..5ef830e 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
@@ -984,20 +984,6 @@ consoleModule.controller('metadataController', [
                     });
             };
 
-            $scope.tableSimpleValid = function (item, field, name, index) {
-                var model = item[field.model];
-
-                if ($common.isDefined(model)) {
-                    var idx = _.indexOf(model, name);
-
-                    // Found duplicate.
-                    if (idx >= 0 && idx != index)
-                        return showPopoverMessage(null, null, 
$table.tableFieldId(index, 'TextField'), 'Field with such name already 
exists!');
-                }
-
-                return true;
-            };
-
             $scope.toggleValid = function () {
                 $scope.ui.showValid = !$scope.ui.showValid;
 
@@ -1031,7 +1017,7 @@ consoleModule.controller('metadataController', [
 
                         // Found duplicate by key.
                         if (idx >= 0 && idx != index)
-                            return showPopoverMessage(null, null, 
$table.tableFieldId(index, pairField.idPrefix + pairField.id), 'Field with such 
' + pairField.dupObjName + ' already exists!');
+                            return showPopoverMessage($scope.panels, 'query', 
$table.tableFieldId(index, pairField.idPrefix + pairField.id), 'Field with such 
' + pairField.dupObjName + ' already exists!');
                     }
 
                     if (pairField.classValidation && 
!$common.isValidJavaClass(pairField.msg, pairValue.value, true, 
$table.tableFieldId(index, 'Value' + pairField.id)))
@@ -1069,7 +1055,7 @@ consoleModule.controller('metadataController', [
 
                     var model = item[field.model];
 
-                    if (!$common.isValidJavaIdentifier(dbFieldTable.msg + ' 
java name', dbFieldValue.javaFieldName, $table.tableFieldId(index, 'JavaName' + 
dbFieldTable.id)))
+                    if (!$common.isValidJavaIdentifier(dbFieldTable.msg + ' 
java name', dbFieldValue.javaFieldName, $table.tableFieldId(index, 
'JavaFieldName' + dbFieldTable.id)))
                         return false;
 
                     if ($common.isDefined(model)) {
@@ -1079,7 +1065,7 @@ consoleModule.controller('metadataController', [
 
                         // Found duplicate.
                         if (idx >= 0 && index != idx)
-                            return showPopoverMessage(null, null, 
$table.tableFieldId(index, 'DatabaseName' + dbFieldTable.id), 'Field with such 
database name already exists!');
+                            return showPopoverMessage($scope.panels, 'store', 
$table.tableFieldId(index, 'DatabaseFieldName' + dbFieldTable.id), 'Field with 
such database name already exists!');
 
                         idx = _.findIndex(model, function (dbMeta) {
                             return dbMeta.javaFieldName == 
dbFieldValue.javaFieldName;
@@ -1087,7 +1073,7 @@ consoleModule.controller('metadataController', [
 
                         // Found duplicate.
                         if (idx >= 0 && index != idx)
-                            return showPopoverMessage(null, null, 
$table.tableFieldId(index, 'JavaName' + dbFieldTable.id), 'Field with such java 
name already exists!');
+                            return showPopoverMessage($scope.panels, 'store', 
$table.tableFieldId(index, 'JavaFieldName' + dbFieldTable.id), 'Field with such 
java name already exists!');
 
                         if (index < 0) {
                             model.push(dbFieldValue);
@@ -1143,7 +1129,7 @@ consoleModule.controller('metadataController', [
 
                     // Found duplicate.
                     if (idx >= 0 && idx != curIdx)
-                        return showPopoverMessage(null, null, 
$table.tableFieldId(curIdx, 'IndexName'), 'Index with such name already 
exists!');
+                        return showPopoverMessage($scope.panels, 'query', 
$table.tableFieldId(curIdx, 'IndexName'), 'Index with such name already 
exists!');
                 }
 
                 if (curIdx < 0) {
@@ -1172,9 +1158,11 @@ consoleModule.controller('metadataController', [
             };
 
             $scope.tableIndexNewItem = function (field, indexIdx) {
-                var indexName = $scope.backupItem.indexes[indexIdx].name;
+                var index = $scope.backupItem.indexes[indexIdx];
 
-                $table.tableNewItem({ui: 'table-index-fields', model: 
indexName});
+                var indexName = index.name;
+
+                $table.tableNewItem({ui: 'table-index-fields', model: 
indexName, sorted: index.indexType == 'SORTED', indexIdx: indexIdx});
 
                 field.newFieldName = null;
                 field.newDirection = true;
@@ -1222,7 +1210,7 @@ consoleModule.controller('metadataController', [
                 field.curFieldName = indexItem.name;
                 field.curDirection = indexItem.direction;
 
-                $focus('curFieldName');
+                $focus('curFieldName' + (index.indexType == 'SORTED' ? 'S' : 
'') + indexIdx + '-' + curIdx);
             };
 
             $scope.tableIndexItemSaveVisible = function (field, index) {
@@ -1232,7 +1220,9 @@ consoleModule.controller('metadataController', [
             $scope.tableIndexItemSave = function (field, indexIdx, curIdx) {
                 var indexItemValue = tableIndexItemValue(field, curIdx);
 
-                var fields = $scope.backupItem.indexes[indexIdx].fields;
+                var index = $scope.backupItem.indexes[indexIdx];
+
+                var fields = index.fields;
 
                 if ($common.isDefined(fields)) {
                     var idx = _.findIndex(fields, function (field) {
@@ -1241,11 +1231,9 @@ consoleModule.controller('metadataController', [
 
                     // Found duplicate.
                     if (idx >= 0 && idx != curIdx)
-                        return showPopoverMessage(null, null, 
$table.tableFieldId(curIdx, 'FieldName'), 'Field with such name already exists 
in index!');
+                        return showPopoverMessage($scope.panels, 'query', 
$table.tableFieldId(curIdx, 'FieldName' + (index.indexType == 'SORTED' ? 'S' : 
'') + indexIdx + (curIdx >= 0 ? '-' : '')), 'Field with such name already 
exists in index!');
                 }
 
-                var index = $scope.backupItem.indexes[indexIdx];
-
                 if (curIdx < 0) {
                     if (index.fields)
                         index.fields.push(indexItemValue);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f795cef/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 f0334f7..ce9760b 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
@@ -110,7 +110,7 @@ mixin table-pair(header, tblMdl, keyFld, valFld, 
keyPlaceholder, valPlaceholder,
                             
a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') 
{{compactJavaName(field.model, $index + 1, 55, [item.#{keyFld}, 
item.#{valFld}], '#{divider}')}}
                             +btn-remove('tableRemove(backupItem, field, 
$index)', 'field.removeTip')
                         td.col-sm-12(ng-show='tableEditing(field, $index)')
-                            +table-pair-edit('cur', keyPlaceholder, 
valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, 
'{{::field.focusId}}', '$index', divider)
+                            +table-pair-edit('cur', keyPlaceholder, 
valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId 
+ $index}}', '$index', divider)
                 tfoot(ng-show='tableNewItemActive(field)')
                     tr
                         td.col-sm-12
@@ -153,7 +153,7 @@ mixin table-igfs-path-mode(header, tblMdl, keyFld, valFld, 
keyPlaceholder, valPl
                             
a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') 
{{item.#{keyFld} + " [" + item.#{valFld} + "]"}}
                             +btn-remove('tableRemove(backupItem, field, 
$index)', 'field.removeTip')
                         td.col-sm-12(ng-show='tableEditing(field, $index)')
-                            +table-igfs-path-mode-edit('cur', keyPlaceholder, 
valPlaceholder, '{{::field.focusId}}', '$index')
+                            +table-igfs-path-mode-edit('cur', keyPlaceholder, 
valPlaceholder, '{{::field.focusId + $index}}', '$index')
                 tfoot(ng-show='tableNewItemActive(field)')
                     tr
                         td.col-sm-12
@@ -225,7 +225,7 @@ mixin details-row
                                         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}}' 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)
+                                            
input.form-control(id='cur{{::detail.focusId + $index}}' 
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.')
                         tfoot(ng-show='tableNewItemActive(detail)')
                             tr
@@ -277,7 +277,7 @@ mixin table-db-field-edit(prefix, focusId, index)
         .input-tip
             button.form-control(id=javaTypeId ng-model=javaTypeModel 
data-placeholder='Java type' ng-class='{placeholder: !#{javaTypeModel}}' 
bs-select bs-options='item.value as item.label for item in 
{{supportedJavaTypes}}' on-enter=btnVisibleAndSave on-escape='tableReset()' 
tabindex='0')
 
-mixin table-index-item-edit(prefix, index, sortAvailable)
+mixin table-index-item-edit(prefix, index, sortAvailable, idAddition)
     -var fieldName = prefix + 'FieldName'
     -var direction = prefix + 'Direction'
 
@@ -292,17 +292,17 @@ mixin table-index-item-edit(prefix, index, sortAvailable)
         label.placeholder Field name
         label.fieldSep /
         .input-tip
-            input.form-control(id=fieldName enter-focus-next=direction 
type='text' ng-model=fieldNameModel placeholder='Field name' 
on-escape='tableReset()')
+            input.form-control(id='{{::"#{fieldName}S" + #{idAddition}}}' 
enter-focus-next='{{::"#{direction}S" + #{idAddition}}}' type='text' 
ng-model=fieldNameModel placeholder='Field name' on-escape='tableReset()')
     .col-xs-4.col-sm-4.col-md-4(ng-show=sortAvailable)
         label.placeholder Sort order
         +btn-save(btnVisible, btnSave)
         .input-tip
-            button.form-control(id=direction ng-model=directionModel bs-select 
bs-options='item.value as item.label for item in {{sortDirections}}' 
on-enter=btnVisibleAndSave on-escape='tableReset()' tabindex='0')
+            button.form-control(id='{{::"#{direction}S" + #{idAddition}}}' 
ng-model=directionModel bs-select bs-options='item.value as item.label for item 
in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()' 
tabindex='0')
     .col-xs-12(ng-show='!(#{sortAvailable})')
         label.placeholder Field name
         +btn-save(btnVisible, btnSave)
         .input-tip
-            input.form-control(id=fieldName enter-focus-next=direction 
type='text' ng-model=fieldNameModel placeholder='Field name' 
on-escape='tableReset()')
+            input.form-control(id='{{::"#{fieldName}" + #{idAddition}}}' 
type='text' ng-model=fieldNameModel placeholder='Field name' 
on-enter=btnVisibleAndSave on-escape='tableReset()')
 
 mixin form-row(dataSource)
     +form-row-custom(['col-xs-4 col-sm-4 col-md-4'], ['col-xs-8 col-sm-8 
col-md-8'], dataSource)
@@ -405,7 +405,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
                                         label.labelField {{$index + 1}})
                                         
+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()')
+                                            
input.form-control(id='cur{{::field.focusId + $index}}' 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
@@ -436,8 +436,8 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
                                     div(ng-show='!tableEditing(field, $index)')
                                         
a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{$index 
+ 1}}) {{item.databaseFieldName}} / {{item.databaseFieldType}} / 
{{item.javaFieldName}} / {{item.javaFieldType}}
                                         +btn-remove('tableRemove(backupItem, 
field, $index)', 'field.removeTip')
-                                    div(ng-if='tableEditing(field, $index)')
-                                        +table-db-field-edit('cur', 
'{{::field.focusId}}', '$index')
+                                    div(ng-show='tableEditing(field, $index)')
+                                        +table-db-field-edit('cur', 
'{{::field.focusId + $index}}', '$index')
                         tfoot(ng-show='tableNewItemActive(field)')
                             tr
                                 td
@@ -465,12 +465,12 @@ mixin form-row-custom(lblClasses, fieldClasses, 
dataSource)
                                             label.placeholder Index name
                                             label.fieldSep /
                                             .input-tip
-                                                
input#curIndexName.form-control(type='text' enter-focus-next="curIndexType" 
ng-model='field.curIndexName' placeholder='Index name' 
on-enter=btnVisibleAndSave on-escape='tableReset()')
+                                                
input.form-control(id='{{"curIndexName" + $index}}' type='text' 
enter-focus-next='{{"curIndexType" + $index}}' ng-model='field.curIndexName' 
placeholder='Index name' on-enter=btnVisibleAndSave on-escape='tableReset()')
                                         .col-sm-5
                                             label.placeholder Index type
                                             
+btn-save('tableIndexSaveVisible(field, $index)', 'tableIndexSave(field, 
$index)')
                                             .input-tip
-                                                
button#curIndexType.form-control(bs-select ng-model='field.curIndexType' 
data-placeholder='Select index type' bs-options="item.value as item.label for 
item in indexType" tabindex='0' on-enter=btnVisibleAndSave 
on-escape='tableReset()')
+                                                
button.form-control(id='{{"curIndexType" + $index}}' bs-select 
ng-model='field.curIndexType' data-placeholder='Select index type' 
bs-options="item.value as item.label for item in indexType" tabindex='0' 
on-enter=btnVisibleAndSave on-escape='tableReset()')
                                     .margin-left-dflt
                                         
table.links-edit-sub(st-table='item.fields' ng-init='itemIndex = $index')
                                             tbody
@@ -481,11 +481,11 @@ mixin form-row-custom(lblClasses, fieldClasses, 
dataSource)
                                                             
a.labelFormField(ng-if='item.indexType != "SORTED"' 
ng-click='tableIndexItemStartEdit(field, itemIndex, $index)') {{$index + 1}}) 
{{itemItem.name}}
                                                             
+btn-remove('tableRemoveIndexItem(item, $index)', 'field.removeItemTip')
                                                         
div(ng-show='tableIndexItemEditing(itemIndex, $index)')
-                                                            
+table-index-item-edit('cur', '$index', '{{item.indexType == "SORTED"}}')
+                                                            
+table-index-item-edit('cur', '$index', 'item.indexType == "SORTED"', 
'itemIndex + "-" + $index')
                                             
tfoot(ng-show='tableIndexNewItemActive(itemIndex)')
                                                 tr(style='padding-left: 18px')
                                                     td
-                                                        
+table-index-item-edit('new', '-1', '{{item.indexType == "SORTED"}}')
+                                                        
+table-index-item-edit('new', '-1', 'item.indexType == "SORTED"', 'itemIndex')
                         tfoot(ng-show='tableNewItemActive(field)')
                             tr
                                 td

Reply via email to