diff --git a/ui/components/PresetForm.vue b/ui/components/PresetForm.vue index d7b90262..44116009 100644 --- a/ui/components/PresetForm.vue +++ b/ui/components/PresetForm.vue @@ -22,32 +22,70 @@
-
- -
- - -
-
- -
- -
- + +
@@ -98,7 +136,8 @@ Use this output template if non are given with URL. if not set, it will defaults to {{ config.app.output_template }}. For more information visit this page. + target="_blank"> + this page.
@@ -223,6 +262,7 @@ const form = reactive(JSON.parse(JSON.stringify(props.preset))) const import_string = ref('') const showImport = useStorage('showImport', false) const box = useConfirm() +const selected_preset = ref('') onMounted(() => { if (props.preset?.cli && '' !== props.preset?.cli) { @@ -329,10 +369,6 @@ const importItem = async () => { return } - if (form.cli && false === box.confirm('This will overwrite the current data. Are you sure?', true)) { - return - } - if (item.name) { form.name = item.name } @@ -371,4 +407,26 @@ const importItem = async () => { } } +const filter_presets = (flag = true) => config.presets.filter(item => item.default === flag) + +const import_existing_preset = async () => { + if (!selected_preset.value) { + return + } + + const preset = config.presets.find(p => p.name === selected_preset.value) + if (!preset) { + toast.error('Preset not found.') + return + } + + form.cli = preset.cli || '' + form.folder = preset.folder || '' + form.template = preset.template || '' + form.cookies = preset.cookies || '' + form.description = preset.description || '' + + await nextTick() + selected_preset.value = '' +}