Fix glances service widgets handling of default version

pull/3207/head
shamoon 8 months ago
parent 97d193faf1
commit b0d57866a0

@ -20,12 +20,11 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ value: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(service.widget, "cpu", {
const { data, error } = useWidgetAPI(service.widget, `${version}/cpu`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
const { data: quicklookData, error: quicklookError } = useWidgetAPI(service.widget, "quicklook", { version });
const { data: quicklookData, error: quicklookError } = useWidgetAPI(service.widget, `${version}/quicklook`);
useEffect(() => {
if (data) {

@ -24,9 +24,8 @@ export default function Component({ service }) {
);
const [ratePoints, setRatePoints] = useState(new Array(pointsLimit).fill({ a: 0, b: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(service.widget, "diskio", {
const { data, error } = useWidgetAPI(service.widget, `${version}/diskio`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
const calculateRates = (d) =>

@ -15,9 +15,8 @@ export default function Component({ service }) {
const [, fsName] = widget.metric.split("fs:");
const diskUnits = widget.diskUnits === "bbytes" ? "common.bbytes" : "common.bytes";
const { data, error } = useWidgetAPI(widget, "fs", {
const { data, error } = useWidgetAPI(widget, `${version}/fs`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
if (error) {

@ -21,9 +21,8 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ a: 0, b: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(widget, "gpu", {
const { data, error } = useWidgetAPI(widget, `${version}/gpu`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
useEffect(() => {

@ -76,14 +76,12 @@ export default function Component({ service }) {
const { widget } = service;
const { chart, refreshInterval = defaultInterval, version = 3 } = widget;
const { data: quicklookData, errorL: quicklookError } = useWidgetAPI(service.widget, "quicklook", {
const { data: quicklookData, errorL: quicklookError } = useWidgetAPI(service.widget, `${version}/quicklook`, {
refreshInterval,
version,
});
const { data: systemData, errorL: systemError } = useWidgetAPI(service.widget, "system", {
const { data: systemData, errorL: systemError } = useWidgetAPI(service.widget, `${version}/system`, {
refreshInterval: defaultSystemInterval,
version,
});
if (quicklookError) {

@ -21,9 +21,8 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ value: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(service.widget, "mem", {
const { data, error } = useWidgetAPI(service.widget, `${version}/mem`, {
refreshInterval: Math.max(defaultInterval(chart), refreshInterval),
version,
});
useEffect(() => {

@ -26,9 +26,8 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ value: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(widget, "network", {
const { data, error } = useWidgetAPI(widget, `${version}/network`, {
refreshInterval: Math.max(defaultInterval(chart), refreshInterval),
version,
});
useEffect(() => {
@ -51,7 +50,7 @@ export default function Component({ service }) {
});
}
}
}, [data, interfaceName, pointsLimit]);
}, [data, interfaceName, pointsLimit, rxKey, txKey]);
if (error) {
return (

@ -26,9 +26,8 @@ export default function Component({ service }) {
const memoryInfoKey = version === 3 ? 0 : "data";
const { data, error } = useWidgetAPI(service.widget, "processlist", {
const { data, error } = useWidgetAPI(service.widget, `${version}/processlist`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
if (error) {

@ -21,9 +21,8 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ value: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(service.widget, "sensors", {
const { data, error } = useWidgetAPI(service.widget, `${version}/sensors`, {
refreshInterval: Math.max(defaultInterval, refreshInterval),
version,
});
useEffect(() => {

@ -1,7 +1,7 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/{version}/{endpoint}",
api: "{url}/api/{endpoint}",
proxyHandler: credentialedProxyHandler,
};

Loading…
Cancel
Save