feat: add customizable widget sizes with chart visualizations
Add three-tier size system (small/medium/large) for server stats widgets. Integrate recharts library for visualizing trends in large widgets with line charts (CPU), area charts (Memory), and radial bar charts (Disk). Fix layout overflow issues with proper flexbox patterns.
This commit is contained in:
@@ -7,9 +7,12 @@ export type WidgetType =
|
||||
// | 'processes' // 进程数
|
||||
// | 'uptime'; // 运行时间
|
||||
|
||||
export type WidgetSize = "small" | "medium" | "large";
|
||||
|
||||
export interface Widget {
|
||||
id: string; // 唯一 ID:"cpu-1", "memory-2"
|
||||
type: WidgetType; // 卡片类型
|
||||
size: WidgetSize; // 尺寸:small/medium/large
|
||||
x: number; // 网格X坐标 (0-11)
|
||||
y: number; // 网格Y坐标
|
||||
w: number; // 宽度(网格单位 1-12)
|
||||
@@ -22,9 +25,9 @@ export interface StatsConfig {
|
||||
|
||||
export const DEFAULT_STATS_CONFIG: StatsConfig = {
|
||||
widgets: [
|
||||
{ id: "cpu-1", type: "cpu", x: 0, y: 0, w: 4, h: 2 },
|
||||
{ id: "memory-1", type: "memory", x: 4, y: 0, w: 4, h: 2 },
|
||||
{ id: "disk-1", type: "disk", x: 8, y: 0, w: 4, h: 2 },
|
||||
{ id: "cpu-1", type: "cpu", size: "medium", x: 0, y: 0, w: 4, h: 2 },
|
||||
{ id: "memory-1", type: "memory", size: "medium", x: 4, y: 0, w: 4, h: 2 },
|
||||
{ id: "disk-1", type: "disk", size: "medium", x: 8, y: 0, w: 4, h: 2 },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user