fix: 自适应表格高度并改用中文标签
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
/** 后台界面中文标签;原值可放 tooltip。 */
|
||||
|
||||
export const messageStateLabel: Record<string, string> = {
|
||||
scheduled: "定时中",
|
||||
dispatched: "投递中",
|
||||
completed: "已完成",
|
||||
};
|
||||
|
||||
export const destKindLabel: Record<string, string> = {
|
||||
endpoint: "端",
|
||||
group: "群",
|
||||
};
|
||||
|
||||
export const deliveryStateLabel: Record<string, string> = {
|
||||
pending: "待投递",
|
||||
accepted: "已收下",
|
||||
recalled: "已撤回",
|
||||
expired: "已过期",
|
||||
dropped: "已丢弃",
|
||||
rejected: "已拒绝",
|
||||
};
|
||||
|
||||
export const reasonLabel: Record<string, string> = {
|
||||
disabled: "端已停用",
|
||||
expired: "已过期",
|
||||
recalled: "已撤回",
|
||||
dropped: "已丢弃",
|
||||
rejected: "已拒绝",
|
||||
unauthorized: "未授权",
|
||||
not_found: "不存在",
|
||||
};
|
||||
|
||||
export const settingsFieldLabel: Record<string, string> = {
|
||||
listen: "端监听地址",
|
||||
admin_listen: "后台监听地址",
|
||||
session_idle_days: "会话闲置天数",
|
||||
record_retention_days: "记录保留天数",
|
||||
idempotency_hours: "防重小时数",
|
||||
receipt_retention_days: "回执保留天数",
|
||||
sqlite_synchronous: "SQLite 同步模式",
|
||||
};
|
||||
|
||||
export const limitsLabel: Record<string, string> = {
|
||||
max_body_bytes: "正文上限(字节)",
|
||||
max_meta_bytes: "元数据上限(字节)",
|
||||
max_frame_bytes: "帧上限(字节)",
|
||||
max_ttl_seconds: "TTL 上限(秒)",
|
||||
max_schedule_seconds: "定时上限(秒)",
|
||||
max_group_members: "群成员上限",
|
||||
grace_seconds: "宽限秒数",
|
||||
ack_timeout_seconds: "确认超时(秒)",
|
||||
delivery_window: "投递窗口",
|
||||
receipt_window: "回执窗口",
|
||||
requests_per_second: "每秒请求",
|
||||
max_pending_per_sender: "发送方未完成上限",
|
||||
max_pending_per_receiver: "接收方未完成上限",
|
||||
};
|
||||
|
||||
export function zhLabel(map: Record<string, string>, value: string | undefined | null, fallback = "—"): string {
|
||||
if (value == null || value === "") return fallback;
|
||||
return map[value] ?? value;
|
||||
}
|
||||
|
||||
/** 运行时长:天、时、分。 */
|
||||
export function formatUptime(ms: number): string {
|
||||
const total = Math.max(0, Math.floor(ms / 1000));
|
||||
const days = Math.floor(total / 86400);
|
||||
const hours = Math.floor((total % 86400) / 3600);
|
||||
const mins = Math.floor((total % 3600) / 60);
|
||||
const parts: string[] = [];
|
||||
if (days > 0) parts.push(`${days} 天`);
|
||||
if (hours > 0 || days > 0) parts.push(`${hours} 小时`);
|
||||
parts.push(`${mins} 分`);
|
||||
return parts.join(" ");
|
||||
}
|
||||
Reference in New Issue
Block a user