You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/10/30 11:56:15 UTC

[20/20] ignite git commit: IGNITE-843 Minor fixes.

IGNITE-843 Minor fixes.


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

Branch: refs/heads/ignite-843-rc1
Commit: 36079c22b622e6fef2206a3acd3a86651aba0aa2
Parents: ebdc21d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Oct 30 17:55:54 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Oct 30 17:55:54 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  2 +
 .../main/js/controllers/clusters-controller.js  |  2 +
 .../src/main/js/controllers/common-module.js    |  9 +++--
 .../src/main/js/controllers/igfs-controller.js  |  2 +
 .../main/js/controllers/metadata-controller.js  | 40 ++++----------------
 .../src/main/js/views/includes/controls.jade    | 20 +++++-----
 6 files changed, 30 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 d23088b..624f6f0 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
@@ -594,6 +594,8 @@ consoleModule.controller('cachesController', [
             };
 
             $scope.resetAll = function() {
+                $table.tableReset();
+
                 $confirm.confirm('Are you sure you want to reset current cache?')
                     .then(function() {
                         $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem();

http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 50320d6..f3c7c7e 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
@@ -590,6 +590,8 @@ consoleModule.controller('clustersController', [
         };
 
         $scope.resetAll = function() {
+            $table.tableReset();
+
             $confirm.confirm('Are you sure you want to reset current cluster?')
                 .then(function() {
                     $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem();

http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 8c62ca2..f855298 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
@@ -692,9 +692,12 @@ consoleModule.service('$common', [
              * @param index Showed index of element.
              * @param maxLength Maximum length in symbols for all names.
              * @param names Array of class names to compact.
+             * @param divider String to visualy divide items.
              * @returns {*} Array of compacted class names.
              */
-            compactJavaName: function (id, index, maxLength, names) {
+            compactJavaName: function (id, index, maxLength, names, divider) {
+                divider = ' ' + divider + ' ';
+
                 var prefix = index + ') ';
 
                 var nameCnt = names.length;
@@ -702,7 +705,7 @@ consoleModule.service('$common', [
                 var nameLength = ((maxLength - 3 * (nameCnt - 1)) / nameCnt) | 0;
 
                 try {
-                    var nameWidth = (availableWidth(index, id) - measureText(prefix) - (nameCnt - 1) * measureText(' / ')) /
+                    var nameWidth = (availableWidth(index, id) - measureText(prefix) - (nameCnt - 1) * measureText(divider)) /
                         nameCnt | 0;
 
                     // HTML5 calculation of showed message width.
@@ -715,7 +718,7 @@ consoleModule.service('$common', [
                 var result = prefix + names[0];
 
                 for (var nameIx = 1; nameIx < names.length; nameIx ++)
-                    result += ' / ' + names[nameIx];
+                    result += divider + names[nameIx];
 
                 return result;
             },

http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 b57fb28..c96616c 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
@@ -383,6 +383,8 @@ consoleModule.controller('igfsController', [
             };
 
             $scope.resetAll = function() {
+                $table.tableReset();
+
                 $confirm.confirm('Are you sure you want to reset current IGFS?')
                     .then(function() {
                         $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem();

http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 5ee53d7..dc340e1 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
@@ -504,8 +504,7 @@ consoleModule.controller('metadataController', [
                             var colName = col.name;
                             var jdbcType = $common.findJdbcType(col.type);
 
-                            if (!fieldIndexed(colName, table))
-                                qryFields.push(queryField(colName, jdbcType));
+                            qryFields.push(queryField(colName, jdbcType));
 
                             if (col.key) {
                                 keyFields.push(dbField(colName, jdbcType));
@@ -572,21 +571,6 @@ consoleModule.controller('metadataController', [
                 });
 
                 /**
-                 * Check field with specified name is indexed.
-                 *
-                 * @param name Field name.
-                 * @param table Table to check indexed fields.
-                 * @returns {boolean} <code>True</code> when field is indexed of <code>false</code> otherwise.
-                 */
-                function fieldIndexed(name, table) {
-                    // Check if in asc or desc fields.
-                    if (_.includes(table.ascCols, name) || _.includes(table.descCols, name) || !table.idxs)
-                        return true;
-
-                    return _.findKey(table.idxs, function(fields) { return _.includes(Object.keys(fields), name); }) != undefined;
-                }
-
-                /**
                  * Generate message to show on confirm dialog.
                  *
                  * @param meta Object to confirm.
@@ -992,8 +976,8 @@ consoleModule.controller('metadataController', [
             };
 
             var pairFields = {
-                fields: {msg: 'Query field class', id: 'QryField', checkValidClass: true},
-                aliases: {msg: 'Ascending field class', id: 'Alias', keyCol: 'field', valCol: 'alias', valColName: 'alias', checkEqualsSecondField: true}
+                fields: {msg: 'Query field class', id: 'QryField', idPrefix: 'Key', searchCol: 'name', valueCol: 'key', classValidation: true, dupObjName: 'name'},
+                aliases: {id: 'Alias', idPrefix: 'Value', searchCol: 'alias', valueCol: 'value', dupObjName: 'alias'}
             };
 
             $scope.tablePairValid = function (item, field, index) {
@@ -1006,25 +990,15 @@ consoleModule.controller('metadataController', [
 
                     if ($common.isDefined(model)) {
                         var idx = _.findIndex(model, function (pair) {
-                            return pair[pairField.keyCol || 'name'] == pairValue.key;
+                            return pair[pairField.searchCol] == pairValue[pairField.valueCol];
                         });
 
                         // Found duplicate by key.
                         if (idx >= 0 && idx != index)
-                            return showPopoverMessage(null, null, $table.tableFieldId(index, 'Key' + pairField.id), 'Field with such name already exists!');
-
-                        if (pairField.checkEqualsSecondField) {
-                            idx = _.findIndex(model, function (pair) {
-                                return pair[pairField.valCol || 'className'].toUpperCase() === pairValue.value.toUpperCase();
-                            });
-
-                            // Found duplicate by value.
-                            if (idx >= 0 && idx != index)
-                                return showPopoverMessage(null, null, $table.tableFieldId(index, 'Value' + pairField.id), 'Field with such ' + pairField.valColName + ' already exists!');
-                        }
+                            return showPopoverMessage(null, null, $table.tableFieldId(index, pairField.idPrefix + pairField.id), 'Field with such ' + pairField.dupObjName + ' already exists!');
                     }
 
-                    if (pairField.checkValidClass && !$common.isValidJavaClass(pairField.msg, pairValue.value, true, $table.tableFieldId(index, 'Value' + pairField.id)))
+                    if (pairField.classValidation && !$common.isValidJavaClass(pairField.msg, pairValue.value, true, $table.tableFieldId(index, 'Value' + pairField.id)))
                         return $table.tableFocusInvalidField(index, 'Value' + pairField.id);
                 }
 
@@ -1270,6 +1244,8 @@ consoleModule.controller('metadataController', [
             };
 
             $scope.resetAll = function() {
+                $table.tableReset();
+
                 $confirm.confirm('Are you sure you want to reset current metadata?')
                     .then(function() {
                         $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem();

http://git-wip-us.apache.org/repos/asf/ignite/blob/36079c22/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 9c7af9b..c53e9a2 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
@@ -66,7 +66,7 @@ mixin btn-up(show, click)
 mixin btn-down(show, click)
     i.tipField.fa.fa-arrow-down(ng-if=show ng-click=click bs-tooltip data-title='Move item down')
 
-mixin table-pair-edit(prefix, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, focusId, index)
+mixin table-pair-edit(prefix, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, focusId, index, divider)
     -var keyModel = 'field.' + prefix + 'Key'
     -var valModel = 'field.' + prefix + 'Value'
 
@@ -75,7 +75,7 @@ mixin table-pair-edit(prefix, keyPlaceholder, valPlaceholder, keyJavaBuildInType
 
     .col-xs-6.col-sm-6.col-md-6
         label.placeholder #{keyPlaceholder}
-        label.fieldSep /
+        label.fieldSep #{divider}
         .input-tip
             if keyJavaBuildInTypes
                 input.form-control(id=keyFocusId enter-focus-next=valFocusId type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead container='body' retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()')
@@ -95,7 +95,7 @@ mixin table-pair-edit(prefix, keyPlaceholder, valPlaceholder, keyJavaBuildInType
             else
                 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)
+mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, divider)
     .col-sm-12.group
         .group-legend
             label #{header}
@@ -107,14 +107,14 @@ mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder,
                 tbody
                     tr(ng-repeat='item in #{tblMdl}')
                         td.col-sm-12(ng-show='!tableEditing(field, $index)')
-                            a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{compactJavaName(field.model, $index + 1, 55, [item.#{keyFld}, item.#{valFld}])}}
+                            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')
+                            +table-pair-edit('cur', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '$index', divider)
                 tfoot(ng-show='tableNewItemActive(field)')
                     tr
                         td.col-sm-12
-                            +table-pair-edit('new', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '-1')
+                            +table-pair-edit('new', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '-1', divider)
 
 mixin table-igfs-path-mode-edit(prefix, keyPlaceholder, valPlaceholder, focusId, index)
     -var keyModel = 'field.' + prefix + 'Key'
@@ -397,7 +397,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
                             tr(ng-repeat='item in #{fieldMdl} track by $index')
                                 td
                                     div(ng-show='!tableEditing(field, $index)')
-                                        a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{compactJavaName(field.model, $index + 1, 55, [item])}}
+                                        a.labelFormField(ng-click='tableStartEdit(backupItem, field, $index)') {{compactJavaName(field.model, $index + 1, 55, [item], '/')}}
                                         +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)')
@@ -414,11 +414,11 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
                                     .input-tip
                                         input.form-control(id='new{{::field.focusId}}' type='text' ng-model='field.newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(field, -1) && tableSimpleSave(tableSimpleValid, backupItem, field, -1)' on-escape='tableReset()')
         .group-section(ng-switch-when='indexedTypes')
-            +table-pair('Index key-value type pairs', fieldMdl, 'keyClass', 'valueClass', 'Key full class name', 'Value class full name', true, true)
+            +table-pair('Index key-value type pairs', fieldMdl, 'keyClass', 'valueClass', 'Key full class name', 'Value class full name', true, true, '/')
         div(ng-switch-when='fields' ng-hide=fieldHide)
-            +table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field full class name', false, true)
+            +table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field full class name', false, true, '/')
         .group-section(ng-switch-when='aliases' ng-hide=fieldHide)
-            +table-pair('{{::field.label}}', fieldMdl, 'field', 'alias', 'Field name', 'Field Alias', false, false)
+            +table-pair('{{::field.label}}', fieldMdl, 'field', 'alias', 'Field name', 'Field Alias', false, false, '->')
         .group-section(ng-switch-when='pathModes' ng-hide=fieldHide)
             +table-igfs-path-mode('{{::field.label}}', fieldMdl, 'path', 'mode', 'Path', 'Mode')
         .group-section(ng-switch-when='table-db-fields' ng-hide=fieldHide)