Skip to content

Commit

Permalink
feat: 首页全新设计
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 16, 2024
1 parent 722c4f3 commit 3de3b40
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 366 deletions.
75 changes: 0 additions & 75 deletions web/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,81 +12,6 @@
"fileIndex": {
"title": "Files"
},
"homeIndex": {
"title": "Dashboard",
"website": "Website",
"database": "Database",
"cron": "Scheduled Tasks",
"sponsor": "Sponsor",
"git": "Open Source",
"resources": {
"title": "Resource Usage",
"cpu": {
"used": "{used} CPU / {total} threads"
},
"memory": {
"title": "Memory",
"physical": {
"used": "Physical used {used} / {total} total"
},
"swap": {
"used": "Swap used {used} / {total} total"
}
}
},
"loads": {
"title": "System Load",
"load": "{load} minute load",
"time": "nearly {time} minutes"
},
"traffic": {
"title": "Real-Time Traffic",
"network": {
"title": "Network",
"current": "Current uplink { sent } / current downlink { received }",
"total": "Total uplink { sent } / total downlink { received }"
},
"disk": {
"title": "Disk",
"current": "Current read { read } / current write { write }",
"total": "Total read { read } / total write { write }"
}
},
"store": {
"title": "Storage",
"columns": {
"path": "Path",
"type": "Type",
"usageRate": "Usage Rate",
"total": "Total",
"used": "Used",
"free": "Free"
}
},
"system": {
"title": "System Information",
"columns": {
"os": "OS",
"panel": "Panel",
"uptime": "Uptime",
"operate": "Operate",
"loading": "loading..."
},
"restart": {
"label": "Restart",
"confirm": "Are you sure you want to restart the panel?",
"success": "Restart successful",
"loading": "Restarting..."
},
"update": {
"label": "Update",
"success": "Update successful"
}
},
"apps": {
"title": "Quick App"
}
},
"homeUpdate": {
"title": "Update panel",
"loading": "Loading update information, please wait a moment",
Expand Down
75 changes: 0 additions & 75 deletions web/src/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,81 +12,6 @@
"fileIndex": {
"title": "文件管理"
},
"homeIndex": {
"title": "仪表盘",
"website": "网站",
"database": "数据库",
"cron": "计划任务",
"sponsor": "赞助支持",
"git": "开源地址",
"resources": {
"title": "资源使用",
"cpu": {
"used": "{used} CPU / 共 {total} 线程"
},
"memory": {
"title": "内存",
"physical": {
"used": "物理内存 使用 {used} / 总共 {total}"
},
"swap": {
"used": "交换分区 使用 {used} / 总共 {total}"
}
}
},
"loads": {
"title": "系统负载",
"load": "{load} 分钟负载",
"time": "近 {time} 分钟"
},
"traffic": {
"title": "实时流量",
"network": {
"title": "网络",
"current": "实时上行 { sent }/s / 实时下行 { received }/s",
"total": "累计上行 { sent } / 累计下行 { received }"
},
"disk": {
"title": "硬盘",
"current": "实时读取 { read }/s / 实时写入 { write }/s",
"total": "累计读取 { read } / 累计写入 { write }"
}
},
"store": {
"title": "存储信息",
"columns": {
"path": "挂载点",
"type": "文件系统",
"usageRate": "使用率",
"total": "总共",
"used": "已用",
"free": "可用"
}
},
"system": {
"title": "系统信息",
"columns": {
"os": "操作系统",
"panel": "面板版本",
"uptime": "运行时间",
"operate": "操作",
"loading": "加载中..."
},
"restart": {
"label": "重启面板",
"confirm": "确定重启面板吗?",
"success": "面板重启成功",
"loading": "面板重启中..."
},
"update": {
"label": "检查更新",
"success": "当前已是最新版本"
}
},
"apps": {
"title": "快捷应用"
}
},
"homeUpdate": {
"title": "升级面板",
"loading": "正在加载更新信息,稍等片刻",
Expand Down
11 changes: 7 additions & 4 deletions web/src/utils/common/common.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { DateTime, Duration } from 'luxon'

type Time = undefined | string | Date

/** 格式化时间,默认格式:yyyy-MM-dd HH:mm:ss */
export function formatDateTime(time: Time, format = 'yyyy-MM-dd HH:mm:ss'): string {
export function formatDateTime(time: any, format = 'yyyy-MM-dd HH:mm:ss'): string {
const dateTime = time ? DateTime.fromJSDate(new Date(time)) : DateTime.now()
return dateTime.toFormat(format)
}

/** 格式化日期,默认格式:yyyy-MM-dd */
export function formatDate(date: Time = undefined, format = 'yyyy-MM-dd') {
export function formatDate(date: any, format = 'yyyy-MM-dd') {
return formatDateTime(date, format)
}

Expand All @@ -24,6 +22,11 @@ export function formatDuration(seconds: number) {
return `${days}天${hours}小时${minutes}分钟${secs}秒`
}

/** 转时间戳 */
export function toTimestamp(time: any) {
return DateTime.fromJSDate(new Date(time)).toSeconds()
}

/** 生成随机字符串 */
export function generateRandomString(length: number) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
Expand Down
Loading

0 comments on commit 3de3b40

Please sign in to comment.