mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 14:38:47 +00:00
Fix: Improve error handling for Glances widgets when host is unreachable (#3657)
--------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
ec448d6c41
commit
f07d595ed9
10 changed files with 53 additions and 76 deletions
|
@ -1,4 +1,21 @@
|
|||
export default function Container({ children, chart = true, className = "" }) {
|
||||
import { useContext } from "react";
|
||||
|
||||
import Error from "./error";
|
||||
|
||||
import { SettingsContext } from "utils/contexts/settings";
|
||||
|
||||
export default function Container({ children, widget, error = null, chart = true, className = "" }) {
|
||||
const { settings } = useContext(SettingsContext);
|
||||
const hideErrors = settings.hideErrors || widget?.hideErrors;
|
||||
|
||||
if (error) {
|
||||
if (hideErrors) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <Error />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{children}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue