diff --git a/apps/web-ui/app/root.tsx b/apps/web-ui/app/root.tsx index 300c4e0a..eccaaa3a 100644 --- a/apps/web-ui/app/root.tsx +++ b/apps/web-ui/app/root.tsx @@ -86,7 +86,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - Restate UI + Restate diff --git a/apps/web-ui/app/routes/invocations.tsx b/apps/web-ui/app/routes/invocations.tsx index 5e3034a8..2ec12018 100644 --- a/apps/web-ui/app/routes/invocations.tsx +++ b/apps/web-ui/app/routes/invocations.tsx @@ -2,3 +2,6 @@ import { invocations } from '@restate/features/invocations-route'; export default invocations.Component; export const clientLoader = invocations.clientLoader; +export function meta() { + return [{ title: 'Restate - Invocations' }]; +} diff --git a/apps/web-ui/app/routes/overview.tsx b/apps/web-ui/app/routes/overview.tsx index 04d83336..0df257fc 100644 --- a/apps/web-ui/app/routes/overview.tsx +++ b/apps/web-ui/app/routes/overview.tsx @@ -1,3 +1,6 @@ import { overview } from '@restate/features/overview-route'; +export function meta() { + return [{ title: 'Restate - Overview' }]; +} export default overview.Component; diff --git a/apps/web-ui/app/tailwind.css b/apps/web-ui/app/tailwind.css index db6e421b..04f092a0 100644 --- a/apps/web-ui/app/tailwind.css +++ b/apps/web-ui/app/tailwind.css @@ -11,3 +11,7 @@ *[data-testid='underlay'] { pointer-events: none; } + +*[tabindex='0']:not(:has(*)) { + outline: none; +} diff --git a/libs/data-access/admin-api/src/lib/api/client.ts b/libs/data-access/admin-api/src/lib/api/client.ts index 05ebd716..3581d248 100644 --- a/libs/data-access/admin-api/src/lib/api/client.ts +++ b/libs/data-access/admin-api/src/lib/api/client.ts @@ -6,7 +6,11 @@ import { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query'; import type { FetchResponse, Middleware } from 'openapi-fetch'; import createClient from 'openapi-fetch'; -const client = createClient({}); +const client = createClient({ + fetch: (...args) => { + return globalThis.fetch(...args); + }, +}); const errorMiddleware: Middleware = { async onResponse({ response, request }) { if (!response.ok) { diff --git a/libs/data-access/middleware-service-worker/src/lib/queryFetcher.ts b/libs/data-access/middleware-service-worker/src/lib/queryFetcher.ts new file mode 100644 index 00000000..15ca3822 --- /dev/null +++ b/libs/data-access/middleware-service-worker/src/lib/queryFetcher.ts @@ -0,0 +1,20 @@ +import { query } from '@restate/data-access/query'; + +const fetchHandler: ProxyHandler = { + apply: async function (target, thisArg, argumentsList) { + const [resource, init] = argumentsList as [RequestInfo, RequestInit?]; + const url = typeof resource === 'string' ? resource : resource.url; + const urlObject = new URL(url); + if (urlObject.pathname.startsWith('/query/')) { + const response = query(new Request(resource, init)); + if (response) { + return response; + } + } + + return target.call(thisArg, resource, init); + }, +}; + +const originalFetch = globalThis.fetch; +export const queryFetcher = new Proxy(originalFetch, fetchHandler); diff --git a/libs/data-access/middleware-service-worker/src/lib/register.ts b/libs/data-access/middleware-service-worker/src/lib/register.ts index 23418bd9..34a7f86c 100644 --- a/libs/data-access/middleware-service-worker/src/lib/register.ts +++ b/libs/data-access/middleware-service-worker/src/lib/register.ts @@ -1,4 +1,5 @@ /// +import { queryFetcher } from './queryFetcher'; import workerUrl from './worker?worker&url'; export async function register() { @@ -22,6 +23,7 @@ export async function register() { await navigator.serviceWorker.ready; } catch (error) { console.error(`Registration failed with ${error}`); + globalThis.fetch = queryFetcher; } } } diff --git a/libs/features/invocations-route/src/lib/invocations.route.tsx b/libs/features/invocations-route/src/lib/invocations.route.tsx index 71184009..a8102a97 100644 --- a/libs/features/invocations-route/src/lib/invocations.route.tsx +++ b/libs/features/invocations-route/src/lib/invocations.route.tsx @@ -338,7 +338,7 @@ function Component() { return ( -
+
+
{data.total_count ? ( <> {data.rows.length}