diff --git a/frontend/src/i18n/lang/en.json b/frontend/src/i18n/lang/en.json index 36635cc8a..2cd6e516b 100644 --- a/frontend/src/i18n/lang/en.json +++ b/frontend/src/i18n/lang/en.json @@ -659,7 +659,13 @@ "import": "Import Tasks", "untitled": "Untitled Task", "completed": "Completed", - "ignore": "Ignore" + "ignore": "Ignore", + "delimiters": { + "comma": "Comma (,)", + "semicolon": "Semicolon (;)", + "tab": "Tab", + "pipe": "Pipe (|)" + } } }, "label": { diff --git a/frontend/src/services/migrator/csvMigration.ts b/frontend/src/services/migrator/csvMigration.ts index 695c57456..e87be2bab 100644 --- a/frontend/src/services/migrator/csvMigration.ts +++ b/frontend/src/services/migrator/csvMigration.ts @@ -19,18 +19,18 @@ export type TaskAttribute = | 'reminder' | 'ignore' -export const TASK_ATTRIBUTES: { value: TaskAttribute; label: string }[] = [ - { value: 'title', label: 'Title' }, - { value: 'description', label: 'Description' }, - { value: 'due_date', label: 'Due Date' }, - { value: 'start_date', label: 'Start Date' }, - { value: 'end_date', label: 'End Date' }, - { value: 'done', label: 'Done/Completed' }, - { value: 'priority', label: 'Priority' }, - { value: 'labels', label: 'Labels/Tags' }, - { value: 'project', label: 'Project' }, - { value: 'reminder', label: 'Reminder' }, - { value: 'ignore', label: 'Ignore' }, +export const TASK_ATTRIBUTES: TaskAttribute[] = [ + 'title', + 'description', + 'due_date', + 'start_date', + 'end_date', + 'done', + 'priority', + 'labels', + 'project', + 'reminder', + 'ignore', ] export interface DetectionResult { @@ -73,24 +73,19 @@ export interface MigrationStatus { finished_at: string | null } -export const SUPPORTED_DELIMITERS = [ - { value: ',', label: 'Comma (,)' }, - { value: ';', label: 'Semicolon (;)' }, - { value: '\t', label: 'Tab' }, - { value: '|', label: 'Pipe (|)' }, -] +export const SUPPORTED_DELIMITERS = [',', ';', '\t', '|'] as const export const SUPPORTED_DATE_FORMATS = [ - { value: '2006-01-02', label: 'YYYY-MM-DD (2024-01-15)' }, - { value: '2006-01-02T15:04:05', label: 'ISO DateTime (2024-01-15T10:30:00)' }, - { value: '02/01/2006', label: 'DD/MM/YYYY (15/01/2024)' }, - { value: '01/02/2006', label: 'MM/DD/YYYY (01/15/2024)' }, - { value: '02-01-2006', label: 'DD-MM-YYYY (15-01-2024)' }, - { value: '01-02-2006', label: 'MM-DD-YYYY (01-15-2024)' }, - { value: '02.01.2006', label: 'DD.MM.YYYY (15.01.2024)' }, - { value: '2006/01/02', label: 'YYYY/MM/DD (2024/01/15)' }, - { value: '2006-01-02 15:04:05', label: 'DateTime (2024-01-15 10:30:00)' }, -] + '2006-01-02', + '2006-01-02T15:04:05', + '02/01/2006', + '01/02/2006', + '02-01-2006', + '01-02-2006', + '02.01.2006', + '2006/01/02', + '2006-01-02 15:04:05', +] as const export default class CSVMigrationService extends AbstractService { constructor() { diff --git a/frontend/src/views/migrate/MigrationCSV.vue b/frontend/src/views/migrate/MigrationCSV.vue index 31485dc12..4f43ce430 100644 --- a/frontend/src/views/migrate/MigrationCSV.vue +++ b/frontend/src/views/migrate/MigrationCSV.vue @@ -55,10 +55,10 @@ > @@ -71,10 +71,10 @@ > @@ -105,10 +105,10 @@ > @@ -269,6 +269,31 @@ function getAttributeLabel(attribute: string): string { return t(attributeMap[attribute] || attribute) } +function getDelimiterLabel(delimiter: string): string { + const labels: Record = { + ',': t('migrate.csv.delimiters.comma'), + ';': t('migrate.csv.delimiters.semicolon'), + '\t': t('migrate.csv.delimiters.tab'), + '|': t('migrate.csv.delimiters.pipe'), + } + return labels[delimiter] || delimiter +} + +function getDateFormatLabel(format: string): string { + const labels: Record = { + '2006-01-02': 'YYYY-MM-DD (2024-01-15)', + '2006-01-02T15:04:05': 'ISO DateTime (2024-01-15T10:30:00)', + '02/01/2006': 'DD/MM/YYYY (15/01/2024)', + '01/02/2006': 'MM/DD/YYYY (01/15/2024)', + '02-01-2006': 'DD-MM-YYYY (15-01-2024)', + '01-02-2006': 'MM-DD-YYYY (01-15-2024)', + '02.01.2006': 'DD.MM.YYYY (15.01.2024)', + '2006/01/02': 'YYYY/MM/DD (2024/01/15)', + '2006-01-02 15:04:05': 'DateTime (2024-01-15 10:30:00)', + } + return labels[format] || format +} + function truncate(text: string, length: number): string { if (text.length <= length) return text return text.substring(0, length) + '...'