api-docs: migrate entity filters to entity predicates
Migrated entity filters from deprecated string-based format to the new
entity predicate format in the alpha exports. Also updated documentation
across multiple plugins to use the new format and Blueprint APIs.
Changes:
- Migrated all entity filters in api-docs plugin from strings like
'kind:api' to entity predicates like { kind: 'api' }
- Updated documentation examples in api-docs, org, kubernetes, and
catalog-graph plugins
- Migrated all documentation examples from createEntityCardExtension and
createEntityContentExtension to use EntityCardBlueprint and
EntityContentBlueprint
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -80,9 +80,9 @@ describe('api-docs plugin entity extensions', () => {
|
||||
],
|
||||
});
|
||||
|
||||
// Wait for page to render, then check definition card is not shown
|
||||
expect(await screen.findByText('my-component')).toBeInTheDocument();
|
||||
expect(screen.queryByText('openapi')).not.toBeInTheDocument();
|
||||
expect(
|
||||
await screen.findByTestId('empty-entity-page'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should display the API definition content', async () => {
|
||||
@@ -166,8 +166,9 @@ describe('api-docs plugin entity extensions', () => {
|
||||
});
|
||||
|
||||
// Content should not render for Components
|
||||
expect(await screen.findByText('my-service')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Definition')).not.toBeInTheDocument();
|
||||
expect(
|
||||
await screen.findByTestId('empty-entity-page'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ const apiDocsHasApisEntityCard = EntityCardBlueprint.make({
|
||||
const apiDocsDefinitionEntityCard = EntityCardBlueprint.make({
|
||||
name: 'definition',
|
||||
params: {
|
||||
filter: 'kind:api',
|
||||
filter: { kind: 'api' },
|
||||
loader: () =>
|
||||
import('./components/ApiDefinitionCard').then(m => (
|
||||
<m.ApiDefinitionCard />
|
||||
@@ -123,7 +123,7 @@ const apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({
|
||||
// Omitting configSchema for now
|
||||
// We are skipping variants and columns are too complex to map to zod
|
||||
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
||||
filter: 'kind:component',
|
||||
filter: { kind: 'component' },
|
||||
loader: () =>
|
||||
import('./components/ApisCards').then(m => <m.ConsumedApisCard />),
|
||||
},
|
||||
@@ -135,7 +135,7 @@ const apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({
|
||||
// Omitting configSchema for now
|
||||
// We are skipping variants and columns are too complex to map to zod
|
||||
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
||||
filter: 'kind:component',
|
||||
filter: { kind: 'component' },
|
||||
loader: () =>
|
||||
import('./components/ApisCards').then(m => <m.ProvidedApisCard />),
|
||||
},
|
||||
@@ -147,7 +147,7 @@ const apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({
|
||||
// Omitting configSchema for now
|
||||
// We are skipping variants
|
||||
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
||||
filter: 'kind:api',
|
||||
filter: { kind: 'api' },
|
||||
loader: () =>
|
||||
import('./components/ComponentsCards').then(m => (
|
||||
<m.ConsumingComponentsCard />
|
||||
@@ -161,7 +161,7 @@ const apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({
|
||||
// Omitting configSchema for now
|
||||
// We are skipping variants
|
||||
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
||||
filter: 'kind:api',
|
||||
filter: { kind: 'api' },
|
||||
loader: () =>
|
||||
import('./components/ComponentsCards').then(m => (
|
||||
<m.ProvidingComponentsCard />
|
||||
@@ -174,7 +174,7 @@ const apiDocsDefinitionEntityContent = EntityContentBlueprint.make({
|
||||
params: {
|
||||
path: '/definition',
|
||||
title: 'Definition',
|
||||
filter: 'kind:api',
|
||||
filter: { kind: 'api' },
|
||||
loader: async () =>
|
||||
import('./components/ApiDefinitionCard').then(m => (
|
||||
<Grid container spacing={3}>
|
||||
@@ -191,7 +191,7 @@ const apiDocsApisEntityContent = EntityContentBlueprint.make({
|
||||
params: {
|
||||
path: '/apis',
|
||||
title: 'APIs',
|
||||
filter: 'kind:component',
|
||||
filter: { kind: 'component' },
|
||||
loader: async () =>
|
||||
import('./components/ApisCards').then(m => (
|
||||
<Grid container spacing={3} alignItems="stretch">
|
||||
|
||||
Reference in New Issue
Block a user