mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
fix(editor): Display value of selected matching column in RMC (#7298)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
parent
a040770a27
commit
3aac22b4c1
|
@ -34,18 +34,21 @@ const {
|
||||||
pluralFieldWordCapitalized,
|
pluralFieldWordCapitalized,
|
||||||
} = useNodeSpecificationValues(props.typeOptions);
|
} = useNodeSpecificationValues(props.typeOptions);
|
||||||
|
|
||||||
|
const initialValue = computed<string | string[]>(() => {
|
||||||
|
return resourceMapperTypeOptions.value?.multiKeyMatch === true
|
||||||
|
? props.initialValue
|
||||||
|
: props.initialValue[0];
|
||||||
|
});
|
||||||
|
|
||||||
// Depending on the mode (multiple/singe key column), the selected value can be a string or an array of strings
|
// Depending on the mode (multiple/singe key column), the selected value can be a string or an array of strings
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
selected: props.initialValue as string[] | string,
|
selected: initialValue.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.initialValue,
|
() => props.initialValue,
|
||||||
() => {
|
() => {
|
||||||
state.selected =
|
state.selected = initialValue.value;
|
||||||
resourceMapperTypeOptions.value?.multiKeyMatch === true
|
|
||||||
? props.initialValue
|
|
||||||
: props.initialValue[0];
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -294,4 +294,46 @@ describe('ResourceMapper.vue', () => {
|
||||||
await waitAllPromises();
|
await waitAllPromises();
|
||||||
expect(fetchFieldsSpy).not.toHaveBeenCalled();
|
expect(fetchFieldsSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders initially selected matching column properly', async () => {
|
||||||
|
const { getByTestId } = renderComponent(
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
node: {
|
||||||
|
parameters: {
|
||||||
|
columns: {
|
||||||
|
mappingMode: 'autoMapInputData',
|
||||||
|
matchingColumns: ['name'],
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
id: 'name',
|
||||||
|
displayName: 'name',
|
||||||
|
canBeUsedToMatch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'email',
|
||||||
|
displayName: 'email',
|
||||||
|
canBeUsedToMatch: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
parameter: {
|
||||||
|
typeOptions: {
|
||||||
|
resourceMapper: {
|
||||||
|
supportAutoMap: true,
|
||||||
|
mode: 'upsert',
|
||||||
|
multiKeyMatch: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ merge: true },
|
||||||
|
);
|
||||||
|
await waitAllPromises();
|
||||||
|
|
||||||
|
expect(getByTestId('matching-column-select').querySelector('input')).toHaveValue('name');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue