enh: model preset delete confirmation

This commit is contained in:
Timothy J. Baek 2024-06-15 04:13:30 -06:00
parent a0dbc970a9
commit 262501304c

View File

@ -17,15 +17,19 @@
import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte'; import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte';
import ModelMenu from './Models/ModelMenu.svelte'; import ModelMenu from './Models/ModelMenu.svelte';
import ModelDeleteConfirmDialog from '../common/ConfirmDialog.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
let showModelDeleteConfirm = false;
let localModelfiles = []; let localModelfiles = [];
let importFiles; let importFiles;
let modelsImportInputElement: HTMLInputElement; let modelsImportInputElement: HTMLInputElement;
let _models = []; let _models = [];
let selectedModel = null;
let sortable = null; let sortable = null;
let searchValue = ''; let searchValue = '';
@ -199,6 +203,13 @@
</title> </title>
</svelte:head> </svelte:head>
<ModelDeleteConfirmDialog
bind:show={showModelDeleteConfirm}
on:confirm={() => {
deleteModelHandler(selectedModel);
}}
/>
<div class=" text-lg font-semibold mb-3">{$i18n.t('Models')}</div> <div class=" text-lg font-semibold mb-3">{$i18n.t('Models')}</div>
<div class=" flex w-full space-x-2"> <div class=" flex w-full space-x-2">
@ -339,7 +350,8 @@
hideModelHandler(model); hideModelHandler(model);
}} }}
deleteHandler={() => { deleteHandler={() => {
deleteModelHandler(model); selectedModel = model;
showModelDeleteConfirm = true;
}} }}
onClose={() => {}} onClose={() => {}}
> >