add map option to preserve field order

This commit is contained in:
Ivan Atanasov 2024-12-06 21:36:09 +01:00
parent 4e759419f7
commit 6fc8e29fca
No known key found for this signature in database
4 changed files with 24 additions and 3 deletions

View file

@ -74,6 +74,27 @@ describe('ResourceMapper.vue', () => {
expect(queryByTestId('matching-column-select')).not.toBeInTheDocument();
});
it('renders map mode properly', async () => {
const { getByTestId, queryByTestId } = renderComponent(
{
props: {
parameter: {
typeOptions: {
resourceMapper: {
mode: 'map',
},
},
},
},
},
{ merge: true },
);
await waitAllPromises();
expect(getByTestId('resource-mapper-container')).toBeInTheDocument();
// This mode doesn't render matching column selector
expect(queryByTestId('matching-column-select')).not.toBeInTheDocument();
});
it('renders multi-key match selector properly', async () => {
const { container, getByTestId } = renderComponent(
{

View file

@ -164,7 +164,7 @@ const showMappingModeSelect = computed<boolean>(() => {
const showMatchingColumnsSelector = computed<boolean>(() => {
return (
!state.loading &&
props.parameter.typeOptions?.resourceMapper?.mode !== 'add' &&
['upsert', 'update'].includes(props.parameter.typeOptions?.resourceMapper?.mode) &&
state.paramValue.schema.length > 0
);
});

View file

@ -222,7 +222,7 @@ export class ExecuteWorkflow implements INodeType {
resourceMapper: {
localResourceMapperMethod: 'loadWorkflowInputMappings',
valuesLabel: 'Workflow Inputs',
mode: 'add',
mode: 'map',
fieldWords: {
singular: 'workflow input',
plural: 'workflow inputs',

View file

@ -1366,7 +1366,7 @@ export interface INodePropertyTypeOptions {
}
export interface ResourceMapperTypeOptionsBase {
mode: 'add' | 'update' | 'upsert';
mode: 'add' | 'update' | 'upsert' | 'map';
valuesLabel?: string;
fieldWords?: {
singular: string;