-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: remote engine model (#4560)
* enhancement: add option delete model remote engine * enhancement: add menu delete remote engine models
- Loading branch information
1 parent
d959918
commit c2fea51
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { memo, useState } from 'react' | ||
|
||
import { Model } from '@janhq/core' | ||
import { Button, Modal, ModalClose } from '@janhq/joi' | ||
|
||
import { Trash2Icon } from 'lucide-react' | ||
|
||
import useDeleteModel from '@/hooks/useDeleteModel' | ||
|
||
const ModalDeleteModel = ({ model }: { model: Model }) => { | ||
const [open, setOpen] = useState(false) | ||
|
||
const { deleteModel } = useDeleteModel() | ||
|
||
return ( | ||
<Modal | ||
title={<span>Delete Model</span>} | ||
open={open} | ||
onOpenChange={() => setOpen(!open)} | ||
trigger={ | ||
<Button theme="icon" variant="outline" onClick={() => setOpen(!open)}> | ||
<Trash2Icon | ||
size={14} | ||
className="text-[hsla(var(--text-secondary))]" | ||
/> | ||
</Button> | ||
} | ||
content={ | ||
<div> | ||
<p className="text-[hsla(var(--text-secondary))]"> | ||
Are you sure you want to delete {model.id}? This action cannot be | ||
undone. | ||
</p> | ||
<div className="mt-4 flex justify-end gap-x-2"> | ||
<ModalClose | ||
asChild | ||
onClick={(e) => { | ||
setOpen(!open) | ||
e.stopPropagation() | ||
}} | ||
> | ||
<Button theme="ghost">No</Button> | ||
</ModalClose> | ||
<ModalClose asChild> | ||
<Button | ||
theme="destructive" | ||
onClick={() => { | ||
deleteModel(model) | ||
}} | ||
autoFocus | ||
> | ||
Yes | ||
</Button> | ||
</ModalClose> | ||
</div> | ||
</div> | ||
} | ||
/> | ||
) | ||
} | ||
|
||
export default memo(ModalDeleteModel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters