From e4b02b95987df16b98d8c2ffee9023ff4062ed95 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Thu, 29 Feb 2024 11:42:57 +0530 Subject: [PATCH] redirect repo page implementation --- src/apps/console/page-components/app-states.tsx | 8 ++++++-- .../_main+/$account+/packages+/repos/repo-resources.tsx | 2 +- .../routes/_main+/$account+/repo+/$repo+/_layout.tsx | 5 +++-- .../routes/_main+/$account+/repo+/$repo+/images/route.tsx | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/apps/console/page-components/app-states.tsx b/src/apps/console/page-components/app-states.tsx index 525729791..221c2ec92 100644 --- a/src/apps/console/page-components/app-states.tsx +++ b/src/apps/console/page-components/app-states.tsx @@ -202,8 +202,12 @@ export const useAppState = () => { const getRepoName = (imageUrl: string) => { const parts: string[] = imageUrl.split(':'); const repoParts: string[] = parts[0].split('/'); - console.log("repo name", repoParts[repoParts.length - 1]) - return repoParts[repoParts.length - 1]; + if (repoParts.length == 1) { + return repoParts[repoParts.length - 1]; + } else { + const repoSlicePart: string[] = repoParts.slice(2) + return repoSlicePart.join("/") + } } const getImageTag = (imageUrl: string) => { diff --git a/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx b/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx index a28c07b1d..9f6dd1c9c 100644 --- a/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx +++ b/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx @@ -141,7 +141,7 @@ const ListView = ({ items, onDelete }: IResource) => { return ( { const { repo, account } = useParams(); + const repoName = atob(repo ? repo : "") return (
{ } /> {repo}} + content={{repoName}} />
); diff --git a/src/apps/console/routes/_main+/$account+/repo+/$repo+/images/route.tsx b/src/apps/console/routes/_main+/$account+/repo+/$repo+/images/route.tsx index 00aa8897d..485930746 100644 --- a/src/apps/console/routes/_main+/$account+/repo+/$repo+/images/route.tsx +++ b/src/apps/console/routes/_main+/$account+/repo+/$repo+/images/route.tsx @@ -17,7 +17,7 @@ export const loader = async (ctx: IRemixCtx) => { const promise = pWrapper(async () => { ensureAccountSet(ctx); const { data, errors } = await GQLServerHandler(ctx.request).listDigest({ - repoName: repo, + repoName: atob(repo), pagination: getPagination(ctx), search: getSearch(ctx), });