) : contentType?.match(/csv|tab-separated/) ? (
+ ) : contentType?.startsWith('application/json') ? (
+
) : (
- // ) : contentType?.startsWith('application/json') ? (
- //
)}
diff --git a/src-web/components/UrlBar.tsx b/src-web/components/UrlBar.tsx
index d1ef61a3..1f6b6a9b 100644
--- a/src-web/components/UrlBar.tsx
+++ b/src-web/components/UrlBar.tsx
@@ -14,7 +14,7 @@ type Props = Pick
& {
placeholder: string;
onSubmit: (e: FormEvent) => void;
onUrlChange: (url: string) => void;
- submitIcon?: IconProps['icon'];
+ submitIcon?: IconProps['icon'] | null;
onMethodChange?: (method: string) => void;
isLoading: boolean;
forceUpdateKey: string;
@@ -74,16 +74,18 @@ export const UrlBar = memo(function UrlBar({
)
}
rightSlot={
-
+ submitIcon !== null && (
+
+ )
}
/>
diff --git a/src-web/components/core/JsonAttributeTree.tsx b/src-web/components/core/JsonAttributeTree.tsx
index 6d173b8a..4edeed4f 100644
--- a/src-web/components/core/JsonAttributeTree.tsx
+++ b/src-web/components/core/JsonAttributeTree.tsx
@@ -38,8 +38,8 @@ export const JsonAttributeTree = ({ depth = 0, attrKey, attrValue, attrKeyJsonPa
))
: null,
isExpandable: true,
- label: isExpanded ? undefined : `{⋯}`,
- labelClassName: 'text-gray-500',
+ label: isExpanded ? '{ }' : `{⋯}`,
+ labelClassName: 'text-gray-600',
};
} else if (jsonType === '[object Array]') {
return {
@@ -54,8 +54,8 @@ export const JsonAttributeTree = ({ depth = 0, attrKey, attrValue, attrKeyJsonPa
))
: null,
isExpandable: true,
- label: isExpanded ? undefined : `[⋯]`,
- labelClassName: 'text-gray-500',
+ label: isExpanded ? '[ ]' : `[⋯]`,
+ labelClassName: 'text-gray-600',
};
} else {
return {
@@ -72,25 +72,38 @@ export const JsonAttributeTree = ({ depth = 0, attrKey, attrValue, attrKeyJsonPa
}
}, [attrValue, attrKeyJsonPath, isExpanded, depth]);
+ const labelEl = (
+
+ {label}
+
+ );
return (
-
+
- {depth === 0 ? null : isExpandable ? (
-
{children &&
{children}
}
diff --git a/src-web/hooks/useGrpc.ts b/src-web/hooks/useGrpc.ts
index 14567b07..6890a55f 100644
--- a/src-web/hooks/useGrpc.ts
+++ b/src-web/hooks/useGrpc.ts
@@ -19,20 +19,8 @@ export function useGrpc(url: string | null) {
useListenToTauriEvent
(
'grpc_message',
(event) => {
- console.log('GOT MESSAGE', event);
setMessages((prev) => [
...prev,
- {
- message: JSON.stringify({
- dummy: 'Yo, this is a dummy message',
- another: 'property',
- list: [1, 2, 3, 4, 5],
- null: null,
- bool: true,
- }),
- time: new Date(),
- isServer: false,
- },
{ message: event.payload, time: new Date(), isServer: true },
]);
},
@@ -59,6 +47,9 @@ export function useGrpc(url: string | null) {
mutationKey: ['grpc_server_streaming', url],
mutationFn: async ({ service, method, message }) => {
if (url === null) throw new Error('No URL provided');
+ setMessages([
+ { isServer: false, message: JSON.stringify(JSON.parse(message)), time: new Date() },
+ ]);
return (await invoke('grpc_server_streaming', {
endpoint: url,
service,