Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Button,
App,
Tooltip,
Popconfirm,
Typography,
Tag,
Modal,
Expand All @@ -24,6 +23,7 @@ import {
Clock,
Eye,
} from "lucide-react";
import { useConfirmModal } from "@/hooks/useConfirmModal";
import { useQueryClient } from "@tanstack/react-query";

import { useAgentList } from "@/hooks/agent/useAgentList";
Expand Down Expand Up @@ -63,6 +63,7 @@ type AgentListRow = Pick<
};

export default function AgentList({ tenantId }: { tenantId: string | null }) {
const { confirm } = useConfirmModal();
const { t } = useTranslation("common");
const { message } = App.useApp();
const [form] = Form.useForm();
Expand Down Expand Up @@ -506,24 +507,21 @@ export default function AgentList({ tenantId }: { tenantId: string | null }) {
size="small"
/>
</Tooltip>
<Popconfirm
title={t("businessLogic.config.modal.deleteTitle")}
description={t("businessLogic.config.modal.deleteContent", {
name: record.display_name,
})}
onConfirm={() => handleDelete(record)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Tooltip title={t("common.delete")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
/>
</Tooltip>
</Popconfirm>
<Tooltip title={t("common.delete")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
onClick={() => confirm({
title: t("businessLogic.config.modal.deleteTitle"),
content: t("businessLogic.config.modal.deleteContent", { name: record.display_name }),
okText: t("common.confirm"),
cancelText: t("common.cancel"),
onOk: () => handleDelete(record),
})}
/>
</Tooltip>
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import React, { useMemo, useState } from "react";
import { App, Button, Popconfirm, Table, Tag } from "antd";
import { App, Button, Table, Tag } from "antd";
import type { ColumnsType } from "antd/es/table";
import { RefreshCw, Trash2 } from "lucide-react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -155,35 +155,36 @@ export default function ApiKeyList({ tenantId }: { tenantId: string | null }) {
width: 100,
render: (_, record) => (
<div className="flex items-center gap-1">
<Popconfirm
title={t("tenantResources.apiKeys.confirmRefresh")}
description={t("tenantResources.apiKeys.affectsAll")}
onConfirm={() => refreshKey(record)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Button
type="text"
size="small"
loading={pendingUserId === record.user_id}
icon={<RefreshCw className="h-4 w-4" />}
/>
</Popconfirm>
<Popconfirm
title={t("tenantResources.apiKeys.confirmRevoke")}
description={t("tenantResources.apiKeys.affectsAll")}
onConfirm={() => revokeKey(record)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Button
type="text"
danger
size="small"
disabled={pendingUserId === record.user_id}
icon={<Trash2 className="h-4 w-4" />}
/>
</Popconfirm>
<Button
type="text"
size="small"
loading={pendingUserId === record.user_id}
icon={<RefreshCw className="h-4 w-4" />}
onClick={() => modal.confirm({
title: t("tenantResources.apiKeys.confirmRefresh"),
content: t("tenantResources.apiKeys.affectsAll"),
centered: true,
okText: t("common.confirm"),
cancelText: t("common.cancel"),
onOk: () => refreshKey(record),
})}
/>
<Button
type="text"
danger
size="small"
disabled={pendingUserId === record.user_id}
icon={<Trash2 className="h-4 w-4" />}
onClick={() => modal.confirm({
title: t("tenantResources.apiKeys.confirmRevoke"),
content: t("tenantResources.apiKeys.affectsAll"),
centered: true,
okText: t("common.confirm"),
cancelText: t("common.cancel"),
okButtonProps: { danger: true },
onOk: () => revokeKey(record),
})}
/>
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
Modal,
Form,
Input,
Popconfirm,
message,
Select,
Tooltip,
Expand All @@ -18,6 +17,7 @@ import { Edit, Trash2 } from "lucide-react";
import { ColumnsType } from "antd/es/table";
import { useGroupList } from "@/hooks/group/useGroupList";
import { useUserList } from "@/hooks/user/useUserList";
import { useConfirmModal } from "@/hooks/useConfirmModal";
import {
createGroup,
updateGroup,
Expand All @@ -33,6 +33,7 @@ import {
import { type User } from "@/services/userService";

export default function GroupList({ tenantId }: { tenantId: string | null }) {
const { confirm } = useConfirmModal();
const { t } = useTranslation("common");
const queryClient = useQueryClient();

Expand Down Expand Up @@ -272,23 +273,21 @@ export default function GroupList({ tenantId }: { tenantId: string | null }) {
size="small"
/>
</Tooltip>
<Popconfirm
title={t("tenantResources.groups.confirmDelete", {
name: record.group_name,
})}
onConfirm={() => handleDelete(record.group_id)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Tooltip title={t("tenantResources.groups.deleteGroup")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
/>
</Tooltip>
</Popconfirm>
<Tooltip title={t("tenantResources.groups.deleteGroup")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
onClick={() => confirm({
title: t("tenantResources.groups.confirmDelete", { name: record.group_name }),
content: "",
okText: t("common.confirm"),
cancelText: t("common.cancel"),
onOk: () => handleDelete(record.group_id),
})}
/>
</Tooltip>
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Form,
Input,
Select,
Popconfirm,
message,
Tag,
Pagination,
Expand All @@ -23,6 +22,7 @@ import { copyToClipboard } from "@/lib/clipboard";
import { ColumnsType } from "antd/es/table";
import { useInvitationList } from "@/hooks/invitation/useInvitationList";
import { useGroupList } from "@/hooks/group/useGroupList";
import { useConfirmModal } from "@/hooks/useConfirmModal";
import { getTenantDefaultGroupId } from "@/services/groupService";
import {
createInvitation,
Expand Down Expand Up @@ -60,6 +60,7 @@ export default function InvitationList({
tenantId: string | null;
refreshKey?: number;
}) {
const { confirm } = useConfirmModal();
const { t } = useTranslation("common");
const { user } = useAuthorizationContext();
const userRole = user?.role;
Expand Down Expand Up @@ -408,24 +409,21 @@ export default function InvitationList({
size="small"
/>
</Tooltip>
<Popconfirm
title={t("tenantResources.invitation.confirmDeleteInvitation", {
code: record.invitation_code,
})}
description={t("common.cannotBeUndone")}
onConfirm={() => handleDelete(record.invitation_code)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Tooltip title={t("tenantResources.invitation.deleteInvitation")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
/>
</Tooltip>
</Popconfirm>
<Tooltip title={t("tenantResources.invitation.deleteInvitation")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
onClick={() => confirm({
title: t("tenantResources.invitation.confirmDeleteInvitation", { code: record.invitation_code }),
content: t("common.cannotBeUndone"),
okText: t("common.confirm"),
cancelText: t("common.cancel"),
onOk: () => handleDelete(record.invitation_code),
})}
/>
</Tooltip>
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { useMemo, useState, useEffect, useCallback } from "react";
import { useTranslation } from "react-i18next";
import {
Table,
Popconfirm,
message,
Button,
Input,
Expand All @@ -28,6 +27,7 @@ import { MarkdownRenderer } from "@/components/common/markdownRenderer";
import { useKnowledgeList } from "@/hooks/knowledge/useKnowledgeList";
import { useGroupList } from "@/hooks/group/useGroupList";
import { useAuthorization } from "@/hooks/auth/useAuthorization";
import { useConfirmModal } from "@/hooks/useConfirmModal";
import knowledgeBaseService from "@/services/knowledgeBaseService";
import quotaService from "@/services/quotaService";
import { type KnowledgeBase } from "@/types/knowledgeBase";
Expand Down Expand Up @@ -62,6 +62,7 @@ export default function KnowledgeList({
}: {
tenantId: string | null;
}) {
const { confirm } = useConfirmModal();
const { t } = useTranslation("common");
const [kbView, setKbView] = useState<"shared" | "personal">("shared");
const { data, isLoading, refetch } = useKnowledgeList(tenantId);
Expand Down Expand Up @@ -531,22 +532,23 @@ export default function KnowledgeList({
size="small"
/>
</Tooltip>
<Popconfirm
title={t("knowledgeBase.modal.deleteConfirm.title")}
description={t("common.cannotBeUndone")}
onConfirm={() => handleDelete(record.id)}
okText={t("common.confirm")}
cancelText={t("common.cancel")}
>
<Tooltip title={t("common.delete")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
/>
</Tooltip>
</Popconfirm>
<Tooltip title={t("common.delete")}>
<Button
type="text"
danger
icon={<Trash2 className="h-4 w-4" />}
size="small"
onClick={() =>
confirm({
title: t("knowledgeBase.modal.deleteConfirm.title"),
content: t("common.cannotBeUndone"),
okText: t("common.confirm"),
cancelText: t("common.cancel"),
onOk: () => handleDelete(record.id),
})
}
/>
</Tooltip>
</div>
);
},
Expand Down
Loading
Loading