Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IndexBundle] index ui improvements #1300

Merged
merged 1 commit into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,32 @@ coreshop.index.fields = Class.create({
this.class = klass;
},

setClass: function(klass) {
this.class = klass;
},

reload: function() {
if (this.classDefinitionTreePanel) {
this.classDefinitionTreePanel.destroy();
}

this.classDefinitionTreePanel = this.getClassTree('/admin/coreshop/indices/get-class-definition-for-field-selection', this.class);

this.configPanel.add(this.classDefinitionTreePanel);
},

getLayout: function () {
var items = [
this.getSelectionPanel()
];

if (this.class) {
items.push(this.getClassDefinitionTreePanel());
}

this.configPanel = new Ext.Panel({
layout: 'border',
items: [this.getSelectionPanel(), this.getClassDefinitionTreePanel()]
items: items

});

Expand Down Expand Up @@ -127,9 +149,12 @@ coreshop.index.fields = Class.create({
var target = overModel.getOwnerTree().getView();
var source = data.view;

if (target != source) {
if (target !== source) {
var record = data.records[0];
var copy = record.createNode(Ext.apply({}, record.data));

copy.id = Ext.id();

var element = this.getConfigElement(copy);

element.getConfigDialog(copy);
Expand Down Expand Up @@ -200,7 +225,10 @@ coreshop.index.fields = Class.create({
getClassDefinitionTreePanel: function () {
if (!this.classDefinitionTreePanel) {
this.brickKeys = [];
this.classDefinitionTreePanel = this.getClassTree('/admin/coreshop/indices/get-class-definition-for-field-selection', this.class);

if (this.class) {
this.classDefinitionTreePanel = this.getClassTree('/admin/coreshop/indices/get-class-definition-for-field-selection', this.class);
}
}

return this.classDefinitionTreePanel;
Expand Down Expand Up @@ -242,17 +270,16 @@ coreshop.index.fields = Class.create({
});

tree.addListener('itemdblclick', function (tree, record, item, index, e, eOpts) {
if (!record.data.root && record.datatype != 'layout'
&& record.data.dataType != 'localizedfields') {
if (!record.data.root && record.datatype !== 'layout' && record.data.dataType !== 'localizedfields') {
var copy = Ext.apply({}, record.data);

copy.id = Ext.id();

if (this.selectionPanel && !this.selectionPanel.getRootNode().findChild('name', record.data.name)) {
this.selectionPanel.getRootNode().appendChild(copy);
}
var node = this.selectionPanel.getRootNode().appendChild(copy);

if (record.data.dataType == 'keyValue') {
var ccd = new pimcore.object.keyvalue.columnConfigDialog();
ccd.getConfigDialog(copy, this.selectionPanel);
var element = this.getConfigElement(node);
element.getConfigDialog(node);
}
}
}.bind(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ coreshop.index.item = Class.create(coreshop.resource.item, {

getIndexFields: function () {
this.fieldsPanel = new coreshop.index.fields(this.data, this.data.class);

this.indexFields = new Ext.panel.Panel({
iconCls: 'coreshop_icon_indexes_fields',
title: t('coreshop_indexes_fields'),
Expand Down Expand Up @@ -184,6 +183,15 @@ coreshop.index.item = Class.create(coreshop.resource.item, {
return saveData;
},

postSave: function (res) {
if (res.success) {
if (res.data.class) {
this.fieldsPanel.setClass(res.data.class);
this.fieldsPanel.reload();
}
}
},

isValid: function () {
return this.formPanel.down("form").isValid();
}
Expand Down