diff --git a/console/client/src/features/calls/CallList.tsx b/console/client/src/features/calls/CallList.tsx index 9a2f0f44cc..0ce1f6ca68 100644 --- a/console/client/src/features/calls/CallList.tsx +++ b/console/client/src/features/calls/CallList.tsx @@ -82,7 +82,7 @@ export const CallList = ({ calls }: Props) => { {call.response} - + {call.error} diff --git a/console/client/src/features/verbs/VerbForm.tsx b/console/client/src/features/verbs/VerbForm.tsx index 8f4c2fdaf3..fad753fe2e 100644 --- a/console/client/src/features/verbs/VerbForm.tsx +++ b/console/client/src/features/verbs/VerbForm.tsx @@ -88,7 +88,7 @@ export const VerbForm = ({ module, verb }: Props) => {
{ beforeMount={handleEditorWillMount} />
- - +
+ +
{response && (
diff --git a/console/client/src/features/verbs/VerbPage.tsx b/console/client/src/features/verbs/VerbPage.tsx index e60c17939f..d506ad448e 100644 --- a/console/client/src/features/verbs/VerbPage.tsx +++ b/console/client/src/features/verbs/VerbPage.tsx @@ -3,11 +3,12 @@ import React from 'react' import { useParams } from 'react-router-dom' import { CodeBlock } from '../../components/CodeBlock' import { Page } from '../../layout' -import { CallEvent, Module, Verb } from '../../protos/xyz/block/ftl/v1/console/console_pb' +import { CallEvent, EventType, Module, Verb } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { modulesContext } from '../../providers/modules-provider' import { SidePanelProvider } from '../../providers/side-panel-provider' -import { getCalls } from '../../services/console.service' +import { callFilter, eventTypesFilter, streamEvents } from '../../services/console.service' import { CallList } from '../calls/CallList' +import { VerbForm } from './VerbForm' import { buildVerbSchema } from './verb.utils' export const VerbPage = () => { @@ -15,7 +16,7 @@ export const VerbPage = () => { const modules = React.useContext(modulesContext) const [module, setModule] = React.useState() const [verb, setVerb] = React.useState() - const [calls, setCalls] = React.useState() + const [calls, setCalls] = React.useState([]) const callData = module?.data.filter((data) => [verb?.verb?.request?.name, verb?.verb?.response?.name].includes(data.data?.name)) ?? @@ -34,15 +35,17 @@ export const VerbPage = () => { const abortController = new AbortController() if (!module) return - const fetchCalls = async () => { - const calls = await getCalls({ + const streamCalls = async () => { + setCalls([]) + streamEvents({ abortControllerSignal: abortController.signal, - destModule: module.name, - destVerb: verb?.verb?.name, + filters: [callFilter(module.name, verb?.verb?.name), eventTypesFilter([EventType.CALL])], + onEventReceived: (event) => { + setCalls((prev) => [event.entry.value as CallEvent, ...prev]) + }, }) - setCalls(calls) } - fetchCalls() + streamCalls() return () => { abortController.abort() @@ -62,16 +65,21 @@ export const VerbPage = () => { />
-
- {verb?.verb?.request?.toJsonString() && ( - d.schema), - )} - language='json' - /> - )} +
+
+ {verb?.verb?.request?.toJsonString() && ( + d.schema), + )} + language='json' + /> + )} +
+
+ +
diff --git a/console/client/src/layout/SidePanel.tsx b/console/client/src/layout/SidePanel.tsx index 688a4c2fbc..6342be4edf 100644 --- a/console/client/src/layout/SidePanel.tsx +++ b/console/client/src/layout/SidePanel.tsx @@ -8,7 +8,7 @@ export const SidePanel = () => { const { isOpen, component } = useContext(SidePanelContext) return ( -
+