- 去掉所有 Link search 中的 String() 包装(7处),修复 URL 引号问题 - View Owner 改用 useNavigate 强制导航,解决同页面跳转不生效 - 设备组详情成员列表添加 auth_type Badge 和 device_type Badge - 设备组列表 owner 列统一为 [AUTH_TYPE Badge] + identifier 格式 - UserDetail 组件统一设备标识逻辑,去掉 shortenDeviceIdentifier Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
getUserDetail,
|
||||
getUserSubscribeById,
|
||||
} from "@workspace/ui/services/admin/user";
|
||||
import { shortenDeviceIdentifier } from "@workspace/ui/utils/device";
|
||||
import { formatBytes } from "@workspace/ui/utils/formatting";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Display } from "@/components/display";
|
||||
@@ -230,21 +229,29 @@ export function UserDetail({ id }: { id: number }) {
|
||||
|
||||
if (!id) return "--";
|
||||
|
||||
const emailMethod = data?.auth_methods.find((m) => m.auth_type === "email");
|
||||
const firstMethod = data?.auth_methods[0];
|
||||
const rawIdentifier =
|
||||
emailMethod?.auth_identifier || firstMethod?.auth_identifier || "";
|
||||
const isDevice = !emailMethod && firstMethod?.auth_type === "device";
|
||||
const identifier = isDevice
|
||||
? shortenDeviceIdentifier(rawIdentifier)
|
||||
: rawIdentifier;
|
||||
const isDevice = firstMethod?.auth_type === "device";
|
||||
const deviceNo = (data as any)?.user_devices?.[0]?.device_no;
|
||||
const rawIdentifier = firstMethod?.auth_identifier || "";
|
||||
const identifier = isDevice ? deviceNo || rawIdentifier : rawIdentifier;
|
||||
|
||||
return (
|
||||
<HoverCard>
|
||||
<HoverCardTrigger asChild>
|
||||
<Button asChild className="p-0" variant="link">
|
||||
<Link search={{ user_id: id }} to="/dashboard/user">
|
||||
{identifier || t("loading", "Loading...")}
|
||||
{data ? (
|
||||
<>
|
||||
{firstMethod && (
|
||||
<span className="mr-1 inline-flex items-center rounded border px-1 py-0.5 font-mono text-xs uppercase">
|
||||
{firstMethod.auth_type}
|
||||
</span>
|
||||
)}
|
||||
{identifier}
|
||||
</>
|
||||
) : (
|
||||
t("loading", "Loading...")
|
||||
)}
|
||||
</Link>
|
||||
</Button>
|
||||
</HoverCardTrigger>
|
||||
|
||||
Reference in New Issue
Block a user