diff --git a/hyperglass/ui/components/HyperglassProvider.js b/hyperglass/ui/components/HyperglassProvider.js
index 5441c45..98a352b 100644
--- a/hyperglass/ui/components/HyperglassProvider.js
+++ b/hyperglass/ui/components/HyperglassProvider.js
@@ -6,26 +6,26 @@ import { makeTheme, defaultTheme } from "~/theme";
// Disable SSR for ColorModeProvider
const ColorModeProvider = dynamic(
- () => import("@chakra-ui/core").then(mod => mod.ColorModeProvider),
- { ssr: false }
+ () => import("@chakra-ui/core").then(mod => mod.ColorModeProvider),
+ { ssr: false }
);
const HyperglassContext = createContext(null);
export const HyperglassProvider = ({ config, children }) => {
- const value = useMemo(() => config, [config]);
- const userTheme = value && makeTheme(value.web.theme);
- const theme = value ? userTheme : defaultTheme;
- return (
-
-
-
-
- {children}
-
-
-
- );
+ const value = useMemo(() => config, [config]);
+ const userTheme = value && makeTheme(value.web.theme);
+ const theme = value ? userTheme : defaultTheme;
+ return (
+
+
+
+
+ {children}
+
+
+
+ );
};
export default () => useContext(HyperglassContext);
diff --git a/hyperglass/ui/components/Layout.js b/hyperglass/ui/components/Layout.js
index 4ce89b7..04144fc 100644
--- a/hyperglass/ui/components/Layout.js
+++ b/hyperglass/ui/components/Layout.js
@@ -17,79 +17,87 @@ const bg = { light: "white", dark: "black" };
const color = { light: "black", dark: "white" };
const Layout = () => {
- const config = useConfig();
- const { colorMode } = useColorMode();
- const [isSubmitting, setSubmitting] = useState(false);
- const [formData, setFormData] = useState({});
- const [greetingAck, setGreetingAck] = useSessionStorage("hyperglass-greeting-ack", false);
- const containerRef = useRef(null);
+ const config = useConfig();
+ const { colorMode } = useColorMode();
+ const [isSubmitting, setSubmitting] = useState(false);
+ const [formData, setFormData] = useState({});
+ const [greetingAck, setGreetingAck] = useSessionStorage(
+ "hyperglass-greeting-ack",
+ false
+ );
+ const containerRef = useRef(null);
- const handleFormReset = () => {
- containerRef.current.scrollIntoView({ behavior: "smooth", block: "start" });
- setSubmitting(false);
- };
- return (
- <>
-
-
-
-
-
-
- {isSubmitting && formData && (
-
- )}
-
- {!isSubmitting && (
-
- )}
-
-
-
- {config.developer_mode && }
-
- {config.web.greeting.enable && !greetingAck && (
-
+ const handleFormReset = () => {
+ containerRef.current.scrollIntoView({ behavior: "smooth", block: "start" });
+ setSubmitting(false);
+ setFormData({});
+ };
+
+ return (
+ <>
+
+
+
+
+
+
+ {isSubmitting && formData && (
+
+ )}
+
+ {!isSubmitting && (
+
)}
- >
- );
+
+
+
+ {config.developer_mode && }
+
+ {config.web.greeting.enable && !greetingAck && (
+
+ )}
+ >
+ );
};
Layout.displayName = "HyperglassLayout";
diff --git a/hyperglass/ui/components/Result.js b/hyperglass/ui/components/Result.js
index 4907e7f..8b5da1a 100644
--- a/hyperglass/ui/components/Result.js
+++ b/hyperglass/ui/components/Result.js
@@ -1,4 +1,5 @@
-import React, { useEffect, useState } from "react";
+import * as React from "react";
+import { useEffect, useState } from "react";
import {
AccordionItem,
AccordionHeader,
@@ -82,7 +83,7 @@ const Result = React.forwardRef(
const config = useConfig();
const { isSm } = useMedia();
const { colorMode } = useColorMode();
- const [{ data, loading, error }, refetch] = useAxios({
+ let [{ data, loading, error }, refetch] = useAxios({
url: "/api/query/",
method: "post",
data: {
@@ -102,7 +103,7 @@ const Result = React.forwardRef(
setOpen(!isOpen);
setOverride(true);
};
- const cleanOutput =
+ let cleanOutput =
data &&
data.output
.split("\\n")
@@ -124,54 +125,13 @@ const Result = React.forwardRef(
errorMsg = config.messages.general;
}
- error && console.dir(error);
+ error && console.error(error);
const errorLevel =
(error?.response?.data?.level &&
statusMap[error.response?.data?.level]) ??
"error";
- const cacheLg = (
- <>
-
- {data?.cached && (
-
-
-
-
-
- )}
- >
- );
- const cacheSm = (
- <>
- {data?.cached && (
-
-
-
-
-
- )}
-
- >
- );
-
- const cacheData = isSm ? cacheSm : cacheLg;
-
useEffect(() => {
!loading && resultsComplete === null && setComplete(index);
}, [loading, resultsComplete]);
@@ -179,9 +139,7 @@ const Result = React.forwardRef(
useEffect(() => {
resultsComplete === index && !hasOverride && setOpen(true);
}, [resultsComplete, index]);
- useEffect(() => {
- data && console.log(data);
- });
+
return (
- {data && !error && config.cache.show_text && isSm ? (
+ {config.cache.show_text && data && !error && (
+ <>
+ {!isSm && (
+
+ )}
+
+
+
+
+
+ {isSm && (
+
+ )}
+ >
+ )}
+ {/* {config.cache.show_text && data && !error && isSm ? (
<>
-
+
@@ -297,7 +283,7 @@ const Result = React.forwardRef(
text={config.web.text.cache_prefix}
/>
>
- ) : data && !error && config.cache.show_text ? (
+ ) : config.cache.show_text && data && !error ? (
<>
-
+
>
- ) : null}
+ ) : null} */}