q-shift / backstage-plugins

Apache License 2.0
3 stars 7 forks source link

Path to get the component name is hard coded #55

Open cmoulliard opened 8 months ago

cmoulliard commented 8 months ago

Issue

The following code const componentName = currentPageLocation.pathname.split("/")[4]; part of QuarkusApplicationInfo.tsx file which is working when a component is registered as Entity using the backstage catalog don't work at all when we create a devApp and set the path to access the Quarkus Console as such /quarkus as the component name is not included !

Until now, I aligned the path of the Page to register the QuarkusApplicationInfo as such "/a/b/c/my-quarkus-app" but we should certainly review how the componentName to be fetched from the watchResourcesData is calculated to avoid the issue.

createDevApp()
    .addPage({
        title: "Quarkus application info",
        path: "/a/b/c/my-quarkus-app",
        element: (
            <TestApiProvider
                apis={[
                    [kubernetesApiRef, new MockKubernetesClient(mockKubernetesQuarkusApplicationResponse)],
                ]}
            >
                <EntityProvider entity={mockEntity}>
                    <QuarkusConsolePage />
                </EntityProvider>
            </TestApiProvider>
        )
    })

Originally posted by @cmoulliard in https://github.com/q-shift/backstage-plugins/issues/54#issuecomment-2004443323