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 2017/10/09 10:55:25 UTC
ignite git commit: IGNITE-5767 Web console: Use byte array type
instead of java.lang.Object for binary JDBC types.
Repository: ignite
Updated Branches:
refs/heads/master 90624c64f -> 31844374d
IGNITE-5767 Web console: Use byte array type instead of java.lang.Object for binary JDBC types.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31844374
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31844374
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31844374
Branch: refs/heads/master
Commit: 31844374d516aea57364f716474c4a46b0098898
Parents: 90624c6
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Mon Oct 9 17:55:23 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Oct 9 17:55:23 2017 +0700
----------------------------------------------------------------------
.../frontend/app/helpers/jade/mixins.pug | 9 +++------
.../generator/ConfigurationGenerator.js | 6 +++---
.../modules/states/configuration/caches/store.pug | 4 ++--
.../states/configuration/clusters/attributes.pug | 4 ++--
.../clusters/collision/job-stealing.pug | 4 ++--
.../states/configuration/domains/general.pug | 2 +-
.../modules/states/configuration/domains/query.pug | 8 ++++----
.../frontend/app/services/JavaTypes.service.js | 15 +++++++++++++++
.../frontend/app/services/LegacyUtils.service.js | 16 ++++++++++++----
.../frontend/controllers/domains-controller.js | 7 +++++--
10 files changed, 49 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 9ccbde2..3e39077 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -572,7 +572,7 @@ mixin btn-remove-cond(cond, click, tip)
i.tipField.fa.fa-remove(ng-show=cond ng-click=click bs-tooltip=tip data-trigger='hover')
//- LEGACY mixin for LEGACY pair values tables.
-mixin table-pair-edit(tbl, prefix, keyPlaceholder, valPlaceholder, keyJavaBuiltInTypes, valueJavaBuiltInTypes, focusId, index, divider)
+mixin table-pair-edit(tbl, prefix, keyPlaceholder, valPlaceholder, valueJavaBuiltInClasses, focusId, index, divider)
-var keyModel = `${tbl}.${prefix}Key`
-var valModel = `${tbl}.${prefix}Value`
@@ -582,10 +582,7 @@ mixin table-pair-edit(tbl, prefix, keyPlaceholder, valPlaceholder, keyJavaBuiltI
.col-xs-6.col-sm-6.col-md-6
.fieldSep !{divider}
.input-tip
- if keyJavaBuiltInTypes
- input.form-control(id=keyFocusId ignite-on-enter-focus-move=valFocusId type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead container='body' ignite-retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuiltInClasses' ignite-on-escape='tableReset(false)')
- else
- input.form-control(id=keyFocusId ignite-on-enter-focus-move=valFocusId type='text' ng-model=keyModel placeholder=keyPlaceholder ignite-on-escape='tableReset(false)')
+ input.form-control(id=keyFocusId ignite-on-enter-focus-move=valFocusId type='text' ng-model=keyModel placeholder=keyPlaceholder ignite-on-escape='tableReset(false)')
.col-xs-6.col-sm-6.col-md-6
-var btnVisible = 'tablePairSaveVisible(' + tbl + ', ' + index + ')'
-var btnSave = 'tablePairSave(tablePairValid, backupItem, ' + tbl + ', ' + index + ')'
@@ -593,7 +590,7 @@ mixin table-pair-edit(tbl, prefix, keyPlaceholder, valPlaceholder, keyJavaBuiltI
+btn-save(btnVisible, btnSave)
.input-tip
- if valueJavaBuiltInTypes
+ if valueJavaBuiltInClasses
input.form-control(id=valFocusId type='text' ng-model=valModel placeholder=valPlaceholder bs-typeahead container='body' ignite-retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuiltInClasses' ignite-on-enter=btnVisibleAndSave ignite-on-escape='tableReset(false)')
else
input.form-control(id=valFocusId type='text' ng-model=valModel placeholder=valPlaceholder ignite-on-enter=btnVisibleAndSave ignite-on-escape='tableReset(false)')
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 9d7887a..75ee47c 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1681,7 +1681,7 @@ export default class IgniteConfigurationGenerator {
static domainModelQuery(domain, available, cfg = this.domainConfigurationBean(domain)) {
if (cfg.valueOf('queryMetadata') === 'Configuration') {
const fields = _.filter(_.map(domain.fields,
- (e) => ({name: e.name, className: javaTypes.fullClassName(e.className)})), (field) => {
+ (e) => ({name: e.name, className: javaTypes.stringClassName(e.className)})), (field) => {
return field.name !== domain.keyFieldName && field.name !== domain.valueFieldName;
});
@@ -1695,10 +1695,10 @@ export default class IgniteConfigurationGenerator {
const valFieldName = cfg.valueOf('valueFieldName');
if (keyFieldName)
- fields.push({name: keyFieldName, className: javaTypes.fullClassName(domain.keyType)});
+ fields.push({name: keyFieldName, className: javaTypes.stringClassName(domain.keyType)});
if (valFieldName)
- fields.push({name: valFieldName, className: javaTypes.fullClassName(domain.valueType)});
+ fields.push({name: valFieldName, className: javaTypes.stringClassName(domain.valueType)});
}
cfg.collectionProperty('keyFields', 'keyFields', domain.queryKeyFields, 'java.lang.String', 'java.util.HashSet')
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
index d6dcbbe..0c983a2 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/store.pug
@@ -194,11 +194,11 @@ mixin hibernateField(name, model, items, valid, save, newItem)
a.labelFormField(ng-click='tableStartEdit(backupItem, hibernatePropsTbl, $index)') {{item.name}} = {{item.value}}
+btn-remove('tableRemove(backupItem, hibernatePropsTbl, $index)', '"Remove Property"')
td.col-sm-12(ng-if='tableEditing(hibernatePropsTbl, $index)')
- +table-pair-edit('hibernatePropsTbl', 'cur', 'Property name', 'Property value', false, false, '{{::hibernatePropsTbl.focusId + $index}}', '$index', '=')
+ +table-pair-edit('hibernatePropsTbl', 'cur', 'Property name', 'Property value', false, '{{::hibernatePropsTbl.focusId + $index}}', '$index', '=')
tfoot(ng-show='tableNewItemActive(hibernatePropsTbl)')
tr
td.col-sm-12
- +table-pair-edit('hibernatePropsTbl', 'new', 'Property name', 'Property value', false, false, '{{::hibernatePropsTbl.focusId + $index}}', '-1', '=')
+ +table-pair-edit('hibernatePropsTbl', 'new', 'Property name', 'Property value', false, '{{::hibernatePropsTbl.focusId + $index}}', '-1', '=')
.settings-row
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/states/configuration/clusters/attributes.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/attributes.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/attributes.pug
index cac122b..beb0739 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/attributes.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/attributes.pug
@@ -48,10 +48,10 @@ include /app/helpers/jade/mixins
a.labelFormField(ng-click='tableStartEdit(backupItem, attributesTbl, $index)') {{item.name}} = {{item.value}}
+btn-remove('tableRemove(backupItem, attributesTbl, $index)', '"Remove attribute"')
td.col-sm-12(ng-show='tableEditing(attributesTbl, $index)')
- +table-pair-edit('attributesTbl', 'cur', 'Attribute name', 'Attribute value', false, false, '{{::attributesTbl.focusId + $index}}', '$index', '=')
+ +table-pair-edit('attributesTbl', 'cur', 'Attribute name', 'Attribute value', false, '{{::attributesTbl.focusId + $index}}', '$index', '=')
tfoot(ng-show='tableNewItemActive(attributesTbl)')
tr
td.col-sm-12
- +table-pair-edit('attributesTbl', 'new', 'Attribute name', 'Attribute value', false, false, '{{::attributesTbl.focusId + $index}}', '-1', '=')
+ +table-pair-edit('attributesTbl', 'new', 'Attribute name', 'Attribute value', false, '{{::attributesTbl.focusId + $index}}', '-1', '=')
.col-sm-6
+preview-xml-java(model, 'clusterUserAttributes')
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.pug
index d10a02e..eeb6114 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.pug
@@ -56,8 +56,8 @@ div
a.labelFormField(ng-click='tableStartEdit(backupItem, stealingAttributesTbl, $index)') {{item.name}} = {{item.value}}
+btn-remove('tableRemove(backupItem, stealingAttributesTbl, $index)', '"Remove attribute"')
td.col-sm-12(ng-show='tableEditing(stealingAttributesTbl, $index)')
- +table-pair-edit('stealingAttributesTbl', 'cur', 'Attribute name', 'Attribute value', false, false, '{{::stealingAttributesTbl.focusId + $index}}', '$index', '=')
+ +table-pair-edit('stealingAttributesTbl', 'cur', 'Attribute name', 'Attribute value', false, '{{::stealingAttributesTbl.focusId + $index}}', '$index', '=')
tfoot(ng-show='tableNewItemActive(stealingAttributesTbl)')
tr
td.col-sm-12
- +table-pair-edit('stealingAttributesTbl', 'new', 'Attribute name', 'Attribute value', false, false, '{{::stealingAttributesTbl.focusId + $index}}', '-1', '=')
+ +table-pair-edit('stealingAttributesTbl', 'new', 'Attribute name', 'Attribute value', false, '{{::stealingAttributesTbl.focusId + $index}}', '-1', '=')
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
index f6f4e72..7c8de9a 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
@@ -44,7 +44,7 @@ include /app/helpers/jade/mixins
<li>Configuration via QueryEntity class</li>\
</ul>')
.settings-row
- +java-class-typeahead('Key type:', `${model}.keyType`, '"keyType"', 'javaBuiltInClasses', 'true', 'true', '{{ ' + generatePojo + ' ? "Full class name for Key" : "Key type name" }}', 'Key class used to store key in cache', generatePojo)
+ +java-class-typeahead('Key type:', `${model}.keyType`, '"keyType"', 'javaBuiltInClassesBase', 'true', 'true', '{{ ' + generatePojo + ' ? "Full class name for Key" : "Key type name" }}', 'Key class used to store key in cache', generatePojo)
.settings-row
+java-class-autofocus-placholder('Value type:', `${model}.valueType`, '"valueType"', 'true', 'true', 'false', '{{ ' + generatePojo +' ? "Enter fully qualified class name" : "Value type name" }}', 'Value class used to store value in cache', generatePojo)
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
index e8eceac..b4b5abe 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
@@ -95,11 +95,11 @@ mixin table-index-item-edit(prefix, index, sortAvailable, idAddition)
a.labelFormField(ng-click='tableStartEdit(backupItem, queryFieldsTbl, $index)') {{item.name}} / {{item.className}}
+btn-remove('tableRemove(backupItem, queryFieldsTbl, $index)', '"Remove path"')
td.col-sm-12(ng-show='tableEditing(queryFieldsTbl, $index)')
- +table-pair-edit('queryFieldsTbl', 'cur', 'Field name', 'Field full class name', false, true, '{{::queryFieldsTbl.focusId + $index}}', '$index', '/')
+ +table-pair-edit('queryFieldsTbl', 'cur', 'Field name', 'Field full class name', true, '{{::queryFieldsTbl.focusId + $index}}', '$index', '/')
tfoot(ng-show='tableNewItemActive(queryFieldsTbl)')
tr
td.col-sm-12
- +table-pair-edit('queryFieldsTbl', 'new', 'Field name', 'Field full class name', false, true, '{{::queryFieldsTbl.focusId + $index}}', '-1', '/')
+ +table-pair-edit('queryFieldsTbl', 'new', 'Field name', 'Field full class name', true, '{{::queryFieldsTbl.focusId + $index}}', '-1', '/')
.settings-row
+ignite-form-field-dropdown('Key fields:', queryKeyFields, '"queryKeyFields"', false, false, true,
'Select key fields', 'Configure available fields', 'fields(\'cur\', ' + queryKeyFields + ')',
@@ -125,11 +125,11 @@ mixin table-index-item-edit(prefix, index, sortAvailable, idAddition)
a.labelFormField(ng-click='tableStartEdit(backupItem, aliasesTbl, $index)') {{item.field}} → {{item.alias}}
+btn-remove('tableRemove(backupItem, aliasesTbl, $index)', '"Remove alias"')
td.col-sm-12(ng-show='tableEditing(aliasesTbl, $index)')
- +table-pair-edit('aliasesTbl', 'cur', 'Field name', 'Field Alias', false, false, '{{::aliasesTbl.focusId + $index}}', '$index', '→')
+ +table-pair-edit('aliasesTbl', 'cur', 'Field name', 'Field Alias', false, '{{::aliasesTbl.focusId + $index}}', '$index', '→')
tfoot(ng-show='tableNewItemActive(aliasesTbl)')
tr
td.col-sm-12
- +table-pair-edit('aliasesTbl', 'new', 'Field name', 'Field Alias', false, false, '{{::aliasesTbl.focusId + $index}}', '-1', '→')
+ +table-pair-edit('aliasesTbl', 'new', 'Field name', 'Field Alias', false, '{{::aliasesTbl.focusId + $index}}', '-1', '→')
.settings-row(ng-init='indexesTbl={type: "table-indexes", model: "indexes", focusId: "IndexName", ui: "table-indexes"}')
+ignite-form-group(ng-model=queryIndexes ng-form=queryIndexesForm)
ignite-form-field-label
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/services/JavaTypes.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/JavaTypes.service.js b/modules/web-console/frontend/app/services/JavaTypes.service.js
index 944fea5..dff73a4 100644
--- a/modules/web-console/frontend/app/services/JavaTypes.service.js
+++ b/modules/web-console/frontend/app/services/JavaTypes.service.js
@@ -36,6 +36,9 @@ const VALID_PACKAGE = /^(([a-zA-Z_$][a-zA-Z0-9_$]*)\.)*([a-zA-Z_$][a-zA-Z0-9_$]*
// Regular expression to check UUID string representation.
const VALID_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/im;
+// Extended list of Java built-in class names.
+const JAVA_CLASS_STRINGS = JAVA_CLASSES.slice();
+
/**
* Utility service for various check on java types.
*/
@@ -45,6 +48,8 @@ export default class JavaTypes {
constructor(clusterDflts, cacheDflts, igfsDflts) {
this.enumClasses = _.uniq(this._enumClassesAcc(_.merge(clusterDflts, cacheDflts, igfsDflts), []));
this.shortEnumClasses = _.map(this.enumClasses, (cls) => this.shortClassName(cls));
+
+ JAVA_CLASS_STRINGS.push({short: 'byte[]', full: 'byte[]', stringValue: '[B'});
}
/**
@@ -95,6 +100,16 @@ export default class JavaTypes {
}
/**
+ * @param clsName Class name to check.
+ * @returns {String} Full class name string presentation for java build-in types or source class otherwise.
+ */
+ stringClassName(clsName) {
+ const type = _.find(JAVA_CLASS_STRINGS, (clazz) => clsName === clazz.short);
+
+ return type ? type.stringValue || type.full : clsName;
+ }
+
+ /**
* Extract class name from full class name.
*
* @param clsName full class name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/app/services/LegacyUtils.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/LegacyUtils.service.js b/modules/web-console/frontend/app/services/LegacyUtils.service.js
index e7c064b..be593b0 100644
--- a/modules/web-console/frontend/app/services/LegacyUtils.service.js
+++ b/modules/web-console/frontend/app/services/LegacyUtils.service.js
@@ -50,6 +50,7 @@ export default ['IgniteLegacyUtils', ['IgniteErrorPopover', (ErrorPopover) => {
'boolean',
'Boolean',
'byte',
+ 'byte[]',
'Byte',
'Date',
'double',
@@ -88,13 +89,15 @@ export default ['IgniteLegacyUtils', ['IgniteErrorPopover', (ErrorPopover) => {
/**
* @param clsName Class name to check.
+ * @param additionalClasses List of classes to check as builtin.
* @returns {Boolean} 'true' if given class name is a java build-in type.
*/
- function isJavaBuiltInClass(clsName) {
+ function isJavaBuiltInClass(clsName, additionalClasses) {
if (isEmptyString(clsName))
return false;
- return _.includes(javaBuiltInClasses, clsName) || _.includes(javaBuiltInFullNameClasses, clsName);
+ return _.includes(javaBuiltInClasses, clsName) || _.includes(javaBuiltInFullNameClasses, clsName)
+ || (_.isArray(additionalClasses) && _.includes(additionalClasses, clsName));
}
const SUPPORTED_JDBC_TYPES = [
@@ -323,8 +326,13 @@ export default ['IgniteLegacyUtils', ['IgniteErrorPopover', (ErrorPopover) => {
if (!allowBuiltInClass && isJavaBuiltInClass(ident))
return !stopEdit && ErrorPopover.show(elemId, msg + ' should not be the Java build-in class!', panels, panelId);
- if (len < 2 && !isJavaBuiltInClass(ident) && !packageOnly)
- return !stopEdit && ErrorPopover.show(elemId, msg + ' does not have package specified!', panels, panelId);
+ if (len < 2) {
+ if (isJavaBuiltInClass(ident, allowBuiltInClass))
+ return true;
+
+ if (!packageOnly)
+ return !stopEdit && ErrorPopover.show(elemId, msg + ' does not have package specified!', panels, panelId);
+ }
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
http://git-wip-us.apache.org/repos/asf/ignite/blob/31844374/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 840086e..646f8e5 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -81,7 +81,10 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return !item.empty && (!item._id || _.find($scope.displayedRows, {_id: item._id}));
};
- $scope.javaBuiltInClasses = LegacyUtils.javaBuiltInClasses;
+ $scope.javaBuiltInClassesBase = LegacyUtils.javaBuiltInClasses;
+ $scope.javaBuiltInClasses = $scope.javaBuiltInClassesBase.slice();
+ $scope.javaBuiltInClasses.splice(3, 0, 'byte[]');
+
$scope.compactJavaName = FormUtils.compactJavaName;
$scope.widthIsSufficient = FormUtils.widthIsSufficient;
$scope.saveBtnTipText = FormUtils.saveBtnTipText;
@@ -1600,7 +1603,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return !stopEdit && ErrorPopover.show(LegacyTable.tableFieldId(index, pairField.idPrefix + pairField.id), 'Field with such ' + pairField.dupObjName + ' already exists!', $scope.ui, 'query');
}
- if (pairField.classValidation && !LegacyUtils.isValidJavaClass(pairField.msg, pairValue.value, true, LegacyTable.tableFieldId(index, 'Value' + pairField.id), false, $scope.ui, 'query', stopEdit)) {
+ if (pairField.classValidation && !LegacyUtils.isValidJavaClass(pairField.msg, pairValue.value, ['byte[]'], LegacyTable.tableFieldId(index, 'Value' + pairField.id), false, $scope.ui, 'query', stopEdit)) {
if (stopEdit)
return false;