mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(editor): Fix Remove all fields not removing values in resource mapper (#6940)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
committed by
GitHub
parent
b312f2ee54
commit
e6cff3fce4
@@ -348,18 +348,40 @@ function removeField(name: string): void {
|
||||
}
|
||||
const fieldName = parseResourceMapperFieldName(name);
|
||||
if (fieldName) {
|
||||
if (state.paramValue.value) {
|
||||
delete state.paramValue.value[fieldName];
|
||||
const field = state.paramValue.schema.find((f) => f.id === fieldName);
|
||||
if (field) {
|
||||
field.removed = true;
|
||||
state.paramValue.schema.splice(state.paramValue.schema.indexOf(field), 1, field);
|
||||
}
|
||||
const field = state.paramValue.schema.find((f) => f.id === fieldName);
|
||||
if (field) {
|
||||
deleteField(field);
|
||||
emitValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeAllFields(): void {
|
||||
state.paramValue.schema.forEach((field) => {
|
||||
if (
|
||||
!fieldCannotBeDeleted(
|
||||
field,
|
||||
showMatchingColumnsSelector.value,
|
||||
resourceMapperMode.value,
|
||||
matchingColumns.value,
|
||||
)
|
||||
) {
|
||||
deleteField(field);
|
||||
}
|
||||
});
|
||||
emitValueChanged();
|
||||
}
|
||||
|
||||
// Delete a single field from the mapping (set removed flag to true and delete from value)
|
||||
// Used when removing one or all fields
|
||||
function deleteField(field: ResourceMapperField): void {
|
||||
if (state.paramValue.value) {
|
||||
delete state.paramValue.value[field.id];
|
||||
field.removed = true;
|
||||
state.paramValue.schema.splice(state.paramValue.schema.indexOf(field), 1, field);
|
||||
}
|
||||
}
|
||||
|
||||
function addField(name: string): void {
|
||||
if (name === 'addAllFields') {
|
||||
return addAllFields();
|
||||
@@ -395,23 +417,6 @@ function addAllFields(): void {
|
||||
emitValueChanged();
|
||||
}
|
||||
|
||||
function removeAllFields(): void {
|
||||
state.paramValue.schema.forEach((field) => {
|
||||
if (
|
||||
!fieldCannotBeDeleted(
|
||||
field,
|
||||
showMatchingColumnsSelector.value,
|
||||
resourceMapperMode.value,
|
||||
matchingColumns.value,
|
||||
)
|
||||
) {
|
||||
field.removed = true;
|
||||
state.paramValue.schema.splice(state.paramValue.schema.indexOf(field), 1, field);
|
||||
}
|
||||
});
|
||||
emitValueChanged();
|
||||
}
|
||||
|
||||
function emitValueChanged(): void {
|
||||
pruneParamValues();
|
||||
emit('valueChanged', {
|
||||
@@ -457,6 +462,7 @@ defineExpose({
|
||||
/>
|
||||
<matching-columns-select
|
||||
v-if="showMatchingColumnsSelector"
|
||||
:parameter="props.parameter"
|
||||
:label-size="labelSize"
|
||||
:fieldsToMap="state.paramValue.schema"
|
||||
:typeOptions="props.parameter.typeOptions"
|
||||
@@ -465,7 +471,9 @@ defineExpose({
|
||||
:initialValue="matchingColumns"
|
||||
:serviceName="nodeType?.displayName || locale.baseText('generic.service')"
|
||||
:teleported="teleported"
|
||||
:refreshInProgress="state.refreshInProgress"
|
||||
@matchingColumnsChanged="onMatchingColumnsChanged"
|
||||
@refreshFieldList="initFetching(true)"
|
||||
/>
|
||||
<n8n-text v-if="!showMappingModeSelect && state.loading" size="small">
|
||||
<n8n-icon icon="sync-alt" size="xsmall" :spin="true" />
|
||||
|
||||
Reference in New Issue
Block a user