Skip to content

Commit

Permalink
pre-map columns if direct match
Browse files Browse the repository at this point in the history
  • Loading branch information
fhennig committed Dec 26, 2024
1 parent b85583f commit da379b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,16 @@ function generateBestEffortMapping(
// TODO use previous mappings where possible, else look for a good column
return previousMapping;
} else {
// generate new best effor from scratch based on column similarity
return new Map(targetColumns.map((c) => [c, sourceColumns[0]]));
const result: ColumnMapping = new Map();
targetColumns.forEach((targetColumn) => {
// TODO also check for display name similarity.
if (sourceColumns.includes(targetColumn)) {
result.set(targetColumn, targetColumn);
} else {
result.set(targetColumn, sourceColumns[0]);
}
});
return result;
}
}

Expand Down
4 changes: 3 additions & 1 deletion website/src/components/common/BaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const BaseDialog: React.FC<BaseDialogProps> = ({ title, isOpen, onClose,
<div className='fixed inset-0 bg-black bg-opacity-25' />
<div className='fixed inset-0 overflow-y-auto'>
<div className='flex min-h-full items-center justify-center p-4 text-center'>
<DialogPanel className={`${fullWidthClasses} transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl`}>
<DialogPanel
className={`${fullWidthClasses} transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl`}
>
<DialogTitle as='h3' className='text-2xl font-bold leading-6 text-gray-900 mb-4'>
{title}
</DialogTitle>
Expand Down

0 comments on commit da379b4

Please sign in to comment.