@backstage/plugin-api-docs 0.0.0-nightly-20260317031259 → 0.0.0-nightly-20260319031605

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,25 +1,41 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
- ## 0.0.0-nightly-20260317031259
3
+ ## 0.0.0-nightly-20260319031605
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/ui@0.0.0-nightly-20260319031605
9
+ - @backstage/plugin-catalog@0.0.0-nightly-20260319031605
10
+ - @backstage/plugin-catalog-react@0.0.0-nightly-20260319031605
11
+ - @backstage/core-components@0.18.8
12
+ - @backstage/core-plugin-api@1.12.4
13
+ - @backstage/frontend-plugin-api@0.15.0
14
+ - @backstage/plugin-permission-react@0.4.41
15
+
16
+ ## 0.13.5
4
17
 
5
18
  ### Patch Changes
6
19
 
7
20
  - 9c9d425: Fixed invisible text in parameter input fields when using dark mode in OpenAPI definition pages
8
21
  - 538c985: Updated installation documentation to use feature discovery as the default.
9
22
  - 30e08df: Added default entity content groups for the API docs entity content tabs. The API definition tab defaults to the `documentation` group and the APIs tab defaults to the `development` group.
23
+ - c548a0f: Migrated entity table cards (`ConsumedApisCard`, `ProvidedApisCard`, `HasApisCard`, `ConsumingComponentsCard`, `ProvidingComponentsCard`) to use BUI when no legacy props are passed. The old `variant`, `columns`, and `tableOptions` props are deprecated but still supported — passing any of them triggers the legacy MUI-based rendering. The new `columnConfig` prop accepts `EntityColumnConfig[]` for BUI-based rendering.
24
+ - aa29b50: New frontend system pages now use the default plugin header together with `HeaderPage` instead of the legacy core page header pattern.
10
25
  - 3f36ce1: Updated alpha plugin icons to follow the new frontend icon sizing rules when rendered in plugin and navigation surfaces.
26
+ - 0be2541: Promoted the plugin's translation ref to the stable package entry point. It was previously only available through the alpha entry point.
11
27
  - ca277ef: Updated dependency `graphiql` to `3.9.0` to address security vulnerability in `markdown-it` package.
12
28
  Updated dependency `@graphiql/react` to `0.29.0` to match the version used by `graphiql`.
13
29
  Moved dependency `graphql-config` to `devDependencies` as it is needed only for types.
14
30
  - Updated dependencies
15
- - @backstage/core-components@0.0.0-nightly-20260317031259
16
- - @backstage/frontend-plugin-api@0.0.0-nightly-20260317031259
17
- - @backstage/plugin-catalog@0.0.0-nightly-20260317031259
18
- - @backstage/core-plugin-api@0.0.0-nightly-20260317031259
19
- - @backstage/plugin-catalog-react@0.0.0-nightly-20260317031259
20
- - @backstage/catalog-model@1.7.6
21
- - @backstage/plugin-catalog-common@1.1.8
22
- - @backstage/plugin-permission-react@0.0.0-nightly-20260317031259
31
+ - @backstage/plugin-catalog-react@2.1.0
32
+ - @backstage/ui@0.13.0
33
+ - @backstage/core-plugin-api@1.12.4
34
+ - @backstage/core-components@0.18.8
35
+ - @backstage/frontend-plugin-api@0.15.0
36
+ - @backstage/plugin-catalog@2.0.0
37
+ - @backstage/plugin-permission-react@0.4.41
38
+ - @backstage/catalog-model@1.7.7
23
39
 
24
40
  ## 0.13.5-next.2
25
41
 
package/dist/alpha.d.ts CHANGED
@@ -5,41 +5,6 @@ import * as _backstage_filter_predicates from '@backstage/filter-predicates';
5
5
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
6
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
7
7
 
8
- /**
9
- * @alpha
10
- */
11
- declare const apiDocsTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"api-docs", {
12
- readonly "apiDefinitionCard.error.title": "Could not fetch the API";
13
- readonly "apiDefinitionCard.rawButtonTitle": "Raw";
14
- readonly "apiDefinitionDialog.closeButtonTitle": "Close";
15
- readonly "apiDefinitionDialog.tabsAriaLabel": "API definition options";
16
- readonly "apiDefinitionDialog.rawButtonTitle": "Raw";
17
- readonly "apiDefinitionDialog.toggleButtonAriaLabel": "Toggle API Definition Dialog";
18
- readonly "defaultApiExplorerPage.title": "APIs";
19
- readonly "defaultApiExplorerPage.subtitle": "{{orgName}} API Explorer";
20
- readonly "defaultApiExplorerPage.pageTitleOverride": "APIs";
21
- readonly "defaultApiExplorerPage.createButtonTitle": "Register Existing API";
22
- readonly "defaultApiExplorerPage.supportButtonTitle": "All your APIs";
23
- readonly "consumedApisCard.error.title": "Could not load APIs";
24
- readonly "consumedApisCard.title": "Consumed APIs";
25
- readonly "consumedApisCard.emptyContent.title": "This {{entity}} does not consume any APIs.";
26
- readonly "hasApisCard.error.title": "Could not load APIs";
27
- readonly "hasApisCard.title": "APIs";
28
- readonly "hasApisCard.emptyContent.title": "This {{entity}} does not contain any APIs.";
29
- readonly "providedApisCard.error.title": "Could not load APIs";
30
- readonly "providedApisCard.title": "Provided APIs";
31
- readonly "providedApisCard.emptyContent.title": "This {{entity}} does not provide any APIs.";
32
- readonly "apiEntityColumns.typeTitle": "Type";
33
- readonly "apiEntityColumns.apiDefinitionTitle": "API Definition";
34
- readonly "consumingComponentsCard.error.title": "Could not load components";
35
- readonly "consumingComponentsCard.title": "Consumers";
36
- readonly "consumingComponentsCard.emptyContent.title": "No component consumes this API.";
37
- readonly "providingComponentsCard.error.title": "Could not load components";
38
- readonly "providingComponentsCard.title": "Providers";
39
- readonly "providingComponentsCard.emptyContent.title": "No component provides this API.";
40
- readonly apisCardHelpLinkTitle: "Learn how to change this";
41
- }>;
42
-
43
8
  declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{
44
9
  root: _backstage_core_plugin_api.RouteRef<undefined>;
45
10
  }, {
@@ -349,4 +314,40 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
349
314
  }>;
350
315
  }>;
351
316
 
317
+ /**
318
+ * @alpha
319
+ * @deprecated Import from `@backstage/plugin-api-docs` instead.
320
+ */
321
+ declare const apiDocsTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"api-docs", {
322
+ readonly "apiDefinitionCard.error.title": "Could not fetch the API";
323
+ readonly "apiDefinitionCard.rawButtonTitle": "Raw";
324
+ readonly "apiDefinitionDialog.closeButtonTitle": "Close";
325
+ readonly "apiDefinitionDialog.tabsAriaLabel": "API definition options";
326
+ readonly "apiDefinitionDialog.rawButtonTitle": "Raw";
327
+ readonly "apiDefinitionDialog.toggleButtonAriaLabel": "Toggle API Definition Dialog";
328
+ readonly "defaultApiExplorerPage.title": "APIs";
329
+ readonly "defaultApiExplorerPage.subtitle": "{{orgName}} API Explorer";
330
+ readonly "defaultApiExplorerPage.pageTitleOverride": "APIs";
331
+ readonly "defaultApiExplorerPage.createButtonTitle": "Register Existing API";
332
+ readonly "defaultApiExplorerPage.supportButtonTitle": "All your APIs";
333
+ readonly "consumedApisCard.error.title": "Could not load APIs";
334
+ readonly "consumedApisCard.title": "Consumed APIs";
335
+ readonly "consumedApisCard.emptyContent.title": "This {{entity}} does not consume any APIs.";
336
+ readonly "hasApisCard.error.title": "Could not load APIs";
337
+ readonly "hasApisCard.title": "APIs";
338
+ readonly "hasApisCard.emptyContent.title": "This {{entity}} does not contain any APIs.";
339
+ readonly "providedApisCard.error.title": "Could not load APIs";
340
+ readonly "providedApisCard.title": "Provided APIs";
341
+ readonly "providedApisCard.emptyContent.title": "This {{entity}} does not provide any APIs.";
342
+ readonly "apiEntityColumns.typeTitle": "Type";
343
+ readonly "apiEntityColumns.apiDefinitionTitle": "API Definition";
344
+ readonly "consumingComponentsCard.error.title": "Could not load components";
345
+ readonly "consumingComponentsCard.title": "Consumers";
346
+ readonly "consumingComponentsCard.emptyContent.title": "No component consumes this API.";
347
+ readonly "providingComponentsCard.error.title": "Could not load components";
348
+ readonly "providingComponentsCard.title": "Providers";
349
+ readonly "providingComponentsCard.emptyContent.title": "No component provides this API.";
350
+ readonly apisCardHelpLinkTitle: "Learn how to change this.";
351
+ }>;
352
+
352
353
  export { apiDocsTranslationRef, _default as default };
package/dist/alpha.esm.js CHANGED
@@ -7,7 +7,7 @@ import { AppIcon } from '@backstage/core-components';
7
7
  import '@backstage/core-plugin-api';
8
8
  import '@material-ui/lab/Alert';
9
9
  import { apiDocsConfigRef } from './config.esm.js';
10
- export { apiDocsTranslationRef } from './translation.esm.js';
10
+ import { apiDocsTranslationRef as apiDocsTranslationRef$1 } from './translation.esm.js';
11
11
  import { defaultDefinitionWidgets } from './components/ApiDefinitionCard/ApiDefinitionWidget.esm.js';
12
12
  import '@material-ui/core/Typography';
13
13
  import { rootRoute, registerComponentRouteRef } from './routes.esm.js';
@@ -46,12 +46,14 @@ const apiDocsExplorerPage = PageBlueprint.makeWithOverrides({
46
46
  return originalFactory({
47
47
  path: "/api-docs",
48
48
  routeRef: rootRoute,
49
- loader: () => import('./components/ApiExplorerPage/index.esm.js').then((m) => /* @__PURE__ */ jsx(
50
- m.ApiExplorerIndexPage,
51
- {
52
- initiallySelectedFilter: config.initiallySelectedFilter
53
- }
54
- ))
49
+ loader: () => import('./components/ApiExplorerPage/DefaultApiExplorerPage.esm.js').then(
50
+ (m) => /* @__PURE__ */ jsx(
51
+ m.NfsApiExplorerPage,
52
+ {
53
+ initiallySelectedFilter: config.initiallySelectedFilter
54
+ }
55
+ )
56
+ )
55
57
  });
56
58
  }
57
59
  });
@@ -164,6 +166,7 @@ var alpha = createFrontendPlugin({
164
166
  apiDocsApisEntityContent
165
167
  ]
166
168
  });
169
+ const apiDocsTranslationRef = apiDocsTranslationRef$1;
167
170
 
168
- export { alpha as default };
171
+ export { apiDocsTranslationRef, alpha as default };
169
172
  //# sourceMappingURL=alpha.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: rootRoute,\n icon: () => <AppIcon fontSize=\"inherit\" id=\"kind:api\" />,\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: defineParams =>\n defineParams({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Omitting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n path: '/api-docs',\n routeRef: rootRoute,\n loader: () =>\n import('./components/ApiExplorerPage').then(m => (\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />\n )),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () => import('./components/ApisCards').then(m => <m.HasApisCard />),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ApiDefinitionCard').then(m => (\n <m.ApiDefinitionCard />\n )),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'component' },\n loader: () =>\n import('./components/ApisCards').then(m => <m.ConsumedApisCard />),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'component' },\n loader: () =>\n import('./components/ApisCards').then(m => <m.ProvidedApisCard />),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Omitting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ComponentsCards').then(m => (\n <m.ConsumingComponentsCard />\n )),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Omitting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ComponentsCards').then(m => (\n <m.ProvidingComponentsCard />\n )),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n path: '/definition',\n title: 'Definition',\n group: 'documentation',\n filter: { kind: 'api' },\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m => (\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>\n )),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n path: '/apis',\n title: 'APIs',\n group: 'development',\n filter: { kind: 'component' },\n loader: async () =>\n import('./components/ApisCards').then(m => (\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>\n )),\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'api-docs',\n title: 'APIs',\n icon: <AppIcon fontSize=\"inherit\" id=\"kind:api\" />,\n info: { packageJson: () => import('../package.json') },\n routes: {\n root: rootRoute,\n },\n externalRoutes: {\n registerApi: registerComponentRouteRef,\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n\nexport { apiDocsTranslationRef } from './translation';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyCA,MAAM,cAAA,GAAiB,iBAAiB,IAAA,CAAK;AAAA,EAC3C,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,QAAA,EAAU,SAAA;AAAA,IACV,MAAM,sBAAM,GAAA,CAAC,WAAQ,QAAA,EAAS,SAAA,EAAU,IAAG,UAAA,EAAW;AAAA;AAE1D,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAA,CAAK;AAAA,EACzC,IAAA,EAAM,QAAA;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,EAAM;AAAA,GACR;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,WAAA,EAAa;AAAA,GACf;AAAA,EACA,UAAA,EAAY;AAAA,IACV,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,wBAAA;AAAA,IACA,2BAAA;AAAA,IACA,6BAAA;AAAA,IACA,6BAAA;AAAA,IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: rootRoute,\n icon: () => <AppIcon fontSize=\"inherit\" id=\"kind:api\" />,\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: defineParams =>\n defineParams({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Omitting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n path: '/api-docs',\n routeRef: rootRoute,\n loader: () =>\n import('./components/ApiExplorerPage/DefaultApiExplorerPage').then(\n m => (\n <m.NfsApiExplorerPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () => import('./components/ApisCards').then(m => <m.HasApisCard />),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ApiDefinitionCard').then(m => (\n <m.ApiDefinitionCard />\n )),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'component' },\n loader: () =>\n import('./components/ApisCards').then(m => <m.ConsumedApisCard />),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Omitting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'component' },\n loader: () =>\n import('./components/ApisCards').then(m => <m.ProvidedApisCard />),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Omitting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ComponentsCards').then(m => (\n <m.ConsumingComponentsCard />\n )),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Omitting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: { kind: 'api' },\n loader: () =>\n import('./components/ComponentsCards').then(m => (\n <m.ProvidingComponentsCard />\n )),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n path: '/definition',\n title: 'Definition',\n group: 'documentation',\n filter: { kind: 'api' },\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m => (\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>\n )),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n path: '/apis',\n title: 'APIs',\n group: 'development',\n filter: { kind: 'component' },\n loader: async () =>\n import('./components/ApisCards').then(m => (\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>\n )),\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'api-docs',\n title: 'APIs',\n icon: <AppIcon fontSize=\"inherit\" id=\"kind:api\" />,\n info: { packageJson: () => import('../package.json') },\n routes: {\n root: rootRoute,\n },\n externalRoutes: {\n registerApi: registerComponentRouteRef,\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n\nimport { apiDocsTranslationRef as _apiDocsTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-api-docs` instead.\n */\nexport const apiDocsTranslationRef = _apiDocsTranslationRef;\n"],"names":["_apiDocsTranslationRef"],"mappings":";;;;;;;;;;;;;;;AAyCA,MAAM,cAAA,GAAiB,iBAAiB,IAAA,CAAK;AAAA,EAC3C,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,QAAA,EAAU,SAAA;AAAA,IACV,MAAM,sBAAM,GAAA,CAAC,WAAQ,QAAA,EAAS,SAAA,EAAU,IAAG,UAAA,EAAW;AAAA;AAE1D,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAA,CAAK;AAAA,EACzC,IAAA,EAAM,QAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,gBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,SAAS,MAAM;AACb,MAAA,MAAM,oBAAoB,wBAAA,EAAyB;AACnD,MAAA,OAAO;AAAA,QACL,sBAAA,EAAwB,CAAC,SAAA,KAAyB;AAChD,UAAA,OAAO,kBAAkB,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,IAAA,KAAS,SAAA,CAAU,KAAK,IAAI,CAAA;AAAA,QACnE;AAAA,OACF;AAAA,IACF;AAAA,GACD;AACL,CAAC,CAAA;AAED,MAAM,mBAAA,GAAsB,cAAc,iBAAA,CAAkB;AAAA,EAC1D,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CreateButton, SupportButton } from '@backstage/core-components';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { CreateButton, SupportButton, PageWithHeader, Content, ContentHeader } from '@backstage/core-components';
3
3
  import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
4
+ import { HeaderPage } from '@backstage/ui';
4
5
  import { CatalogTable } from '@backstage/plugin-catalog';
5
6
  import { EntityListProvider, CatalogFilterLayout, EntityKindPicker, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
6
7
  import { registerComponentRouteRef } from '../../routes.esm.js';
@@ -19,6 +20,26 @@ const defaultColumns = [
19
20
  CatalogTable.columns.createMetadataDescriptionColumn(),
20
21
  CatalogTable.columns.createTagsColumn()
21
22
  ];
23
+ function ApiExplorerPageContent(props) {
24
+ const {
25
+ initiallySelectedFilter,
26
+ columns,
27
+ actions,
28
+ ownerPickerMode,
29
+ pagination
30
+ } = props;
31
+ return /* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
32
+ /* @__PURE__ */ jsxs(CatalogFilterLayout.Filters, { children: [
33
+ /* @__PURE__ */ jsx(EntityKindPicker, { initialFilter: "api", hidden: true }),
34
+ /* @__PURE__ */ jsx(EntityTypePicker, {}),
35
+ /* @__PURE__ */ jsx(UserListPicker, { initialFilter: initiallySelectedFilter }),
36
+ /* @__PURE__ */ jsx(EntityOwnerPicker, { mode: ownerPickerMode }),
37
+ /* @__PURE__ */ jsx(EntityLifecyclePicker, {}),
38
+ /* @__PURE__ */ jsx(EntityTagPicker, {})
39
+ ] }),
40
+ /* @__PURE__ */ jsx(CatalogFilterLayout.Content, { children: /* @__PURE__ */ jsx(CatalogTable, { columns: columns || defaultColumns, actions }) })
41
+ ] }) });
42
+ }
22
43
  const DefaultApiExplorerPage = (props) => {
23
44
  const {
24
45
  initiallySelectedFilter = "all",
@@ -36,6 +57,16 @@ const DefaultApiExplorerPage = (props) => {
36
57
  const { allowed } = usePermission({
37
58
  permission: catalogEntityCreatePermission
38
59
  });
60
+ const headerActions = /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ allowed && /* @__PURE__ */ jsx(
62
+ CreateButton,
63
+ {
64
+ title: t("defaultApiExplorerPage.createButtonTitle"),
65
+ to: registerComponentLink?.()
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx(SupportButton, { children: t("defaultApiExplorerPage.supportButtonTitle") })
69
+ ] });
39
70
  return /* @__PURE__ */ jsx(
40
71
  PageWithHeader,
41
72
  {
@@ -44,37 +75,62 @@ const DefaultApiExplorerPage = (props) => {
44
75
  subtitle: generatedSubtitle,
45
76
  pageTitleOverride: t("defaultApiExplorerPage.pageTitleOverride"),
46
77
  children: /* @__PURE__ */ jsxs(Content, { children: [
47
- /* @__PURE__ */ jsxs(ContentHeader, { title: "", children: [
48
- allowed && /* @__PURE__ */ jsx(
49
- CreateButton,
50
- {
51
- title: t("defaultApiExplorerPage.createButtonTitle"),
52
- to: registerComponentLink?.()
53
- }
54
- ),
55
- /* @__PURE__ */ jsx(SupportButton, { children: t("defaultApiExplorerPage.supportButtonTitle") })
56
- ] }),
57
- /* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
58
- /* @__PURE__ */ jsxs(CatalogFilterLayout.Filters, { children: [
59
- /* @__PURE__ */ jsx(EntityKindPicker, { initialFilter: "api", hidden: true }),
60
- /* @__PURE__ */ jsx(EntityTypePicker, {}),
61
- /* @__PURE__ */ jsx(UserListPicker, { initialFilter: initiallySelectedFilter }),
62
- /* @__PURE__ */ jsx(EntityOwnerPicker, { mode: ownerPickerMode }),
63
- /* @__PURE__ */ jsx(EntityLifecyclePicker, {}),
64
- /* @__PURE__ */ jsx(EntityTagPicker, {})
65
- ] }),
66
- /* @__PURE__ */ jsx(CatalogFilterLayout.Content, { children: /* @__PURE__ */ jsx(
67
- CatalogTable,
68
- {
69
- columns: columns || defaultColumns,
70
- actions
71
- }
72
- ) })
73
- ] }) })
78
+ /* @__PURE__ */ jsx(ContentHeader, { title: "", children: headerActions }),
79
+ /* @__PURE__ */ jsx(
80
+ ApiExplorerPageContent,
81
+ {
82
+ initiallySelectedFilter,
83
+ columns,
84
+ actions,
85
+ ownerPickerMode,
86
+ pagination
87
+ }
88
+ )
74
89
  ] })
75
90
  }
76
91
  );
77
92
  };
93
+ const NfsApiExplorerPage = (props) => {
94
+ const {
95
+ initiallySelectedFilter = "all",
96
+ columns,
97
+ actions,
98
+ ownerPickerMode,
99
+ pagination
100
+ } = props;
101
+ const configApi = useApi(configApiRef);
102
+ const { t } = useTranslationRef(apiDocsTranslationRef);
103
+ const generatedSubtitle = t("defaultApiExplorerPage.subtitle", {
104
+ orgName: configApi.getOptionalString("organization.name") ?? "Backstage"
105
+ });
106
+ const registerComponentLink = useRouteRef(registerComponentRouteRef);
107
+ const { allowed } = usePermission({
108
+ permission: catalogEntityCreatePermission
109
+ });
110
+ const headerActions = /* @__PURE__ */ jsxs(Fragment, { children: [
111
+ allowed && /* @__PURE__ */ jsx(
112
+ CreateButton,
113
+ {
114
+ title: t("defaultApiExplorerPage.createButtonTitle"),
115
+ to: registerComponentLink?.()
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsx(SupportButton, { children: t("defaultApiExplorerPage.supportButtonTitle") })
119
+ ] });
120
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
121
+ /* @__PURE__ */ jsx(HeaderPage, { title: generatedSubtitle, customActions: headerActions }),
122
+ /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
123
+ ApiExplorerPageContent,
124
+ {
125
+ initiallySelectedFilter,
126
+ columns,
127
+ actions,
128
+ ownerPickerMode,
129
+ pagination
130
+ }
131
+ ) })
132
+ ] });
133
+ };
78
134
 
79
- export { DefaultApiExplorerPage };
135
+ export { DefaultApiExplorerPage, NfsApiExplorerPage };
80
136
  //# sourceMappingURL=DefaultApiExplorerPage.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultApiExplorerPage.esm.js","sources":["../../../src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { CatalogTable, CatalogTableRow } from '@backstage/plugin-catalog';\nimport {\n EntityKindPicker,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityListPagination,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n CatalogFilterLayout,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport { registerComponentRouteRef } from '../../routes';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\n CatalogTable.columns.createTitleColumn({ hidden: true }),\n CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),\n CatalogTable.columns.createSystemColumn(),\n CatalogTable.columns.createOwnerColumn(),\n CatalogTable.columns.createSpecTypeColumn(),\n CatalogTable.columns.createSpecLifecycleColumn(),\n CatalogTable.columns.createMetadataDescriptionColumn(),\n CatalogTable.columns.createTagsColumn(),\n];\n\n/**\n * DefaultApiExplorerPageProps\n * @public\n */\nexport type DefaultApiExplorerPageProps = {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n};\n\n/**\n * DefaultApiExplorerPage\n * @public\n */\nexport const DefaultApiExplorerPage = (props: DefaultApiExplorerPageProps) => {\n const {\n initiallySelectedFilter = 'all',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n } = props;\n\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const generatedSubtitle = t('defaultApiExplorerPage.subtitle', {\n orgName: configApi.getOptionalString('organization.name') ?? 'Backstage',\n });\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title={t('defaultApiExplorerPage.title')}\n subtitle={generatedSubtitle}\n pageTitleOverride={t('defaultApiExplorerPage.pageTitleOverride')}\n >\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('defaultApiExplorerPage.createButtonTitle')}\n to={registerComponentLink?.()}\n />\n )}\n <SupportButton>\n {t('defaultApiExplorerPage.supportButtonTitle')}\n </SupportButton>\n </ContentHeader>\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns || defaultColumns}\n actions={actions}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n};\n"],"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ACF;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultApiExplorerPage.esm.js","sources":["../../../src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { HeaderPage } from '@backstage/ui';\nimport { CatalogTable, CatalogTableRow } from '@backstage/plugin-catalog';\nimport {\n EntityKindPicker,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityListPagination,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n CatalogFilterLayout,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport { registerComponentRouteRef } from '../../routes';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\n CatalogTable.columns.createTitleColumn({ hidden: true }),\n CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),\n CatalogTable.columns.createSystemColumn(),\n CatalogTable.columns.createOwnerColumn(),\n CatalogTable.columns.createSpecTypeColumn(),\n CatalogTable.columns.createSpecLifecycleColumn(),\n CatalogTable.columns.createMetadataDescriptionColumn(),\n CatalogTable.columns.createTagsColumn(),\n];\n\n/**\n * DefaultApiExplorerPageProps\n * @public\n */\nexport type DefaultApiExplorerPageProps = {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n};\n\ntype ApiExplorerPageContentProps = {\n initiallySelectedFilter: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n};\n\nfunction ApiExplorerPageContent(props: ApiExplorerPageContentProps) {\n const {\n initiallySelectedFilter,\n columns,\n actions,\n ownerPickerMode,\n pagination,\n } = props;\n\n return (\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable columns={columns || defaultColumns} actions={actions} />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n );\n}\n\n/**\n * DefaultApiExplorerPage\n * @public\n */\nexport const DefaultApiExplorerPage = (props: DefaultApiExplorerPageProps) => {\n const {\n initiallySelectedFilter = 'all',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n } = props;\n\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const generatedSubtitle = t('defaultApiExplorerPage.subtitle', {\n orgName: configApi.getOptionalString('organization.name') ?? 'Backstage',\n });\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const headerActions = (\n <>\n {allowed && (\n <CreateButton\n title={t('defaultApiExplorerPage.createButtonTitle')}\n to={registerComponentLink?.()}\n />\n )}\n <SupportButton>\n {t('defaultApiExplorerPage.supportButtonTitle')}\n </SupportButton>\n </>\n );\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title={t('defaultApiExplorerPage.title')}\n subtitle={generatedSubtitle}\n pageTitleOverride={t('defaultApiExplorerPage.pageTitleOverride')}\n >\n <Content>\n <ContentHeader title=\"\">{headerActions}</ContentHeader>\n <ApiExplorerPageContent\n initiallySelectedFilter={initiallySelectedFilter}\n columns={columns}\n actions={actions}\n ownerPickerMode={ownerPickerMode}\n pagination={pagination}\n />\n </Content>\n </PageWithHeader>\n );\n};\n\nexport const NfsApiExplorerPage = (props: DefaultApiExplorerPageProps) => {\n const {\n initiallySelectedFilter = 'all',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n } = props;\n\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const generatedSubtitle = t('defaultApiExplorerPage.subtitle', {\n orgName: configApi.getOptionalString('organization.name') ?? 'Backstage',\n });\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const headerActions = (\n <>\n {allowed && (\n <CreateButton\n title={t('defaultApiExplorerPage.createButtonTitle')}\n to={registerComponentLink?.()}\n />\n )}\n <SupportButton>\n {t('defaultApiExplorerPage.supportButtonTitle')}\n </SupportButton>\n </>\n );\n\n return (\n <>\n <HeaderPage title={generatedSubtitle} customActions={headerActions} />\n <Content>\n <ApiExplorerPageContent\n initiallySelectedFilter={initiallySelectedFilter}\n columns={columns}\n actions={actions}\n ownerPickerMode={ownerPickerMode}\n pagination={pagination}\n />\n </Content>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA+CA,MAAM,cAAA,GAAiD;AAAA,EACrD,aAAa,OAAA,CAAQ,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACvD,aAAa,OAAA,C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,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAO,iBAAA,EAAmB,aAAA,EAAe,aAAA,EAAe,CAAA;AAAA,wBACnE,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,uBAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAA;AAAA,QACA,eAAA;AAAA,QACA;AAAA;AAAA,KACF,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -2,12 +2,16 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { RELATION_CONSUMES_API } from '@backstage/catalog-model';
3
3
  import Typography from '@material-ui/core/Typography';
4
4
  import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
5
- import { getApiEntityColumns } from './presets.esm.js';
5
+ import { EntityRelationCard } from '@backstage/plugin-catalog-react/alpha';
6
+ import { getApiEntityColumnConfig, getApiEntityColumns } from './presets.esm.js';
6
7
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
7
8
  import { useTranslationRef } from '@backstage/frontend-plugin-api';
8
9
  import { apiDocsTranslationRef } from '../../translation.esm.js';
9
10
 
10
- const ConsumedApisCard = (props) => {
11
+ function isLegacyProps(props) {
12
+ return "variant" in props || "columns" in props || "tableOptions" in props;
13
+ }
14
+ function ConsumedApisCardLegacy(props) {
11
15
  const { t } = useTranslationRef(apiDocsTranslationRef);
12
16
  const {
13
17
  variant = "gridItem",
@@ -55,6 +59,31 @@ const ConsumedApisCard = (props) => {
55
59
  entities
56
60
  }
57
61
  );
62
+ }
63
+ const ConsumedApisCard = (props) => {
64
+ const { t } = useTranslationRef(apiDocsTranslationRef);
65
+ const { entity } = useEntity();
66
+ if (isLegacyProps(props)) {
67
+ return /* @__PURE__ */ jsx(ConsumedApisCardLegacy, { ...props });
68
+ }
69
+ const {
70
+ title = t("consumedApisCard.title"),
71
+ columnConfig = getApiEntityColumnConfig(t)
72
+ } = props;
73
+ return /* @__PURE__ */ jsx(
74
+ EntityRelationCard,
75
+ {
76
+ title,
77
+ relationType: RELATION_CONSUMES_API,
78
+ columnConfig,
79
+ emptyState: {
80
+ message: t("consumedApisCard.emptyContent.title", {
81
+ entity: entity.kind.toLocaleLowerCase("en-US")
82
+ }),
83
+ helpLink: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
84
+ }
85
+ }
86
+ );
58
87
  };
59
88
 
60
89
  export { ConsumedApisCard };
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumedApisCard.esm.js","sources":["../../../src/components/ApisCards/ConsumedApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_CONSUMES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport { getApiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const ConsumedApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const {\n variant = 'gridItem',\n title = t('consumedApisCard.title'),\n columns = getApiEntityColumns(t),\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_CONSUMES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('consumedApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('consumedApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link\n to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\"\n externalLinkIcon\n >\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwCO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAK3B;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,MAAM;AAAA,IACJ,OAAA,GAAU,UAAA;AAAA,IACV,KAAA,GAAQ,EAAE,wBAAwB,CAAA;AAAA,IAClC,OAAA,GAAU,oBAAoB,CAAC,CAAA;AAAA,IAC/B,eAAe;AAAC,GAClB,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,EAAE,QAAA,EAAU,OAAA,EAAS,KAAA,EAAM,GAAI,mBAAmB,MAAA,EAAQ;AAAA,IAC9D,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BACG,QAAA,EAAA,EAAS,OAAA,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../../../src/components/ApisCards/ConsumedApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_CONSUMES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport {\n EntityRelationCard,\n EntityColumnConfig,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { getApiEntityColumns, getApiEntityColumnConfig } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/** @public */\nexport interface ConsumedApisCardProps {\n title?: string;\n columnConfig?: EntityColumnConfig[];\n}\n\n/**\n * Props for the legacy MUI-based rendering.\n * @deprecated Use {@link ConsumedApisCardProps} instead.\n * @public\n */\nexport interface ConsumedApisCardLegacyProps {\n title?: string;\n /** @deprecated Use `columnConfig` instead. */\n variant?: InfoCardVariants;\n /** @deprecated Use `columnConfig` instead. */\n columns?: TableColumn<ApiEntity>[];\n /** @deprecated Use `columnConfig` instead. */\n tableOptions?: TableOptions;\n}\n\nfunction isLegacyProps(\n props: ConsumedApisCardProps | ConsumedApisCardLegacyProps,\n): props is ConsumedApisCardLegacyProps {\n return 'variant' in props || 'columns' in props || 'tableOptions' in props;\n}\n\nfunction ConsumedApisCardLegacy(props: ConsumedApisCardLegacyProps) {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const {\n variant = 'gridItem',\n title = t('consumedApisCard.title'),\n columns = getApiEntityColumns(t),\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_CONSUMES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('consumedApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('consumedApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link\n to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\"\n externalLinkIcon\n >\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n}\n\n/**\n * @public\n */\nexport const ConsumedApisCard = (\n props: ConsumedApisCardProps | ConsumedApisCardLegacyProps,\n) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const { entity } = useEntity();\n\n if (isLegacyProps(props)) {\n return <ConsumedApisCardLegacy {...props} />;\n }\n\n const {\n title = t('consumedApisCard.title'),\n columnConfig = getApiEntityColumnConfig(t),\n } = props;\n\n return (\n <EntityRelationCard\n title={title}\n relationType={RELATION_CONSUMES_API}\n columnConfig={columnConfig}\n emptyState={{\n message: t('consumedApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n }),\n helpLink:\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional',\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;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AAuC;AAAA,UAChD,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,iBAAA,CAAkB,OAAO;AAAA,SAC9C,CAAA;AAAA,QACD,QAAA,EACE;AAAA;AACJ;AAAA,GACF;AAEJ;;;;"}
@@ -1,14 +1,18 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { RELATION_HAS_PART } from '@backstage/catalog-model';
3
3
  import Typography from '@material-ui/core/Typography';
4
- import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
4
+ import { useEntity, EntityTable, useRelatedEntities } from '@backstage/plugin-catalog-react';
5
+ import { EntityRelationCard } from '@backstage/plugin-catalog-react/alpha';
5
6
  import { useMemo } from 'react';
6
- import { createSpecApiTypeColumn } from './presets.esm.js';
7
+ import { getHasApisColumnConfig, createSpecApiTypeColumn } from './presets.esm.js';
7
8
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
8
9
  import { useTranslationRef } from '@backstage/frontend-plugin-api';
9
10
  import { apiDocsTranslationRef } from '../../translation.esm.js';
10
11
 
11
- const HasApisCard = (props) => {
12
+ function isLegacyProps(props) {
13
+ return "variant" in props || "columns" in props || "tableOptions" in props;
14
+ }
15
+ function HasApisCardLegacy(props) {
12
16
  const { t } = useTranslationRef(apiDocsTranslationRef);
13
17
  const presetColumns = useMemo(() => {
14
18
  return [
@@ -59,6 +63,32 @@ const HasApisCard = (props) => {
59
63
  entities
60
64
  }
61
65
  );
66
+ }
67
+ const HasApisCard = (props) => {
68
+ const { t } = useTranslationRef(apiDocsTranslationRef);
69
+ const { entity } = useEntity();
70
+ if (isLegacyProps(props)) {
71
+ return /* @__PURE__ */ jsx(HasApisCardLegacy, { ...props });
72
+ }
73
+ const {
74
+ title = t("hasApisCard.title"),
75
+ columnConfig = getHasApisColumnConfig(t)
76
+ } = props;
77
+ return /* @__PURE__ */ jsx(
78
+ EntityRelationCard,
79
+ {
80
+ title,
81
+ entityKind: "API",
82
+ relationType: RELATION_HAS_PART,
83
+ columnConfig,
84
+ emptyState: {
85
+ message: t("hasApisCard.emptyContent.title", {
86
+ entity: entity.kind.toLocaleLowerCase("en-US")
87
+ }),
88
+ helpLink: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api"
89
+ }
90
+ }
91
+ );
62
92
  };
63
93
 
64
94
  export { HasApisCard };
@@ -1 +1 @@
1
- {"version":3,"file":"HasApisCard.esm.js","sources":["../../../src/components/ApisCards/HasApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_HAS_PART } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport { useMemo } from 'react';\nimport { createSpecApiTypeColumn } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const HasApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const presetColumns: TableColumn<ApiEntity>[] = useMemo(() => {\n return [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(t),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n ];\n }, [t]);\n const {\n variant = 'gridItem',\n title = t('hasApisCard.title'),\n columns = presetColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_HAS_PART,\n kind: 'API',\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('hasApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('hasApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyCO,MAAM,WAAA,GAAc,CAAC,KAAA,KAKtB;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,MAAM,aAAA,GAA0C,QAAQ,MAAM;AAC5D,IAAA,OAAO;AAAA,MACL,YAAY,OAAA,CAAQ,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,MAChE,WAAA,CAAY,QAAQ,iBAAA,EAAkB;AAAA,MACtC,wBAAwB,CAAC,CAAA;AAAA,MACzB,WAAA,CAAY,QAAQ,yBAAA,EAA0B;AAAA,MAC9C,WAAA,CAAY,QAAQ,+BAAA;AAAgC,KACtD;AAAA,EACF,CAAA,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AA,EAAkC;AAAA,UACnC,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,iBAAA,CAAkB,OAAO;AAAA,SAC9C,CAAA,EACH,CAAA;AAAA,wBACA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,gFAAA,EACN,QAAA,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CAAA,EACF;AAAA,OAAA,EACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"HasApisCard.esm.js","sources":["../../../src/components/ApisCards/HasApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_HAS_PART } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport {\n EntityRelationCard,\n EntityColumnConfig,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { useMemo } from 'react';\nimport { createSpecApiTypeColumn, getHasApisColumnConfig } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/** @public */\nexport interface HasApisCardProps {\n title?: string;\n columnConfig?: EntityColumnConfig[];\n}\n\n/**\n * Props for the legacy MUI-based rendering.\n * @deprecated Use {@link HasApisCardProps} instead.\n * @public\n */\nexport interface HasApisCardLegacyProps {\n title?: string;\n /** @deprecated Use `columnConfig` instead. */\n variant?: InfoCardVariants;\n /** @deprecated Use `columnConfig` instead. */\n columns?: TableColumn<ApiEntity>[];\n /** @deprecated Use `columnConfig` instead. */\n tableOptions?: TableOptions;\n}\n\nfunction isLegacyProps(\n props: HasApisCardProps | HasApisCardLegacyProps,\n): props is HasApisCardLegacyProps {\n return 'variant' in props || 'columns' in props || 'tableOptions' in props;\n}\n\nfunction HasApisCardLegacy(props: HasApisCardLegacyProps) {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const presetColumns: TableColumn<ApiEntity>[] = useMemo(() => {\n return [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(t),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n ];\n }, [t]);\n const {\n variant = 'gridItem',\n title = t('hasApisCard.title'),\n columns = presetColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_HAS_PART,\n kind: 'API',\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('hasApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('hasApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n}\n\n/**\n * @public\n */\nexport const HasApisCard = (\n props: HasApisCardProps | HasApisCardLegacyProps,\n) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const { entity } = useEntity();\n\n if (isLegacyProps(props)) {\n return <HasApisCardLegacy {...props} />;\n }\n\n const {\n title = t('hasApisCard.title'),\n columnConfig = getHasApisColumnConfig(t),\n } = props;\n\n return (\n <EntityRelationCard\n title={title}\n entityKind=\"API\"\n relationType={RELATION_HAS_PART}\n columnConfig={columnConfig}\n emptyState={{\n message: t('hasApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n }),\n helpLink:\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api',\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA+DA,SAAS,cACP,KAAA,EACiC;AACjC,EAAA,OAAO,SAAA,IAAa,KAAA,IAAS,SAAA,IAAa,KAAA,IAAS,cAAA,IAAkB,KAAA;AACvE;AAEA,SAAS,kBAAkB,KAAA,EAA+B;AACxD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,MAAM,aAAA,GAA0C,QAAQ,MAAM;AAC5D,IAAA,OAAO;AAAA,MACL,YAAY,OAAA,CAAQ,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,MAChE,WAAA,CAAY,QAAQ,iBAAA,EAAkB;AAAA,MACtC,wBAAwB,CAAC,CAAA;AAAA,MACzB,WAAA,CAAY,QAAQ,yBAAA,EAA0B;AAAA,MAC9C,WAAA,CAAY,QAAQ,+BAAA;AAAgC,KACtD;AAAA,EACF,CAAA,EAAG,CAAC,CAAC,CAAC,CAAA;AACN,EAAA,MAAM;AAAA,IACJ,OAAA,GAAU,UAAA;AAA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