Skip to content

Commit

Permalink
fix: request graph loading calls in reverse order (#409)
Browse files Browse the repository at this point in the history
Fixes #405 

<img width="490" alt="Screenshot 2023-09-19 at 7 31 28 AM"
src="https://github.com/TBD54566975/ftl/assets/51647/f8d5f6a1-9260-4302-8458-71168b4bab94">
  • Loading branch information
wesbillman authored Sep 19, 2023
1 parent e5b753b commit fe7f938
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion console/client/src/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CodeBlock = ({ code, language, maxHeight }: Props) => {

return (
<pre>
<code className={`max-h-[${maxHeight}px] language-${language} text-sm`}>{code}</code>
<code className={`max-h-[${maxHeight}px] language-${language} text-xs`}>{code}</code>
</pre>
)
}
2 changes: 1 addition & 1 deletion console/client/src/features/timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Timeline = ({ timeSettings, filters }: Props) => {
if (timeSettings.newerThan || timeSettings.olderThan) {
eventFilters = [timeFilter(timeSettings.olderThan, timeSettings.newerThan), ...filters]
}
const events = await getEvents(eventFilters)
const events = await getEvents({ filters: eventFilters })
setEntries(events)
}

Expand Down
28 changes: 17 additions & 11 deletions console/client/src/services/console.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export const timeFilter = (olderThan: Timestamp | undefined, newerThan: Timestam
}

export const getRequestCalls = async (requestKey: string): Promise<Call[]> => {
const allEvents = await getEvents([requestKeysFilter([requestKey]), eventTypesFilter([EventType.CALL])])
const allEvents = await getEvents({
filters: [requestKeysFilter([requestKey]), eventTypesFilter([EventType.CALL])],
})
return allEvents.map((e) => e.entry.value) as Call[]
}

Expand All @@ -102,20 +104,24 @@ export const getCalls = async (
destVerb: string | undefined = undefined,
sourceModule: string | undefined = undefined,
): Promise<Call[]> => {
const allEvents = await getEvents([
callFilter(destModule, destVerb, sourceModule),
eventTypesFilter([EventType.CALL]),
])
const allEvents = await getEvents({
filters: [callFilter(destModule, destVerb, sourceModule), eventTypesFilter([EventType.CALL])],
})
return allEvents.map((e) => e.entry.value) as Call[]
}

export const getEvents = async (
filters: EventsQuery_Filter[] = [],
limit: number = 100,
order: EventsQuery_Order = EventsQuery_Order.DESC,
): Promise<Event[]> => {
const response = await client.getEvents({ filters, limit, order })
interface GetEventsParams {
limit?: number
order?: EventsQuery_Order
filters?: EventsQuery_Filter[]
}

export const getEvents = async ({
limit = 1000,
order = EventsQuery_Order.ASC,
filters = [],
}: GetEventsParams): Promise<Event[]> => {
const response = await client.getEvents({ filters, limit, order })
return response.events
}

Expand Down

0 comments on commit fe7f938

Please sign in to comment.