diff --git a/public/locales/en/modules/health-monitoring.json b/public/locales/en/modules/health-monitoring.json
index 8642591e6..ab284e799 100644
--- a/public/locales/en/modules/health-monitoring.json
+++ b/public/locales/en/modules/health-monitoring.json
@@ -12,7 +12,8 @@
"cpu": {
"label": "CPU",
"load": "Load Average",
- "minute": "{{minute}} minute"
+ "minute": "{{minute}} minute",
+ "minutes": "{{minutes}} minutes"
},
"memory": {
"label": "Memory",
diff --git a/src/server/api/routers/openmediavault.ts b/src/server/api/routers/openmediavault.ts
index 3d42ad4fd..66a2f84ae 100644
--- a/src/server/api/routers/openmediavault.ts
+++ b/src/server/api/routers/openmediavault.ts
@@ -76,51 +76,67 @@ export const openmediavaultRouter = createTRPCRouter({
input
);
- const cookies = authResponse.headers['set-cookie'] || [];
- sessionId = cookies
- .find(
- (cookie: any) =>
- cookie.includes('X-OPENMEDIAVAULT-SESSIONID') ||
- cookie.includes('OPENMEDIAVAULT-SESSIONID')
- )
- ?.split(';')[0];
- loginToken = cookies
- .find(
- (cookie: any) =>
- cookie.includes('X-OPENMEDIAVAULT-LOGIN') || cookie.includes('OPENMEDIAVAULT-LOGIN')
- )
- ?.split(';')[0];
+ if (authResponse.data.response.sessionid) {
+ sessionId = authResponse.data.response.sessionid;
+ } else {
+ const cookies = authResponse.headers['set-cookie'] || [];
+ sessionId = cookies
+ .find((cookie: any) => cookie.includes('X-OPENMEDIAVAULT-SESSIONID'))
+ ?.split(';')[0];
+
+ loginToken = cookies
+ .find((cookie: any) => cookie.includes('X-OPENMEDIAVAULT-LOGIN'))
+ ?.split(';')[0];
+ }
}
- const [systemInfoResponse, fileSystemResponse, cpuTempResponse] = await Promise.all([
+ const responses = await Promise.allSettled([
makeOpenMediaVaultRPCCall(
'system',
'getInformation',
{},
- { Cookie: `${loginToken};${sessionId}` },
+ loginToken
+ ? { Cookie: `${loginToken};${sessionId}` }
+ : { 'X-OPENMEDIAVAULT-SESSIONID': sessionId as string },
input
),
makeOpenMediaVaultRPCCall(
'filesystemmgmt',
'enumerateMountedFilesystems',
{ includeroot: true },
- { Cookie: `${loginToken};${sessionId}` },
+ loginToken
+ ? { Cookie: `${loginToken};${sessionId}` }
+ : { 'X-OPENMEDIAVAULT-SESSIONID': sessionId as string },
input
),
makeOpenMediaVaultRPCCall(
'cputemp',
'get',
{},
- { Cookie: `${loginToken};${sessionId}` },
+ loginToken
+ ? { Cookie: `${loginToken};${sessionId}` }
+ : { 'X-OPENMEDIAVAULT-SESSIONID': sessionId as string },
input
),
]);
+ const systemInfoResponse =
+ responses[0].status === 'fulfilled' && responses[0].value
+ ? responses[0].value.data?.response
+ : null;
+ const fileSystemResponse =
+ responses[1].status === 'fulfilled' && responses[1].value
+ ? responses[1].value.data?.response
+ : null;
+ const cpuTempResponse =
+ responses[2].status === 'fulfilled' && responses[2].value
+ ? responses[2].value.data?.response
+ : null;
+
return {
- authenticated: authResponse ? authResponse.data.response.authenticated : true,
- systemInfo: systemInfoResponse?.data.response,
- fileSystem: fileSystemResponse?.data.response,
- cpuTemp: cpuTempResponse?.data.response,
+ systemInfo: systemInfoResponse,
+ fileSystem: fileSystemResponse,
+ cpuTemp: cpuTempResponse,
};
}),
});
diff --git a/src/widgets/health-monitoring/HealthMonitoringCpu.tsx b/src/widgets/health-monitoring/HealthMonitoringCpu.tsx
index d023d7d43..610313830 100644
--- a/src/widgets/health-monitoring/HealthMonitoringCpu.tsx
+++ b/src/widgets/health-monitoring/HealthMonitoringCpu.tsx
@@ -23,13 +23,13 @@ const HealthMonitoringCpu = ({ info, cpuTemp, fahrenheit }: any) => {
color: 'teal',
},
{
- label: `${t('cpu.minute', { minute: 5 })}`,
+ label: `${t('cpu.minutes', { minutes: 5 })}`,
stats: info.loadAverage['5min'],
progress: info.loadAverage['5min'],
color: 'blue',
},
{
- label: `${t('cpu.minute', { minute: 15 })}`,
+ label: `${t('cpu.minutes', { minutes: 15 })}`,
stats: info.loadAverage['15min'],
progress: info.loadAverage['15min'],
color: 'red',
@@ -40,12 +40,12 @@ const HealthMonitoringCpu = ({ info, cpuTemp, fahrenheit }: any) => {
{info.cpuUtilization.toFixed(2)}%
-
+
@@ -83,27 +83,29 @@ const HealthMonitoringCpu = ({ info, cpuTemp, fahrenheit }: any) => {
},
]}
/>
-
- {fahrenheit ? `${toFahrenheit(cpuTemp.cputemp)}°F` : `${cpuTemp.cputemp}°C`}
-
-
- }
- sections={[
- {
- value: cpuTemp.cputemp,
- color: cpuTemp.cputemp < 60 ? 'green' : 'red',
- },
- ]}
- />
+ {cpuTemp && (
+
+ {fahrenheit ? `${toFahrenheit(cpuTemp.cputemp)}°F` : `${cpuTemp.cputemp}°C`}
+
+
+ }
+ sections={[
+ {
+ value: cpuTemp.cputemp,
+ color: cpuTemp.cputemp < 60 ? 'green' : 'red',
+ },
+ ]}
+ />
+ )}
);
};
diff --git a/src/widgets/health-monitoring/HealthMonitoringFileSystem.tsx b/src/widgets/health-monitoring/HealthMonitoringFileSystem.tsx
index 0efa59070..5462ab85a 100644
--- a/src/widgets/health-monitoring/HealthMonitoringFileSystem.tsx
+++ b/src/widgets/health-monitoring/HealthMonitoringFileSystem.tsx
@@ -15,6 +15,10 @@ const HealthMonitoringFileSystem = ({ fileSystem }: any) => {
available: number;
}
+ const sortedFileSystem = fileSystem.slice().sort((a: FileSystemDisk, b: FileSystemDisk) => {
+ return a.devicename.localeCompare(b.devicename);
+ });
+
return (
{
gap={{ base: 'sm', sm: 'lg' }}
justify={{ sm: 'center' }}
>
- {fileSystem.map((disk: FileSystemDisk) => (
+ {sortedFileSystem.map((disk: FileSystemDisk) => (
{disk.devicename}
-
+
diff --git a/src/widgets/health-monitoring/HealthMonitoringMemory.tsx b/src/widgets/health-monitoring/HealthMonitoringMemory.tsx
index 8da67b772..7243ac2cb 100644
--- a/src/widgets/health-monitoring/HealthMonitoringMemory.tsx
+++ b/src/widgets/health-monitoring/HealthMonitoringMemory.tsx
@@ -16,12 +16,12 @@ const HealthMonitoringMemory = ({ info }: any) => {
{usedMemoryGB}GiB
-
+
diff --git a/src/widgets/health-monitoring/HealthMonitoringTile.tsx b/src/widgets/health-monitoring/HealthMonitoringTile.tsx
index 251936bc6..8bd0e6bc4 100644
--- a/src/widgets/health-monitoring/HealthMonitoringTile.tsx
+++ b/src/widgets/health-monitoring/HealthMonitoringTile.tsx
@@ -122,7 +122,7 @@ export const useOpenmediavaultQuery = () => {
configName: configName!,
},
{
- staleTime: 1000 * 10,
+ refetchInterval: 5000,
}
);
};