From 3f0552116ba112c1180cf3fb9f3596c205fb1946 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Fri, 19 Jan 2024 15:03:09 +0100 Subject: [PATCH 1/9] chore: add @tanstack/react-router --- package.json | 4 ++- tsr.config.json | 5 +++ yarn.lock | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 tsr.config.json diff --git a/package.json b/package.json index ae05acfcfad..e4c1dcfd47c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "setup": "sh s.sh", - "start": "nx serve console", + "start": "nx serve console & tsr watch", "storybook": "nx storybook shared-ui", "build-storybook": "nx run shared-ui:build-storybook", "format": "nx format:write", @@ -37,6 +37,7 @@ "@szhsin/react-menu": "^3.0.0", "@tanstack/react-query": "^4.32.6", "@tanstack/react-query-devtools": "^4.32.6", + "@tanstack/react-router": "^1.33.0", "@tanstack/react-table": "^8.16.0", "@uidotdev/usehooks": "^2.2.0", "@xterm/addon-attach": "^0.10.0", @@ -110,6 +111,7 @@ "@swc/core": "1.3.95", "@swc/helpers": "0.5.3", "@tanstack/eslint-plugin-query": "^5.6.0", + "@tanstack/router-cli": "^1.6.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "14.0.0", "@testing-library/user-event": "^14.4.3", diff --git a/tsr.config.json b/tsr.config.json new file mode 100644 index 00000000000..271ed13b1c0 --- /dev/null +++ b/tsr.config.json @@ -0,0 +1,5 @@ +{ + "routesDirectory": "./libs/shared/routes/src/lib/routes", + "generatedRouteTree": "./libs/shared/routes/src/lib/route-tree.gen.ts", + "quoteStyle": "single" +} diff --git a/yarn.lock b/yarn.lock index f9bda0cd4fc..0066701aba7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3846,7 +3846,9 @@ __metadata: "@tanstack/eslint-plugin-query": ^5.6.0 "@tanstack/react-query": ^4.32.6 "@tanstack/react-query-devtools": ^4.32.6 + "@tanstack/react-router": ^1.33.0 "@tanstack/react-table": ^8.16.0 + "@tanstack/router-cli": ^1.6.0 "@testing-library/jest-dom": ^5.16.5 "@testing-library/react": 14.0.0 "@testing-library/user-event": ^14.4.3 @@ -6511,6 +6513,13 @@ __metadata: languageName: node linkType: hard +"@tanstack/history@npm:1.31.16": + version: 1.31.16 + resolution: "@tanstack/history@npm:1.31.16" + checksum: 9116552ddb2659c7ce166a82460c2a12408a2ef99fa98aeac3d9dc6e60c641b85149cf30a065614bfad23c8bc2c0879be320825dc4f9d64f36e1a1722b3fabed + languageName: node + linkType: hard + "@tanstack/match-sorter-utils@npm:^8.7.0": version: 8.8.4 resolution: "@tanstack/match-sorter-utils@npm:8.8.4" @@ -6561,6 +6570,34 @@ __metadata: languageName: node linkType: hard +"@tanstack/react-router@npm:^1.33.0": + version: 1.33.7 + resolution: "@tanstack/react-router@npm:1.33.7" + dependencies: + "@tanstack/history": 1.31.16 + "@tanstack/react-store": ^0.2.1 + tiny-invariant: ^1.3.1 + tiny-warning: ^1.0.3 + peerDependencies: + react: ">=16.8" + react-dom: ">=16.8" + checksum: f7c362c09427f0bebcc3c58d9f8226271ad843881a4967e60bc54652ebd6d2786390452f3948786e0a46216c500ad714bfec764d5a3d9594b656c39262afc665 + languageName: node + linkType: hard + +"@tanstack/react-store@npm:^0.2.1": + version: 0.2.1 + resolution: "@tanstack/react-store@npm:0.2.1" + dependencies: + "@tanstack/store": 0.1.3 + use-sync-external-store: ^1.2.0 + peerDependencies: + react: ">=16" + react-dom: ">=16" + checksum: 44e1ff82cee4d963eb926f5976f938da089446e8613315117629b2c99f0dca35259529a1203e88d3507ede6cc44dc53cf2913a25f45e2210f78ee9603d20b6e1 + languageName: node + linkType: hard + "@tanstack/react-table@npm:^8.16.0": version: 8.16.0 resolution: "@tanstack/react-table@npm:8.16.0" @@ -6573,6 +6610,36 @@ __metadata: languageName: node linkType: hard +"@tanstack/router-cli@npm:^1.6.0": + version: 1.32.10 + resolution: "@tanstack/router-cli@npm:1.32.10" + dependencies: + "@tanstack/router-generator": 1.32.10 + chokidar: ^3.5.3 + yargs: ^17.6.2 + bin: + tsr: bin/tsr.cjs + checksum: 66d64470fc5f3b778b442f86333d6273f664ce2322b00b8ccd31ae3767a0c790cfa1bbd99160878408d5f0fb24f5216091617a475b2be27c632f8648f423378b + languageName: node + linkType: hard + +"@tanstack/router-generator@npm:1.32.10": + version: 1.32.10 + resolution: "@tanstack/router-generator@npm:1.32.10" + dependencies: + prettier: ^3.1.1 + zod: ^3.22.4 + checksum: 27c708a91a592b40ad60eb1cfd45cd99a81f3e2bb711d0e6b446e6f6a243a58e220d7b3bb8faeeedaf9c4a1e774af6a84e35efe56849e97c7aa26d8100773f29 + languageName: node + linkType: hard + +"@tanstack/store@npm:0.1.3": + version: 0.1.3 + resolution: "@tanstack/store@npm:0.1.3" + checksum: 47f6a6d2e0cd7e896eb838f25081761e3fbbc5988b826f54136c23dd00971247d0493117efa4fe3c870df6598c1d48e1d47d1dab959a9b911bae5935dcc01f4b + languageName: node + linkType: hard + "@tanstack/table-core@npm:8.16.0": version: 8.16.0 resolution: "@tanstack/table-core@npm:8.16.0" @@ -21860,6 +21927,13 @@ __metadata: languageName: node linkType: hard +"tiny-warning@npm:^1.0.3": + version: 1.0.3 + resolution: "tiny-warning@npm:1.0.3" + checksum: da62c4acac565902f0624b123eed6dd3509bc9a8d30c06e017104bedcf5d35810da8ff72864400ad19c5c7806fc0a8323c68baf3e326af7cb7d969f846100d71 + languageName: node + linkType: hard + "tmp@npm:^0.0.33": version: 0.0.33 resolution: "tmp@npm:0.0.33" @@ -23372,3 +23446,10 @@ __metadata: checksum: f77b3d8d00310def622123df93d4ee654fc6a0096182af8bd60679ddcdfb3474c56c6c7190817c84a2785648cdee9d721c0154eb45698c62176c322fb46fc700 languageName: node linkType: hard + +"zod@npm:^3.22.4": + version: 3.23.8 + resolution: "zod@npm:3.23.8" + checksum: 15949ff82118f59c893dacd9d3c766d02b6fa2e71cf474d5aa888570c469dbf5446ac5ad562bb035bf7ac9650da94f290655c194f4a6de3e766f43febd432c5c + languageName: node + linkType: hard From 1d3ff828891578e3bd2ce21dd933132ec8c13285 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Mon, 22 Jan 2024 09:32:45 +0100 Subject: [PATCH 2/9] chore: extract query-client --- apps/console/src/main.tsx | 116 +------------------------------ apps/console/src/query-client.ts | 105 ++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 113 deletions(-) create mode 100644 apps/console/src/query-client.ts diff --git a/apps/console/src/main.tsx b/apps/console/src/main.tsx index cd979bb892d..954cf2cd1d4 100644 --- a/apps/console/src/main.tsx +++ b/apps/console/src/main.tsx @@ -1,13 +1,6 @@ import { Auth0Provider } from '@auth0/auth0-react' import { Provider as TooltipProvider } from '@radix-ui/react-tooltip' -import { - type Mutation, - MutationCache, - type Query, - QueryCache, - QueryClient, - QueryClientProvider, -} from '@tanstack/react-query' +import { QueryClientProvider } from '@tanstack/react-query' import posthog from 'posthog-js' import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' @@ -17,8 +10,7 @@ import { BrowserRouter } from 'react-router-dom' import { IntercomProvider } from 'react-use-intercom' import { InstantSearchProvider } from '@qovery/shared/assistant/feature' import { LOGIN_AUTH_REDIRECT_URL, LOGIN_URL } from '@qovery/shared/routes' -import { ModalProvider, ToastBehavior, toastError } from '@qovery/shared/ui' -import { ToastEnum, toast } from '@qovery/shared/ui' +import { ModalProvider, ToastBehavior } from '@qovery/shared/ui' import { INTERCOM, OAUTH_AUDIENCE, @@ -28,39 +20,7 @@ import { POSTHOG_APIHOST, } from '@qovery/shared/util-node-env' import App from './app/app' - -type ToastArgs = { - status?: ToastEnum - title: string - description?: string - callback?: () => void - iconAction?: string - labelAction?: string - externalLink?: string -} - -interface _QueryMeta { - notifyOnSuccess?: boolean | ((data: unknown, query: Query) => ToastArgs) | ToastArgs - notifyOnError?: boolean | { title: string; description?: string } -} - -interface _MutationMeta { - notifyOnSuccess?: - | boolean - | (( - data: unknown, - variables: unknown, - context: unknown, - mutation: Mutation - ) => ToastArgs) - | ToastArgs - notifyOnError?: boolean | { title: string; description?: string } -} - -declare module '@tanstack/react-query' { - interface MutationMeta extends _MutationMeta {} - interface QueryMeta extends _QueryMeta {} -} +import { queryClient } from './query-client' // posthog init posthog.init(POSTHOG, { @@ -70,76 +30,6 @@ posthog.init(POSTHOG, { const container = document.getElementById('root') || document.createElement('div') const root = createRoot(container) -const queryClient = new QueryClient({ - defaultOptions: { - queries: { - staleTime: 60_000, - }, - }, - mutationCache: new MutationCache({ - onSuccess(data, variables, context, mutation) { - if (mutation.meta?.notifyOnSuccess) { - if (mutation.meta.notifyOnSuccess === true) { - toast(ToastEnum.SUCCESS, JSON.stringify(data)) - } else { - const { - status = ToastEnum.SUCCESS, - title, - description, - callback, - iconAction, - labelAction, - externalLink, - } = typeof mutation.meta.notifyOnSuccess === 'function' - ? mutation.meta.notifyOnSuccess(data, variables, context, mutation) - : mutation.meta.notifyOnSuccess - toast(status, title, description, callback, iconAction, labelAction, externalLink) - } - } - }, - onError(error, _variables, _context, mutation) { - if (mutation.meta?.notifyOnError) { - if (mutation.meta.notifyOnError === true) { - toastError(error as Error) - } else { - toastError(error as Error, mutation.meta.notifyOnError.title, mutation.meta.notifyOnError.description) - } - } - }, - }), - queryCache: new QueryCache({ - onSuccess(data, query) { - if (query.meta?.notifyOnSuccess) { - if (query.meta.notifyOnSuccess === true) { - toast(ToastEnum.SUCCESS, JSON.stringify(data)) - } else { - const { - status = ToastEnum.SUCCESS, - title, - description, - callback, - iconAction, - labelAction, - externalLink, - } = typeof query.meta.notifyOnSuccess === 'function' - ? query.meta.notifyOnSuccess(data, query) - : query.meta.notifyOnSuccess - toast(status, title, description, callback, iconAction, labelAction, externalLink) - } - } - }, - onError(error, query) { - if (query.meta?.notifyOnError) { - if (query.meta.notifyOnError === true) { - toastError(error as Error) - } else { - toastError(error as Error, query.meta.notifyOnError.title, query.meta.notifyOnError.description) - } - } - }, - }), -}) - root.render( void + iconAction?: string + labelAction?: string + externalLink?: string +} + +interface _QueryMeta { + notifyOnSuccess?: boolean | ((data: unknown, query: Query) => ToastArgs) | ToastArgs + notifyOnError?: boolean | { title: string; description?: string } +} + +interface _MutationMeta { + notifyOnSuccess?: + | boolean + | (( + data: unknown, + variables: unknown, + context: unknown, + mutation: Mutation + ) => ToastArgs) + | ToastArgs + notifyOnError?: boolean | { title: string; description?: string } +} + +declare module '@tanstack/react-query' { + interface MutationMeta extends _MutationMeta {} + interface QueryMeta extends _QueryMeta {} +} + +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 60_000, + }, + }, + mutationCache: new MutationCache({ + onSuccess(data, variables, context, mutation) { + if (mutation.meta?.notifyOnSuccess) { + if (mutation.meta.notifyOnSuccess === true) { + toast(ToastEnum.SUCCESS, JSON.stringify(data)) + } else { + const { + status = ToastEnum.SUCCESS, + title, + description, + callback, + iconAction, + labelAction, + externalLink, + } = typeof mutation.meta.notifyOnSuccess === 'function' + ? mutation.meta.notifyOnSuccess(data, variables, context, mutation) + : mutation.meta.notifyOnSuccess + toast(status, title, description, callback, iconAction, labelAction, externalLink) + } + } + }, + onError(error, _variables, _context, mutation) { + if (mutation.meta?.notifyOnError) { + if (mutation.meta.notifyOnError === true) { + toastError(error as Error) + } else { + toastError(error as Error, mutation.meta.notifyOnError.title, mutation.meta.notifyOnError.description) + } + } + }, + }), + queryCache: new QueryCache({ + onSuccess(data, query) { + if (query.meta?.notifyOnSuccess) { + if (query.meta.notifyOnSuccess === true) { + toast(ToastEnum.SUCCESS, JSON.stringify(data)) + } else { + const { + status = ToastEnum.SUCCESS, + title, + description, + callback, + iconAction, + labelAction, + externalLink, + } = typeof query.meta.notifyOnSuccess === 'function' + ? query.meta.notifyOnSuccess(data, query) + : query.meta.notifyOnSuccess + toast(status, title, description, callback, iconAction, labelAction, externalLink) + } + } + }, + onError(error, query) { + if (query.meta?.notifyOnError) { + if (query.meta.notifyOnError === true) { + toastError(error as Error) + } else { + toastError(error as Error, query.meta.notifyOnError.title, query.meta.notifyOnError.description) + } + } + }, + }), +}) From 39f88c1091a0a986338ac84d775378b389a30c12 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Mon, 22 Jan 2024 10:14:01 +0100 Subject: [PATCH 3/9] chore: setup tanstack/router --- apps/console/src/app/app.tsx | 20 +++++++++++++++++++- libs/shared/routes/src/index.ts | 2 ++ libs/shared/routes/src/lib/routes/__root.tsx | 8 ++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 libs/shared/routes/src/lib/routes/__root.tsx diff --git a/apps/console/src/app/app.tsx b/apps/console/src/app/app.tsx index d773906b8e1..5771e29957e 100644 --- a/apps/console/src/app/app.tsx +++ b/apps/console/src/app/app.tsx @@ -1,5 +1,6 @@ import { type User, useAuth0 } from '@auth0/auth0-react' import { GTMProvider } from '@elgorditosalsero/react-gtm-hook' +import { NotFoundRoute, Router, RouterProvider } from '@tanstack/react-router' import axios from 'axios' import LogRocket from 'logrocket' import posthog from 'posthog-js' @@ -14,14 +15,30 @@ import { AssistantContext } from '@qovery/shared/assistant/feature' import { useAuth, useInviteMember } from '@qovery/shared/auth' import { ProtectedRoute } from '@qovery/shared/router' import { HELM_DEFAULT_VALUES, KUBECONFIG, LOGIN_URL, LOGOUT_URL, PREVIEW_CODE } from '@qovery/shared/routes' +import { rootRoute, routeTree } from '@qovery/shared/routes' import { LoadingScreen } from '@qovery/shared/ui' import { useDocumentTitle } from '@qovery/shared/util-hooks' import { GTM, LOGROCKET, NODE_ENV, NX_GIT_SHA, QOVERY_API } from '@qovery/shared/util-node-env' import { useAuthInterceptor } from '@qovery/shared/utils' +import { queryClient } from '../query-client' import PreviewCode from './components/preview-code' import ScrollToTop from './components/scroll-to-top' import { ROUTER } from './router/main.router' +const notFoundRoute = new NotFoundRoute({ + getParentRoute: () => rootRoute, + component: () => , +}) + +const router = new Router({ routeTree, context: { queryClient }, notFoundRoute }) + +// Register things for typesafety +declare module '@tanstack/react-router' { + interface Register { + router: typeof router + } +} + export function App() { useDocumentTitle('Loading...') const { isLoading } = useAuth() @@ -158,7 +175,8 @@ export function App() { /> ) )} - } /> + {/** NOTE: Delegate remaining routing to @tanstack/router **/} + } /> diff --git a/libs/shared/routes/src/index.ts b/libs/shared/routes/src/index.ts index 1f24e387fba..d75cc773f23 100644 --- a/libs/shared/routes/src/index.ts +++ b/libs/shared/routes/src/index.ts @@ -1 +1,3 @@ export * from './lib/router' +export { routeTree } from './lib/route-tree.gen' +export { Route as rootRoute } from './lib/routes/__root' diff --git a/libs/shared/routes/src/lib/routes/__root.tsx b/libs/shared/routes/src/lib/routes/__root.tsx new file mode 100644 index 00000000000..5f342751294 --- /dev/null +++ b/libs/shared/routes/src/lib/routes/__root.tsx @@ -0,0 +1,8 @@ +import { QueryClient } from '@tanstack/react-query' +import { Outlet, rootRouteWithContext } from '@tanstack/react-router' + +export const Route = rootRouteWithContext<{ + queryClient: QueryClient +}>()({ + component: () => , +}) From 3d28731b32e21a9bb3d4b6653bf97b2c3b8d9459 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Mon, 22 Jan 2024 14:13:38 +0100 Subject: [PATCH 4/9] WIP --- libs/shared/routes/src/lib/route-tree.gen.ts | 42 +++++++++++++++++++ .../clusters/$clusterId/_logs.tsx | 12 ++++++ .../clusters/$clusterId/_logs/index.tsx | 15 +++++++ 3 files changed, 69 insertions(+) create mode 100644 libs/shared/routes/src/lib/route-tree.gen.ts create mode 100644 libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx create mode 100644 libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx diff --git a/libs/shared/routes/src/lib/route-tree.gen.ts b/libs/shared/routes/src/lib/route-tree.gen.ts new file mode 100644 index 00000000000..352abb98949 --- /dev/null +++ b/libs/shared/routes/src/lib/route-tree.gen.ts @@ -0,0 +1,42 @@ +// This file is auto-generated by TanStack Router +// Import Routes +import { Route as rootRoute } from './routes/__root' +import { Route as OrganizationsOrganizationIdClustersClusterIdLogsImport } from './routes/organizations/$organizationId/clusters/$clusterId/_logs' +import { Route as OrganizationsOrganizationIdClustersClusterIdLogsIndexImport } from './routes/organizations/$organizationId/clusters/$clusterId/_logs/index' + +// Create/Update Routes + +const OrganizationsOrganizationIdClustersClusterIdLogsRoute = + OrganizationsOrganizationIdClustersClusterIdLogsImport.update({ + path: '/organizations/$organizationId/clusters/$clusterId/logs', + getParentRoute: () => rootRoute, + } as any) + +const OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute = + OrganizationsOrganizationIdClustersClusterIdLogsIndexImport.update({ + path: '/', + getParentRoute: () => OrganizationsOrganizationIdClustersClusterIdLogsRoute, + } as any) + +// Populate the FileRoutesByPath interface + +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/organizations/$organizationId/clusters/$clusterId/_logs': { + preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsImport + parentRoute: typeof rootRoute + } + '/organizations/$organizationId/clusters/$clusterId/_logs/': { + preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsIndexImport + parentRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsImport + } + } +} + +// Create and export the route tree + +export const routeTree = rootRoute.addChildren([ + OrganizationsOrganizationIdClustersClusterIdLogsRoute.addChildren([ + OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute, + ]), +]) diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx new file mode 100644 index 00000000000..4760fee0472 --- /dev/null +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx @@ -0,0 +1,12 @@ +import { FileRoute, Outlet } from '@tanstack/react-router' +import { DarkModeEnabler, Layout } from '@qovery/pages/layout' + +export const Route = new FileRoute('/organizations/$organizationId/clusters/$clusterId/_logs').createRoute({ + component: () => ( + + + + + + ), +}) diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx new file mode 100644 index 00000000000..ffb8d2419fc --- /dev/null +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx @@ -0,0 +1,15 @@ +import { FileRoute } from '@tanstack/react-router' +import { PageInfraLogs } from '@qovery/pages/logs/infra' +import { queries } from '@qovery/state/util-queries' + +export const Route = new FileRoute('/organizations/$organizationId/clusters/$clusterId/_logs/').createRoute({ + loader: async ({ context: { queryClient }, params: { organizationId, clusterId } }) => { + const clusters = await queryClient.ensureQueryData({ ...queries.clusters.list({ organizationId }) }) + const cluster = (clusters ?? []).find(({ id }) => id === clusterId) + if (!cluster) { + throw Error('Unknown cluster') + } + return cluster + }, + component: PageInfraLogs, +}) From 30112d284a260bae7dc96105d854f34474b4f3a3 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Wed, 22 May 2024 14:34:14 +0200 Subject: [PATCH 5/9] replace deprecated methods --- apps/console/src/app/app.tsx | 13 ++++++------- libs/shared/routes/src/index.ts | 1 - libs/shared/routes/src/lib/routes/__root.tsx | 4 ++-- .../$organizationId/clusters/$clusterId/_logs.tsx | 4 ++-- .../clusters/$clusterId/_logs/index.tsx | 4 ++-- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/apps/console/src/app/app.tsx b/apps/console/src/app/app.tsx index 5771e29957e..0992a3de53f 100644 --- a/apps/console/src/app/app.tsx +++ b/apps/console/src/app/app.tsx @@ -1,6 +1,6 @@ import { type User, useAuth0 } from '@auth0/auth0-react' import { GTMProvider } from '@elgorditosalsero/react-gtm-hook' -import { NotFoundRoute, Router, RouterProvider } from '@tanstack/react-router' +import { RouterProvider, createRouter } from '@tanstack/react-router' import axios from 'axios' import LogRocket from 'logrocket' import posthog from 'posthog-js' @@ -15,7 +15,7 @@ import { AssistantContext } from '@qovery/shared/assistant/feature' import { useAuth, useInviteMember } from '@qovery/shared/auth' import { ProtectedRoute } from '@qovery/shared/router' import { HELM_DEFAULT_VALUES, KUBECONFIG, LOGIN_URL, LOGOUT_URL, PREVIEW_CODE } from '@qovery/shared/routes' -import { rootRoute, routeTree } from '@qovery/shared/routes' +import { routeTree } from '@qovery/shared/routes' import { LoadingScreen } from '@qovery/shared/ui' import { useDocumentTitle } from '@qovery/shared/util-hooks' import { GTM, LOGROCKET, NODE_ENV, NX_GIT_SHA, QOVERY_API } from '@qovery/shared/util-node-env' @@ -25,13 +25,12 @@ import PreviewCode from './components/preview-code' import ScrollToTop from './components/scroll-to-top' import { ROUTER } from './router/main.router' -const notFoundRoute = new NotFoundRoute({ - getParentRoute: () => rootRoute, - component: () => , +const router = createRouter({ + routeTree, + context: { queryClient }, + defaultNotFoundComponent: () => , }) -const router = new Router({ routeTree, context: { queryClient }, notFoundRoute }) - // Register things for typesafety declare module '@tanstack/react-router' { interface Register { diff --git a/libs/shared/routes/src/index.ts b/libs/shared/routes/src/index.ts index d75cc773f23..4488bd07afe 100644 --- a/libs/shared/routes/src/index.ts +++ b/libs/shared/routes/src/index.ts @@ -1,3 +1,2 @@ export * from './lib/router' export { routeTree } from './lib/route-tree.gen' -export { Route as rootRoute } from './lib/routes/__root' diff --git a/libs/shared/routes/src/lib/routes/__root.tsx b/libs/shared/routes/src/lib/routes/__root.tsx index 5f342751294..284d87a9cd1 100644 --- a/libs/shared/routes/src/lib/routes/__root.tsx +++ b/libs/shared/routes/src/lib/routes/__root.tsx @@ -1,7 +1,7 @@ import { QueryClient } from '@tanstack/react-query' -import { Outlet, rootRouteWithContext } from '@tanstack/react-router' +import { Outlet, createRootRouteWithContext } from '@tanstack/react-router' -export const Route = rootRouteWithContext<{ +export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({ component: () => , diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx index 4760fee0472..5daac583b4c 100644 --- a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx @@ -1,7 +1,7 @@ -import { FileRoute, Outlet } from '@tanstack/react-router' +import { Outlet, createFileRoute } from '@tanstack/react-router' import { DarkModeEnabler, Layout } from '@qovery/pages/layout' -export const Route = new FileRoute('/organizations/$organizationId/clusters/$clusterId/_logs').createRoute({ +export const Route = createFileRoute('/organizations/$organizationId/clusters/$clusterId/_logs')({ component: () => ( diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx index ffb8d2419fc..2fb3d79751d 100644 --- a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx @@ -1,8 +1,8 @@ -import { FileRoute } from '@tanstack/react-router' +import { createFileRoute } from '@tanstack/react-router' import { PageInfraLogs } from '@qovery/pages/logs/infra' import { queries } from '@qovery/state/util-queries' -export const Route = new FileRoute('/organizations/$organizationId/clusters/$clusterId/_logs/').createRoute({ +export const Route = createFileRoute('/organizations/$organizationId/clusters/$clusterId/_logs/')({ loader: async ({ context: { queryClient }, params: { organizationId, clusterId } }) => { const clusters = await queryClient.ensureQueryData({ ...queries.clusters.list({ organizationId }) }) const cluster = (clusters ?? []).find(({ id }) => id === clusterId) From e8d9e77a68190575232f7d36bf4dd37a6acdd648 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Wed, 22 May 2024 17:55:12 +0200 Subject: [PATCH 6/9] move xterm memo internally due to webpack module resolution issue --- .../feature/src/lib/service-terminal/service-terminal.tsx | 5 +---- libs/shared/ui/src/lib/components/xterm/xterm.tsx | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libs/domains/services/feature/src/lib/service-terminal/service-terminal.tsx b/libs/domains/services/feature/src/lib/service-terminal/service-terminal.tsx index 97b3eef576f..4c56d47b5e1 100644 --- a/libs/domains/services/feature/src/lib/service-terminal/service-terminal.tsx +++ b/libs/domains/services/feature/src/lib/service-terminal/service-terminal.tsx @@ -5,7 +5,6 @@ import { type ITerminalAddon } from '@xterm/xterm' import { type KeyboardEvent, type MouseEvent as MouseDownEvent, - memo, useCallback, useContext, useEffect, @@ -18,8 +17,6 @@ import { useRunningStatus } from '../..' import { InputSearch } from './input-search/input-search' import { ServiceTerminalContext } from './service-terminal-provider' -const MemoizedXTerm = memo(XTerm) - export interface ServiceTerminalProps { organizationId: string clusterId: string @@ -180,7 +177,7 @@ export function ServiceTerminal({ ) : ( - + )} , diff --git a/libs/shared/ui/src/lib/components/xterm/xterm.tsx b/libs/shared/ui/src/lib/components/xterm/xterm.tsx index 77f445e72c9..475d14e2d9f 100644 --- a/libs/shared/ui/src/lib/components/xterm/xterm.tsx +++ b/libs/shared/ui/src/lib/components/xterm/xterm.tsx @@ -1,6 +1,6 @@ import { type ITerminalAddon, type ITerminalInitOnlyOptions, type ITerminalOptions, Terminal } from '@xterm/xterm' import '@xterm/xterm/css/xterm.css' -import { type ComponentPropsWithoutRef, useEffect, useRef, useState } from 'react' +import { type ComponentPropsWithoutRef, memo, useEffect, useRef, useState } from 'react' export interface UseXTermProps { addons?: ITerminalAddon[] @@ -100,7 +100,7 @@ export function useXTerm({ options, addons, listeners }: UseXTermProps = {}) { export interface XTermProps extends Omit, 'onResize' | 'onScroll'>, UseXTermProps {} -export function XTerm({ className = '', options, addons, listeners, ...props }: XTermProps) { +export const XTerm = memo(function XTerm({ className = '', options, addons, listeners, ...props }: XTermProps) { const { ref } = useXTerm({ options, addons, @@ -108,6 +108,6 @@ export function XTerm({ className = '', options, addons, listeners, ...props }: }) return
-} +}) export default XTerm From 36cbabd29c91377ff7322fa48527b3adff968fee Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Wed, 22 May 2024 18:00:47 +0200 Subject: [PATCH 7/9] generate routes --- libs/shared/routes/src/lib/route-tree.gen.ts | 66 +++++++++++++-- .../clusters/$clusterId/_logs/index.tsx | 12 +-- .../clusters/$clusterId/_logs/logs.tsx | 84 +++++++++++++++++++ 3 files changed, 143 insertions(+), 19 deletions(-) create mode 100644 libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx diff --git a/libs/shared/routes/src/lib/route-tree.gen.ts b/libs/shared/routes/src/lib/route-tree.gen.ts index 352abb98949..c2169484058 100644 --- a/libs/shared/routes/src/lib/route-tree.gen.ts +++ b/libs/shared/routes/src/lib/route-tree.gen.ts @@ -1,15 +1,33 @@ +/* prettier-ignore-start */ + +/* eslint-disable */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols // This file is auto-generated by TanStack Router +import { createFileRoute } from '@tanstack/react-router' // Import Routes import { Route as rootRoute } from './routes/__root' import { Route as OrganizationsOrganizationIdClustersClusterIdLogsImport } from './routes/organizations/$organizationId/clusters/$clusterId/_logs' import { Route as OrganizationsOrganizationIdClustersClusterIdLogsIndexImport } from './routes/organizations/$organizationId/clusters/$clusterId/_logs/index' +import { Route as OrganizationsOrganizationIdClustersClusterIdLogsLogsImport } from './routes/organizations/$organizationId/clusters/$clusterId/_logs/logs' + +// Create Virtual Routes + +const OrganizationsOrganizationIdClustersClusterIdImport = createFileRoute( + '/organizations/$organizationId/clusters/$clusterId' +)() // Create/Update Routes +const OrganizationsOrganizationIdClustersClusterIdRoute = OrganizationsOrganizationIdClustersClusterIdImport.update({ + path: '/organizations/$organizationId/clusters/$clusterId', + getParentRoute: () => rootRoute, +} as any) + const OrganizationsOrganizationIdClustersClusterIdLogsRoute = OrganizationsOrganizationIdClustersClusterIdLogsImport.update({ - path: '/organizations/$organizationId/clusters/$clusterId/logs', - getParentRoute: () => rootRoute, + id: '/_logs', + getParentRoute: () => OrganizationsOrganizationIdClustersClusterIdRoute, } as any) const OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute = @@ -18,15 +36,41 @@ const OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute = getParentRoute: () => OrganizationsOrganizationIdClustersClusterIdLogsRoute, } as any) +const OrganizationsOrganizationIdClustersClusterIdLogsLogsRoute = + OrganizationsOrganizationIdClustersClusterIdLogsLogsImport.update({ + path: '/logs', + getParentRoute: () => OrganizationsOrganizationIdClustersClusterIdLogsRoute, + } as any) + // Populate the FileRoutesByPath interface declare module '@tanstack/react-router' { interface FileRoutesByPath { + '/organizations/$organizationId/clusters/$clusterId': { + id: '/organizations/$organizationId/clusters/$clusterId' + path: '/organizations/$organizationId/clusters/$clusterId' + fullPath: '/organizations/$organizationId/clusters/$clusterId' + preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdImport + parentRoute: typeof rootRoute + } '/organizations/$organizationId/clusters/$clusterId/_logs': { + id: '/organizations/$organizationId/clusters/$clusterId/_logs' + path: '/organizations/$organizationId/clusters/$clusterId' + fullPath: '/organizations/$organizationId/clusters/$clusterId' preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsImport - parentRoute: typeof rootRoute + parentRoute: typeof OrganizationsOrganizationIdClustersClusterIdRoute + } + '/organizations/$organizationId/clusters/$clusterId/_logs/logs': { + id: '/organizations/$organizationId/clusters/$clusterId/_logs/logs' + path: '/logs' + fullPath: '/organizations/$organizationId/clusters/$clusterId/logs' + preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsLogsImport + parentRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsImport } '/organizations/$organizationId/clusters/$clusterId/_logs/': { + id: '/organizations/$organizationId/clusters/$clusterId/_logs/' + path: '/' + fullPath: '/organizations/$organizationId/clusters/$clusterId/' preLoaderRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsIndexImport parentRoute: typeof OrganizationsOrganizationIdClustersClusterIdLogsImport } @@ -35,8 +79,14 @@ declare module '@tanstack/react-router' { // Create and export the route tree -export const routeTree = rootRoute.addChildren([ - OrganizationsOrganizationIdClustersClusterIdLogsRoute.addChildren([ - OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute, - ]), -]) +export const routeTree = rootRoute.addChildren({ + OrganizationsOrganizationIdClustersClusterIdRoute: OrganizationsOrganizationIdClustersClusterIdRoute.addChildren({ + OrganizationsOrganizationIdClustersClusterIdLogsRoute: + OrganizationsOrganizationIdClustersClusterIdLogsRoute.addChildren({ + OrganizationsOrganizationIdClustersClusterIdLogsLogsRoute, + OrganizationsOrganizationIdClustersClusterIdLogsIndexRoute, + }), + }), +}) + +/* prettier-ignore-end */ diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx index 2fb3d79751d..ec0d66423f3 100644 --- a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx @@ -1,15 +1,5 @@ import { createFileRoute } from '@tanstack/react-router' -import { PageInfraLogs } from '@qovery/pages/logs/infra' -import { queries } from '@qovery/state/util-queries' export const Route = createFileRoute('/organizations/$organizationId/clusters/$clusterId/_logs/')({ - loader: async ({ context: { queryClient }, params: { organizationId, clusterId } }) => { - const clusters = await queryClient.ensureQueryData({ ...queries.clusters.list({ organizationId }) }) - const cluster = (clusters ?? []).find(({ id }) => id === clusterId) - if (!cluster) { - throw Error('Unknown cluster') - } - return cluster - }, - component: PageInfraLogs, + component: () =>
Hello /organizations/$organizationId/clusters/$clusterId/_logs/!
, }) diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx new file mode 100644 index 00000000000..ec8f6c28ced --- /dev/null +++ b/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx @@ -0,0 +1,84 @@ +import { createFileRoute } from '@tanstack/react-router' +import { type ClusterLogs, ClusterLogsStepEnum } from 'qovery-typescript-axios' +import { useClusterLogs, useClusterStatus } from '@qovery/domains/clusters/feature' +import { dateDifferenceMinutes } from '@qovery/shared/util-dates' +import { useDocumentTitle } from '@qovery/shared/util-hooks' +import { queries } from '@qovery/state/util-queries' + +export const Route = createFileRoute('/organizations/$organizationId/clusters/$clusterId/_logs/logs')({ + loader: async ({ context: { queryClient }, params: { organizationId, clusterId } }) => { + const clusters = await queryClient.ensureQueryData({ ...queries.clusters.list({ organizationId }) }) + const cluster = (clusters ?? []).find(({ id }) => id === clusterId) + if (!cluster) { + throw Error('Unknown cluster') + } + return cluster + }, + component: PageInfraLogs, +}) + +function PageInfraLogs() { + return null + // const { clusterId, organizationId } = Route.useParams() + // const cluster = Route.useLoaderData() + + // const { data: clusterLogs, isLoading: isClusterLogsLoading } = useClusterLogs({ + // organizationId, + // clusterId, + // refetchInterval: 3000, + // }) + // const { data: clusterStatus } = useClusterStatus({ organizationId, clusterId }) + + // useDocumentTitle(`Cluster - ${cluster.name} (${cluster.region}) `) + + // const firstDate = + // clusterLogs && clusterLogs.length > 0 && clusterLogs[0].timestamp ? new Date(clusterLogs[0].timestamp) : undefined + + // const errors = + // clusterLogs && + // (clusterLogs + // .map( + // (currentData: ClusterLogs, index: number) => + // currentData.error && { + // index: index + 1, + // timeAgo: + // clusterLogs && + // clusterLogs[0].timestamp && + // currentData.timestamp && + // dateDifferenceMinutes(new Date(currentData.timestamp), new Date(clusterLogs[0].timestamp)), + // step: currentData.step, + // error: currentData.error, + // } + // ) + // .filter((error) => error) as ErrorLogsProps[]) + + // const realErrors = errors?.filter( + // (error: ErrorLogsProps) => + // error.step === ClusterLogsStepEnum.DELETE_ERROR || + // error.step === ClusterLogsStepEnum.PAUSE_ERROR || + // error.step === ClusterLogsStepEnum.CREATE_ERROR + // ) + + // const clusterIsDeployed = clusterStatus?.is_deployed + // const clusterBanner = cluster && displayClusterDeploymentBanner(cluster.status) && !clusterIsDeployed + + // return ( + // } + // errors={realErrors} + // clusterBanner={clusterBanner} + // > + // {clusterLogs && + // clusterLogs.map((currentData: ClusterLogs, index: number) => ( + // + // ))} + // + // ) +} + +export default PageInfraLogs From 6aae93e4cbc87907638f93b96bb66efa0fe96dc1 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Thu, 6 Jun 2024 15:53:19 +0200 Subject: [PATCH 8/9] move protected-route --- apps/console/src/app/app.tsx | 2 +- .../console/src/app/components}/protected-route.spec.tsx | 2 +- .../console/src/app/components}/protected-route.tsx | 0 libs/shared/router/src/index.ts | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) rename {libs/shared/router/src/lib/protected-route => apps/console/src/app/components}/protected-route.spec.tsx (84%) rename {libs/shared/router/src/lib/protected-route => apps/console/src/app/components}/protected-route.tsx (100%) diff --git a/apps/console/src/app/app.tsx b/apps/console/src/app/app.tsx index 0992a3de53f..b93facddfe0 100644 --- a/apps/console/src/app/app.tsx +++ b/apps/console/src/app/app.tsx @@ -13,7 +13,6 @@ import { DarkModeEnabler, Layout } from '@qovery/pages/layout' import { PageLogin, PageLogoutFeature } from '@qovery/pages/login' import { AssistantContext } from '@qovery/shared/assistant/feature' import { useAuth, useInviteMember } from '@qovery/shared/auth' -import { ProtectedRoute } from '@qovery/shared/router' import { HELM_DEFAULT_VALUES, KUBECONFIG, LOGIN_URL, LOGOUT_URL, PREVIEW_CODE } from '@qovery/shared/routes' import { routeTree } from '@qovery/shared/routes' import { LoadingScreen } from '@qovery/shared/ui' @@ -22,6 +21,7 @@ import { GTM, LOGROCKET, NODE_ENV, NX_GIT_SHA, QOVERY_API } from '@qovery/shared import { useAuthInterceptor } from '@qovery/shared/utils' import { queryClient } from '../query-client' import PreviewCode from './components/preview-code' +import { ProtectedRoute } from './components/protected-route' import ScrollToTop from './components/scroll-to-top' import { ROUTER } from './router/main.router' diff --git a/libs/shared/router/src/lib/protected-route/protected-route.spec.tsx b/apps/console/src/app/components/protected-route.spec.tsx similarity index 84% rename from libs/shared/router/src/lib/protected-route/protected-route.spec.tsx rename to apps/console/src/app/components/protected-route.spec.tsx index 7a710ee3228..38c7ca42680 100644 --- a/libs/shared/router/src/lib/protected-route/protected-route.spec.tsx +++ b/apps/console/src/app/components/protected-route.spec.tsx @@ -1,5 +1,5 @@ import { render } from '__tests__/utils/setup-jest' -import ProtectedRoute from '../protected-route/protected-route' +import ProtectedRoute from './protected-route' describe('ProtectedRoute', () => { const ProtectedComponent = () => { diff --git a/libs/shared/router/src/lib/protected-route/protected-route.tsx b/apps/console/src/app/components/protected-route.tsx similarity index 100% rename from libs/shared/router/src/lib/protected-route/protected-route.tsx rename to apps/console/src/app/components/protected-route.tsx diff --git a/libs/shared/router/src/index.ts b/libs/shared/router/src/index.ts index bce3edd2f15..e69de29bb2d 100644 --- a/libs/shared/router/src/index.ts +++ b/libs/shared/router/src/index.ts @@ -1 +0,0 @@ -export * from './lib/protected-route/protected-route' From 891ff45e44d8b4a490bcf9be30c46d4a43be6212 Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Thu, 6 Jun 2024 16:10:08 +0200 Subject: [PATCH 9/9] extract router in independant lib --- apps/console/src/app/app.tsx | 2 +- libs/shared/router/src/index.ts | 1 + libs/shared/{routes => router}/src/lib/route-tree.gen.ts | 0 libs/shared/{routes => router}/src/lib/routes/__root.tsx | 2 +- .../$organizationId/clusters/$clusterId/_logs.tsx | 0 .../$organizationId/clusters/$clusterId/_logs/index.tsx | 0 .../$organizationId/clusters/$clusterId/_logs/logs.tsx | 0 libs/shared/routes/src/index.ts | 1 - tsr.config.json | 4 ++-- 9 files changed, 5 insertions(+), 5 deletions(-) rename libs/shared/{routes => router}/src/lib/route-tree.gen.ts (100%) rename libs/shared/{routes => router}/src/lib/routes/__root.tsx (77%) rename libs/shared/{routes => router}/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx (100%) rename libs/shared/{routes => router}/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx (100%) rename libs/shared/{routes => router}/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx (100%) diff --git a/apps/console/src/app/app.tsx b/apps/console/src/app/app.tsx index b93facddfe0..abfd2e79afd 100644 --- a/apps/console/src/app/app.tsx +++ b/apps/console/src/app/app.tsx @@ -13,8 +13,8 @@ import { DarkModeEnabler, Layout } from '@qovery/pages/layout' import { PageLogin, PageLogoutFeature } from '@qovery/pages/login' import { AssistantContext } from '@qovery/shared/assistant/feature' import { useAuth, useInviteMember } from '@qovery/shared/auth' +import { routeTree } from '@qovery/shared/router' import { HELM_DEFAULT_VALUES, KUBECONFIG, LOGIN_URL, LOGOUT_URL, PREVIEW_CODE } from '@qovery/shared/routes' -import { routeTree } from '@qovery/shared/routes' import { LoadingScreen } from '@qovery/shared/ui' import { useDocumentTitle } from '@qovery/shared/util-hooks' import { GTM, LOGROCKET, NODE_ENV, NX_GIT_SHA, QOVERY_API } from '@qovery/shared/util-node-env' diff --git a/libs/shared/router/src/index.ts b/libs/shared/router/src/index.ts index e69de29bb2d..df026494d23 100644 --- a/libs/shared/router/src/index.ts +++ b/libs/shared/router/src/index.ts @@ -0,0 +1 @@ +export { routeTree } from './lib/route-tree.gen' diff --git a/libs/shared/routes/src/lib/route-tree.gen.ts b/libs/shared/router/src/lib/route-tree.gen.ts similarity index 100% rename from libs/shared/routes/src/lib/route-tree.gen.ts rename to libs/shared/router/src/lib/route-tree.gen.ts diff --git a/libs/shared/routes/src/lib/routes/__root.tsx b/libs/shared/router/src/lib/routes/__root.tsx similarity index 77% rename from libs/shared/routes/src/lib/routes/__root.tsx rename to libs/shared/router/src/lib/routes/__root.tsx index 284d87a9cd1..d36455a17d6 100644 --- a/libs/shared/routes/src/lib/routes/__root.tsx +++ b/libs/shared/router/src/lib/routes/__root.tsx @@ -1,4 +1,4 @@ -import { QueryClient } from '@tanstack/react-query' +import { type QueryClient } from '@tanstack/react-query' import { Outlet, createRootRouteWithContext } from '@tanstack/react-router' export const Route = createRootRouteWithContext<{ diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx b/libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx similarity index 100% rename from libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx rename to libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs.tsx diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx b/libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx similarity index 100% rename from libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx rename to libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/index.tsx diff --git a/libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx b/libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx similarity index 100% rename from libs/shared/routes/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx rename to libs/shared/router/src/lib/routes/organizations/$organizationId/clusters/$clusterId/_logs/logs.tsx diff --git a/libs/shared/routes/src/index.ts b/libs/shared/routes/src/index.ts index 4488bd07afe..1f24e387fba 100644 --- a/libs/shared/routes/src/index.ts +++ b/libs/shared/routes/src/index.ts @@ -1,2 +1 @@ export * from './lib/router' -export { routeTree } from './lib/route-tree.gen' diff --git a/tsr.config.json b/tsr.config.json index 271ed13b1c0..e6d3eb91592 100644 --- a/tsr.config.json +++ b/tsr.config.json @@ -1,5 +1,5 @@ { - "routesDirectory": "./libs/shared/routes/src/lib/routes", - "generatedRouteTree": "./libs/shared/routes/src/lib/route-tree.gen.ts", + "routesDirectory": "./libs/shared/router/src/lib/routes", + "generatedRouteTree": "./libs/shared/router/src/lib/route-tree.gen.ts", "quoteStyle": "single" }