Skip to content

Commit 338410e

Browse files
committed
use active memory in systemmonitor
1 parent 7821a91 commit 338410e

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ WORKDIR /usr/src/app
1111
COPY ./frontend ./
1212
RUN npm install
1313
ENV NODE_ENV=production
14-
RUN npm run build:dev
14+
RUN npm run build
1515

1616
# Deploy (Backend)
1717
FROM --platform=linux/amd64 node:lts-slim AS backend-deploy

frontend/src/components/widgets/SystemMonitorWidget/GaugeWidget.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ interface GaugeWidgetProps {
1212
title: string;
1313
size?: number;
1414
temperature?: boolean;
15+
total?: number;
1516
}
1617

17-
export const GaugeWidget: React.FC<GaugeWidgetProps> = ({ value, title, size, temperature }) => {
18+
export const GaugeWidget: React.FC<GaugeWidgetProps> = ({ value, title, size, temperature, total }) => {
1819
return (
1920
<Box position='relative' display='inline-flex'>
2021
{/* Gauge Chart */}
21-
<Gauge value={value} valueMax={100} startAngle={-150} endAngle={150} cornerRadius='50%' sx={(theme) => (
22+
<Gauge value={value} valueMax={total ? total : 100} startAngle={-150} endAngle={150} cornerRadius='50%' sx={(theme) => (
2223
{ '& .MuiGauge-valueText': { display: 'none' },
2324
[`& .${gaugeClasses.valueArc}`]: {
2425
fill: 'primary.main',

frontend/src/components/widgets/SystemMonitorWidget/SystemMonitorWidget.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ export const SystemMonitorWidget = () => {
2727

2828
const getRamPercentage = (systemData: any) => {
2929
let totalPercentage = 0;
30-
if (systemData?.memory?.total && systemData?.memory?.used) {
31-
totalPercentage = Math.round((systemData.memory.used / systemData.memory.total) * 100);
30+
31+
console.log(convertBytesToGB(systemData?.memory?.active));
32+
33+
if (systemData?.memory?.total && systemData?.memory?.active) {
34+
totalPercentage = Math.round((systemData.memory.active / systemData.memory.total) * 100);
3235
}
3336
setMemoryInformation(totalPercentage);
3437
};

frontend/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"jsx": "react-jsx",
2020
/* Linting */
2121
"strict": true,
22-
"noUnusedLocals": true,
23-
"noUnusedParameters": true,
22+
"noUnusedLocals": false,
23+
"noUnusedParameters": false,
2424
"noFallthroughCasesInSwitch": true,
2525
"noUncheckedSideEffectImports": true,
2626
},

0 commit comments

Comments
 (0)