@allbluecn/admin-app 0.3.8 → 0.5.0

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.
Files changed (53) hide show
  1. package/package.json +3 -3
  2. package/src/components/admin/developer-log.tsx +2 -2
  3. package/src/components/dependency/dependency-table.tsx +21 -3
  4. package/src/components/invitations/invitations-page.tsx +16 -4
  5. package/src/components/knowledge/public/kp-crud-page.tsx +208 -0
  6. package/src/components/market/market-app-form.tsx +1 -1
  7. package/src/components/user/settings-profile.tsx +1 -1
  8. package/src/components/user/user-create-dialog.tsx +1 -1
  9. package/src/components/user/user-detail/user-detail-dialogs.tsx +9 -9
  10. package/src/paraglide/messages/_index.js +8 -8
  11. package/src/paraglide/messages/admin_invitations_filter_showdisabled1.js +30 -0
  12. package/src/paraglide/messages/admin_users_action_deactivate.js +30 -0
  13. package/src/paraglide/messages/admin_users_dialog_deactivate_confirm.js +30 -0
  14. package/src/paraglide/messages/admin_users_dialog_deactivate_description.js +30 -0
  15. package/src/paraglide/messages/admin_users_dialog_deactivate_placeholder.js +30 -0
  16. package/src/paraglide/messages/admin_users_dialog_deactivate_title.js +30 -0
  17. package/src/paraglide/messages/admin_users_toast_deactivatefailed1.js +30 -0
  18. package/src/paraglide/messages/admin_users_toast_userdeactivated1.js +30 -0
  19. package/src/routes/_nav/knowledge-public/bookmarks/route.lazy.tsx +36 -111
  20. package/src/routes/_nav/knowledge-public/compliance/route.lazy.tsx +29 -105
  21. package/src/routes/_nav/knowledge-public/legal/route.lazy.tsx +30 -108
  22. package/src/routes/_nav/monitoring/errors/route.lazy.tsx +1 -1
  23. package/src/routes/_nav/monitoring/logs/route.lazy.tsx +1 -1
  24. package/src/routes/_nav/monitoring/metrics/route.lazy.tsx +1 -1
  25. package/src/routes/_nav/permissions/route.lazy.tsx +1 -1
  26. package/src/routes/_nav/sso/route.lazy.tsx +1 -1
  27. package/src/routes/_nav/users/$userId/route.lazy.tsx +10 -10
  28. package/src/server/knowledge/public/kp-factory.ts +134 -0
  29. package/src/server/serverFns/dependency/sync.ts +2 -2
  30. package/src/server/serverFns/knowledge/public/bookmarks/create.ts +23 -25
  31. package/src/server/serverFns/knowledge/public/bookmarks/delete.ts +2 -14
  32. package/src/server/serverFns/knowledge/public/bookmarks/detail.ts +2 -11
  33. package/src/server/serverFns/knowledge/public/bookmarks/list.ts +32 -38
  34. package/src/server/serverFns/knowledge/public/bookmarks/update.ts +23 -22
  35. package/src/server/serverFns/knowledge/public/compliance/create.ts +10 -15
  36. package/src/server/serverFns/knowledge/public/compliance/delete.ts +2 -14
  37. package/src/server/serverFns/knowledge/public/compliance/detail.ts +2 -11
  38. package/src/server/serverFns/knowledge/public/compliance/list.ts +24 -31
  39. package/src/server/serverFns/knowledge/public/compliance/update.ts +22 -22
  40. package/src/server/serverFns/knowledge/public/legal/create.ts +11 -15
  41. package/src/server/serverFns/knowledge/public/legal/delete.ts +2 -14
  42. package/src/server/serverFns/knowledge/public/legal/detail.ts +2 -11
  43. package/src/server/serverFns/knowledge/public/legal/list.ts +24 -32
  44. package/src/server/serverFns/knowledge/public/legal/update.ts +20 -22
  45. package/src/server/serverFns/user/{delete.ts → deactivate.ts} +2 -2
  46. package/src/paraglide/messages/admin_users_dialog_delete_confirm.js +0 -30
  47. package/src/paraglide/messages/admin_users_dialog_delete_description.js +0 -30
  48. package/src/paraglide/messages/admin_users_dialog_delete_placeholder.js +0 -30
  49. package/src/paraglide/messages/admin_users_dialog_delete_title.js +0 -30
  50. package/src/paraglide/messages/admin_users_toast_deletefailed1.js +0 -30
  51. package/src/paraglide/messages/admin_users_toast_userdeleted1.js +0 -30
  52. package/src/paraglide/messages/common_button_cancel.js +0 -29
  53. package/src/paraglide/messages/common_dependency_table_pagination_total.js +0 -29
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@allbluecn/admin-app",
3
- "version": "0.3.8",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@allbluecn/database": "0.9.5",
9
- "@allbluecn/kernel": "0.10.1",
8
+ "@allbluecn/database": "0.10.1",
9
+ "@allbluecn/kernel": "0.11.0",
10
10
  "@auth/core": "^0.41.2",
11
11
  "@base-ui/react": "^1.8.0",
12
12
  "@fontsource-variable/inter": "^5.3.0",
@@ -133,7 +133,7 @@ function DeveloperLogDialog({
133
133
  </div>
134
134
  </div>
135
135
  <DialogFooter>
136
- <Button variant="outline" onClick={() => onOpenChange(false)}>{m.common_button_cancel()}</Button>
136
+ <Button variant="outline" onClick={() => onOpenChange(false)}>{m.common_common_cancel()}</Button>
137
137
  <Button onClick={handleSave}>{m.common_button_save()}</Button>
138
138
  </DialogFooter>
139
139
  </DialogContent>
@@ -335,7 +335,7 @@ function DeveloperLogPage() {
335
335
  trigger={<Button variant="ghost" size="icon" className="size-7 text-destructive"><Trash2 className="size-3.5" /></Button>}
336
336
  title={m.common_button_delete()}
337
337
  description={m.common_developerLogs_deleteConfirm()}
338
- cancelLabel={m.common_button_cancel()}
338
+ cancelLabel={m.common_common_cancel()}
339
339
  confirmLabel={m.common_button_confirm()}
340
340
  confirmClassName="bg-destructive hover:bg-destructive/90"
341
341
  onConfirm={() => handleDelete(entry.id)}
@@ -56,6 +56,7 @@ import { cn } from "@/lib/utils"
56
56
  import { getPageNumbers } from "@/components/data-table/data-table-pagination"
57
57
  import { dependencyTableFeatures, getDependencyColumns } from "./columns"
58
58
 
59
+ const SYNC_ALL_BATCH_SIZE = 50
59
60
  const PAGE_SIZE = 15
60
61
 
61
62
  const STATUS_FILTERS: Array<{ value: "all" | VersionStatus }> = [
@@ -89,6 +90,7 @@ export function DependencyTable({
89
90
  const [viewFilter, setViewFilter] = useState<"watched" | "all">("watched")
90
91
  const [syncing, setSyncing] = useState<Set<string>>(new Set())
91
92
  const [syncingAll, setSyncingAll] = useState(false)
93
+ const [syncAllProgress, setSyncAllProgress] = useState<{ done: number; total: number } | null>(null)
92
94
  const [{ pageIndex }, setPagination] = useState<PaginationState>({ pageIndex: 0, pageSize: PAGE_SIZE })
93
95
 
94
96
  // 外部筛选(搜索 + 分类 + 状态 + 视图),得到 filtered 后交给 TanStack Table 分页
@@ -173,7 +175,20 @@ export function DependencyTable({
173
175
  }
174
176
  setSyncingAll(true)
175
177
  try {
176
- const results = await syncAllDependenciesFn({ data: { names } })
178
+ // A10 超时治理:分批请求 + 游标续跑。单批(含网络级)失败只记该批结果,
179
+ // 游标继续,不中断整体;serverless 单请求时长因此有界(50 × 单包往返)。
180
+ const results: Awaited<ReturnType<typeof syncAllDependenciesFn>> = []
181
+ for (let cursor = 0; cursor < names.length; cursor += SYNC_ALL_BATCH_SIZE) {
182
+ const batch = names.slice(cursor, cursor + SYNC_ALL_BATCH_SIZE)
183
+ setSyncAllProgress({ done: cursor, total: names.length })
184
+ try {
185
+ results.push(...(await syncAllDependenciesFn({ data: { names: batch } })))
186
+ } catch (e) {
187
+ const msg = e instanceof Error ? e.message : String(e)
188
+ results.push(...batch.map((name) => ({ name, success: false as const, error: msg })))
189
+ }
190
+ }
191
+ setSyncAllProgress(null)
177
192
  const ok = results.filter((r) => r.success)
178
193
  const fail = results.filter((r) => !r.success)
179
194
  if (ok.length) toast.success(m.common_dependency_table_toast_syncSuccess({ count: ok.length }))
@@ -186,11 +201,12 @@ export function DependencyTable({
186
201
  })
187
202
  onMutated?.()
188
203
  } catch (e) {
189
- // 批量同步整体抛错同样此前无 catch(unhandled rejection)
204
+ // 兜底:分批循环外的意外错误(如 setSyncAllProgress 抛错等)
190
205
  toast.error(m.common_dependency_table_toast_syncAllFailed(), {
191
206
  description: e instanceof Error ? e.message : String(e),
192
207
  })
193
208
  } finally {
209
+ setSyncAllProgress(null)
194
210
  setSyncingAll(false)
195
211
  }
196
212
  }
@@ -211,7 +227,9 @@ export function DependencyTable({
211
227
  <div className="ml-auto flex items-center gap-2">
212
228
  <Button onClick={handleSyncAll} disabled={syncingAll} variant="outline" size="sm">
213
229
  {syncingAll ? <Loader2 className="mr-1 size-3.5 animate-spin" /> : <RefreshCw className="mr-1 size-3.5" />}
214
- {m.common_dependency_table_syncAll({ count: filtered.length })}
230
+ {syncingAll && syncAllProgress
231
+ ? `${syncAllProgress.done}/${syncAllProgress.total}`
232
+ : m.common_dependency_table_syncAll({ count: filtered.length })}
215
233
  </Button>
216
234
  </div>
217
235
  </div>
@@ -107,10 +107,12 @@ export function InvitationsPage(): React.ReactElement {
107
107
  const [usesViewer, setUsesViewer] = useState<InvitationCodeRow | null>(null)
108
108
  const [createOpen, setCreateOpen] = useState(false)
109
109
  const [createForm, setCreateForm] = useState({ code: "", maxUses: 1, validDays: 30 })
110
+ // 已禁用码默认隐藏(服务端同默认);开关打开后可查回并走「启用」恢复
111
+ const [includeDisabled, setIncludeDisabled] = useState(false)
110
112
 
111
113
  const codesQuery = useQuery({
112
- queryKey: ["invitations", "codes"],
113
- queryFn: () => listInvitationCodesFn({ data: { page: 1, pageSize: 100 } }),
114
+ queryKey: ["invitations", "codes", includeDisabled],
115
+ queryFn: () => listInvitationCodesFn({ data: { page: 1, pageSize: 100, includeDisabled } }),
114
116
  })
115
117
  const modeQuery = useQuery({
116
118
  queryKey: ["invitations", "mode"],
@@ -220,10 +222,20 @@ export function InvitationsPage(): React.ReactElement {
220
222
  <div className="space-y-3">
221
223
  <div className="flex items-center justify-between">
222
224
  <h2 className="text-lg font-semibold">{m["admin-invitations_page_title"]()}</h2>
223
- <Button onClick={() => setCreateOpen(true)}>
225
+ <div className="flex items-center gap-4">
226
+ <label className="flex cursor-pointer items-center gap-2 text-sm text-muted-foreground">
227
+ <Switch
228
+ checked={includeDisabled}
229
+ onCheckedChange={setIncludeDisabled}
230
+ aria-label={m["admin-invitations_filter_showDisabled"]()}
231
+ />
232
+ {m["admin-invitations_filter_showDisabled"]()}
233
+ </label>
234
+ <Button onClick={() => setCreateOpen(true)}>
224
235
  <Plus className="size-4" />
225
236
  {m["admin-invitations_create_title"]()}
226
- </Button>
237
+ </Button>
238
+ </div>
227
239
  </div>
228
240
 
229
241
  {loading ? (
@@ -0,0 +1,208 @@
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
+ // S34(审计 A11 建议):knowledge-public 三管理页(bookmarks/compliance/legal)
19
+ // 的同构 CRUD 骨架抽取——状态机(搜索同步/表单开合/删除确认)收进 useKpCrud,
20
+ // 页面 chrome(标题头/搜索栏/表格容器)收进 KpCrudShell。列定义与表单对话框
21
+ // 各域差异大,保留在各页(audit/billing 页结构各异不强抽,审计同口径)。
22
+
23
+ import { useEffect, useState, useTransition, type ReactNode } from 'react'
24
+ import { useNavigate, useRouter } from '@tanstack/react-router'
25
+ import { PlusIcon, SearchIcon } from 'lucide-react'
26
+ import { Button } from '@/components/ui/button'
27
+ import { Input } from '@/components/ui/input'
28
+ import { DataTable, type AdminColumnDef } from '@/components/data-table/data-table'
29
+ import { ConfirmDialog } from '@/components/confirm-dialog'
30
+ import { toast } from '@/components/ui/toast'
31
+ import { m } from '@/paraglide/messages.js'
32
+
33
+ export interface KpCrud<Row> {
34
+ searchInput: string
35
+ setSearchInput: (v: string) => void
36
+ applySearch: () => void
37
+ refresh: () => void
38
+ formOpen: boolean
39
+ setFormOpen: (o: boolean) => void
40
+ editing: Row | null
41
+ openCreate: () => void
42
+ openEdit: (row: Row) => void
43
+ deleting: Row | null
44
+ setDeleting: (row: Row | null) => void
45
+ deletePending: boolean
46
+ confirmDelete: () => void
47
+ }
48
+
49
+ /** 三页同构 CRUD 状态机(S34):搜索同步 / 表单开合 / 删除确认 */
50
+ export function useKpCrud<Row extends { id: string; title?: string }>(args: {
51
+ routePath: string
52
+ search?: string
53
+ /** 删除请求(确认对话框提交时调用,错误 toast 在此统一处理) */
54
+ deleteFn: (row: Row) => Promise<unknown>
55
+ /** 删除成功专用文案(各域 i18n key) */
56
+ deleteSuccessToast: string
57
+ }): KpCrud<Row> {
58
+ const navigate = useNavigate()
59
+ const router = useRouter()
60
+ const [searchInput, setSearchInput] = useState(args.search ?? '')
61
+ const [formOpen, setFormOpen] = useState(false)
62
+ const [editing, setEditing] = useState<Row | null>(null)
63
+ const [deleting, setDeleting] = useState<Row | null>(null)
64
+ const [deletePending, startDelete] = useTransition()
65
+
66
+ // URL search 变化(后退/前进、外部导航)同步回输入框
67
+ useEffect(() => {
68
+ setSearchInput(args.search ?? '')
69
+ }, [args.search])
70
+
71
+ function refresh() {
72
+ router.invalidate()
73
+ }
74
+
75
+ function applySearch() {
76
+ navigate({
77
+ to: args.routePath,
78
+ search: (s: Record<string, unknown>) => ({ ...s, search: searchInput.trim() || undefined }),
79
+ })
80
+ }
81
+
82
+ function openCreate() {
83
+ setEditing(null)
84
+ setFormOpen(true)
85
+ }
86
+ function openEdit(row: Row) {
87
+ setEditing(row)
88
+ setFormOpen(true)
89
+ }
90
+
91
+ function confirmDelete() {
92
+ if (!deleting) return
93
+ startDelete(async () => {
94
+ try {
95
+ await args.deleteFn(deleting)
96
+ toast.success(args.deleteSuccessToast)
97
+ setDeleting(null)
98
+ refresh()
99
+ } catch (err) {
100
+ toast.error(err instanceof Error ? err.message : m.common_common_deleteFailed())
101
+ }
102
+ })
103
+ }
104
+
105
+ return {
106
+ searchInput,
107
+ setSearchInput,
108
+ applySearch,
109
+ refresh,
110
+ formOpen,
111
+ setFormOpen,
112
+ editing,
113
+ openCreate,
114
+ openEdit,
115
+ deleting,
116
+ setDeleting,
117
+ deletePending,
118
+ confirmDelete,
119
+ }
120
+ }
121
+
122
+ export interface KpCrudShellProps<Row> {
123
+ title: string
124
+ subtitle: string
125
+ createLabel: string
126
+ searchPlaceholder: string
127
+ /** 总数(副标题插值) */
128
+ total: number
129
+ items: Row[]
130
+ // S34:shell 仅转发列定义(类型在页面侧构造),AdminColumnDef 对泛型 Row 的
131
+ // RowData 联合约束无法被交叉约束证明,此处用 any 转发
132
+ columns: AdminColumnDef<any>[]
133
+ /** useKpCrud 状态(表格与删除确认对话框所需子集) */
134
+ crud: KpCrud<Row>
135
+ deleteConfirmTitle: string
136
+ deleteConfirmDescription: string
137
+ /** 标题头右侧扩展插槽(如 bookmarks 的 GitHub 全量同步按钮,位于创建按钮左侧) */
138
+ headerActions?: ReactNode
139
+ /** 额外对话框插槽(如 bookmarks 的同步确认,位于 shell 自身对话框之后) */
140
+ children?: ReactNode
141
+ /** 表单对话框(各域自行配置,open/editing 由 shell 注入) */
142
+ renderFormDialog: (ctx: { open: boolean; editing: Row | null; onOpenChange: (o: boolean) => void; onSuccess: () => void }) => ReactNode
143
+ }
144
+
145
+ /** 三页同构页面 chrome(S34):标题头 / 搜索栏 / 数据表 / 删除确认 */
146
+ export function KpCrudShell<Row extends Record<string, any> & { id: string; title?: string }>(props: KpCrudShellProps<Row>) {
147
+ const { crud } = props
148
+ return (
149
+ <div className="space-y-4 p-6">
150
+ <div className="flex items-center justify-between">
151
+ <div>
152
+ <h2 className="text-xl font-bold">{props.title}</h2>
153
+ <p className="text-sm text-muted-foreground">
154
+ {props.subtitle}
155
+ </p>
156
+ </div>
157
+ <div className="flex items-center gap-2">
158
+ {props.headerActions}
159
+ <Button onClick={crud.openCreate}>
160
+ <PlusIcon className="mr-1 size-4" />
161
+ {props.createLabel}
162
+ </Button>
163
+ </div>
164
+ </div>
165
+
166
+ <div className="flex items-center gap-2">
167
+ <div className="relative max-w-sm flex-1">
168
+ <SearchIcon className="absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
169
+ <Input
170
+ value={crud.searchInput}
171
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => crud.setSearchInput(e.target.value)}
172
+ onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
173
+ if (e.key === 'Enter') crud.applySearch()
174
+ }}
175
+ placeholder={props.searchPlaceholder}
176
+ className="pl-8"
177
+ />
178
+ </div>
179
+ <Button variant="outline" onClick={crud.applySearch}>
180
+ {m.common_common_search()}
181
+ </Button>
182
+ </div>
183
+
184
+ <DataTable columns={props.columns} data={props.items} />
185
+
186
+ {props.renderFormDialog({
187
+ open: crud.formOpen,
188
+ editing: crud.editing,
189
+ onOpenChange: crud.setFormOpen,
190
+ onSuccess: crud.refresh,
191
+ })}
192
+
193
+ <ConfirmDialog
194
+ open={!!crud.deleting}
195
+ onOpenChange={(o: boolean) => !o && crud.setDeleting(null)}
196
+ title={props.deleteConfirmTitle}
197
+ description={props.deleteConfirmDescription}
198
+ cancelLabel={m.common_common_cancel()}
199
+ confirmLabel={crud.deletePending ? m.common_common_deleting() : m.common_common_delete()}
200
+ confirmClassName="bg-destructive text-destructive-foreground hover:bg-destructive/90"
201
+ confirmDisabled={crud.deletePending}
202
+ cancelDisabled={crud.deletePending}
203
+ onConfirm={crud.confirmDelete}
204
+ />
205
+ {props.children}
206
+ </div>
207
+ )
208
+ }
@@ -111,7 +111,7 @@ export function MarketAppForm({ open, onOpenChange, editData, onSuccess }: Marke
111
111
  // 非 JSON 响应(网关 502 HTML 错误页等)时 res.json() 会抛 SyntaxError,须兜底通用文案
112
112
  // 服务端 err.error 可能携带内部细节(栈/表名),不当作用户文案(A1x-1 批);
113
113
  // 通用文案兜底 + console.warn 留证
114
- let message = m.common_market_form_operationFailed()
114
+ const message = m.common_market_form_operationFailed()
115
115
  try {
116
116
  const err = (await res.json()) as { error?: string }
117
117
  if (err?.error) console.warn('[market-app-form] submit failed:', err.error)
@@ -416,7 +416,7 @@ export default function SettingsProfile({
416
416
  type="button"
417
417
  variant="outline"
418
418
  >
419
- {showEmailChangeForm ? m.common_button_cancel() : m['admin-users_profile_changeEmail']()}
419
+ {showEmailChangeForm ? m.common_common_cancel() : m['admin-users_profile_changeEmail']()}
420
420
  </Button>
421
421
  )}
422
422
  </div>
@@ -151,7 +151,7 @@ export function UserCreateDialog({ open, onOpenChange }: UserCreateDialogProps)
151
151
  </div>
152
152
  <DialogFooter>
153
153
  <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
154
- {m.common_button_cancel()}
154
+ {m.common_common_cancel()}
155
155
  </Button>
156
156
  <Button type="submit" disabled={isPending}>
157
157
  {isPending ? m['admin-users_create_submitting']() : m.common_button_create()}
@@ -30,7 +30,7 @@ import { Label } from '@/components/ui/label'
30
30
  import { Button } from '@/components/ui/button'
31
31
 
32
32
  export type UserDialogState = { open: boolean; value: string }
33
- export type UserDeleteDialogState = { open: boolean; confirmName: string }
33
+ export type UserDeactivateDialogState = { open: boolean; confirmName: string }
34
34
 
35
35
  type DialogProps = {
36
36
  username: string
@@ -83,7 +83,7 @@ function UserSingleSelectDialog({
83
83
  </Select>
84
84
  </div>
85
85
  <DialogFooter>
86
- <Button variant="outline" onClick={onCancel}>{m.common_button_cancel()}</Button>
86
+ <Button variant="outline" onClick={onCancel}>{m.common_common_cancel()}</Button>
87
87
  <Button disabled={isPending} onClick={onSubmit}>{m.common_button_confirm()}</Button>
88
88
  </DialogFooter>
89
89
  </DialogContent>
@@ -154,7 +154,7 @@ export function UserPasswordDialog({
154
154
  <Input type="password" value={value} onChange={(e: React.ChangeEvent<HTMLInputElement>) => onValueChange(e.target.value)} />
155
155
  </div>
156
156
  <DialogFooter>
157
- <Button type="button" variant="outline" onClick={onCancel}>{m.common_button_cancel()}</Button>
157
+ <Button type="button" variant="outline" onClick={onCancel}>{m.common_common_cancel()}</Button>
158
158
  <Button type="submit" disabled={isPending || !value.trim()}>{m['admin-users_dialog_password_confirm']()}</Button>
159
159
  </DialogFooter>
160
160
  </form>
@@ -164,7 +164,7 @@ export function UserPasswordDialog({
164
164
  }
165
165
 
166
166
  /** 删除用户确认对话框(输入用户名确认) */
167
- export function UserDeleteDialog({
167
+ export function UserDeactivateDialog({
168
168
  open,
169
169
  confirmName,
170
170
  username,
@@ -183,18 +183,18 @@ export function UserDeleteDialog({
183
183
  <AlertDialog open={open} onOpenChange={onOpenChange}>
184
184
  <AlertDialogContent>
185
185
  <AlertDialogHeader>
186
- <AlertDialogTitle>{m['admin-users_dialog_delete_title']()}</AlertDialogTitle>
186
+ <AlertDialogTitle>{m['admin-users_dialog_deactivate_title']()}</AlertDialogTitle>
187
187
  <AlertDialogDescription>
188
- {m['admin-users_dialog_delete_description']({ username })}
188
+ {m['admin-users_dialog_deactivate_description']({ username })}
189
189
  </AlertDialogDescription>
190
190
  </AlertDialogHeader>
191
- <Input placeholder={m['admin-users_dialog_delete_placeholder']()} value={confirmName} onChange={(e: React.ChangeEvent<HTMLInputElement>) => onConfirmNameChange(e.target.value)} />
191
+ <Input placeholder={m['admin-users_dialog_deactivate_placeholder']()} value={confirmName} onChange={(e: React.ChangeEvent<HTMLInputElement>) => onConfirmNameChange(e.target.value)} />
192
192
  <AlertDialogFooter>
193
- <AlertDialogCancel>{m.common_button_cancel()}</AlertDialogCancel>
193
+ <AlertDialogCancel>{m.common_common_cancel()}</AlertDialogCancel>
194
194
  <AlertDialogAction
195
195
  disabled={confirmName !== username || isPending}
196
196
  onClick={onSubmit}
197
- >{m['admin-users_dialog_delete_confirm']()}</AlertDialogAction>
197
+ >{m['admin-users_dialog_deactivate_confirm']()}</AlertDialogAction>
198
198
  </AlertDialogFooter>
199
199
  </AlertDialogContent>
200
200
  </AlertDialog>
@@ -283,6 +283,7 @@ export * from './admin_invitations_delete_confirm_desc.js'
283
283
  export * from './admin_invitations_delete_confirm_title.js'
284
284
  export * from './admin_invitations_delete_disabled_hint.js'
285
285
  export * from './admin_invitations_empty.js'
286
+ export * from './admin_invitations_filter_showdisabled1.js'
286
287
  export * from './admin_invitations_mode_invite.js'
287
288
  export * from './admin_invitations_mode_invite_desc.js'
288
289
  export * from './admin_invitations_mode_open.js'
@@ -342,6 +343,7 @@ export * from './admin_loginproviders_toast_testfailed2.js'
342
343
  export * from './admin_loginproviders_toast_testok2.js'
343
344
  export * from './admin_users_action_changerole1.js'
344
345
  export * from './admin_users_action_changestatus1.js'
346
+ export * from './admin_users_action_deactivate.js'
345
347
  export * from './admin_users_action_resetpassword1.js'
346
348
  export * from './admin_users_action_viewdetails1.js'
347
349
  export * from './admin_users_column_email.js'
@@ -378,10 +380,10 @@ export * from './admin_users_detail_stats_prds.js'
378
380
  export * from './admin_users_detail_stats_reviews.js'
379
381
  export * from './admin_users_detail_stats_title.js'
380
382
  export * from './admin_users_detail_usernotfound2.js'
381
- export * from './admin_users_dialog_delete_confirm.js'
382
- export * from './admin_users_dialog_delete_description.js'
383
- export * from './admin_users_dialog_delete_placeholder.js'
384
- export * from './admin_users_dialog_delete_title.js'
383
+ export * from './admin_users_dialog_deactivate_confirm.js'
384
+ export * from './admin_users_dialog_deactivate_description.js'
385
+ export * from './admin_users_dialog_deactivate_placeholder.js'
386
+ export * from './admin_users_dialog_deactivate_title.js'
385
387
  export * from './admin_users_dialog_password_confirm.js'
386
388
  export * from './admin_users_dialog_password_newpassword1.js'
387
389
  export * from './admin_users_dialog_password_title.js'
@@ -444,13 +446,13 @@ export * from './admin_users_status_banned.js'
444
446
  export * from './admin_users_status_inactive.js'
445
447
  export * from './admin_users_toast_createfailed1.js'
446
448
  export * from './admin_users_toast_createsuccess1.js'
447
- export * from './admin_users_toast_deletefailed1.js'
449
+ export * from './admin_users_toast_deactivatefailed1.js'
448
450
  export * from './admin_users_toast_passwordreset1.js'
449
451
  export * from './admin_users_toast_resetfailed1.js'
450
452
  export * from './admin_users_toast_roleupdated1.js'
451
453
  export * from './admin_users_toast_statusupdated1.js'
452
454
  export * from './admin_users_toast_updatefailed1.js'
453
- export * from './admin_users_toast_userdeleted1.js'
455
+ export * from './admin_users_toast_userdeactivated1.js'
454
456
  export * from './common_activitylog_actiontype2.js'
455
457
  export * from './common_activitylog_actiontypes_all2.js'
456
458
  export * from './common_activitylog_actiontypes_create2.js'
@@ -500,7 +502,6 @@ export * from './common_bookmarkform_url1.js'
500
502
  export * from './common_bookmarkform_urlhint2.js'
501
503
  export * from './common_bookmarkform_urlrequired2.js'
502
504
  export * from './common_button_back.js'
503
- export * from './common_button_cancel.js'
504
505
  export * from './common_button_close.js'
505
506
  export * from './common_button_confirm.js'
506
507
  export * from './common_button_create.js'
@@ -683,7 +684,6 @@ export * from './common_dependency_table_columns_status.js'
683
684
  export * from './common_dependency_table_empty.js'
684
685
  export * from './common_dependency_table_pagination_next.js'
685
686
  export * from './common_dependency_table_pagination_prev.js'
686
- export * from './common_dependency_table_pagination_total.js'
687
687
  export * from './common_dependency_table_searchplaceholder1.js'
688
688
  export * from './common_dependency_table_stats_outdated.js'
689
689
  export * from './common_dependency_table_stats_watched.js'
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{}} Admin_Invitations_Filter_Showdisabled1Inputs */
7
+
8
+ const zh_admin_invitations_filter_showdisabled1 = /** @type {(inputs: Admin_Invitations_Filter_Showdisabled1Inputs) => LocalizedString} */ () => {
9
+ return /** @type {LocalizedString} */ (`显示已禁用`)
10
+ };
11
+
12
+ const en_admin_invitations_filter_showdisabled1 = /** @type {(inputs: Admin_Invitations_Filter_Showdisabled1Inputs) => LocalizedString} */ () => {
13
+ return /** @type {LocalizedString} */ (`Show disabled`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Show disabled" |
20
+ *
21
+ * @param {Admin_Invitations_Filter_Showdisabled1Inputs} inputs
22
+ * @param {{ locale?: "zh" | "en" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ const admin_invitations_filter_showdisabled1 = /** @type {((inputs?: Admin_Invitations_Filter_Showdisabled1Inputs, options?: { locale?: "zh" | "en" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Invitations_Filter_Showdisabled1Inputs, { locale?: "zh" | "en" }, {}>} */ ((inputs = {}, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_admin_invitations_filter_showdisabled1(inputs)
28
+ return zh_admin_invitations_filter_showdisabled1(inputs)
29
+ });
30
+ export { admin_invitations_filter_showdisabled1 as "admin-invitations_filter_showDisabled" }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{}} Admin_Users_Action_DeactivateInputs */
7
+
8
+ const zh_admin_users_action_deactivate = /** @type {(inputs: Admin_Users_Action_DeactivateInputs) => LocalizedString} */ () => {
9
+ return /** @type {LocalizedString} */ (`停用账号`)
10
+ };
11
+
12
+ const en_admin_users_action_deactivate = /** @type {(inputs: Admin_Users_Action_DeactivateInputs) => LocalizedString} */ () => {
13
+ return /** @type {LocalizedString} */ (`Deactivate`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Deactivate" |
20
+ *
21
+ * @param {Admin_Users_Action_DeactivateInputs} inputs
22
+ * @param {{ locale?: "zh" | "en" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ const admin_users_action_deactivate = /** @type {((inputs?: Admin_Users_Action_DeactivateInputs, options?: { locale?: "zh" | "en" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Users_Action_DeactivateInputs, { locale?: "zh" | "en" }, {}>} */ ((inputs = {}, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_admin_users_action_deactivate(inputs)
28
+ return zh_admin_users_action_deactivate(inputs)
29
+ });
30
+ export { admin_users_action_deactivate as "admin-users_action_deactivate" }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{}} Admin_Users_Dialog_Deactivate_ConfirmInputs */
7
+
8
+ const zh_admin_users_dialog_deactivate_confirm = /** @type {(inputs: Admin_Users_Dialog_Deactivate_ConfirmInputs) => LocalizedString} */ () => {
9
+ return /** @type {LocalizedString} */ (`确认停用`)
10
+ };
11
+
12
+ const en_admin_users_dialog_deactivate_confirm = /** @type {(inputs: Admin_Users_Dialog_Deactivate_ConfirmInputs) => LocalizedString} */ () => {
13
+ return /** @type {LocalizedString} */ (`Confirm Deactivate`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Confirm Deactivate" |
20
+ *
21
+ * @param {Admin_Users_Dialog_Deactivate_ConfirmInputs} inputs
22
+ * @param {{ locale?: "zh" | "en" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ const admin_users_dialog_deactivate_confirm = /** @type {((inputs?: Admin_Users_Dialog_Deactivate_ConfirmInputs, options?: { locale?: "zh" | "en" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Users_Dialog_Deactivate_ConfirmInputs, { locale?: "zh" | "en" }, {}>} */ ((inputs = {}, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_admin_users_dialog_deactivate_confirm(inputs)
28
+ return zh_admin_users_dialog_deactivate_confirm(inputs)
29
+ });
30
+ export { admin_users_dialog_deactivate_confirm as "admin-users_dialog_deactivate_confirm" }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{ username: NonNullable<unknown> }} Admin_Users_Dialog_Deactivate_DescriptionInputs */
7
+
8
+ const zh_admin_users_dialog_deactivate_description = /** @type {(inputs: Admin_Users_Dialog_Deactivate_DescriptionInputs) => LocalizedString} */ (i) => {
9
+ return /** @type {LocalizedString} */ (`停用后该用户将无法登录,数据保留,可随时通过「修改状态」恢复为启用。请输入用户名 <strong>${i?.username}</strong> 以确认。`)
10
+ };
11
+
12
+ const en_admin_users_dialog_deactivate_description = /** @type {(inputs: Admin_Users_Dialog_Deactivate_DescriptionInputs) => LocalizedString} */ (i) => {
13
+ return /** @type {LocalizedString} */ (`Once deactivated, this user can no longer sign in. Their data is kept and the account can be re-enabled anytime via 'Change Status'. Please enter <strong>${i?.username}</strong> to confirm.`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Once deactivated, this user can no longer sign in. Their data is kept and the account can be re-enabled anytime via 'Change Status'. Please enter <strong>{us..." |
20
+ *
21
+ * @param {Admin_Users_Dialog_Deactivate_DescriptionInputs} inputs
22
+ * @param {{ locale?: "zh" | "en" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ const admin_users_dialog_deactivate_description = /** @type {((inputs: Admin_Users_Dialog_Deactivate_DescriptionInputs, options?: { locale?: "zh" | "en" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Users_Dialog_Deactivate_DescriptionInputs, { locale?: "zh" | "en" }, {}>} */ ((inputs, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_admin_users_dialog_deactivate_description(inputs)
28
+ return zh_admin_users_dialog_deactivate_description(inputs)
29
+ });
30
+ export { admin_users_dialog_deactivate_description as "admin-users_dialog_deactivate_description" }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{}} Admin_Users_Dialog_Deactivate_PlaceholderInputs */
7
+
8
+ const zh_admin_users_dialog_deactivate_placeholder = /** @type {(inputs: Admin_Users_Dialog_Deactivate_PlaceholderInputs) => LocalizedString} */ () => {
9
+ return /** @type {LocalizedString} */ (`输入用户名确认`)
10
+ };
11
+
12
+ const en_admin_users_dialog_deactivate_placeholder = /** @type {(inputs: Admin_Users_Dialog_Deactivate_PlaceholderInputs) => LocalizedString} */ () => {
13
+ return /** @type {LocalizedString} */ (`Enter username to confirm`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Enter username to confirm" |
20
+ *
21
+ * @param {Admin_Users_Dialog_Deactivate_PlaceholderInputs} inputs
22
+ * @param {{ locale?: "zh" | "en" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ const admin_users_dialog_deactivate_placeholder = /** @type {((inputs?: Admin_Users_Dialog_Deactivate_PlaceholderInputs, options?: { locale?: "zh" | "en" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Users_Dialog_Deactivate_PlaceholderInputs, { locale?: "zh" | "en" }, {}>} */ ((inputs = {}, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_admin_users_dialog_deactivate_placeholder(inputs)
28
+ return zh_admin_users_dialog_deactivate_placeholder(inputs)
29
+ });
30
+ export { admin_users_dialog_deactivate_placeholder as "admin-users_dialog_deactivate_placeholder" }