@allbluecn/admin-app 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +15 -15
- package/src/components/__tests__/user-avatar.test.tsx +39 -0
- package/src/components/admin/admin-user-menu.tsx +6 -6
- package/src/components/admin/developer-log.tsx +7 -7
- package/src/components/ai-memory/memory-facts-panel.tsx +9 -9
- package/src/components/ai-prompts/preview-panel.tsx +1 -1
- package/src/components/ai-prompts/prompt-editor.tsx +8 -8
- package/src/components/ai-prompts/prompt-table.tsx +6 -6
- package/src/components/ai-prompts/section-editor.tsx +3 -3
- package/src/components/ai-prompts/variable-panel.tsx +2 -2
- package/src/components/ai-prompts/version-history.tsx +5 -5
- package/src/components/ai-provider/model-list-editor.tsx +2 -2
- package/src/components/ai-provider/provider-form.tsx +7 -7
- package/src/components/ai-provider/provider-table.tsx +6 -6
- package/src/components/auth/admin-login-form.tsx +8 -8
- package/src/components/auth/icon-input.tsx +2 -2
- package/src/components/auth/password-input.tsx +2 -2
- package/src/components/component/component-form-dialog.tsx +8 -8
- package/src/components/component/component-import-dialog.tsx +6 -6
- package/src/components/component/component-table.tsx +3 -3
- package/{allblue-ui/src → src}/components/confirm-dialog.tsx +2 -2
- package/src/components/dependency/changelog-dialog.tsx +2 -2
- package/src/components/dependency/columns.tsx +3 -3
- package/src/components/dependency/dependency-table.tsx +7 -7
- package/src/components/dependency/edit-dialog.tsx +8 -8
- package/src/components/invitations/invitations-page.tsx +13 -13
- package/src/components/{knowledge-public → knowledge/public}/bookmark-form-dialog.tsx +10 -10
- package/src/components/{knowledge-public → knowledge/public}/compliance-form-dialog.tsx +10 -10
- package/src/components/{knowledge-public → knowledge/public}/legal-form-dialog.tsx +11 -11
- package/src/components/layout/sidebar-02/app-sidebar.tsx +1 -1
- package/src/components/layout/sidebar-02/index.tsx +1 -1
- package/src/components/layout/sidebar-02/nav-main.tsx +2 -2
- package/src/components/layout/sidebar-02/nav-notifications.tsx +3 -3
- package/src/components/market/columns.tsx +4 -4
- package/src/components/market/market-app-form.tsx +6 -6
- package/src/components/market/market-app-list.tsx +4 -4
- package/src/components/monitoring/error-list.tsx +1 -1
- package/src/components/monitoring/metrics-stats.tsx +1 -1
- package/src/components/monitoring/request-log-table.tsx +1 -1
- package/src/components/oauth-providers/provider-page.tsx +9 -9
- package/src/components/permissions/assign-dialog.tsx +5 -5
- package/src/components/permissions/create-role-dialog.tsx +6 -6
- package/{allblue-ui/src → src/components}/ui/checkbox.tsx +4 -4
- package/{allblue-ui/src → src/components}/ui/sidebar.tsx +1 -1
- package/src/components/user/columns.tsx +5 -5
- package/src/components/user/settings-activity-log.tsx +7 -7
- package/src/components/user/settings-profile/avatar-uploader.tsx +2 -2
- package/src/components/user/settings-profile/social-links.tsx +2 -2
- package/src/components/user/settings-profile.tsx +6 -6
- package/src/components/user/user-create-dialog.tsx +6 -6
- package/src/components/user/user-detail/error-boundary.tsx +1 -1
- package/src/components/user/user-detail/user-detail-dialogs.tsx +6 -6
- package/src/components/user/user-filters.tsx +3 -3
- package/{allblue-ui/src → src}/components/user-avatar.tsx +7 -4
- package/src/lib/__tests__/avatar-shape.test.ts +44 -0
- package/src/lib/auth.config.ts +1 -1
- package/{allblue-ui/src/lib/avatar.ts → src/lib/avatar-shape.ts} +15 -21
- package/src/providers/index.tsx +1 -1
- package/src/routes/__root.tsx +1 -1
- package/src/routes/_nav/audit/route.lazy.tsx +1 -1
- package/src/routes/_nav/compliance/route.lazy.tsx +3 -3
- package/src/routes/_nav/components/route.lazy.tsx +4 -4
- package/src/routes/_nav/knowledge-public/bookmarks/route.lazy.tsx +16 -16
- package/src/routes/_nav/knowledge-public/bookmarks/route.tsx +1 -1
- package/src/routes/_nav/knowledge-public/compliance/route.lazy.tsx +14 -14
- package/src/routes/_nav/knowledge-public/compliance/route.tsx +1 -1
- package/src/routes/_nav/knowledge-public/legal/route.lazy.tsx +14 -14
- package/src/routes/_nav/knowledge-public/legal/route.tsx +1 -1
- package/src/routes/_nav/licenses/$licenseId/route.lazy.tsx +3 -3
- package/src/routes/_nav/licenses/new/route.lazy.tsx +5 -5
- package/src/routes/_nav/licenses/route.lazy.tsx +1 -1
- package/src/routes/_nav/monitoring/ai-usage/route.lazy.tsx +2 -2
- package/src/routes/_nav/monitoring/errors/route.lazy.tsx +1 -1
- package/src/routes/_nav/monitoring/health/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/logs/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/metrics/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/route.lazy.tsx +2 -2
- package/src/routes/_nav/monitoring/sentry/route.lazy.tsx +1 -1
- package/src/routes/_nav/permissions/route.lazy.tsx +4 -4
- package/src/routes/_nav/sso/route.lazy.tsx +2 -2
- package/src/routes/_nav/users/$userId/route.lazy.tsx +9 -9
- package/src/routes/_nav/users/-components/users-table.tsx +1 -1
- package/src/routes/_nav/users/route.lazy.tsx +1 -1
- package/src/routes/login/route.lazy.tsx +1 -1
- package/src/routes/setup/route.lazy.tsx +2 -2
- package/src/server/dependency/helpers.ts +0 -1
- package/src/server/{knowledge-public → knowledge/public}/github-sync.ts +12 -2
- package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/create.ts +1 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/list.ts +2 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/sync-all-github.ts +3 -2
- package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/update.ts +3 -2
- package/src/server/serverFns/{knowledge-public → knowledge/public}/compliance/create.ts +1 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/compliance/list.ts +2 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/compliance/update.ts +3 -2
- package/src/server/serverFns/{knowledge-public → knowledge/public}/legal/create.ts +1 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/legal/list.ts +2 -1
- package/src/server/serverFns/{knowledge-public → knowledge/public}/legal/update.ts +3 -2
- package/src/styles/globals.css +3 -3
- package/allblue-ui/package.json +0 -6
- package/allblue-ui/src/components/infinite-scroll-sentinel.tsx +0 -37
- package/allblue-ui/src/hooks/use-load-more.ts +0 -57
- package/allblue-ui/src/index.ts +0 -31
- package/allblue-ui/src/lib/utils.ts +0 -1
- /package/{allblue-ui/src → src/components}/data-table/data-table-pagination.tsx +0 -0
- /package/{allblue-ui/src → src/components}/data-table/data-table.tsx +0 -0
- /package/{allblue-ui/src → src/components}/data-table/table-detail-layout.tsx +0 -0
- /package/{allblue-ui/src → src}/components/notion-avatar.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/alert-dialog.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/alert.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/avatar.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/badge.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/button.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/card.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/collapsible.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/dialog.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/dropdown-menu.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/field.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/input-group.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/input.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/label.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/pagination.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/select.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/separator.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/sheet.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/skeleton.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/switch.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/table.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/textarea.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/toast.tsx +0 -0
- /package/{allblue-ui/src → src/components}/ui/tooltip.tsx +0 -0
- /package/{allblue-ui/src → src}/hooks/use-mobile.ts +0 -0
- /package/{allblue-ui/src → src}/lib/datetime.ts +0 -0
- /package/{allblue-ui/src → src}/lib/sanitize.ts +0 -0
- /package/src/server/{knowledge-public → knowledge/public}/canonical-id.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/delete.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/bookmarks/detail.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/compliance/delete.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/compliance/detail.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/legal/delete.ts +0 -0
- /package/src/server/serverFns/{knowledge-public → knowledge/public}/legal/detail.ts +0 -0
|
@@ -23,19 +23,19 @@ import {
|
|
|
23
23
|
DialogHeader,
|
|
24
24
|
DialogTitle,
|
|
25
25
|
DialogFooter,
|
|
26
|
-
} from "
|
|
27
|
-
import { Button } from "
|
|
28
|
-
import { Input } from "
|
|
29
|
-
import { Label } from "
|
|
26
|
+
} from "@/components/ui/dialog";
|
|
27
|
+
import { Button } from "@/components/ui/button";
|
|
28
|
+
import { Input } from "@/components/ui/input";
|
|
29
|
+
import { Label } from "@/components/ui/label";
|
|
30
30
|
import {
|
|
31
31
|
Select,
|
|
32
32
|
SelectContent,
|
|
33
33
|
SelectItem,
|
|
34
34
|
SelectTrigger,
|
|
35
35
|
SelectValue,
|
|
36
|
-
} from "
|
|
36
|
+
} from "@/components/ui/select";
|
|
37
37
|
import { createUserFn } from "@/server/serverFns/user/create";
|
|
38
|
-
import { toast } from '
|
|
38
|
+
import { toast } from '@/components/ui/toast';
|
|
39
39
|
|
|
40
40
|
interface UserCreateDialogProps {
|
|
41
41
|
open: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { m } from '@/paraglide/messages.js'
|
|
4
4
|
import { AlertCircle } from 'lucide-react'
|
|
5
|
-
import { Button } from '
|
|
5
|
+
import { Button } from '@/components/ui/button'
|
|
6
6
|
|
|
7
7
|
export function AdminUserErrorBoundary({ error, reset }: { error: unknown; reset: () => void }) {
|
|
8
8
|
return <AdminUserErrorBoundaryInner error={error instanceof Error ? error : new Error(String(error))} reset={reset} />
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
DialogFooter,
|
|
8
8
|
DialogHeader,
|
|
9
9
|
DialogTitle,
|
|
10
|
-
} from '
|
|
10
|
+
} from '@/components/ui/dialog'
|
|
11
11
|
import {
|
|
12
12
|
AlertDialog,
|
|
13
13
|
AlertDialogAction,
|
|
@@ -17,17 +17,17 @@ import {
|
|
|
17
17
|
AlertDialogFooter,
|
|
18
18
|
AlertDialogHeader,
|
|
19
19
|
AlertDialogTitle,
|
|
20
|
-
} from '
|
|
20
|
+
} from '@/components/ui/alert-dialog'
|
|
21
21
|
import {
|
|
22
22
|
Select,
|
|
23
23
|
SelectContent,
|
|
24
24
|
SelectItem,
|
|
25
25
|
SelectTrigger,
|
|
26
26
|
SelectValue,
|
|
27
|
-
} from '
|
|
28
|
-
import { Input } from '
|
|
29
|
-
import { Label } from '
|
|
30
|
-
import { Button } from '
|
|
27
|
+
} from '@/components/ui/select'
|
|
28
|
+
import { Input } from '@/components/ui/input'
|
|
29
|
+
import { Label } from '@/components/ui/label'
|
|
30
|
+
import { Button } from '@/components/ui/button'
|
|
31
31
|
|
|
32
32
|
export type UserDialogState = { open: boolean; value: string }
|
|
33
33
|
export type UserDeleteDialogState = { open: boolean; confirmName: string }
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
import { useNavigate } from "@tanstack/react-router";
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import { useCallback } from "react";
|
|
21
|
-
import { Input } from "
|
|
22
|
-
import { Button } from "
|
|
21
|
+
import { Input } from "@/components/ui/input";
|
|
22
|
+
import { Button } from "@/components/ui/button";
|
|
23
23
|
import {
|
|
24
24
|
Select,
|
|
25
25
|
SelectContent,
|
|
26
26
|
SelectItem,
|
|
27
27
|
SelectTrigger,
|
|
28
28
|
SelectValue,
|
|
29
|
-
} from "
|
|
29
|
+
} from "@/components/ui/select";
|
|
30
30
|
import { SearchIcon, XIcon } from "lucide-react";
|
|
31
31
|
|
|
32
32
|
interface UserFiltersProps {
|
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
import { NotionAvatar } from "./notion-avatar"
|
|
20
|
-
import
|
|
20
|
+
import { toAvatarShape } from "@/lib/avatar-shape"
|
|
21
|
+
import type { AvatarConfig } from "@allbluecn/kernel"
|
|
21
22
|
|
|
22
23
|
type UserAvatarProps = {
|
|
23
24
|
avatarConfig?: AvatarConfig | null
|
|
24
|
-
|
|
25
|
+
/** DB 字典直通的 string|null,内部经 toAvatarShape 归一,非法值回落 square */
|
|
26
|
+
bgShape?: string | null
|
|
25
27
|
bgColor?: string | null
|
|
26
28
|
name?: string | null
|
|
27
29
|
imageUrl?: string | null
|
|
@@ -50,14 +52,15 @@ export function UserAvatar({
|
|
|
50
52
|
size = "md",
|
|
51
53
|
}: UserAvatarProps) {
|
|
52
54
|
const initial = (name || "U").charAt(0).toUpperCase()
|
|
55
|
+
const shape = toAvatarShape(bgShape) ?? "square"
|
|
53
56
|
const shapeClass =
|
|
54
|
-
|
|
57
|
+
shape === "circle" ? "rounded-full" : shape === "square" ? "rounded-none" : "rounded-lg"
|
|
55
58
|
|
|
56
59
|
if (avatarConfig) {
|
|
57
60
|
return (
|
|
58
61
|
<NotionAvatar
|
|
59
62
|
config={avatarConfig}
|
|
60
|
-
shape={
|
|
63
|
+
shape={shape}
|
|
61
64
|
bgColor={bgColor ?? "#fff"}
|
|
62
65
|
className={`${sizeClasses[size]} shrink-0 ${className ?? ""}`}
|
|
63
66
|
/>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// This program is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU Affero General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
import { describe, it, expect } from "vitest";
|
|
19
|
+
import { AVATAR_SHAPES, toAvatarShape } from "../avatar-shape";
|
|
20
|
+
|
|
21
|
+
describe("AVATAR_SHAPES", () => {
|
|
22
|
+
it("与 kernel ShapeType 三值一致", () => {
|
|
23
|
+
expect([...AVATAR_SHAPES]).toEqual(["circle", "rounded", "square"]);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("toAvatarShape", () => {
|
|
28
|
+
it("三个合法值原样通过", () => {
|
|
29
|
+
expect(toAvatarShape("circle")).toBe("circle");
|
|
30
|
+
expect(toAvatarShape("rounded")).toBe("rounded");
|
|
31
|
+
expect(toAvatarShape("square")).toBe("square");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("非法字符串返回 null", () => {
|
|
35
|
+
expect(toAvatarShape("weird")).toBeNull();
|
|
36
|
+
expect(toAvatarShape("CIRCLE")).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("空串与空值返回 null", () => {
|
|
40
|
+
expect(toAvatarShape("")).toBeNull();
|
|
41
|
+
expect(toAvatarShape(null)).toBeNull();
|
|
42
|
+
expect(toAvatarShape(undefined)).toBeNull();
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/lib/auth.config.ts
CHANGED
|
@@ -257,7 +257,7 @@ export const authConfig: StartAuthJSConfig = {
|
|
|
257
257
|
user.role = token.role as string
|
|
258
258
|
user.id = token.id as string
|
|
259
259
|
user.avatarConfig = token.avatarConfig as Record<string, number> | undefined
|
|
260
|
-
user.bgShape = token.bgShape
|
|
260
|
+
user.bgShape = typeof token.bgShape === "string" ? token.bgShape : undefined
|
|
261
261
|
user.bgColor = token.bgColor as string | undefined
|
|
262
262
|
if (token.name) user.name = token.name as string | null
|
|
263
263
|
if (token.email) user.email = token.email as string | null
|
|
@@ -15,27 +15,21 @@
|
|
|
15
15
|
// You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import type { ShapeType } from "@allbluecn/kernel"
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
export const AVATAR_SHAPES = [
|
|
21
|
+
"circle",
|
|
22
|
+
"rounded",
|
|
23
|
+
"square",
|
|
24
|
+
// satisfies 只防 kernel 收窄方向漂移(本数组塞进非 ShapeType 值会报错);
|
|
25
|
+
// kernel 新增形状值不会报错,会在 toAvatarShape 中静默归 null
|
|
26
|
+
] as const satisfies readonly ShapeType[]
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* UserBrief.bgShape 是 DB 字典直通的 string|null,UI 底形只认 ShapeType:
|
|
30
|
+
* 运行时守卫替代断言撒谎型 cast,非法/空值返回 null(由消费端决定回落)。
|
|
31
|
+
* 与 web 端 shared-kit/avatars/avatar-shape.ts 同构(双端 UI 不共享,各自维护)。
|
|
32
|
+
*/
|
|
33
|
+
export function toAvatarShape(v: string | null | undefined): ShapeType | null {
|
|
34
|
+
return AVATAR_SHAPES.find((shape) => shape === v) ?? null
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
export function getBoringAvatarUrl(
|
|
31
|
-
seed: string,
|
|
32
|
-
options: AvatarOptions = {}
|
|
33
|
-
): string {
|
|
34
|
-
const { style = "avataaars", size = 80 } = options;
|
|
35
|
-
|
|
36
|
-
return `${DICE_BEAR_BASE}/${style}/svg?seed=${encodeURIComponent(seed)}&size=${size}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function getAvatarFallback(name: string): string {
|
|
40
|
-
return name.charAt(0).toUpperCase();
|
|
41
|
-
}
|
package/src/providers/index.tsx
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { ThemeProvider } from "next-themes";
|
|
20
20
|
import { type ReactNode } from "react";
|
|
21
|
-
import { TooltipProvider } from "
|
|
21
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
22
22
|
|
|
23
23
|
export function Providers({
|
|
24
24
|
children,
|
package/src/routes/__root.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import globalsCss from '../styles/globals.css?url'
|
|
|
21
21
|
import type { RouterContext } from '@/lib/router-context'
|
|
22
22
|
import type { AppLocale } from '@/lib/i18n/config'
|
|
23
23
|
import { Providers } from '@/providers'
|
|
24
|
-
import { Toaster } from '
|
|
24
|
+
import { Toaster } from '@/components/ui/toast'
|
|
25
25
|
import { getSessionFn } from '@/server/serverFns/auth/session'
|
|
26
26
|
import { getLocaleFn } from '@/server/serverFns/locale'
|
|
27
27
|
import { reportClientError } from '@/server/serverFns/monitoring/report-error'
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { createLazyFileRoute } from '@tanstack/react-router'
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import type React from 'react'
|
|
21
|
-
import { Badge } from '
|
|
21
|
+
import { Badge } from '@/components/ui/badge'
|
|
22
22
|
|
|
23
23
|
export const Route = createLazyFileRoute('/_nav/audit')({
|
|
24
24
|
pendingComponent: () => (
|
|
@@ -19,11 +19,11 @@ import { createLazyFileRoute } from '@tanstack/react-router'
|
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
21
21
|
import { useServerFn } from '@tanstack/react-start'
|
|
22
|
-
import { toast } from '
|
|
22
|
+
import { toast } from '@/components/ui/toast'
|
|
23
23
|
import type React from 'react'
|
|
24
24
|
import { listComplianceExportsFn, executeComplianceJobFn } from '@/server/serverFns/compliance'
|
|
25
|
-
import { Badge } from '
|
|
26
|
-
import { Button } from '
|
|
25
|
+
import { Badge } from '@/components/ui/badge'
|
|
26
|
+
import { Button } from '@/components/ui/button'
|
|
27
27
|
import { Loader2 } from 'lucide-react'
|
|
28
28
|
|
|
29
29
|
export const Route = createLazyFileRoute('/_nav/compliance')({
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
import { useState } from 'react'
|
|
19
19
|
import { createLazyFileRoute, useNavigate, useRouter } from '@tanstack/react-router'
|
|
20
20
|
import { Plus, Search, Download } from 'lucide-react'
|
|
21
|
-
import { Button } from '
|
|
22
|
-
import { Input } from '
|
|
23
|
-
import { ConfirmDialog } from '
|
|
21
|
+
import { Button } from '@/components/ui/button'
|
|
22
|
+
import { Input } from '@/components/ui/input'
|
|
23
|
+
import { ConfirmDialog } from '@/components/confirm-dialog'
|
|
24
24
|
import { cn } from '@/lib/utils'
|
|
25
25
|
import { ComponentTable, type ComponentItem } from '@/components/component/component-table'
|
|
26
26
|
import { ComponentFormDialog } from '@/components/component/component-form-dialog'
|
|
27
27
|
import { ComponentImportDialog } from '@/components/component/component-import-dialog'
|
|
28
28
|
import { deleteComponentFn } from '@/server/serverFns/components/mutations'
|
|
29
|
-
import { toast } from '
|
|
29
|
+
import { toast } from '@/components/ui/toast'
|
|
30
30
|
|
|
31
31
|
const CATEGORY_TABS = [
|
|
32
32
|
{ key: 'all', label: '全部' },
|
|
@@ -37,18 +37,18 @@ import {
|
|
|
37
37
|
const categoryIconMap: Record<string, LucideIcon> = {
|
|
38
38
|
Folder, Globe, Code, Book, BookOpen,
|
|
39
39
|
}
|
|
40
|
-
import { DataTable, type AdminColumnDef } from '
|
|
41
|
-
import { Button } from '
|
|
42
|
-
import { Input } from '
|
|
43
|
-
import { Badge } from '
|
|
44
|
-
import { ConfirmDialog } from '
|
|
45
|
-
import { toast } from '
|
|
40
|
+
import { DataTable, type AdminColumnDef } from '@/components/data-table/data-table'
|
|
41
|
+
import { Button } from '@/components/ui/button'
|
|
42
|
+
import { Input } from '@/components/ui/input'
|
|
43
|
+
import { Badge } from '@/components/ui/badge'
|
|
44
|
+
import { ConfirmDialog } from '@/components/confirm-dialog'
|
|
45
|
+
import { toast } from '@/components/ui/toast'
|
|
46
46
|
import {
|
|
47
47
|
BookmarkFormDialog,
|
|
48
48
|
type BookmarkRow,
|
|
49
|
-
} from '@/components/knowledge
|
|
50
|
-
import { adminDeleteBookmarkFn } from '@/server/serverFns/knowledge
|
|
51
|
-
import { adminSyncAllGithubFn } from '@/server/serverFns/knowledge
|
|
49
|
+
} from '@/components/knowledge/public/bookmark-form-dialog'
|
|
50
|
+
import { adminDeleteBookmarkFn } from '@/server/serverFns/knowledge/public/bookmarks/delete'
|
|
51
|
+
import { adminSyncAllGithubFn } from '@/server/serverFns/knowledge/public/bookmarks/sync-all-github'
|
|
52
52
|
|
|
53
53
|
export const Route = createLazyFileRoute('/_nav/knowledge-public/bookmarks')({
|
|
54
54
|
pendingComponent: () => (
|
|
@@ -144,7 +144,7 @@ function BookmarksPage() {
|
|
|
144
144
|
{
|
|
145
145
|
accessorKey: 'title',
|
|
146
146
|
header: m.common_knowledgePublic_bookmarks_columns_website(),
|
|
147
|
-
cell: ({ row }
|
|
147
|
+
cell: ({ row }) => {
|
|
148
148
|
const b = row.original
|
|
149
149
|
return (
|
|
150
150
|
<div className="flex min-w-[180px] items-center gap-2">
|
|
@@ -164,7 +164,7 @@ function BookmarksPage() {
|
|
|
164
164
|
{
|
|
165
165
|
accessorKey: 'url',
|
|
166
166
|
header: m.common_knowledgePublic_bookmarks_columns_url(),
|
|
167
|
-
cell: ({ row }
|
|
167
|
+
cell: ({ row }) => {
|
|
168
168
|
const url = row.original.url
|
|
169
169
|
return (
|
|
170
170
|
<a
|
|
@@ -182,7 +182,7 @@ function BookmarksPage() {
|
|
|
182
182
|
{
|
|
183
183
|
accessorKey: 'categoryId',
|
|
184
184
|
header: m.common_knowledgePublic_bookmarks_columns_category(),
|
|
185
|
-
cell: ({ row }
|
|
185
|
+
cell: ({ row }) =>
|
|
186
186
|
row.original.categoryId ? (
|
|
187
187
|
<Badge variant="outline" className="font-mono text-xs">
|
|
188
188
|
{row.original.categoryId}
|
|
@@ -194,7 +194,7 @@ function BookmarksPage() {
|
|
|
194
194
|
{
|
|
195
195
|
id: 'github',
|
|
196
196
|
header: 'GitHub',
|
|
197
|
-
cell: ({ row }
|
|
197
|
+
cell: ({ row }) => {
|
|
198
198
|
const b = row.original
|
|
199
199
|
if (!b.isGithub) return <span className="text-muted-foreground">-</span>
|
|
200
200
|
return (
|
|
@@ -215,7 +215,7 @@ function BookmarksPage() {
|
|
|
215
215
|
{
|
|
216
216
|
accessorKey: 'tags',
|
|
217
217
|
header: m.common_knowledgePublic_bookmarks_columns_tags(),
|
|
218
|
-
cell: ({ row }
|
|
218
|
+
cell: ({ row }) => (
|
|
219
219
|
<div className="flex max-w-xs flex-wrap gap-1">
|
|
220
220
|
{row.original.tags.length === 0 ? (
|
|
221
221
|
<span className="text-muted-foreground">-</span>
|
|
@@ -232,7 +232,7 @@ function BookmarksPage() {
|
|
|
232
232
|
{
|
|
233
233
|
accessorKey: 'createdAt',
|
|
234
234
|
header: m.common_knowledgePublic_bookmarks_columns_createdAt(),
|
|
235
|
-
cell: ({ row }
|
|
235
|
+
cell: ({ row }) => (
|
|
236
236
|
<span className="text-muted-foreground">
|
|
237
237
|
{new Date(row.original.createdAt).toLocaleDateString('zh-CN')}
|
|
238
238
|
</span>
|
|
@@ -241,7 +241,7 @@ function BookmarksPage() {
|
|
|
241
241
|
{
|
|
242
242
|
id: 'actions',
|
|
243
243
|
header: '',
|
|
244
|
-
cell: ({ row }
|
|
244
|
+
cell: ({ row }) => (
|
|
245
245
|
<div className="flex items-center gap-1">
|
|
246
246
|
<Button
|
|
247
247
|
variant="ghost"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { createFileRoute } from '@tanstack/react-router'
|
|
19
19
|
import { z } from 'zod'
|
|
20
|
-
import { adminListBookmarksFn } from '@/server/serverFns/knowledge
|
|
20
|
+
import { adminListBookmarksFn } from '@/server/serverFns/knowledge/public/bookmarks/list'
|
|
21
21
|
|
|
22
22
|
const bookmarkSearchSchema = z.object({
|
|
23
23
|
search: z.string().optional(),
|
|
@@ -19,17 +19,17 @@ import { createLazyFileRoute, useNavigate, useRouter } from '@tanstack/react-rou
|
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import { useState, useTransition } from 'react'
|
|
21
21
|
import { PlusIcon, PencilIcon, Trash2Icon, SearchIcon } from 'lucide-react'
|
|
22
|
-
import { DataTable, type AdminColumnDef } from '
|
|
23
|
-
import { Button } from '
|
|
24
|
-
import { Input } from '
|
|
25
|
-
import { Badge } from '
|
|
26
|
-
import { ConfirmDialog } from '
|
|
27
|
-
import { toast } from '
|
|
22
|
+
import { DataTable, type AdminColumnDef } from '@/components/data-table/data-table'
|
|
23
|
+
import { Button } from '@/components/ui/button'
|
|
24
|
+
import { Input } from '@/components/ui/input'
|
|
25
|
+
import { Badge } from '@/components/ui/badge'
|
|
26
|
+
import { ConfirmDialog } from '@/components/confirm-dialog'
|
|
27
|
+
import { toast } from '@/components/ui/toast'
|
|
28
28
|
import {
|
|
29
29
|
ComplianceFormDialog,
|
|
30
30
|
type ComplianceRow,
|
|
31
|
-
} from '@/components/knowledge
|
|
32
|
-
import { adminDeleteComplianceFn } from '@/server/serverFns/knowledge
|
|
31
|
+
} from '@/components/knowledge/public/compliance-form-dialog'
|
|
32
|
+
import { adminDeleteComplianceFn } from '@/server/serverFns/knowledge/public/compliance/delete'
|
|
33
33
|
|
|
34
34
|
export const Route = createLazyFileRoute('/_nav/knowledge-public/compliance')({
|
|
35
35
|
pendingComponent: () => (
|
|
@@ -90,19 +90,19 @@ function CompliancePage() {
|
|
|
90
90
|
{
|
|
91
91
|
accessorKey: 'title',
|
|
92
92
|
header: m.common_knowledgePublic_compliance_columns_title(),
|
|
93
|
-
cell: ({ row }
|
|
93
|
+
cell: ({ row }) => <span className="font-medium">{row.original.title}</span>,
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
accessorKey: 'industry',
|
|
97
97
|
header: m.common_knowledgePublic_compliance_columns_industry(),
|
|
98
|
-
cell: ({ row }
|
|
98
|
+
cell: ({ row }) => (
|
|
99
99
|
<Badge variant="outline">{row.original.industry}</Badge>
|
|
100
100
|
),
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
accessorKey: 'regulatoryBody',
|
|
104
104
|
header: m.common_knowledgePublic_compliance_columns_regulatoryBody(),
|
|
105
|
-
cell: ({ row }
|
|
105
|
+
cell: ({ row }) => (
|
|
106
106
|
<span className="text-muted-foreground">
|
|
107
107
|
{row.original.regulatoryBody ?? '-'}
|
|
108
108
|
</span>
|
|
@@ -111,7 +111,7 @@ function CompliancePage() {
|
|
|
111
111
|
{
|
|
112
112
|
accessorKey: 'tags',
|
|
113
113
|
header: m.common_knowledgePublic_compliance_columns_tags(),
|
|
114
|
-
cell: ({ row }
|
|
114
|
+
cell: ({ row }) => (
|
|
115
115
|
<div className="flex max-w-xs flex-wrap gap-1">
|
|
116
116
|
{row.original.tags.length === 0 ? (
|
|
117
117
|
<span className="text-muted-foreground">-</span>
|
|
@@ -128,7 +128,7 @@ function CompliancePage() {
|
|
|
128
128
|
{
|
|
129
129
|
accessorKey: 'createdAt',
|
|
130
130
|
header: m.common_knowledgePublic_compliance_columns_createdAt(),
|
|
131
|
-
cell: ({ row }
|
|
131
|
+
cell: ({ row }) => (
|
|
132
132
|
<span className="text-muted-foreground">
|
|
133
133
|
{new Date(row.original.createdAt).toLocaleDateString('zh-CN')}
|
|
134
134
|
</span>
|
|
@@ -137,7 +137,7 @@ function CompliancePage() {
|
|
|
137
137
|
{
|
|
138
138
|
id: 'actions',
|
|
139
139
|
header: '',
|
|
140
|
-
cell: ({ row }
|
|
140
|
+
cell: ({ row }) => (
|
|
141
141
|
<div className="flex items-center gap-1">
|
|
142
142
|
<Button
|
|
143
143
|
variant="ghost"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { createFileRoute } from '@tanstack/react-router'
|
|
19
19
|
import { z } from 'zod'
|
|
20
|
-
import { adminListComplianceFn } from '@/server/serverFns/knowledge
|
|
20
|
+
import { adminListComplianceFn } from '@/server/serverFns/knowledge/public/compliance/list'
|
|
21
21
|
|
|
22
22
|
const complianceSearchSchema = z.object({
|
|
23
23
|
search: z.string().optional(),
|
|
@@ -19,10 +19,10 @@ import { createLazyFileRoute, useNavigate, useRouter } from '@tanstack/react-rou
|
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import { useState, useTransition } from 'react'
|
|
21
21
|
import { PlusIcon, PencilIcon, Trash2Icon, SearchIcon } from 'lucide-react'
|
|
22
|
-
import { DataTable, type AdminColumnDef } from '
|
|
23
|
-
import { Button } from '
|
|
24
|
-
import { Input } from '
|
|
25
|
-
import { Badge } from '
|
|
22
|
+
import { DataTable, type AdminColumnDef } from '@/components/data-table/data-table'
|
|
23
|
+
import { Button } from '@/components/ui/button'
|
|
24
|
+
import { Input } from '@/components/ui/input'
|
|
25
|
+
import { Badge } from '@/components/ui/badge'
|
|
26
26
|
import {
|
|
27
27
|
AlertDialog,
|
|
28
28
|
AlertDialogAction,
|
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
AlertDialogFooter,
|
|
33
33
|
AlertDialogHeader,
|
|
34
34
|
AlertDialogTitle,
|
|
35
|
-
} from '
|
|
36
|
-
import { toast } from '
|
|
37
|
-
import { LegalFormDialog, type LegalRow } from '@/components/knowledge
|
|
38
|
-
import { adminDeleteLegalFn } from '@/server/serverFns/knowledge
|
|
35
|
+
} from '@/components/ui/alert-dialog'
|
|
36
|
+
import { toast } from '@/components/ui/toast'
|
|
37
|
+
import { LegalFormDialog, type LegalRow } from '@/components/knowledge/public/legal-form-dialog'
|
|
38
|
+
import { adminDeleteLegalFn } from '@/server/serverFns/knowledge/public/legal/delete'
|
|
39
39
|
|
|
40
40
|
export const Route = createLazyFileRoute('/_nav/knowledge-public/legal')({
|
|
41
41
|
pendingComponent: () => (
|
|
@@ -96,12 +96,12 @@ function LegalPage() {
|
|
|
96
96
|
{
|
|
97
97
|
accessorKey: 'title',
|
|
98
98
|
header: m.common_knowledgePublic_legal_columns_title(),
|
|
99
|
-
cell: ({ row }
|
|
99
|
+
cell: ({ row }) => <span className="font-medium">{row.original.title}</span>,
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
accessorKey: 'jurisdiction',
|
|
103
103
|
header: m.common_knowledgePublic_legal_columns_jurisdiction(),
|
|
104
|
-
cell: ({ row }
|
|
104
|
+
cell: ({ row }) => (
|
|
105
105
|
<Badge variant="outline">
|
|
106
106
|
{row.original.jurisdiction}
|
|
107
107
|
</Badge>
|
|
@@ -110,14 +110,14 @@ function LegalPage() {
|
|
|
110
110
|
{
|
|
111
111
|
accessorKey: 'category',
|
|
112
112
|
header: m.common_knowledgePublic_legal_columns_category(),
|
|
113
|
-
cell: ({ row }
|
|
113
|
+
cell: ({ row }) => (
|
|
114
114
|
<span className="text-muted-foreground">{row.original.category}</span>
|
|
115
115
|
),
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
accessorKey: 'tags',
|
|
119
119
|
header: m.common_knowledgePublic_legal_columns_tags(),
|
|
120
|
-
cell: ({ row }
|
|
120
|
+
cell: ({ row }) => (
|
|
121
121
|
<div className="flex max-w-xs flex-wrap gap-1">
|
|
122
122
|
{row.original.tags.length === 0 ? (
|
|
123
123
|
<span className="text-muted-foreground">-</span>
|
|
@@ -134,7 +134,7 @@ function LegalPage() {
|
|
|
134
134
|
{
|
|
135
135
|
accessorKey: 'createdAt',
|
|
136
136
|
header: m.common_knowledgePublic_legal_columns_createdAt(),
|
|
137
|
-
cell: ({ row }
|
|
137
|
+
cell: ({ row }) => (
|
|
138
138
|
<span className="text-muted-foreground">
|
|
139
139
|
{new Date(row.original.createdAt).toLocaleDateString('zh-CN')}
|
|
140
140
|
</span>
|
|
@@ -143,7 +143,7 @@ function LegalPage() {
|
|
|
143
143
|
{
|
|
144
144
|
id: 'actions',
|
|
145
145
|
header: '',
|
|
146
|
-
cell: ({ row }
|
|
146
|
+
cell: ({ row }) => (
|
|
147
147
|
<div className="flex items-center gap-1">
|
|
148
148
|
<Button
|
|
149
149
|
variant="ghost"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { createFileRoute } from '@tanstack/react-router'
|
|
19
19
|
import { z } from 'zod'
|
|
20
|
-
import { adminListLegalFn } from '@/server/serverFns/knowledge
|
|
20
|
+
import { adminListLegalFn } from '@/server/serverFns/knowledge/public/legal/list'
|
|
21
21
|
|
|
22
22
|
const legalSearchSchema = z.object({
|
|
23
23
|
search: z.string().optional(),
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
import { createLazyFileRoute, Link, useNavigate } from '@tanstack/react-router'
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import { useServerFn } from '@tanstack/react-start'
|
|
21
|
-
import { toast } from '
|
|
21
|
+
import { toast } from '@/components/ui/toast'
|
|
22
22
|
import type React from 'react'
|
|
23
|
-
import { Button } from '
|
|
24
|
-
import { Card, CardContent, CardHeader, CardTitle } from '
|
|
23
|
+
import { Button } from '@/components/ui/button'
|
|
24
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
25
25
|
import { revokeLicenseFn } from '@/server/serverFns/licenses'
|
|
26
26
|
|
|
27
27
|
export const Route = createLazyFileRoute('/_nav/licenses/$licenseId')({
|
|
@@ -22,11 +22,11 @@ import { useState } from 'react'
|
|
|
22
22
|
import { useForm } from '@tanstack/react-form'
|
|
23
23
|
import { useServerFn } from '@tanstack/react-start'
|
|
24
24
|
import { Check, Copy } from 'lucide-react'
|
|
25
|
-
import { Button } from '
|
|
26
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '
|
|
27
|
-
import { Input } from '
|
|
28
|
-
import { Label } from '
|
|
29
|
-
import { Alert, AlertDescription, AlertTitle } from '
|
|
25
|
+
import { Button } from '@/components/ui/button'
|
|
26
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
|
27
|
+
import { Input } from '@/components/ui/input'
|
|
28
|
+
import { Label } from '@/components/ui/label'
|
|
29
|
+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
|
30
30
|
import { issueLicenseFn } from '@/server/serverFns/licenses'
|
|
31
31
|
import { FeatureRegistry } from '@allbluecn/kernel'
|
|
32
32
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { createLazyFileRoute, Link } from '@tanstack/react-router'
|
|
19
19
|
import { m } from '@/paraglide/messages.js'
|
|
20
20
|
import type React from 'react'
|
|
21
|
-
import { Button } from '
|
|
21
|
+
import { Button } from '@/components/ui/button'
|
|
22
22
|
|
|
23
23
|
export const Route = createLazyFileRoute('/_nav/licenses')({
|
|
24
24
|
pendingComponent: () => (
|
|
@@ -8,8 +8,8 @@ import { tooltip } from '@tanstack/charts/tooltip'
|
|
|
8
8
|
import { Chart } from '@tanstack/charts/react'
|
|
9
9
|
import { BarChart3, AlertCircle, AlertTriangle, ChevronLeft, ChevronRight, RefreshCw } from 'lucide-react'
|
|
10
10
|
import { PageHeader } from '@/components/common/page-header'
|
|
11
|
-
import { Card, CardContent, CardHeader, CardTitle } from '
|
|
12
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '
|
|
11
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
12
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
|
|
13
13
|
import { getAiUsageOverviewFn } from '@/server/serverFns/monitoring/get-ai-usage-overview'
|
|
14
14
|
import { checkAiAlertsFn } from '@/server/serverFns/monitoring/check-ai-alerts'
|
|
15
15
|
import type { AiUsageOverview } from '@/server/admin-ai-usage'
|
|
@@ -25,7 +25,7 @@ import { ErrorItem } from '@/components/monitoring/error-list'
|
|
|
25
25
|
import { getErrors } from '@/server/serverFns/monitoring/get-errors'
|
|
26
26
|
import { resetMonitoring } from '@/server/serverFns/monitoring/reset'
|
|
27
27
|
import { jsonify } from '@/lib/loader-serial'
|
|
28
|
-
import { toast } from '
|
|
28
|
+
import { toast } from '@/components/ui/toast'
|
|
29
29
|
|
|
30
30
|
export const Route = createLazyFileRoute('/_nav/monitoring/errors')({
|
|
31
31
|
component: MonitoringErrors,
|