fix: move enabled options to multi-select

This commit is contained in:
MauriceNino
2022-06-28 12:51:44 +02:00
parent eb0313f551
commit 72832a5767

View File

@@ -25,25 +25,10 @@ export const DashdotModule = asModule({
name: 'Use Compact View', name: 'Use Compact View',
value: false, value: false,
}, },
showCpu: { graphs: {
name: 'Show CPU Graph', name: 'Graphs',
value: true, value: ['CPU', 'RAM', 'Storage', 'Network'],
}, options: ['CPU', 'RAM', 'Storage', 'Network', 'GPU'],
showStorage: {
name: 'Show Storage Graph',
value: true,
},
showRam: {
name: 'Show RAM Graph',
value: true,
},
showNetwork: {
name: 'Show Network Graphs',
value: true,
},
showGpu: {
name: 'Show GPU Graph',
value: false,
}, },
}, },
}); });
@@ -135,11 +120,12 @@ export function DashdotComponent() {
const isCompact = dashConfig?.useCompactView?.value ?? false; const isCompact = dashConfig?.useCompactView?.value ?? false;
const dashdotService = config.services.filter((service) => service.type === 'Dash.')[0]; const dashdotService = config.services.filter((service) => service.type === 'Dash.')[0];
const cpuEnabled = dashConfig?.showCpu?.value ?? true; const enabledGraphs = dashConfig?.graphs?.value ?? ['CPU', 'RAM', 'Storage', 'Network'];
const storageEnabled = dashConfig?.showStorage?.value ?? true; const cpuEnabled = enabledGraphs.includes('CPU');
const ramEnabled = dashConfig?.showRam?.value ?? true; const storageEnabled = enabledGraphs.includes('Storage');
const networkEnabled = dashConfig?.showNetwork?.value ?? true; const ramEnabled = enabledGraphs.includes('RAM');
const gpuEnabled = dashConfig?.showGpu?.value ?? false; const networkEnabled = enabledGraphs.includes('Network');
const gpuEnabled = enabledGraphs.includes('GPU');
const info = useJson(dashdotService, '/info'); const info = useJson(dashdotService, '/info');
const storageLoad = useJson(dashdotService, '/load/storage'); const storageLoad = useJson(dashdotService, '/load/storage');