feat: enhance server stats widgets and fix TypeScript/ESLint errors #394

Merged
ZacharyZcR merged 50 commits from feature-server-stats-customization into dev-1.8.0 2025-10-10 03:48:34 +00:00
2 changed files with 3 additions and 36 deletions
Showing only changes of commit 8c20d41072 - Show all commits
+3
View File
@@ -233,6 +233,7 @@ router.post(
enableFileManager,
defaultPath,
tunnelConnections,
statsConfig,
} = hostData;
if (
!isNonEmptyString(userId) ||
@@ -268,6 +269,7 @@ router.post(
: null,
enableFileManager: enableFileManager ? 1 : 0,
defaultPath: defaultPath || null,
statsConfig: statsConfig || null,
};
if (effectiveAuthType === "password") {
@@ -322,6 +324,7 @@ router.post(
? JSON.parse(createdHost.tunnelConnections)
: [],
enableFileManager: !!createdHost.enableFileManager,
statsConfig: createdHost.statsConfig || undefined,
};
const resolvedHost = (await resolveHostCredentials(baseHost)) || baseHost;
@@ -210,16 +210,6 @@ export function HostManagerEditor({
.default([]),
enableFileManager: z.boolean().default(true),
defaultPath: z.string().optional(),
statsConfig: z
.object({
enabled: z.boolean().default(true),
displayItems: z.object({
cpu: z.boolean().default(true),
memory: z.boolean().default(true),
disk: z.boolean().default(true),
}),
})
.optional(),
})
.superRefine((data, ctx) => {
if (data.authType === "password") {
@@ -302,14 +292,6 @@ export function HostManagerEditor({
enableFileManager: true,
defaultPath: "/",
tunnelConnections: [],
statsConfig: {
enabled: true,
displayItems: {
cpu: true,
memory: true,
disk: true,
},
},
},
});
@@ -366,14 +348,6 @@ export function HostManagerEditor({
enableFileManager: Boolean(cleanedHost.enableFileManager),
defaultPath: cleanedHost.defaultPath || "/",
tunnelConnections: cleanedHost.tunnelConnections || [],
statsConfig: cleanedHost.statsConfig
? typeof cleanedHost.statsConfig === "string"
? JSON.parse(cleanedHost.statsConfig)
: cleanedHost.statsConfig
: {
enabled: true,
displayItems: { cpu: true, memory: true, disk: true },
},
};
if (defaultAuthType === "password") {
@@ -409,10 +383,6 @@ export function HostManagerEditor({
enableFileManager: true,
defaultPath: "/",
tunnelConnections: [],
statsConfig: {
enabled: true,
displayItems: { cpu: true, memory: true, disk: true },
},
};
form.reset(defaultFormData);
@@ -451,12 +421,6 @@ export function HostManagerEditor({
enableFileManager: Boolean(data.enableFileManager),
defaultPath: data.defaultPath || "/",
tunnelConnections: data.tunnelConnections || [],
statsConfig: JSON.stringify(
data.statsConfig || {
enabled: true,
displayItems: { cpu: true, memory: true, disk: true },
},
),
};
submitData.credentialId = null;