diff --git a/i18n/en.json b/i18n/en.json index cfccc3d42..4157e5038 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -369,11 +369,17 @@ "storage_template_migration_info": "The storage template will convert all extensions to lowercase. Template changes will only apply to new assets. To retroactively apply the template to previously uploaded assets, run the {job}.", "storage_template_migration_job": "Storage Template Migration Job", "storage_template_more_details": "For more details about this feature, refer to the Storage Template and its implications", - "storage_template_onboarding_description_v2": "When enabled, this feature will auto-organize files based on a user-defined template. For more information, please see the documentation.", + "storage_template_onboarding_description_v3": "Storage templates allow you to define a custom folder structure on disk for your uploaded assets. This can always be changed later.", + "storage_template_option_custom": "Custom", + "storage_template_option_custom_description": "Build your own folder structure with template variables", + "storage_template_option_date_description": "Sort files into year, month, and day folders", + "storage_template_option_none": "No template", + "storage_template_option_none_description": "Keep the folder structure Immich uses by default", "storage_template_path_length": "Approximate path length limit: {length, number}/{limit, number}", "storage_template_settings": "Storage Template", "storage_template_settings_description": "Manage the folder structure and file name of the upload asset", "storage_template_user_label": "{label} is the user's Storage Label", + "storage_template_variables": "Template variables", "system_settings": "System Settings", "tag_cleanup_job": "Tag cleanup", "template_email_available_tags": "You can use the following variables in your template: {tags}", diff --git a/web/src/lib/components/admin-settings/StorageTemplateSettings.svelte b/web/src/lib/components/admin-settings/StorageTemplateSettings.svelte index e22808bbf..5451c2540 100644 --- a/web/src/lib/components/admin-settings/StorageTemplateSettings.svelte +++ b/web/src/lib/components/admin-settings/StorageTemplateSettings.svelte @@ -1,24 +1,23 @@ -
-
-

- - {#snippet children({ tag, message })} - {#if tag === 'template-link'} - {message} - {:else if tag === 'implications-link'} - - {message} - - {/if} - {/snippet} - -

+{#snippet templateOption(option: StorageTemplateOption, label: string, description: string, preview: string)} +
+ + + {#if option === StorageTemplateOption.Custom && selectedOption === StorageTemplateOption.Custom} +
+
+ + +
+ + + {#snippet trailingSnippet()} + + {/snippet} + + + + + {#snippet children({ message })} + {message} + {/snippet} + + + + + + {#snippet children({ message })} + {message} + {/snippet} + + +
+ {/if} + + {#if preview} + + {$t('preview')}: + {`UPLOAD_LOCATION/library/${authManager.user.storageLabel || authManager.user.id}/${preview}.jpg`} + + {/if}
+{/snippet} + +
+ {#if !minified} +
+

+ + {#snippet children({ tag, message })} + {#if tag === 'template-link'} + {message} + {:else if tag === 'implications-link'} + + {message} + + {/if} + {/snippet} + +

+
+ {/if} + {#await getTemplateOptions() then}
- +
+ {@render templateOption( + StorageTemplateOption.None, + $t('admin.storage_template_option_none'), + $t('admin.storage_template_option_none_description'), + '', + )} + {@render templateOption( + StorageTemplateOption.Date, + 'YYYY/MM/DD', + $t('admin.storage_template_option_date_description'), + renderTemplate(DATE_TEMPLATE), + )} + {@render templateOption( + StorageTemplateOption.Custom, + $t('admin.storage_template_option_custom'), + $t('admin.storage_template_option_custom_description'), + parsedCustomTemplate(), + )} +
{#if !minified} - {/if} - {#if configToEdit.storageTemplate.enabled} -
- - - {$t('variables')} - - -
- {#await getSupportDateTimeFormat()} - - {:then options} -
- -
- {/await} -
- -
- -
- -
- - - {$t('template')} - - -
- {$t('preview')} -
- -

- - {#snippet children({ message })} - {message} - {/snippet} - -

- -

- - {#snippet children({ message })} - {message} - {/snippet} - -

- -

- UPLOAD_LOCATION/library/{authManager.user.storageLabel || authManager.user.id}/{parsedTemplate()}.jpg -

- -
-
- {#if templateOptions} - - - {/if} -
+ {#snippet children({ message })} + {message} + {/snippet} + +

+
+
+ {/if} -
- - -
- -
-
- - {#if !minified} -
- - {$t('notes')} - -
-

- - {#snippet children({ message })} - {message} - {/snippet} - -

-
-
- {/if} - - - {/if} - - {#if !minified} {/if} diff --git a/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte b/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte index d91e15cff..7b48f5f58 100644 --- a/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte +++ b/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte @@ -1,7 +1,7 @@ -{$t('other_variables')} +{$t('other_variables')} - +
diff --git a/web/src/lib/modals/StorageTemplateVariablesModal.svelte b/web/src/lib/modals/StorageTemplateVariablesModal.svelte new file mode 100644 index 000000000..654f938fc --- /dev/null +++ b/web/src/lib/modals/StorageTemplateVariablesModal.svelte @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/web/src/routes/auth/onboarding/OnboardingStorageTemplate.svelte b/web/src/routes/auth/onboarding/OnboardingStorageTemplate.svelte index aea4d7349..aa8117ab0 100644 --- a/web/src/routes/auth/onboarding/OnboardingStorageTemplate.svelte +++ b/web/src/routes/auth/onboarding/OnboardingStorageTemplate.svelte @@ -2,16 +2,11 @@ import StorageTemplateSettings from '$lib/components/admin-settings/StorageTemplateSettings.svelte'; import FormatMessage from '$lib/elements/FormatMessage.svelte'; import { authManager } from '$lib/managers/auth-manager.svelte'; - import { Link } from '@immich/ui'; -
+

- - {#snippet children({ message })} - {message} - {/snippet} - +

{#if authManager.authenticated}