diff --git a/hyperglass/execution/main.py b/hyperglass/execution/main.py
index 51309db..283f506 100644
--- a/hyperglass/execution/main.py
+++ b/hyperglass/execution/main.py
@@ -69,6 +69,8 @@ async def execute(query: "Query") -> Union["OutputDataModel", str]:
output = await driver.response(response)
+ log.debug("Response for {!r}\n{response}", query, response=response)
+
if is_series(output):
if len(output) == 0:
raise ResponseEmpty(query=query)
diff --git a/hyperglass/ui/components/output/highlighted.tsx b/hyperglass/ui/components/output/highlighted.tsx
index 9f0cdfc..e5f61c7 100644
--- a/hyperglass/ui/components/output/highlighted.tsx
+++ b/hyperglass/ui/components/output/highlighted.tsx
@@ -1,5 +1,5 @@
-import React, { memo } from 'react';
import { Badge, Tooltip, useStyleConfig } from '@chakra-ui/react';
+import React, { memo } from 'react';
import isEqual from 'react-fast-compare';
import replace from 'react-string-replace';
@@ -29,20 +29,24 @@ const Highlight = (props: HighlightProps): JSX.Element => {
const _Highlighted = (props: HighlightedProps): JSX.Element => {
const { patterns, children } = props;
- let result: React.ReactNodeArray = [];
+ let result: React.ReactNode[] = [];
let times: number = 0;
- for (const config of patterns) {
- let toReplace: string | React.ReactNodeArray = children;
- if (times !== 0) {
- toReplace = result;
+ if (patterns.length === 0) {
+ result = [children];
+ } else {
+ for (const config of patterns) {
+ let toReplace: string | React.ReactNode[] = children;
+ if (times !== 0) {
+ toReplace = result;
+ }
+ result = replace(toReplace, new RegExp(`(${config.pattern})`, 'gm'), (m, i) => (
+
+ {m}
+
+ ));
+ times++;
}
- result = replace(toReplace, new RegExp(`(${config.pattern})`, 'gm'), (m, i) => (
-
- {m}
-
- ));
- times++;
}
return <>{result}>;
diff --git a/hyperglass/ui/components/results/individual.tsx b/hyperglass/ui/components/results/individual.tsx
index 740123e..8a7c460 100644
--- a/hyperglass/ui/components/results/individual.tsx
+++ b/hyperglass/ui/components/results/individual.tsx
@@ -1,39 +1,39 @@
-import { forwardRef, memo, useEffect, useMemo } from 'react';
import {
- Box,
- Flex,
- Alert,
- chakra,
- HStack,
- Tooltip,
- useToast,
+ AccordionButton,
AccordionItem,
AccordionPanel,
- AccordionButton,
+ Alert,
+ Box,
+ Flex,
+ HStack,
+ Tooltip,
+ chakra,
useAccordionContext,
+ useToast,
} from '@chakra-ui/react';
import { motion } from 'framer-motion';
import startCase from 'lodash/startCase';
+import { forwardRef, memo, useEffect, useMemo } from 'react';
import isEqual from 'react-fast-compare';
-import { If, Then, Else } from 'react-if';
+import { Else, If, Then } from 'react-if';
import { BGPTable, Path, TextOutput } from '~/components';
import { useConfig } from '~/context';
import { Countdown, DynamicIcon } from '~/elements';
import {
- useStrf,
- useDevice,
- useMobile,
- useLGQuery,
- useFormState,
useColorValue,
+ useDevice,
+ useFormState,
+ useLGQuery,
+ useMobile,
+ useStrf,
useTableToString,
} from '~/hooks';
-import { isStructuredOutput, isStringOutput } from '~/types';
-import { isStackError, isFetchError, isLGError, isLGOutputOrError } from './guards';
-import { RequeryButton } from './requery-button';
+import { isStringOutput, isStructuredOutput } from '~/types';
import { CopyButton } from './copy-button';
import { FormattedError } from './formatted-error';
+import { isFetchError, isLGError, isLGOutputOrError, isStackError } from './guards';
import { ResultHeader } from './header';
+import { RequeryButton } from './requery-button';
import type { ErrorLevels } from '~/types';
diff --git a/hyperglass/ui/hooks/use-lg-query.ts b/hyperglass/ui/hooks/use-lg-query.ts
index 4648f90..3153ecc 100644
--- a/hyperglass/ui/hooks/use-lg-query.ts
+++ b/hyperglass/ui/hooks/use-lg-query.ts
@@ -1,13 +1,13 @@
-import { useEffect, useMemo } from 'react';
import { useQuery } from '@tanstack/react-query';
+import { useEffect, useMemo } from 'react';
import { useConfig } from '~/context';
import { fetchWithTimeout } from '~/util';
import type {
QueryFunction,
- UseQueryOptions,
- QueryObserverResult,
QueryFunctionContext,
+ QueryObserverResult,
+ UseQueryOptions,
} from '@tanstack/react-query';
import type { FormQuery } from '~/types';
@@ -54,7 +54,10 @@ export function useLGQuery(
controller,
);
try {
- return await res.json();
+ const data = await res.json();
+ console.dir(data, { depth: null });
+ return data;
+ // return await res.json();
} catch (err) {
throw new Error(res.statusText);
}
diff --git a/hyperglass/ui/package.json b/hyperglass/ui/package.json
index 1a599a4..c9455d4 100644
--- a/hyperglass/ui/package.json
+++ b/hyperglass/ui/package.json
@@ -44,7 +44,7 @@
"react-if": "^4.1.4",
"react-markdown": "^5.0.3",
"react-select": "^5.7.0",
- "react-string-replace": "^0.5.0",
+ "react-string-replace": "^1.1.1",
"react-table": "^7.7.0",
"reactflow": "^11.10.4",
"remark-gfm": "^1.0.0",
diff --git a/hyperglass/ui/pnpm-lock.yaml b/hyperglass/ui/pnpm-lock.yaml
index 38c0f10..b145880 100644
--- a/hyperglass/ui/pnpm-lock.yaml
+++ b/hyperglass/ui/pnpm-lock.yaml
@@ -87,8 +87,8 @@ dependencies:
specifier: ^5.7.0
version: 5.7.0(@types/react@18.2.60)(react-dom@18.2.0)(react@18.2.0)
react-string-replace:
- specifier: ^0.5.0
- version: 0.5.0
+ specifier: ^1.1.1
+ version: 1.1.1
react-table:
specifier: ^7.7.0
version: 7.7.0(react@18.2.0)
@@ -6325,8 +6325,8 @@ packages:
react-dom: 18.2.0(react@18.2.0)
dev: false
- /react-string-replace@0.5.0:
- resolution: {integrity: sha512-xtfotmm+Gby5LjfYg3s5+eT6bnwgOIdZRAdHTouLY/7SicDtX4JXjG7CAGaGDcS0ax4nsaaEVNRxArSa8BgQKw==}
+ /react-string-replace@1.1.1:
+ resolution: {integrity: sha512-26TUbLzLfHQ5jO5N7y3Mx88eeKo0Ml0UjCQuX4BMfOd/JX+enQqlKpL1CZnmjeBRvQE8TR+ds9j1rqx9CxhKHQ==}
engines: {node: '>=0.12.0'}
dev: false