bugfix multiple call for lookup item (#324)

pull/3759/head
Leonel Matos 2020-02-11 18:14:25 -04:00 committed by GitHub
parent 252cc43679
commit 2d9b33398e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 3 deletions

View File

@ -138,8 +138,11 @@ export default {
if (!this.metadata.inTable) {
if (this.metadata.displayed) {
if (!this.options.some(option => option.key === value)) {
this.options.push({
key: value,
label: this.findLabel(value)
})
this.value = value
this.getDataLookupItem()
}
}
this.value = value

View File

@ -61,7 +61,8 @@ const callOutControl = {
newValues,
isSendToServer: false,
withOutColumnNames,
isSendCallout: false
isSendCallout: false,
isChangeFromCallout: true
})
}
})

View File

@ -362,7 +362,8 @@ const panel = {
isSendCallout = true,
isAdvancedQuery = false,
isPrivateAccess = false,
fieldList = []
fieldList = [],
isChangeFromCallout = false
}) {
if (!fieldList.length) {
fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
@ -377,6 +378,46 @@ const panel = {
if (!newValues.hasOwnProperty(actionField.columnName)) {
return
}
if (isChangeFromCallout && actionField.componentPath === 'FieldSelect' && !newValues.hasOwnProperty(`DisplayColumn_${actionField.columnName}`)) {
const lookup = getters.getLookupItem({
parentUuid: parentUuid,
containerUuid: containerUuid,
directQuery: actionField.reference.directQuery,
tableName: actionField.reference.tableName,
value: newValues[actionField.columnName]
})
if (isEmptyValue(lookup)) {
dispatch('getLookupItemFromServer', {
parentUuid: parentUuid,
containerUuid: containerUuid,
tableName: actionField.reference.tableName,
directQuery: actionField.reference.parsedDirectQuery,
value: newValues[actionField.columnName]
})
.then(response => {
dispatch('notifyFieldChange', {
isSendToServer,
isSendCallout,
isAdvancedQuery,
panelType,
parentUuid,
containerUuid,
columnName: actionField.columnName,
displayColumn: response.label,
newValue: newValues[actionField.columnName],
valueTo: newValues[`${actionField.columnName}_To`],
fieldList,
field: actionField,
withOutColumnNames,
isChangedOldValue: true // defines if set oldValue with newValue instead of current value
})
})
} else {
newValues[`DisplayColumn_${actionField.columnName}`] = lookup.label
}
}
dispatch('notifyFieldChange', {
isSendToServer,
isSendCallout,