partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit f6f3c3ca10c977f2d05bcdb4705889195482404d
parent 2edc04b4a1dee261516f21e08c5bbbb7bc4e0b0e
Author: Felicia Hummel <felicia@partkeepr.com>
Date:   Thu, 19 Jan 2017 20:06:48 +0100

Updated model reflection to ExtJS 6.2

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/ModelTreeMaker/ModelTreeMaker.js | 10+++++-----
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/EntityQueryPanel.js | 11+++++------
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/FieldSelector.js | 8++++----
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js | 2+-
4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/ModelTreeMaker/ModelTreeMaker.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/ModelTreeMaker/ModelTreeMaker.js @@ -108,18 +108,18 @@ Ext.define("PartKeepr.ModelTreeMaker.ModelTreeMaker", { for (i in associations) { associationAlreadyProcessed = false; - if (typeof associations[i].legacy !== "undefined" && associations[i].isMany === true) { + if (typeof(associations[i].storeName) !== "undefined" && associations[i].isMany === true) { for (j = 0; j < this.visitedModels.length; j++) { - if (this.visitedModels[j] === associations[i].model) { + if (this.visitedModels[j] === associations[i].type) { associationAlreadyProcessed = true; } } if (!associationAlreadyProcessed) { childNode = node.appendChild(Ext.create("PartKeepr.Data.ReflectionFieldTreeModel",{ - text: associations[i].name, + text: associations[i].role, data: { - name: prefix + associations[i].name, + name: prefix + associations[i].role, type: "onetomany", reference: associations[i].cls }, @@ -130,7 +130,7 @@ Ext.define("PartKeepr.ModelTreeMaker.ModelTreeMaker", { childNode.set(callback(associations[i].cls, childNode)); } - this.make(childNode, associations[i].cls, prefix + associations[i].name + ".", callback); + this.make(childNode, associations[i].cls, prefix + associations[i].role+ ".", callback); } } } diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/EntityQueryPanel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/EntityQueryPanel.js @@ -49,7 +49,8 @@ Ext.define("PartKeepr.Widgets.EntityQueryPanel", { maxValue: 99 }, renderer: function (val, md, record) { - if (record.get("data") !== null && + if (record.get("data") instanceof Object && + typeof(record.get("data").type) !== "undefined" && record.get("data").type !== "onetomany") { return ""; } else { @@ -205,10 +206,7 @@ Ext.define("PartKeepr.Widgets.EntityQueryPanel", { this.columns.push({ dataIndex: fieldPath, text: fieldPath, - renderer: function (value, metadata, record, rowIndex, colIndex) - { - return record.get(this.getColumns()[colIndex].dataIndex); - }, + renderer: this.columnRenderer, scope: this.down('#grid') }); @@ -278,7 +276,8 @@ Ext.define("PartKeepr.Widgets.EntityQueryPanel", { }, columnRenderer: function (value, metadata, record, rowIndex, colIndex) { - return record.get(this.getColumns()[colIndex].dataIndex); + var index = this.getColumns()[colIndex].dataIndex; + return record.get(index); }, /** * Returns if a specific column exists in the grid.Must be a record and has the "data" property defined. diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/FieldSelector.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/FieldSelector.js @@ -136,7 +136,7 @@ Ext.define('PartKeepr.Components.Widgets.FieldSelector', { for (i in associations) { associationAlreadyProcessed = false; - if (typeof associations[i].legacy !== "undefined" && associations[i].isMany === true) { + if (typeof(associations[i].storeName) !== "undefined" && associations[i].isMany === true) { for (j = 0; j < this.visitedModels.length; j++) { if (this.visitedModels[j] === associations[i].model) { associationAlreadyProcessed = true; @@ -145,9 +145,9 @@ Ext.define('PartKeepr.Components.Widgets.FieldSelector', { if (!associationAlreadyProcessed) { childNode = node.appendChild({ - text: associations[i].name, + text: associations[i].role, data: { - name: prefix + associations[i].name, + name: prefix + associations[i].role, type: "onetomany", reference: associations[i].cls }, @@ -158,7 +158,7 @@ Ext.define('PartKeepr.Components.Widgets.FieldSelector', { childNode.set(callback(associations[i].cls, childNode)); } - this.treeMaker(childNode, associations[i].cls, prefix + associations[i].name + ".", callback); + this.treeMaker(childNode, associations[i].cls, prefix + associations[i].role + ".", callback); } } } diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js @@ -43,7 +43,7 @@ Ext.define("PartKeepr.data.HydraModel", { closingBracket = parts[0].indexOf("]", openingBracket); index = parts[0].substring(openingBracket+1, closingBracket); - subEntityStore = this[this.associations[subEntity].name](); + subEntityStore = this[this.associations[subEntity].role](); item = subEntityStore.getAt(index); if (item !== null) {