IGNITE-843: WIP assosiate meta with cache.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8f304282 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8f304282 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8f304282 Branch: refs/heads/ignite-1121 Commit: 8f3042822c23a165745ebf7de3f094fe07738332 Parents: b6911af Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Jul 24 18:51:59 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Jul 24 18:51:59 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/caches-controller.js | 14 ++++++++++++++ .../main/js/controllers/clusters-controller.js | 6 ++---- .../src/main/js/controllers/models/caches.json | 14 ++++++++++++++ .../src/main/js/controllers/models/metadata.json | 8 +++++++- modules/web-control-center/src/main/js/db.js | 2 ++ .../src/main/js/routes/caches.js | 18 ++++++++++++++---- .../src/main/js/views/includes/controls.jade | 4 ++-- 7 files changed, 55 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/controllers/caches-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/caches-controller.js b/modules/web-control-center/src/main/js/controllers/caches-controller.js index 0c23e3b..d8993c2 100644 --- a/modules/web-control-center/src/main/js/controllers/caches-controller.js +++ b/modules/web-control-center/src/main/js/controllers/caches-controller.js @@ -100,6 +100,8 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' }); $scope.caches = []; + $scope.queryMetadata = []; + $scope.storeMetadata = []; $scope.required = function (field) { var model = $common.isDefined(field.path) ? field.path + '.' + field.model : field.model; @@ -172,6 +174,16 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' $scope.spaces = data.spaces; $scope.caches = data.caches; + _.forEach(data.metadatas, function (meta) { + var kind = meta.kind; + + if (kind == 'query' || kind == 'both') + $scope.queryMetadata.push(meta); + + if (kind == 'store' || kind == 'both') + $scope.storeMetadata.push(meta); + }); + var restoredItem = angular.fromJson(sessionStorage.cacheBackupItem); if (restoredItem) { @@ -214,6 +226,8 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common' $table.tableReset(); $scope.backupItem = {mode: 'PARTITIONED', atomicityMode: 'ATOMIC', readFromBackup: true, copyOnRead: true}; + $scope.backupItem.queryMetadata = []; + $scope.backupItem.spaceMetadata = []; $scope.backupItem.space = $scope.spaces[0]._id; }; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/controllers/clusters-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/clusters-controller.js b/modules/web-control-center/src/main/js/controllers/clusters-controller.js index 1ec78a1..41215b0 100644 --- a/modules/web-control-center/src/main/js/controllers/clusters-controller.js +++ b/modules/web-control-center/src/main/js/controllers/clusters-controller.js @@ -32,10 +32,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible; $scope.templates = [ - { - value: {discovery: {kind: 'Multicast', Vm: {addresses: ['127.0.0.1:47500..47510']}, Multicast: {}}}, - label: 'multicast' - }, + {value: {discovery: {kind: 'Multicast', Vm: {addresses: ['127.0.0.1:47500..47510']}, Multicast: {}}},label: 'multicast'}, {value: {discovery: {kind: 'Vm', Vm: {addresses: ['127.0.0.1:47500..47510']}}}, label: 'local'} ]; @@ -188,6 +185,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo $table.tableReset(); $scope.backupItem = angular.copy($scope.create.template); + $scope.backupItem.caches = []; $scope.backupItem.space = $scope.spaces[0]._id; }; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/controllers/models/caches.json ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/models/caches.json b/modules/web-control-center/src/main/js/controllers/models/caches.json index e3f0613..6f334d2 100644 --- a/modules/web-control-center/src/main/js/controllers/models/caches.json +++ b/modules/web-control-center/src/main/js/controllers/models/caches.json @@ -368,6 +368,20 @@ ] }, { + "label": "Metadata", + "type": "dropdown-multiple", + "model": "queryMetadata", + "placeholder": "Choose metadata", + "items": "queryMetadata", + "tip": [ + "Select cache type metadata to describe types in cache." + ], + "addLink": { + "label": "Add metadata(s)", + "ref": "/configuration/metadata" + } + } , + { "type": "indexedTypes", "model": "indexedTypes", "keyName": "keyClass", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/controllers/models/metadata.json ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/models/metadata.json b/modules/web-control-center/src/main/js/controllers/models/metadata.json index b002aeb..6c9bf35 100644 --- a/modules/web-control-center/src/main/js/controllers/models/metadata.json +++ b/modules/web-control-center/src/main/js/controllers/models/metadata.json @@ -93,6 +93,8 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind != 'both' && backupItem.kind == 'query'", + "addTip": "Add key field.", + "removeTip": "Remove key field.", "tip": [ "Collection of key fields descriptions for CacheJdbcPojoStore." ] @@ -104,6 +106,8 @@ "keyName": "name", "valueName": "className", "hide": "backupItem.kind != 'both' && backupItem.kind == 'query'", + "addTip": "Add value field.", + "removeTip": "Remove value field.", "tip": [ "Collection of value fields descriptions for CacheJdbcPojoStore.." ] @@ -167,8 +171,10 @@ "type": "queryGroups", "model": "groups", "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", - "addTip": "Add new group index.", + "addTip": "Add new group.", "removeTip": "Remove group.", + "addItemTip": "Add new field to group.", + "removeItemTip": "Remove field from group.", "tip": [ "Collection of group indexes." ] http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/db.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/db.js b/modules/web-control-center/src/main/js/db.js index e34272c..b0b7053 100644 --- a/modules/web-control-center/src/main/js/db.js +++ b/modules/web-control-center/src/main/js/db.js @@ -124,6 +124,7 @@ var CacheSchema = new Schema({ rebalanceTimeout: Number, rebalanceThrottle: Number, + storeMetadatas: [{type: ObjectId, ref: 'CacheTypeMetadata'}], cacheStoreFactory: { kind: { type: String, @@ -167,6 +168,7 @@ var CacheSchema = new Schema({ sqlEscapeAll: Boolean, sqlOnheapRowCacheSize: Number, longQueryWarningTimeout: Number, + queryMetadatas: [{type: ObjectId, ref: 'CacheTypeMetadata'}], indexedTypes: [{keyClass: String, valueClass: String}], sqlFunctionClasses: [String], statisticsEnabled: Boolean, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/routes/caches.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/routes/caches.js b/modules/web-control-center/src/main/js/routes/caches.js index 3fefd37..7b9c62b 100644 --- a/modules/web-control-center/src/main/js/routes/caches.js +++ b/modules/web-control-center/src/main/js/routes/caches.js @@ -41,12 +41,22 @@ router.post('/list', function (req, res) { return value._id; }); - // Get all caches for spaces. - db.Cache.find({space: {$in: space_ids}}).sort('name').exec(function (err, caches) { + // Get all caches type metadata for spaces. + db.CacheTypeMetadata.find({space: {$in: space_ids}}, '_id name kind', function (err, metadatas) { if (err) - return res.status(500).send(err.message); + return res.status(500).send(err); + + // Get all caches for spaces. + db.Cache.find({space: {$in: space_ids}}).sort('name').exec(function (err, caches) { + if (err) + return res.status(500).send(err.message); + + var metadatasJson = metadatas.map(function (meta) { + return {value: meta._id, label: meta.name, kind: meta.kind}; + }); - res.json({spaces: spaces, caches: caches}); + res.json({spaces: spaces, metadatas: metadatasJson, caches: caches}); + }); }); }); }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8f304282/modules/web-control-center/src/main/js/views/includes/controls.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/views/includes/controls.jade b/modules/web-control-center/src/main/js/views/includes/controls.jade index c0ccc91..aebe4de 100644 --- a/modules/web-control-center/src/main/js/views/includes/controls.jade +++ b/modules/web-control-center/src/main/js/views/includes/controls.jade @@ -307,7 +307,7 @@ mixin form-row-custom(lblClasses, fieldClasses) .col-sm-12(ng-show='!tableEditing(field, $index)') a.labelFormField(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-add('tableGroupNewItem($index)', 'field.addTip') + +btn-add('tableGroupNewItem($index)', 'field.addItemTip') div(ng-show='tableEditing(field, $index)') label.labelField {{$index + 1}}) +btn-save('tableGroupSaveVisible(curGroupName)', 'tableGroupSave(curGroupName, $index)') @@ -319,7 +319,7 @@ mixin form-row-custom(lblClasses, fieldClasses) td div(ng-show='!tableGroupItemEditing(groupIndex, $index)') a.labelFormField(ng-click='curGroupItem = tableGroupItemStartEdit(groupIndex, $index); curFieldName = curGroupItem.name; curClassName = curGroupItem.className; curDirection = curGroupItem.direction') {{$index + 1}}) {{groupItem.name}} / {{groupItem.className}} / {{groupItem.direction}} - +btn-remove('tableRemoveGroupItem(group, $index)', 'field.removeTip') + +btn-remove('tableRemoveGroupItem(group, $index)', 'field.removeItemTip') div(ng-show='tableGroupItemEditing(groupIndex, $index)') label.labelField {{$index + 1}}) +btn-save('tableGroupItemSaveVisible(curFieldName, curClassName)', 'tableGroupItemSave(curFieldName, curClassName, curDirection, groupIndex, $index)')