@backstage/plugin-api-docs 0.13.5-next.1 → 0.13.5

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,5 +1,43 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
+ ## 0.13.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 9c9d425: Fixed invisible text in parameter input fields when using dark mode in OpenAPI definition pages
8
+ - 538c985: Updated installation documentation to use feature discovery as the default.
9
+ - 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.
10
+ - 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.
11
+ - aa29b50: New frontend system pages now use the default plugin header together with `HeaderPage` instead of the legacy core page header pattern.
12
+ - 3f36ce1: Updated alpha plugin icons to follow the new frontend icon sizing rules when rendered in plugin and navigation surfaces.
13
+ - 0be2541: Promoted the plugin's translation ref to the stable package entry point. It was previously only available through the alpha entry point.
14
+ - ca277ef: Updated dependency `graphiql` to `3.9.0` to address security vulnerability in `markdown-it` package.
15
+ Updated dependency `@graphiql/react` to `0.29.0` to match the version used by `graphiql`.
16
+ Moved dependency `graphql-config` to `devDependencies` as it is needed only for types.
17
+ - Updated dependencies
18
+ - @backstage/plugin-catalog-react@2.1.0
19
+ - @backstage/ui@0.13.0
20
+ - @backstage/core-plugin-api@1.12.4
21
+ - @backstage/core-components@0.18.8
22
+ - @backstage/frontend-plugin-api@0.15.0
23
+ - @backstage/plugin-catalog@2.0.0
24
+ - @backstage/plugin-permission-react@0.4.41
25
+ - @backstage/catalog-model@1.7.7
26
+
27
+ ## 0.13.5-next.2
28
+
29
+ ### Patch Changes
30
+
31
+ - ca277ef: Updated dependency `graphiql` to `3.9.0` to address security vulnerability in `markdown-it` package.
32
+ Updated dependency `@graphiql/react` to `0.29.0` to match the version used by `graphiql`.
33
+ Moved dependency `graphql-config` to `devDependencies` as it is needed only for types.
34
+ - Updated dependencies
35
+ - @backstage/frontend-plugin-api@0.15.0-next.1
36
+ - @backstage/core-plugin-api@1.12.4-next.1
37
+ - @backstage/plugin-catalog-react@2.1.0-next.2
38
+ - @backstage/core-components@0.18.8-next.1
39
+ - @backstage/plugin-catalog@2.0.0-next.2
40
+
3
41
  ## 0.13.5-next.1
4
42
 
5
43
  ### Patch Changes
package/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # API Documentation
2
2
 
3
- > Disclaimer:
4
- > If you are looking for documentation on the experimental new frontend system support, please go [here](./README-alpha.md).
5
-
6
3
  This is an extension for the catalog plugin that provides components to discover and display API entities.
7
4
  APIs define the interface between components, see the [system model](https://backstage.io/docs/features/software-catalog/system-model) for details.
8
5
  They are defined in machine readable formats and provide a human readable documentation.
@@ -28,77 +25,32 @@ To link that a component provides or consumes an API, see the [`providesApis`](h
28
25
 
29
26
  > The plugin is already added when using `npx @backstage/create-app` so you can skip these steps.
30
27
 
31
- 1. Install the API docs plugin
32
-
33
28
  ```bash
34
29
  # From your Backstage root directory
35
30
  yarn --cwd packages/app add @backstage/plugin-api-docs
36
31
  ```
37
32
 
38
- 2. Add the `ApiExplorerPage` extension to the app:
39
-
40
- ```tsx
41
- // In packages/app/src/App.tsx
42
-
43
- import { ApiExplorerPage } from '@backstage/plugin-api-docs';
44
-
45
- <Route path="/api-docs" element={<ApiExplorerPage />} />;
46
- ```
47
-
48
- 3. Add one of the provided widgets to the EntityPage:
49
-
50
- ```tsx
51
- // packages/app/src/components/catalog/EntityPage.tsx
33
+ Once installed, the plugin is automatically available in your app through the default feature discovery. For more details and alternative installation methods, see [installing plugins](https://backstage.io/docs/frontend-system/building-apps/installing-plugins).
52
34
 
53
- import {
54
- EntityAboutCard,
55
- EntityApiDefinitionCard,
56
- EntityConsumingComponentsCard,
57
- EntityProvidingComponentsCard,
58
- } from '@backstage/plugin-api-docs';
35
+ You can enable entity cards and tabs on the catalog entity page through configuration:
59
36
 
60
- const apiPage = (
61
- <EntityLayout>
62
- <EntityLayout.Route path="/" title="Overview">
63
- <Grid container spacing={3}>
64
- <Grid item xs={12} md={6}>
65
- <EntityAboutCard />
66
- </Grid>
67
- <Grid container>
68
- <Grid item md={12}>
69
- <Grid item xs={12} md={6}>
70
- <EntityProvidingComponentsCard />
71
- </Grid>
72
- <Grid item xs={12} md={6}>
73
- <EntityConsumingComponentsCard />
74
- </Grid>
75
- </Grid>
76
- </Grid>
77
- </Grid>
78
- </EntityLayout.Route>
79
-
80
- <EntityLayout.Route path="/definition" title="Definition">
81
- <Grid container spacing={3}>
82
- <Grid item xs={12}>
83
- <EntityApiDefinitionCard />
84
- </Grid>
85
- </Grid>
86
- </EntityLayout.Route>
87
- </EntityLayout>
88
- );
89
-
90
- // ...
91
-
92
- export const entityPage = (
93
- <EntitySwitch>
94
- // ...
95
- <EntitySwitch.Case if={isKind('api')} children={apiPage} />
96
- // ...
97
- </EntitySwitch>
98
- );
37
+ ```yaml
38
+ # app-config.yaml
39
+ app:
40
+ extensions:
41
+ - entity-card:api-docs/providing-components:
42
+ config:
43
+ filter:
44
+ kind: api
45
+ - entity-card:api-docs/consuming-components:
46
+ config:
47
+ filter:
48
+ kind: api
49
+ - entity-content:api-docs/definition
50
+ - entity-content:api-docs/apis
99
51
  ```
100
52
 
101
- There are other components to discover in [`./src/components`](./src/components) that are also added by the default app.
53
+ For the full list of available extensions and their configuration options, see the [README-alpha.md](./README-alpha.md).
102
54
 
103
55
  ## Customizations
104
56
 
@@ -388,6 +340,75 @@ import { ApiExplorerPage } from '@backstage/plugin-api-docs';
388
340
  />;
389
341
  ```
390
342
 
343
+ ## Old Frontend System
344
+
345
+ If your Backstage app uses the old frontend system, you need to manually wire the plugin into your app as outlined in this section. If you are on the new frontend system, you can skip this.
346
+
347
+ 1. Add the `ApiExplorerPage` extension to the app:
348
+
349
+ ```tsx
350
+ // In packages/app/src/App.tsx
351
+
352
+ import { ApiExplorerPage } from '@backstage/plugin-api-docs';
353
+
354
+ <Route path="/api-docs" element={<ApiExplorerPage />} />;
355
+ ```
356
+
357
+ 2. Add one of the provided widgets to the EntityPage:
358
+
359
+ ```tsx
360
+ // packages/app/src/components/catalog/EntityPage.tsx
361
+
362
+ import {
363
+ EntityAboutCard,
364
+ EntityApiDefinitionCard,
365
+ EntityConsumingComponentsCard,
366
+ EntityProvidingComponentsCard,
367
+ } from '@backstage/plugin-api-docs';
368
+
369
+ const apiPage = (
370
+ <EntityLayout>
371
+ <EntityLayout.Route path="/" title="Overview">
372
+ <Grid container spacing={3}>
373
+ <Grid item xs={12} md={6}>
374
+ <EntityAboutCard />
375
+ </Grid>
376
+ <Grid container>
377
+ <Grid item md={12}>
378
+ <Grid item xs={12} md={6}>
379
+ <EntityProvidingComponentsCard />
380
+ </Grid>
381
+ <Grid item xs={12} md={6}>
382
+ <EntityConsumingComponentsCard />
383
+ </Grid>
384
+ </Grid>
385
+ </Grid>
386
+ </Grid>
387
+ </EntityLayout.Route>
388
+
389
+ <EntityLayout.Route path="/definition" title="Definition">
390
+ <Grid container spacing={3}>
391
+ <Grid item xs={12}>
392
+ <EntityApiDefinitionCard />
393
+ </Grid>
394
+ </Grid>
395
+ </EntityLayout.Route>
396
+ </EntityLayout>
397
+ );
398
+
399
+ // ...
400
+
401
+ export const entityPage = (
402
+ <EntitySwitch>
403
+ // ...
404
+ <EntitySwitch.Case if={isKind('api')} children={apiPage} />
405
+ // ...
406
+ </EntitySwitch>
407
+ );
408
+ ```
409
+
410
+ There are other components to discover in [`./src/components`](./src/components) that are also added by the default app.
411
+
391
412
  ## Links
392
413
 
393
414
  - [The Backstage homepage](https://backstage.io)
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
  }, {
@@ -339,7 +304,6 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
339
304
  kind: "page";
340
305
  name: undefined;
341
306
  params: {
342
- defaultPath?: [Error: `Use the 'path' param instead`];
343
307
  path: string;
344
308
  title?: string;
345
309
  icon?: _backstage_frontend_plugin_api.IconElement;
@@ -350,4 +314,40 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
350
314
  }>;
351
315
  }>;
352
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
+
353
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';
@@ -17,7 +17,7 @@ const apiDocsNavItem = NavItemBlueprint.make({
17
17
  params: {
18
18
  title: "APIs",
19
19
  routeRef: rootRoute,
20
- icon: () => /* @__PURE__ */ jsx(AppIcon, { id: "kind:api" })
20
+ icon: () => /* @__PURE__ */ jsx(AppIcon, { fontSize: "inherit", id: "kind:api" })
21
21
  }
22
22
  });
23
23
  const apiDocsConfigApi = ApiBlueprint.make({
@@ -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
  });
@@ -142,7 +144,7 @@ const apiDocsApisEntityContent = EntityContentBlueprint.make({
142
144
  var alpha = createFrontendPlugin({
143
145
  pluginId: "api-docs",
144
146
  title: "APIs",
145
- icon: /* @__PURE__ */ jsx(AppIcon, { id: "kind:api" }),
147
+ icon: /* @__PURE__ */ jsx(AppIcon, { fontSize: "inherit", id: "kind:api" }),
146
148
  info: { packageJson: () => import('./package.json.esm.js') },
147
149
  routes: {
148
150
  root: rootRoute
@@ -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 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 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,IAAA,EAAM,sBAAM,GAAA,CAAC,OAAA,EAAA,EAAQ,IAAG,UAAA,EAAW;AAAA;AAEvC,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAA,CAAK;AAAA,EACzC,IAAA,EAAM,QAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YA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AAA,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,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA;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qBACpC,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,CAAA,EAAG,YAAW,SAAA,EACrC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,CAAA,CAAE,gBAAA,EAAF,EAAmB,CAAA,EACtB,CAAA;AAAA,sBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,CAAA,CAAE,gBAAA,EAAF,EAAmB,CAAA,EACtB;AAAA,KAAA,EACF,CACD;AAAA;AAEP,CAAC,CAAA;AAED,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,UAAA;AAAA,EACV,KAAA,EAAO,MAAA;AAAA,EACP,sBAAM,GAAA,CAAC,OAAA,EAAA,EAAQ,QAAA,EAAS,SAAA,EAAU,IAAG,UAAA,EAAW,CAAA;AAAA,EAChD,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,uBAAiB,CAAA,EAAE;AAAA,EACrD,MAAA,EAAQ;AAAA,IACN,IAAA,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;AAQM,MAAM,qBAAA,GAAwBA;;;;"}
@@ -1,6 +1,7 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { PageWithHeader, Content, ContentHeader, 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"],"names":[],"mappings":";;;;;;;;;;;AA8CA,MAAM,cAAA,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plorerPage.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,CAAQ,gBAAA,CAAiB,EAAE,WAAA,EAAa,OAAO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