diff --git a/workspaces/bulk-import/.changeset/fix-bulk-import-routing.md b/workspaces/bulk-import/.changeset/fix-bulk-import-routing.md new file mode 100644 index 0000000000..93f3e56473 --- /dev/null +++ b/workspaces/bulk-import/.changeset/fix-bulk-import-routing.md @@ -0,0 +1,5 @@ +--- +'@red-hat-developer-hub/backstage-plugin-bulk-import': patch +--- + +Fixed routing to handle `/bulk-import` path correctly by adding internal redirect to `/bulk-import/repositories`. The plugin now automatically redirects from the base path to the repositories view, eliminating the need for host applications to configure separate redirect routes. This resolves the 404 error when accessing `/bulk-import` directly in RHDH. diff --git a/workspaces/bulk-import/packages/app/src/App.tsx b/workspaces/bulk-import/packages/app/src/App.tsx index 176b2cf9e8..2eec64b1a3 100644 --- a/workspaces/bulk-import/packages/app/src/App.tsx +++ b/workspaces/bulk-import/packages/app/src/App.tsx @@ -132,8 +132,7 @@ const routes = ( } /> } /> - } /> - } /> + } /> ); diff --git a/workspaces/bulk-import/plugins/bulk-import/README.md b/workspaces/bulk-import/plugins/bulk-import/README.md index 5c1f906840..3044787d15 100644 --- a/workspaces/bulk-import/plugins/bulk-import/README.md +++ b/workspaces/bulk-import/plugins/bulk-import/README.md @@ -47,18 +47,13 @@ g, user:default/, role:default/team_a import { BulkImportPage } from '@red-hat-developer-hub/backstage-plugin-bulk-import'; ... /* highlight-add-start */ - } - /> - } - /> - /* highlight-add-end */ + } /> + /* highlight-add-end */ ... ``` + > **Note:** The plugin automatically redirects `/bulk-import` to `/bulk-import/repositories`. You only need to mount the plugin once at `/bulk-import/*`. + 3. Add **Bulk import** Sidebar Item in `packages/app/src/components/Root/Root.tsx`: ```tsx title="packages/app/src/components/Root/Root.tsx" diff --git a/workspaces/bulk-import/plugins/bulk-import/dev/index.tsx b/workspaces/bulk-import/plugins/bulk-import/dev/index.tsx index 65b58a0a0e..2cd90f5ded 100644 --- a/workspaces/bulk-import/plugins/bulk-import/dev/index.tsx +++ b/workspaces/bulk-import/plugins/bulk-import/dev/index.tsx @@ -176,7 +176,7 @@ createDevApp() ), title: 'Bulk import', - path: '/bulk-import/repositories', + path: '/bulk-import', icon: BulkImportIcon, }) .render(); diff --git a/workspaces/bulk-import/plugins/bulk-import/src/components/Router.tsx b/workspaces/bulk-import/plugins/bulk-import/src/components/Router.tsx index 4e6fe7ce65..ee4895ffa1 100644 --- a/workspaces/bulk-import/plugins/bulk-import/src/components/Router.tsx +++ b/workspaces/bulk-import/plugins/bulk-import/src/components/Router.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Route, Routes } from 'react-router-dom'; +import { Navigate, Route, Routes } from 'react-router-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; @@ -32,7 +32,8 @@ const queryClient = new QueryClient(); export const Router = () => ( - } /> + } /> + } /> }