Skip to content

Commit 8cc2b28

Browse files
committed
style: format api and view
1 parent 61e58a2 commit 8cc2b28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+486
-578
lines changed

api/internal/features/deploy/proxy/caddy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ func (c *Caddy) Serve() error {
8080

8181
// Replace the route for our domain
8282
server := config.Apps.HTTP.Servers["nixopus"]
83-
83+
8484
// Ensure server has listen directive
8585
if len(server.Listen) == 0 {
8686
server.Listen = []string{":80"}
8787
}
88-
88+
8989
var newRoutes []Route
9090
for _, route := range server.Routes {
9191
if len(route.Match) > 0 && len(route.Match[0].Host) > 0 && route.Match[0].Host[0] != c.Domain {

view/app/activities/page.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,15 @@ function ActivitiesTable({ activities }: { activities: ActivityMessage[] }) {
114114
title: '',
115115
width: '50px',
116116
render: (_, activity) => (
117-
<div
118-
className={`h-3 w-3 rounded-full ${getActionColor(activity.action_color)}`}
119-
/>
117+
<div className={`h-3 w-3 rounded-full ${getActionColor(activity.action_color)}`} />
120118
)
121119
},
122120
{
123121
key: 'message',
124122
title: 'Message',
125123
dataIndex: 'message',
126124
className: 'max-w-md',
127-
render: (message) => (
128-
<TypographySmall className="text-foreground">
129-
{message}
130-
</TypographySmall>
131-
)
125+
render: (message) => <TypographySmall className="text-foreground">{message}</TypographySmall>
132126
},
133127
{
134128
key: 'timestamp',
@@ -144,12 +138,7 @@ function ActivitiesTable({ activities }: { activities: ActivityMessage[] }) {
144138

145139
return (
146140
<div className="rounded-md border">
147-
<DataTable
148-
data={activities}
149-
columns={columns}
150-
showBorder={false}
151-
hoverable={false}
152-
/>
141+
<DataTable data={activities} columns={columns} showBorder={false} hoverable={false} />
153142
</div>
154143
);
155144
}

view/app/containers/components/table.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,15 @@ const ContainersTable = ({
7171
dataIndex: 'state',
7272
sortable: true,
7373
render: (state, container) => (
74-
<Badge className={getStatusColor(container.status)}>
75-
{state || 'Unknown'}
76-
</Badge>
74+
<Badge className={getStatusColor(container.status)}>{state || 'Unknown'}</Badge>
7775
)
7876
},
7977
{
8078
key: 'ports',
8179
title: t('dashboard.containers.table.headers.ports'),
8280
render: (_, container) => {
8381
const hasPorts = container.ports && container.ports.length > 0;
84-
82+
8583
if (!hasPorts) {
8684
return <TypographySmall>-</TypographySmall>;
8785
}
@@ -136,19 +134,19 @@ const ContainersTable = ({
136134
}
137135

138136
return (
139-
<DataTable
140-
data={containersData}
141-
columns={columns}
142-
onRowClick={handleRowClick}
143-
onSort={handleSort}
144-
sortConfig={{
145-
field: sortBy,
146-
order: sortOrder
147-
}}
148-
emptyMessage={t('dashboard.containers.table.noContainers')}
149-
hoverable={true}
150-
showBorder={true}
151-
/>
137+
<DataTable
138+
data={containersData}
139+
columns={columns}
140+
onRowClick={handleRowClick}
141+
onSort={handleSort}
142+
sortConfig={{
143+
field: sortBy,
144+
order: sortOrder
145+
}}
146+
emptyMessage={t('dashboard.containers.table.noContainers')}
147+
hoverable={true}
148+
showBorder={true}
149+
/>
152150
);
153151
};
154152

view/app/dashboard/components/containers/container-table.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ const ContainersTable = ({ containersData }: { containersData: ContainerData[] }
1717
title: t('dashboard.containers.table.headers.id'),
1818
dataIndex: 'Id',
1919
width: '100px',
20-
render: (id) => (
21-
<TypographySmall className="font-mono">{truncateId(id)}</TypographySmall>
22-
)
20+
render: (id) => <TypographySmall className="font-mono">{truncateId(id)}</TypographySmall>
2321
},
2422
{
2523
key: 'name',
2624
title: t('dashboard.containers.table.headers.name'),
2725
render: (_, container) => {
28-
const containerName = container.Names && container.Names.length > 0
29-
? container.Names[0].replace(/^\//, '')
30-
: '-';
26+
const containerName =
27+
container.Names && container.Names.length > 0
28+
? container.Names[0].replace(/^\//, '')
29+
: '-';
3130
return <TypographySmall>{containerName}</TypographySmall>;
3231
}
3332
},
@@ -46,9 +45,7 @@ const ContainersTable = ({ containersData }: { containersData: ContainerData[] }
4645
key: 'status',
4746
title: t('dashboard.containers.table.headers.status'),
4847
render: (_, container) => (
49-
<Badge className={getStatusColor(container.Status)}>
50-
{container.State || 'Unknown'}
51-
</Badge>
48+
<Badge className={getStatusColor(container.Status)}>{container.State || 'Unknown'}</Badge>
5249
)
5350
},
5451
{
@@ -88,8 +85,8 @@ const ContainersTable = ({ containersData }: { containersData: ContainerData[] }
8885
render: (created) => {
8986
const formattedDate = created
9087
? new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'long' }).format(
91-
new Date(created * 1000)
92-
)
88+
new Date(created * 1000)
89+
)
9390
: '-';
9491
return <TypographySmall>{formattedDate}</TypographySmall>;
9592
}

view/app/dashboard/components/containers/containers-widget.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ const ContainersWidget: React.FC<ContainersWidgetProps> = ({ containersData }) =
3838
};
3939

4040
export default ContainersWidget;
41-

view/app/dashboard/components/system/clock.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@ const ClockWidget: React.FC = () => {
1717
skeletonContent={<ClockCardSkeletonContent />}
1818
>
1919
<div className="flex flex-col items-center justify-center h-full space-y-3">
20-
<div className="text-5xl font-bold text-primary tabular-nums">
21-
{formattedTime}
22-
</div>
23-
<div className="text-sm text-muted-foreground">
24-
{formattedDate}
25-
</div>
20+
<div className="text-5xl font-bold text-primary tabular-nums">{formattedTime}</div>
21+
<div className="text-sm text-muted-foreground">{formattedDate}</div>
2622
</div>
2723
</SystemMetricCard>
2824
);
2925
};
3026

3127
export default ClockWidget;
32-

view/app/dashboard/components/system/cpu-usage.tsx

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,14 @@ const CPU_COLORS = [
4343
CHART_COLORS.orange,
4444
CHART_COLORS.purple,
4545
CHART_COLORS.red,
46-
CHART_COLORS.yellow,
46+
CHART_COLORS.yellow
4747
];
4848

4949
const CPUUsageHeader: React.FC<CPUUsageHeaderProps> = ({ overallUsage, label }) => {
5050
return (
5151
<div className="text-center">
5252
<TypographyMuted className="text-xs">{label}</TypographyMuted>
53-
<div className="text-3xl font-bold text-primary mt-1">
54-
{formatPercentage(overallUsage)}%
55-
</div>
53+
<div className="text-3xl font-bold text-primary mt-1">{formatPercentage(overallUsage)}%</div>
5654
</div>
5755
);
5856
};
@@ -61,7 +59,7 @@ const CPUUsageChart: React.FC<CPUUsageChartProps> = ({
6159
chartData,
6260
chartConfig,
6361
yAxisLabel,
64-
xAxisLabel,
62+
xAxisLabel
6563
}) => {
6664
return (
6765
<div>
@@ -84,9 +82,7 @@ const CoreItem: React.FC<CoreItemProps> = ({ coreId, usage, color }) => {
8482
<div className="h-2 w-2 rounded-full" style={{ backgroundColor: color }} />
8583
<TypographyMuted className="text-xs">Core {coreId}</TypographyMuted>
8684
</div>
87-
<TypographySmall className="text-sm font-bold">
88-
{formatPercentage(usage)}%
89-
</TypographySmall>
85+
<TypographySmall className="text-sm font-bold">{formatPercentage(usage)}%</TypographySmall>
9086
</div>
9187
);
9288
};
@@ -97,23 +93,22 @@ const TopCoresList: React.FC<TopCoresListProps> = ({ cores }) => {
9793
{cores.map((core) => {
9894
const color = CPU_COLORS[core.core_id % CPU_COLORS.length];
9995
return (
100-
<CoreItem
101-
key={core.core_id}
102-
coreId={core.core_id}
103-
usage={core.usage}
104-
color={color}
105-
/>
96+
<CoreItem key={core.core_id} coreId={core.core_id} usage={core.usage} color={color} />
10697
);
10798
})}
10899
</div>
109100
);
110101
};
111102

112103
const CPUUsageCard: React.FC<CPUUsageCardProps> = ({ systemStats }) => {
113-
const { data: cpu, isLoading, t } = useSystemMetric({
104+
const {
105+
data: cpu,
106+
isLoading,
107+
t
108+
} = useSystemMetric({
114109
systemStats,
115110
extractData: (stats) => stats.cpu,
116-
defaultData: DEFAULT_METRICS.cpu,
111+
defaultData: DEFAULT_METRICS.cpu
117112
});
118113

119114
const perCoreData = cpu.per_core;
@@ -129,10 +124,7 @@ const CPUUsageCard: React.FC<CPUUsageCardProps> = ({ systemStats }) => {
129124
skeletonContent={<CPUUsageCardSkeletonContent />}
130125
>
131126
<div className="space-y-4">
132-
<CPUUsageHeader
133-
overallUsage={cpu.overall}
134-
label={t('dashboard.cpu.overall')}
135-
/>
127+
<CPUUsageHeader overallUsage={cpu.overall} label={t('dashboard.cpu.overall')} />
136128

137129
<CPUUsageChart
138130
chartData={chartData}

view/app/dashboard/components/system/disk-usage.tsx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ interface MountData {
2424
}
2525

2626
const DiskUsageCard: React.FC<DiskUsageCardProps> = ({ systemStats }) => {
27-
const { data: disk, isLoading, t } = useSystemMetric({
27+
const {
28+
data: disk,
29+
isLoading,
30+
t
31+
} = useSystemMetric({
2832
systemStats,
2933
extractData: (stats) => stats.disk,
30-
defaultData: DEFAULT_METRICS.disk,
34+
defaultData: DEFAULT_METRICS.disk
3135
});
3236

3337
return (
@@ -39,10 +43,7 @@ const DiskUsageCard: React.FC<DiskUsageCardProps> = ({ systemStats }) => {
3943
>
4044
<div className="space-y-2 sm:space-y-3">
4145
<div className="w-full h-2 bg-gray-200 rounded-full">
42-
<div
43-
className={`h-2 rounded-full bg-primary`}
44-
style={{ width: `${disk.percentage}%` }}
45-
/>
46+
<div className={`h-2 rounded-full bg-primary`} style={{ width: `${disk.percentage}%` }} />
4647
</div>
4748
<div className="flex justify-between">
4849
<TypographyMuted className="text-xs truncate max-w-[80px] sm:max-w-[100px]">
@@ -74,36 +75,28 @@ function DiskMountsTable({ mounts }: { mounts: MountData[] }) {
7475
title: t('dashboard.disk.table.headers.mount'),
7576
dataIndex: 'mountPoint',
7677
className: 'text-xs pr-1 sm:pr-2',
77-
render: (mountPoint) => (
78-
<TypographySmall className="text-xs">{mountPoint}</TypographySmall>
79-
)
78+
render: (mountPoint) => <TypographySmall className="text-xs">{mountPoint}</TypographySmall>
8079
},
8180
{
8281
key: 'size',
8382
title: t('dashboard.disk.table.headers.size'),
8483
dataIndex: 'size',
8584
className: 'text-xs pr-1 sm:pr-2',
86-
render: (size) => (
87-
<TypographySmall className="text-xs">{size}</TypographySmall>
88-
)
85+
render: (size) => <TypographySmall className="text-xs">{size}</TypographySmall>
8986
},
9087
{
9188
key: 'used',
9289
title: t('dashboard.disk.table.headers.used'),
9390
dataIndex: 'used',
9491
className: 'text-xs pr-1 sm:pr-2',
95-
render: (used) => (
96-
<TypographySmall className="text-xs">{used}</TypographySmall>
97-
)
92+
render: (used) => <TypographySmall className="text-xs">{used}</TypographySmall>
9893
},
9994
{
10095
key: 'capacity',
10196
title: t('dashboard.disk.table.headers.percentage'),
10297
dataIndex: 'capacity',
10398
className: 'text-xs',
104-
render: (capacity) => (
105-
<TypographySmall className="text-xs">{capacity}</TypographySmall>
106-
)
99+
render: (capacity) => <TypographySmall className="text-xs">{capacity}</TypographySmall>
107100
}
108101
];
109102

0 commit comments

Comments
 (0)