feat: separate user navigation from focused host management
This commit is contained in:
1 parent
d7c007adc4
commit
8abb9d8a55
13 files changed
+153
-46
No files matched your search
@@ -9,23 +9,19 @@ const resourceLabels: Record<string, string> = { file: '文件管理', database:
|
||||
|
||||
interface OverviewProps {
|
||||
onRefresh?:()=>void;refreshing?:boolean;
|
||||
pendingProjectIDs?:number[];
|
||||
onEnterHost:(project:Project)=>void;
|
||||
onSchedules?:()=>void;
|
||||
projects: Project[];
|
||||
plan: Plan;
|
||||
usage: Usage;
|
||||
activities: ActivityEntry[];
|
||||
hostScoped: boolean;
|
||||
onCreate: () => void;
|
||||
onToggle: (id: number) => void;
|
||||
onFiles: (id: number) => void;
|
||||
onRunPath: (project: Project) => void;
|
||||
onSites: (project: Project) => void;
|
||||
onCredentials: (project: Project) => void;
|
||||
canCreate: boolean;
|
||||
onLogs?: () => void;
|
||||
}
|
||||
|
||||
export function Overview({ onRefresh,refreshing,pendingProjectIDs,projects, plan, usage, activities, hostScoped, onCreate, onToggle, onFiles, onRunPath, onSites, onCredentials, canCreate, onLogs }: OverviewProps) {
|
||||
export function Overview({ onRefresh,refreshing,projects, plan, usage, activities, hostScoped, onCreate, onEnterHost, onSchedules, canCreate, onLogs }: OverviewProps) {
|
||||
const resources = [
|
||||
{ label: '存储空间', value: usage.storageBytes, limit: plan.storageBytes },
|
||||
{ label: '本月流量', value: usage.bandwidthBytes, limit: plan.bandwidthBytes },
|
||||
@@ -34,14 +30,14 @@ export function Overview({ onRefresh,refreshing,pendingProjectIDs,projects, plan
|
||||
];
|
||||
return (
|
||||
<div className="page">
|
||||
<PageHeader title="总览" description={hostScoped ? '管理当前虚拟主机的网站、文件与访问凭据。' : '查看当前账号下的资源使用情况和业务概览。'} actions={onRefresh?<button className="secondary" disabled={refreshing} onClick={onRefresh}><RefreshCw size={15}/>{refreshing?'正在刷新…':'刷新状态'}</button>:null}/>
|
||||
<PageHeader title="总览" actions={<div className="overview-actions">{onSchedules?<button className="secondary" onClick={onSchedules}>计划任务</button>:null}{onRefresh?<button className="secondary" disabled={refreshing} onClick={onRefresh}><RefreshCw size={15}/>{refreshing?'正在刷新…':'刷新状态'}</button>:null}</div>}/>
|
||||
{!hostScoped ? <div className="metrics-grid">
|
||||
<MetricCard icon={HardDrive} label="存储空间" value={formatBytes(usage.storageBytes)} limit={formatBytes(plan.storageBytes)} percent={usagePercent(usage.storageBytes, plan.storageBytes)} />
|
||||
<MetricCard icon={Network} label="本月流量" value={formatBytes(usage.bandwidthBytes)} limit={formatBytes(plan.bandwidthBytes)} percent={usagePercent(usage.bandwidthBytes, plan.bandwidthBytes)} />
|
||||
<MetricCard icon={Cpu} label="进程数量" value={String(usage.processCount)} limit={String(plan.processLimit)} percent={usagePercent(usage.processCount, plan.processLimit)} />
|
||||
<MetricCard icon={Database} label="数据库大小" value={formatBytes(usage.databaseBytes)} limit={formatBytes(plan.databaseBytes)} percent={usagePercent(usage.databaseBytes, plan.databaseBytes)} />
|
||||
</div> : null}
|
||||
<ProjectTable pendingProjectIDs={pendingProjectIDs} projects={projects} canCreate={canCreate} onCreate={onCreate} onToggle={onToggle} onFiles={onFiles} onRunPath={onRunPath} onSites={onSites} onCredentials={onCredentials} />
|
||||
<ProjectTable projects={projects} canCreate={canCreate} onCreate={onCreate} onEnterHost={onEnterHost} />
|
||||
{!hostScoped ? <div className="lower-grid">
|
||||
<section className="activity-panel">
|
||||
<div className="section-title"><h2>最近操作日志</h2>{onLogs?<button onClick={onLogs}>查看全部 <ArrowRight size={15} /></button>:null}</div>
|
||||
|
||||
Reference in new issue
Block a user