You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/07/15 21:16:59 UTC

[11/45] incubator-ignite git commit: IGNITE-843 WIP on metadata.

IGNITE-843 WIP on metadata.


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

Branch: refs/heads/ignite-1121
Commit: 2265fe4fe0dd0fdc3d1cd7cd532926b807b9f02d
Parents: 8424670
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jul 14 11:57:41 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jul 14 11:57:41 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/models/metadata.json     | 67 +++++++++-----------
 modules/web-control-center/nodejs/db.js         | 15 ++++-
 .../nodejs/views/includes/controls.jade         | 48 ++++++++++++++
 3 files changed, 92 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2265fe4f/modules/web-control-center/nodejs/controllers/models/metadata.json
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/models/metadata.json b/modules/web-control-center/nodejs/controllers/models/metadata.json
index 02b9809..1f540ae 100644
--- a/modules/web-control-center/nodejs/controllers/models/metadata.json
+++ b/modules/web-control-center/nodejs/controllers/models/metadata.json
@@ -24,81 +24,74 @@
       "placeholder": "Select kind"
     },
     {
-      "label": "dbSchema",
+      "label": "Database schema",
       "type": "text",
-      "model": "dbSchema",
+      "model": "databaseSchema",
       "required": true,
       "placeholder": "Input DB schema name"
     },
     {
-      "label": "dbTbl",
+      "label": "Database table",
       "type": "text",
-      "model": "dbTbl",
+      "model": "databaseTable",
       "required": true,
       "placeholder": "Input DB table name"
     },
     {
-      "label": "keyType",
+      "label": "Key type",
       "type": "text",
       "model": "keyType",
       "required": true,
       "placeholder": "Full class name for Key"
     },
     {
-      "label": "valType",
+      "label": "Value type",
       "type": "text",
-      "model": "valType",
+      "model": "value Type",
       "required": true,
       "placeholder": "Full class name for Value"
     },
     {
-      "label": "keyFields",
-      "type": "text",
+      "label": "Key fields",
+      "type": "fieldsMetadata",
       "model": "keyFields",
-      "required": true,
-      "placeholder": "TODO"
+      "tip": ["Collection of key fields descriptions."]
     },
     {
       "label": "valFields",
-      "type": "text",
-      "model": "valFields",
-      "required": true,
-      "placeholder": "TODO"
+      "type": "fieldsMetadata",
+      "model": "valueFields",
+      "tip": ["Collection of value fields descriptions."]
     },
     {
-      "label": "qryFlds",
+      "label": "Query fields",
       "type": "text",
-      "model": "qryFlds",
-      "required": true,
-      "placeholder": "TODO"
+      "model": "queryFields",
+      "tip": ["TODO."]
     },
     {
-      "label": "ascFlds",
+      "label": "Ascending fields",
       "type": "text",
-      "model": "ascFlds",
-      "required": true,
-      "placeholder": "TODO"
+      "model": "ascendingFields",
+      "tip": ["TODO."]
     },
     {
-      "label": "descFlds",
+      "label": "Descending fields",
       "type": "text",
-      "model": "descFlds",
-      "required": true,
-      "placeholder": "TODO"
+      "model": "descendingFields",
+      "tip": ["TODO."]
     },
     {
-      "label": "txtFlds",
-      "type": "text",
-      "model": "txtFlds",
-      "required": true,
-      "placeholder": "TODO"
+      "label": "Text fields",
+      "type": "table-simple",
+      "model": "textFields",
+      "tip": ["TODO."]
     },
     {
-      "label": "grps",
-      "type": "text",
-      "model": "grps",
-      "required": true,
-      "placeholder": "TODO"
+      "label": "Groups",
+      "type": "groupsMetadata",
+      "model": "groups",
+      "tip": ["TODO."]
     }
   ]
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2265fe4f/modules/web-control-center/nodejs/db.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/db.js b/modules/web-control-center/nodejs/db.js
index 101d4ae..b931f78 100644
--- a/modules/web-control-center/nodejs/db.js
+++ b/modules/web-control-center/nodejs/db.js
@@ -51,7 +51,20 @@ exports.Space = mongoose.model('Space', new Schema({
 // Define cache type metadata model.
 var CacheTypeMetadataSchema = new Schema({
     space: {type: ObjectId, ref: 'Space'},
-    name: String
+    name: String,
+    kind: {type: String, enum: ['query', 'store', 'both']},
+    databaseSchema: String,
+    databaseTable: String,
+    keyType: String,
+    valueType: String,
+    valType: String,
+    keyFields: [{dbName: String, dbType: Number, javaName: String, javaType: String}],
+    valueFields: [{dbName: String, dbType: Number, javaName: String, javaType: String}],
+    queryFields: [{name: String, className: String}],
+    ascendingFields: [{name: String, className: String}],
+    descendingFields:  [{name: String, className: String}],
+    textFields: [String],
+    groups: [{name: String, fields: [{field: String, direction: String}]}]
 });
 
 exports.CacheTypeMetadata = mongoose.model('CacheTypeMetadata', CacheTypeMetadataSchema);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2265fe4f/modules/web-control-center/nodejs/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/includes/controls.jade b/modules/web-control-center/nodejs/views/includes/controls.jade
index 7fbe11e..3256f57 100644
--- a/modules/web-control-center/nodejs/views/includes/controls.jade
+++ b/modules/web-control-center/nodejs/views/includes/controls.jade
@@ -174,6 +174,54 @@ mixin form-row
                 +tipField('field.tip')
                 .input-tip
                     input.form-control(type='text' ng-model='newValue' ng-focus='field.editIdx = -1'  placeholder='{{field.placeholder}}')
+        div(ng-switch-when='fieldsMetadata')&attributes(fieldCommon)
+            div
+                label.table-header {{field.label}}:
+                +tipLabel('field.tableTip')
+            table.links-edit.col-sm-12(st-table='#{fieldMdl}' ng-show='#{fieldMdl}.length > 0')
+                tbody
+                    tr.col-sm-12(ng-repeat='item in #{fieldMdl} track by $index')
+                        td.col-sm-6
+                            div(ng-show='field.editIdx != {{$index}}')
+                                a(ng-click='field.editIdx = $index; curValue = #{fieldMdl}[$index]') {{$index + 1}}) {{item | compact}}
+                                i.tipField.fa.fa-remove(ng-click='field.editIdx = -1; #{fieldMdl}.splice($index, 1)')
+                            div(ng-show='field.editIdx == {{$index}}')
+                                label.labelField {{$index + 1}})
+                                i.tipField.fa.fa-floppy-o(ng-click='#{fieldMdl}[$index] = curValue ? curValue : #{fieldMdl}[$index]; field.editIdx = curValue ? -1 : field.editIdx')
+                                .input-tip
+                                    input.form-control(type='text' ng-model='curValue' placeholder='{{field.placeholder}}')
+                        td.col-sm-1(ng-if='field.reordering')
+                            i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index - 1); field.editIdx = -1;')
+                            i.fa.fa-arrow-down(ng-show='$index < #{fieldMdl}.length - 1' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index + 1); field.editIdx = -1;')
+            .col-sm-6
+                button.btn.btn-primary.fieldButton(ng-disabled='!newValue || #{fieldMdl}.indexOf(newValue) >= 0' ng-click='field.editIdx = -1; #{fieldMdl} ? #{fieldMdl}.push(newValue) : #{fieldMdl} = [newValue];') Add
+                +tipField('field.tip')
+                .input-tip
+                    input.form-control(type='text' ng-model='newValue' ng-focus='field.editIdx = -1'  placeholder='{{field.placeholder}}')
+        div(ng-switch-when='groupsMetadata')&attributes(fieldCommon)
+            div
+                label.table-header {{field.label}}:
+                +tipLabel('field.tableTip')
+            table.links-edit.col-sm-12(st-table='#{fieldMdl}' ng-show='#{fieldMdl}.length > 0')
+                tbody
+                    tr.col-sm-12(ng-repeat='item in #{fieldMdl} track by $index')
+                        td.col-sm-6
+                            div(ng-show='field.editIdx != {{$index}}')
+                                a(ng-click='field.editIdx = $index; curValue = #{fieldMdl}[$index]') {{$index + 1}}) {{item | compact}}
+                                i.tipField.fa.fa-remove(ng-click='field.editIdx = -1; #{fieldMdl}.splice($index, 1)')
+                            div(ng-show='field.editIdx == {{$index}}')
+                                label.labelField {{$index + 1}})
+                                i.tipField.fa.fa-floppy-o(ng-click='#{fieldMdl}[$index] = curValue ? curValue : #{fieldMdl}[$index]; field.editIdx = curValue ? -1 : field.editIdx')
+                                .input-tip
+                                    input.form-control(type='text' ng-model='curValue' placeholder='{{field.placeholder}}')
+                        td.col-sm-1(ng-if='field.reordering')
+                            i.fa.fa-arrow-up(ng-show='$index > 0' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index - 1); field.editIdx = -1;')
+                            i.fa.fa-arrow-down(ng-show='$index < #{fieldMdl}.length - 1' ng-click='swapSimpleItems(#{fieldMdl}, $index, $index + 1); field.editIdx = -1;')
+            .col-sm-6
+                button.btn.btn-primary.fieldButton(ng-disabled='!newValue || #{fieldMdl}.indexOf(newValue) >= 0' ng-click='field.editIdx = -1; #{fieldMdl} ? #{fieldMdl}.push(newValue) : #{fieldMdl} = [newValue];') Add
+                +tipField('field.tip')
+                .input-tip
+                    input.form-control(type='text' ng-model='newValue' ng-focus='field.editIdx = -1'  placeholder='{{field.placeholder}}')
         div(ng-switch-when='indexedTypes')
             - var tblMdl = 'backupItem.indexedTypes'
             div