Skip to content

Commit

Permalink
[Bug]: Schema definition check for supported fields does not work (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-moser authored Sep 24, 2024
1 parent f781127 commit 9a9e36b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Resources/public/js/fieldConfigDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
var addNode = function (node) {
if (!node.data.root && node.data.type != "layout" && node.data.dataType != 'localizedfields' && node.data.dataType != 'system') {
if (!this.selectionPanel.getRootNode().findChild("key", node.data.key)) {
if (!this.checkSupported(node, true)) {
return;
}
var copy = Ext.apply({}, node.data);
delete copy.id;
var addedNode = this.selectionPanel.getRootNode().appendChild(copy);
Expand Down Expand Up @@ -338,6 +341,9 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
var dragData = [];
records.forEach(function (record) {
if (!this.selectionPanel.getRootNode().findChild("key", record.data.key)) {
if (!this.checkSupported(record)) {
return;
}
var copy = Ext.apply({}, record.data);
delete copy.id;
copy = record.createNode(copy);
Expand Down Expand Up @@ -867,11 +873,13 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
return element;
},

checkSupported: function (record) {
checkSupported: function (record, silent = false) {
if (record.data.type == "data") {
var dataType = record.data.dataType;
if (dataType != "system" && !in_array(dataType, pimcore.plugin.datahub.graphql["supported" + ucfirst(this.type) + "DataTypes"])) {
Ext.MessageBox.alert(t("error"), sprintf(t("plugin_pimcore_datahub_" + this.type) + " " + t('plugin_pimcore_datahub_datatype_not_supported_yet'), dataType));
if (!silent) {
Ext.MessageBox.alert(t("error"), sprintf(t("plugin_pimcore_datahub_" + this.type) + " " + t('plugin_pimcore_datahub_datatype_not_supported_yet'), dataType));
}
return false;
}
}
Expand Down

0 comments on commit 9a9e36b

Please sign in to comment.