ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [1/2] ignite git commit: IGNITE-2381 WIP Move indexed key-value pairs to metadata screen.
Date Fri, 15 Jan 2016 09:12:36 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 16b51e598 -> 1b27c8c17


IGNITE-2381 WIP Move indexed key-value pairs to metadata screen.


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

Branch: refs/heads/ignite-843-rc2
Commit: 35d362735223a5b6e5440822598c24e8d997a973
Parents: dc63b9b
Author: vsisko <vsisko@gridgain.com>
Authored: Fri Jan 15 16:12:26 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Fri Jan 15 16:12:26 2016 +0700

----------------------------------------------------------------------
 .../main/js/controllers/metadata-controller.js  | 66 +++++++++-----------
 .../main/js/controllers/models/metadata.json    | 29 +++------
 modules/control-center-web/src/main/js/db.js    |  2 +-
 .../js/helpers/generator/generator-common.js    |  4 +-
 .../main/js/helpers/generator/generator-java.js | 37 +++++------
 .../main/js/helpers/generator/generator-xml.js  | 25 ++++----
 6 files changed, 72 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/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 310a5df..fdd34cf 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
@@ -1043,12 +1043,11 @@ consoleModule.controller('metadataController', function ($filter,
$http, $timeou
                 else
                     $scope.backupItem = undefined;
 
-                if ($common.isDefined($scope.backupItem) && !$common.isDefined($scope.backupItem.metadata))
{
-                    $scope.backupItem.metadata = 'Configuration';
+                if ($common.isDefined($scope.backupItem) && !$common.isDefined($scope.backupItem.queryMetadata))
+                    $scope.backupItem.queryMetadata = 'Configuration';
 
-                    if ($common.isDefined($scope.selectedItem))
-                        $scope.selectedItem.metadata = 'Configuration';
-                }
+                if ($common.isDefined($scope.selectedItem) && !$common.isDefined($scope.selectedItem.queryMetadata))
+                    $scope.selectedItem.queryMetadata = 'Configuration';
 
                 if ($common.getQueryVariable('new'))
                     $state.go('base.configuration.metadata');
@@ -1094,45 +1093,42 @@ consoleModule.controller('metadataController', function ($filter,
$http, $timeou
             else if (!$common.isValidJavaClass('Value type', item.valueType, false, 'valueType'))
                 return false;
 
-            if (item.metadata === 'Configuration') {
-                var qry = $common.metadataForQueryConfigured(item);
+            var str = $common.metadataForStoreConfigured(item);
+            var qry = $common.metadataForQueryConfigured(item);
 
-                if (qry) {
-                    if ($common.isEmptyArray(item.fields))
-                        return showPopoverMessage($scope.panels, 'query', 'fields-legend',
'Query fields should not be empty');
+            if (item.queryMetadata === 'Configuration' && qry) {
+                if ($common.isEmptyArray(item.fields))
+                    return showPopoverMessage($scope.panels, 'query', 'fields-legend', 'Query
fields should not be empty');
 
-                    var indexes = item.indexes;
+                var indexes = item.indexes;
 
-                    if (indexes && indexes.length > 0) {
-                        if (_.find(indexes, function (index, i) {
-                                if ($common.isEmptyArray(index.fields))
-                                    return !showPopoverMessage($scope.panels, 'query', 'indexes'
+ i, 'Index fields are not specified');
-                            }))
-                            return false;
-                    }
+                if (indexes && indexes.length > 0) {
+                    if (_.find(indexes, function (index, i) {
+                            if ($common.isEmptyArray(index.fields))
+                                return !showPopoverMessage($scope.panels, 'query', 'indexes'
+ i, 'Index fields are not specified');
+                        }))
+                        return false;
                 }
+            }
 
-                var str = $common.metadataForStoreConfigured(item);
-
-                if (str) {
-                    if ($common.isEmptyString(item.databaseSchema))
-                        return showPopoverMessage($scope.panels, 'store', 'databaseSchema',
'Database schema should not be empty');
+            if (str) {
+                if ($common.isEmptyString(item.databaseSchema))
+                    return showPopoverMessage($scope.panels, 'store', 'databaseSchema', 'Database
schema should not be empty');
 
-                    if ($common.isEmptyString(item.databaseTable))
-                        return showPopoverMessage($scope.panels, 'store', 'databaseTable',
'Database table should not be empty');
+                if ($common.isEmptyString(item.databaseTable))
+                    return showPopoverMessage($scope.panels, 'store', 'databaseTable', 'Database
table should not be empty');
 
-                    if ($common.isEmptyArray(item.keyFields))
-                        return showPopoverMessage($scope.panels, 'store', 'keyFields-add',
'Key fields are not specified');
+                if ($common.isEmptyArray(item.keyFields))
+                    return showPopoverMessage($scope.panels, 'store', 'keyFields-add', 'Key
fields are not specified');
 
-                    if ($common.isJavaBuiltInClass(item.keyType) && item.keyFields.length
!== 1)
-                        return showPopoverMessage($scope.panels, 'store', 'keyFields-add',
'Only one field should be specified in case when key type is a Java built-in type');
+                if ($common.isJavaBuiltInClass(item.keyType) && item.keyFields.length
!== 1)
+                    return showPopoverMessage($scope.panels, 'store', 'keyFields-add', 'Only
one field should be specified in case when key type is a Java built-in type');
 
-                    if ($common.isEmptyArray(item.valueFields))
-                        return showPopoverMessage($scope.panels, 'store', 'valueFields-add',
'Value fields are not specified');
-                }
-                else if (!qry) {
-                    return showPopoverMessage($scope.panels, 'query', 'query-title', 'SQL
query metadata should be configured');
-                }
+                if ($common.isEmptyArray(item.valueFields))
+                    return showPopoverMessage($scope.panels, 'store', 'valueFields-add',
'Value fields are not specified');
+            }
+            else if (!qry && item.queryMetadata === 'Configuration') {
+                return showPopoverMessage($scope.panels, 'query', 'query-title', 'SQL query
metadata should be configured');
             }
 
             return true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/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 fbf092c..1b568fd 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
@@ -23,17 +23,17 @@
           }
         },
         {
-          "label": "Metadata",
-          "id": "metadata",
+          "label": "Query metadata",
+          "id": "queryMetadata",
           "type": "dropdown",
-          "model": "metadata",
+          "model": "queryMetadata",
           "items": "metadataVariants",
           "required": true,
           "tip": [
-            "Metadata configured in: ",
+            "Query metadata configured with: ",
             "<ul>",
-            "  <li>Class annotations</li>",
-            "  <li>Configuration</li>",
+            "  <li>Java annotations like @QuerySqlField</li>",
+            "  <li>Configuration via QueryEntity class</li>",
             "</ul>"
           ]
         },
@@ -72,7 +72,7 @@
         {
           "label": "Not available for annotated types",
           "type": "not-available",
-          "hide": "backupItem.metadata !== 'Annotations'"
+          "hide": "backupItem.queryMetadata !== 'Annotations'"
         },
         {
           "label": "Fields",
@@ -83,7 +83,7 @@
           "keyName": "name",
           "valueName": "className",
           "focusId": "QryField",
-          "hide": "backupItem.metadata !== 'Configuration'",
+          "hide": "backupItem.queryMetadata !== 'Configuration'",
           "addTip": "Add field to query",
           "removeTip": "Remove field",
           "tip": [
@@ -99,7 +99,7 @@
           "keyName": "field",
           "valueName": "alias",
           "focusId": "Alias",
-          "hide": "backupItem.metadata !== 'Configuration'",
+          "hide": "backupItem.queryMetadata !== 'Configuration'",
           "addTip": "Add alias to query",
           "removeTip": "Remove alias",
           "tip": [
@@ -113,7 +113,7 @@
           "type": "table-indexes",
           "ui": "table-indexes",
           "model": "indexes",
-          "hide": "backupItem.metadata !== 'Configuration'",
+          "hide": "backupItem.queryMetadata !== 'Configuration'",
           "addTip": "Add new index",
           "removeTip": "Remove index",
           "addItemTip": "Add new field to index",
@@ -133,16 +133,10 @@
       ],
       "fields": [
         {
-          "label": "Not available for annotated types",
-          "type": "not-available",
-          "hide": "backupItem.metadata !== 'Annotations'"
-        },
-        {
           "label": "Database schema",
           "id": "databaseSchema",
           "type": "text",
           "model": "databaseSchema",
-          "hide": "backupItem.metadata !== 'Configuration'",
           "placeholder": "Input DB schema name",
           "tip": [
             "Schema name in database"
@@ -153,7 +147,6 @@
           "id": "databaseTable",
           "type": "text",
           "model": "databaseTable",
-          "hide": "backupItem.metadata !== 'Configuration'",
           "placeholder": "Input DB table name",
           "tip": [
             "Table name in database"
@@ -167,7 +160,6 @@
           "keyName": "name",
           "valueName": "className",
           "focusId": "KeyField",
-          "hide": "backupItem.metadata !== 'Configuration'",
           "addTip": "Add key field",
           "removeTip": "Remove key field",
           "tip": [
@@ -182,7 +174,6 @@
           "keyName": "name",
           "valueName": "className",
           "focusId": "ValueField",
-          "hide": "backupItem.metadata !== 'Configuration'",
           "addTip": "Add value field",
           "removeTip": "Remove value field",
           "tip": [

http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/modules/control-center-web/src/main/js/db.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js
index 2678ade..cd2c6c9 100644
--- a/modules/control-center-web/src/main/js/db.js
+++ b/modules/control-center-web/src/main/js/db.js
@@ -74,7 +74,7 @@ exports.Space = mongoose.model('Space', new Schema({
 var CacheTypeMetadataSchema = new Schema({
     space: {type: ObjectId, ref: 'Space'},
     caches: [{type: ObjectId, ref: 'Cache'}],
-    metadata: {type: String, enum: ['Annotations', 'Config']},
+    queryMetadata: {type: String, enum: ['Annotations', 'Config']},
     kind: {type: String, enum: ['query', 'store', 'both']},
     databaseSchema: String,
     databaseTable: String,

http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
b/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
index 9922e8a..159f2a9 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
@@ -465,6 +465,6 @@ $generatorCommon.binaryIsDefined = function (binary) {
 };
 
 // Extract domain metadata.
-$generatorCommon.domainMetadata = function(domain) {
-    return domain.metadata ? domain.metadata : 'Configuration';
+$generatorCommon.domainQueryMetadata = function(domain) {
+    return domain.queryMetadata ? domain.queryMetadata : 'Configuration';
 };

http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
index 36fa6a4..64175d2 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
@@ -987,7 +987,7 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
     $generatorJava.property(res, varName, cache, 'longQueryWarningTimeout');
 
     var indexedTypes = _.filter(cache.metadatas, function (meta) {
-        return meta.metadata === 'Annotations'
+        return meta.queryMetadata === 'Annotations'
     });
 
     if ($commonUtils.isDefinedAndNotEmpty(indexedTypes)) {
@@ -1177,7 +1177,7 @@ $generatorJava.cacheStore = function (cache, metadatas, cacheVarName,
res) {
                 res.needEmptyLine = true;
 
                 var metaConfigs = _.filter(metadatas, function (meta) {
-                    return $generatorCommon.domainMetadata(meta) === 'Configuration' &&
+                    return $generatorCommon.domainQueryMetadata(meta) === 'Configuration'
&&
                         $commonUtils.isDefinedAndNotEmpty(meta.databaseTable);
                 });
 
@@ -1496,7 +1496,7 @@ $generatorJava.metadataQuery = function (meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if ($generatorCommon.domainMetadata(meta) === 'Configuration') {
+    if ($generatorCommon.domainQueryMetadata(meta) === 'Configuration') {
         $generatorJava.metadataQueryFields(res, meta);
 
         $generatorJava.metadataQueryAliases(res, meta);
@@ -1514,21 +1514,19 @@ $generatorJava.metadataStore = function (meta, withTypes, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if ($generatorCommon.domainMetadata(meta) === 'Configuration') {
-        $generatorJava.property(res, 'jdbcType', meta, 'databaseSchema');
-        $generatorJava.property(res, 'jdbcType', meta, 'databaseTable');
+    $generatorJava.property(res, 'jdbcType', meta, 'databaseSchema');
+    $generatorJava.property(res, 'jdbcType', meta, 'databaseTable');
 
-        if (withTypes) {
-            $generatorJava.classNameProperty(res, 'jdbcType', meta, 'keyType');
-            $generatorJava.property(res, 'jdbcType', meta, 'valueType');
-        }
+    if (withTypes) {
+        $generatorJava.classNameProperty(res, 'jdbcType', meta, 'keyType');
+        $generatorJava.property(res, 'jdbcType', meta, 'valueType');
+    }
 
-        $generatorJava.metadataDatabaseFields(res, meta, 'keyFields');
+    $generatorJava.metadataDatabaseFields(res, meta, 'keyFields');
 
-        $generatorJava.metadataDatabaseFields(res, meta, 'valueFields');
+    $generatorJava.metadataDatabaseFields(res, meta, 'valueFields');
 
-        res.needEmptyLine = true;
-    }
+    res.needEmptyLine = true;
 
     return res;
 };
@@ -1539,7 +1537,7 @@ $generatorJava.cacheMetadatas = function (metadatas, varName, res) {
         res = $generatorCommon.builder();
 
     var metaConfigs = _.filter(metadatas, function (meta) {
-        return $generatorCommon.domainMetadata(meta) === 'Configuration' &&
+        return $generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
             $commonUtils.isDefinedAndNotEmpty(meta.fields);
     });
 
@@ -1595,8 +1593,7 @@ $generatorJava.clusterMetadatas = function (caches, res) {
 
     _.forEach(caches, function (cache) {
         _.forEach(cache.metadatas, function (meta) {
-            if ($generatorCommon.domainMetadata(meta) === 'Configuration' &&
-                !$commonUtils.isDefined(_.find(metadatas, function (m) {
+            if (!$commonUtils.isDefined(_.find(metadatas, function (m) {
                     return m === meta.valueType;
                 }))) {
                 $generatorJava.resetVariables(res);
@@ -1628,7 +1625,8 @@ $generatorJava.clusterMetadatas = function (caches, res) {
                     res.needEmptyLine = true;
                 }
 
-                if ($commonUtils.isDefinedAndNotEmpty(meta.fields)) {
+                if ($generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
+                    $commonUtils.isDefinedAndNotEmpty(meta.fields)) {
                     res.line('/**');
                     res.line(' * Create SQL Query descriptor for ' + type + '.');
                     res.line(' *');
@@ -2036,8 +2034,7 @@ $generatorJava.pojos = function (caches, useConstructor, includeKeyFields)
{
     _.forEach(caches, function(cache) {
         _.forEach(cache.metadatas, function(meta) {
             // Skip already generated classes.
-            if ($generatorCommon.domainMetadata(meta) === 'Configuration' &&
-                !_.find(metadatas, {valueType: meta.valueType}) &&
+            if (!_.find(metadatas, {valueType: meta.valueType}) &&
                 // Skip metadata without value fields.
                 $commonUtils.isDefinedAndNotEmpty(meta.valueFields)) {
                 var metadata = {};

http://git-wip-us.apache.org/repos/asf/ignite/blob/35d36273/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js b/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
index e795c2b..96f4c0a 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
@@ -766,7 +766,7 @@ $generatorXml.cacheQuery = function(cache, res) {
     $generatorXml.property(res, cache, 'longQueryWarningTimeout');
 
     var indexedTypes = _.filter(cache.metadatas, function (meta) {
-        return meta.metadata === 'Annotations'
+        return meta.queryMetadata === 'Annotations'
     });
 
     if (indexedTypes.length > 0) {
@@ -815,8 +815,7 @@ $generatorXml.cacheStore = function(cache, metadatas, res) {
                 res.endBlock('</property>');
 
                 var metaConfigs = _.filter(metadatas, function (meta) {
-                    return $generatorCommon.domainMetadata(meta) === 'Configuration' &&
-                        $commonUtils.isDefinedAndNotEmpty(meta.databaseTable);
+                    return $commonUtils.isDefinedAndNotEmpty(meta.databaseTable);
                 });
 
                 if ($commonUtils.isDefinedAndNotEmpty(metaConfigs)) {
@@ -1122,7 +1121,7 @@ $generatorXml.metadataQuery = function(meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if ($generatorCommon.domainMetadata(meta) === 'Configuration') {
+    if ($generatorCommon.domainQueryMetadata(meta) === 'Configuration') {
         $generatorXml.metadataQueryFields(res, meta);
 
         $generatorXml.metadataQueryAliases(res, meta);
@@ -1140,19 +1139,17 @@ $generatorXml.metadataStore = function(meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if ($generatorCommon.domainMetadata(meta) === 'Configuration') {
-        $generatorXml.property(res, meta, 'databaseSchema');
-        $generatorXml.property(res, meta, 'databaseTable');
+    $generatorXml.property(res, meta, 'databaseSchema');
+    $generatorXml.property(res, meta, 'databaseTable');
 
-        res.needEmptyLine = true;
+    res.needEmptyLine = true;
 
-        if (!$dataStructures.isJavaBuiltInClass(meta.keyType))
-            $generatorXml.metadataDatabaseFields(res, meta, 'keyFields');
+    if (!$dataStructures.isJavaBuiltInClass(meta.keyType))
+        $generatorXml.metadataDatabaseFields(res, meta, 'keyFields');
 
-        $generatorXml.metadataDatabaseFields(res, meta, 'valueFields');
+    $generatorXml.metadataDatabaseFields(res, meta, 'valueFields');
 
-        res.needEmptyLine = true;
-    }
+    res.needEmptyLine = true;
 
     return res;
 };
@@ -1181,7 +1178,7 @@ $generatorXml.cacheMetadatas = function(metadatas, res) {
         res = $generatorCommon.builder();
 
     var metaConfigs = _.filter(metadatas, function (meta) {
-        return $generatorCommon.domainMetadata(meta) === 'Configuration' &&
+        return $generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
             $commonUtils.isDefinedAndNotEmpty(meta.fields);
     });
 


Mime
View raw message