Allow specifying wan interface on opnsense widget

pull/861/head
Michael Shamoon 2 years ago
parent cdbdb86c9e
commit ca4b5b131d

@ -214,7 +214,8 @@ export function cleanServiceGroups(groups) {
defaultinterval,
namespace, // kubernetes widget
app,
podSelector
podSelector,
wan // opnsense widget
} = cleanedService.widget;
cleanedService.widget = {
@ -237,6 +238,9 @@ export function cleanServiceGroups(groups) {
if (app) cleanedService.widget.app = app;
if (podSelector) cleanedService.widget.podSelector = podSelector;
}
if (type === "opnsense") {
if (wan) cleanedService.widget.wan = wan;
}
}
return cleanedService;

@ -33,16 +33,14 @@ export default function Component({ service }) {
const cpu = 100 - parseFloat(cpuIdle);
const memory = activityData.headers[3].match(/Mem: (.+) Active,/)[1];
const wanUpload = interfaceData.interfaces.wan['bytes transmitted'];
const wanDownload = interfaceData.interfaces.wan['bytes received'];
const wan = widget.wan ? interfaceData.interfaces[widget.wan] : interfaceData.interfaces.wan;
return (
<Container service={service}>
<Block label="opnsense.cpu" value={t("common.percent", { value: cpu.toFixed(2) })} />
<Block label="opnsense.memory" value={memory} />
<Block label="opnsense.wanUpload" value={t("common.bytes", { value: wanUpload })} />
<Block label="opnsense.wanDownload" value={t("common.bytes", { value: wanDownload })} />
{wan && <Block label="opnsense.wanUpload" value={t("common.bytes", { value: wan['bytes transmitted'] })} />}
{wan && <Block label="opnsense.wanDownload" value={t("common.bytes", { value: wan['bytes received'] })} />}
</Container>
);
}

Loading…
Cancel
Save