mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-10 22:15:16 +00:00
fix(ai): only show Custom Presets button to owner/admin roles
This commit is contained in:
@@ -18,6 +18,9 @@ import { HandleAiProviders } from "./handle-ai-providers";
|
|||||||
export const AiForm = () => {
|
export const AiForm = () => {
|
||||||
const { data: aiConfigs, refetch, isPending } = api.ai.getAll.useQuery();
|
const { data: aiConfigs, refetch, isPending } = api.ai.getAll.useQuery();
|
||||||
const { mutateAsync, isPending: isRemoving } = api.ai.delete.useMutation();
|
const { mutateAsync, isPending: isRemoving } = api.ai.delete.useMutation();
|
||||||
|
const { data: currentUser } = api.user.get.useQuery();
|
||||||
|
const isOrgAdmin =
|
||||||
|
currentUser?.role === "owner" || currentUser?.role === "admin";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
@@ -32,7 +35,7 @@ export const AiForm = () => {
|
|||||||
<CardDescription>Manage your AI configurations</CardDescription>
|
<CardDescription>Manage your AI configurations</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row gap-2">
|
<div className="flex flex-row gap-2">
|
||||||
<HandleAiProviders />
|
{isOrgAdmin && <HandleAiProviders />}
|
||||||
{aiConfigs && aiConfigs?.length > 0 && <HandleAi />}
|
{aiConfigs && aiConfigs?.length > 0 && <HandleAi />}
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user