From 34cc12e10d3063b5a65ee925492dda32d5fc9f5f Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Mon, 22 Apr 2024 14:02:37 +0200 Subject: [PATCH] fix(webui): update remaining references to `entry` -> `bundle` --- webui/src/app/(atlas)/[bundle].tsx | 10 +++--- .../app/(atlas)/[bundle]/folders/[path].tsx | 2 +- .../app/(atlas)/[bundle]/modules/[path].tsx | 2 +- .../src/app/--/bundles/[bundle]/reload+api.ts | 7 ++-- webui/src/components/BundleSelectForm.tsx | 2 +- webui/src/providers/bundle.tsx | 36 +++++++++---------- webui/src/utils/bundle.ts | 12 +++---- webui/src/utils/treemap.ts | 2 +- 8 files changed, 37 insertions(+), 36 deletions(-) diff --git a/webui/src/app/(atlas)/[bundle].tsx b/webui/src/app/(atlas)/[bundle].tsx index d9d89ff..932390f 100644 --- a/webui/src/app/(atlas)/[bundle].tsx +++ b/webui/src/app/(atlas)/[bundle].tsx @@ -61,9 +61,7 @@ export default function BundlePage() { ) : ( -

- {filtersEnabled ? 'Try adjusting or clearing the filters' : 'Try another bundle entry'} -

+

{filtersEnabled ? 'Try adjusting or clearing the filters' : 'Try another bundle'}

)} @@ -77,7 +75,7 @@ function useModuleGraphData(bundleId: string, filters: ModuleFilters) { placeholderData: keepPreviousData, queryKey: [`bundles`, bundleId, 'bundle-graph', filters], queryFn: ({ queryKey }) => { - const [_key, entry, _graph, filters] = queryKey as [ + const [_key, bundle, _graph, filters] = queryKey as [ string, string, string, @@ -85,8 +83,8 @@ function useModuleGraphData(bundleId: string, filters: ModuleFilters) { ]; const url = filters - ? `/bundles/${entry}/modules/graph?${moduleFiltersToParams(filters)}` - : `/bundles/${entry}/modules/graph`; + ? `/bundles/${bundle}/modules/graph?${moduleFiltersToParams(filters)}` + : `/bundles/${bundle}/modules/graph`; return fetchApi(url) .then((res) => (res.ok ? res : Promise.reject(res))) diff --git a/webui/src/app/(atlas)/[bundle]/folders/[path].tsx b/webui/src/app/(atlas)/[bundle]/folders/[path].tsx index 10a3c14..30394a4 100644 --- a/webui/src/app/(atlas)/[bundle]/folders/[path].tsx +++ b/webui/src/app/(atlas)/[bundle]/folders/[path].tsx @@ -64,7 +64,7 @@ export default function FolderPage() { ) : ( !modules.isPending && ( - {filtersEnabled ? 'Try adjusting or clearing the filters' : 'Try another bundle entry'} + {filtersEnabled ? 'Try adjusting or clearing the filters' : 'Try another bundle'} ) )} diff --git a/webui/src/app/(atlas)/[bundle]/modules/[path].tsx b/webui/src/app/(atlas)/[bundle]/modules/[path].tsx index f8bfde2..966e6b0 100644 --- a/webui/src/app/(atlas)/[bundle]/modules/[path].tsx +++ b/webui/src/app/(atlas)/[bundle]/modules/[path].tsx @@ -46,7 +46,7 @@ export default function ModulePage() { Try restarting Expo Atlas. If this error keeps happening, open a bug report. ) : !module.data ? ( - Try another bundle entry + Try another bundle ) : (
{!!module.data.importedBy?.length && ( diff --git a/webui/src/app/--/bundles/[bundle]/reload+api.ts b/webui/src/app/--/bundles/[bundle]/reload+api.ts index 3f98a19..481e4a9 100644 --- a/webui/src/app/--/bundles/[bundle]/reload+api.ts +++ b/webui/src/app/--/bundles/[bundle]/reload+api.ts @@ -4,11 +4,14 @@ export async function GET(_request: Request, params: Record<'bundle', string>) { try { const bundle = await getSource().getBundle(params.bundle); if (!bundle) { - return Response.json({ error: 'Entry not found' }, { status: 404 }); + return Response.json({ error: 'Bundle not found' }, { status: 404 }); } if (!bundle.serializeOptions?.sourceUrl) { - return Response.json({ error: 'Entry has no `serializeOptions.sourceUrl`' }, { status: 406 }); + return Response.json( + { error: 'Bundle has no `serializeOptions.sourceUrl`' }, + { status: 406 } + ); } return Response.redirect(bundle.serializeOptions.sourceUrl, 302); diff --git a/webui/src/components/BundleSelectForm.tsx b/webui/src/components/BundleSelectForm.tsx index f02df19..f4b928a 100644 --- a/webui/src/components/BundleSelectForm.tsx +++ b/webui/src/components/BundleSelectForm.tsx @@ -16,7 +16,7 @@ export function BundleSelectForm() { const { bundle, bundles } = useBundle(); return ( - router.setParams({ entry })}> + router.setParams({ bundle })}> diff --git a/webui/src/utils/bundle.ts b/webui/src/utils/bundle.ts index 29a6021..10e9d59 100644 --- a/webui/src/utils/bundle.ts +++ b/webui/src/utils/bundle.ts @@ -1,20 +1,20 @@ import { PartialAtlasBundle } from '~core/data/types'; /** - * Translate an absolute path to a relative path, based on the entry's project root. + * Translate an absolute path to a relative path, based on the bundle's project root. * This is a simple replace operation. */ export function relativeBundlePath( - entry: Pick, + bundle: Pick, path: string ) { - return path.replace(rootBundlePath(entry) + '/', ''); + return path.replace(rootBundlePath(bundle) + '/', ''); } /** - * Get the "shared root" of all paths within the entry. + * Get the "shared root" of all paths within the bundle. * This is calculated by comparing `projectRoot` and `watchFolders`. */ -export function rootBundlePath(entry: Pick) { - return entry.sharedRoot || entry.projectRoot; +export function rootBundlePath(bundle: Pick) { + return bundle.sharedRoot || bundle.projectRoot; } diff --git a/webui/src/utils/treemap.ts b/webui/src/utils/treemap.ts index 37560a2..a64cf93 100644 --- a/webui/src/utils/treemap.ts +++ b/webui/src/utils/treemap.ts @@ -59,7 +59,7 @@ export function createModuleTree(modules: AtlasModule[]): TreemapNode { value: 100, // 100% moduleSize: totalSize, moduleFiles: modules.length, - // NOTE(cedric): technically, this should be the entry's project root, + // NOTE(cedric): technically, this should be the bundle's shared root, // but that kind of clutters the treemap's tooltip a bit modulePath: '', modulePackage: undefined,