@backstage/plugin-api-docs 0.12.6-next.2 → 0.12.7-next.0
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 +35 -0
- package/dist/alpha.d.ts +33 -1
- package/dist/alpha.esm.js +1 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js +5 -2
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js.map +1 -1
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js +10 -5
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApisCards/ConsumedApisCard.esm.js +11 -10
- package/dist/components/ApisCards/ConsumedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/HasApisCard.esm.js +19 -15
- package/dist/components/ApisCards/HasApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/ProvidedApisCard.esm.js +11 -10
- package/dist/components/ApisCards/ProvidedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/presets.esm.js +20 -15
- package/dist/components/ApisCards/presets.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js +9 -6
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js +9 -6
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js.map +1 -1
- package/dist/translation.esm.js +72 -0
- package/dist/translation.esm.js.map +1 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @backstage/plugin-api-docs
|
|
2
2
|
|
|
3
|
+
## 0.12.7-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-compat-api@0.4.2-next.0
|
|
9
|
+
- @backstage/plugin-catalog-react@1.18.0-next.0
|
|
10
|
+
- @backstage/catalog-model@1.7.3
|
|
11
|
+
- @backstage/core-components@0.17.1
|
|
12
|
+
- @backstage/core-plugin-api@1.10.6
|
|
13
|
+
- @backstage/frontend-plugin-api@0.10.1
|
|
14
|
+
- @backstage/plugin-catalog@1.29.1-next.0
|
|
15
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
16
|
+
- @backstage/plugin-permission-react@0.4.33
|
|
17
|
+
|
|
18
|
+
## 0.12.6
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 317bc3d: api-docs plugin support i18n
|
|
23
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
24
|
+
|
|
25
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/plugin-catalog@1.29.0
|
|
29
|
+
- @backstage/plugin-catalog-react@1.17.0
|
|
30
|
+
- @backstage/frontend-plugin-api@0.10.1
|
|
31
|
+
- @backstage/core-compat-api@0.4.1
|
|
32
|
+
- @backstage/core-components@0.17.1
|
|
33
|
+
- @backstage/core-plugin-api@1.10.6
|
|
34
|
+
- @backstage/plugin-permission-react@0.4.33
|
|
35
|
+
- @backstage/catalog-model@1.7.3
|
|
36
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
37
|
+
|
|
3
38
|
## 0.12.6-next.2
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -4,6 +4,38 @@ import * as react from 'react';
|
|
|
4
4
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
5
5
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
declare const apiDocsTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"api-docs", {
|
|
11
|
+
readonly "apiDefinitionDialog.closeButtonTitle": "Close";
|
|
12
|
+
readonly "apiDefinitionDialog.tabsAriaLabel": "API definition options";
|
|
13
|
+
readonly "apiDefinitionDialog.toggleButtonAriaLabel": "Toggle API Definition Dialog";
|
|
14
|
+
readonly "defaultApiExplorerPage.title": "APIs";
|
|
15
|
+
readonly "defaultApiExplorerPage.subtitle": "{{orgName}} API Explorer";
|
|
16
|
+
readonly "defaultApiExplorerPage.pageTitleOverride": "APIs";
|
|
17
|
+
readonly "defaultApiExplorerPage.createButtonTitle": "Register Existing API";
|
|
18
|
+
readonly "defaultApiExplorerPage.supportButtonTitle": "All your APIs";
|
|
19
|
+
readonly "consumedApisCard.error.title": "Could not load APIs";
|
|
20
|
+
readonly "consumedApisCard.title": "Consumed APIs";
|
|
21
|
+
readonly "consumedApisCard.emptyContent.title": "This {{entity}} does not consume any APIs.";
|
|
22
|
+
readonly "hasApisCard.error.title": "Could not load APIs";
|
|
23
|
+
readonly "hasApisCard.title": "APIs";
|
|
24
|
+
readonly "hasApisCard.emptyContent.title": "This {{entity}} does not contain any APIs.";
|
|
25
|
+
readonly "providedApisCard.error.title": "Could not load APIs";
|
|
26
|
+
readonly "providedApisCard.title": "Provided APIs";
|
|
27
|
+
readonly "providedApisCard.emptyContent.title": "This {{entity}} does not provide any APIs.";
|
|
28
|
+
readonly "apiEntityColumns.typeTitle": "Type";
|
|
29
|
+
readonly "apiEntityColumns.apiDefinitionTitle": "API Definition";
|
|
30
|
+
readonly "consumingComponentsCard.error.title": "Could not load components";
|
|
31
|
+
readonly "consumingComponentsCard.title": "Consumers";
|
|
32
|
+
readonly "consumingComponentsCard.emptyContent.title": "No component consumes this API.";
|
|
33
|
+
readonly "providingComponentsCard.error.title": "Could not load components";
|
|
34
|
+
readonly "providingComponentsCard.title": "Providers";
|
|
35
|
+
readonly "providingComponentsCard.emptyContent.title": "No component provides this API.";
|
|
36
|
+
readonly apisCardHelpLinkTitle: "Learn how to change this";
|
|
37
|
+
}>;
|
|
38
|
+
|
|
7
39
|
declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
8
40
|
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
9
41
|
}, {
|
|
@@ -285,4 +317,4 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
285
317
|
}>;
|
|
286
318
|
}>;
|
|
287
319
|
|
|
288
|
-
export { _default as default };
|
|
320
|
+
export { apiDocsTranslationRef, _default as default };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -12,6 +12,7 @@ import { defaultDefinitionWidgets } from './components/ApiDefinitionCard/ApiDefi
|
|
|
12
12
|
import '@material-ui/core/Typography';
|
|
13
13
|
import { rootRoute, registerComponentRouteRef } from './routes.esm.js';
|
|
14
14
|
import { EntityCardBlueprint, EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
15
|
+
export { apiDocsTranslationRef } from './translation.esm.js';
|
|
15
16
|
|
|
16
17
|
const apiDocsNavItem = NavItemBlueprint.make({
|
|
17
18
|
params: {
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -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 createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-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: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\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});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting 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 defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting 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: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\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 compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting 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 =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting 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 =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting 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 compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting 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 compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/definition',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\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});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(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"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+CA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qBAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE;AAAA;AAEvD,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,IAAM,EAAA,QAAA;AAAA,EACN,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A,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 createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-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: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\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});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting 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 defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting 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: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\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 compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting 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 =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting 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 =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting 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 compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting 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 compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/definition',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\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});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(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":";;;;;;;;;;;;;;;;AA+CA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qBAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE;AAAA;AAEvD,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,gBAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AACb,QAAA,MAAM,oBAAoB,wBAAyB,EAAA;AACnD,QAAO,OAAA;AAAA,UACL,sBAAA,EAAwB,CAAC,SAAyB,KAAA;AAChD,YAAA,OAAO,kBAAkB,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,SAAA,CAAU,KAAK,IAAI,CAAA;AAAA;AACnE,SACF;AAAA;AACF,KACD;AAAA;AAEL,CAAC,CAAA;AAED,MAAM,mBAAA,GAAsB,cAAc,iBAAkB,CAAA;AAAA,EAC1D,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAAA,MAEN,uBAAA,EAAyB,CACvB,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,CAAC,SAAS,SAAW,EAAA,KAAK,CAAC,CAAA,CAAE,QAAS;AAAA;AACjD,GACF;AAAA,EACA,OAAQ,CAAA,eAAA,E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,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,EAAmB,CACtB,EAAA;AAAA,SACF,EAAA;AAAA;AACF;AACF;AAEN,CAAC,CAAA;AAED,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,sBAAsB,SAAS;AAAA,GACvC;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,WAAA,EAAa,sBAAsB,yBAAyB;AAAA,GAC9D;AAAA,EACA,UAAY,EAAA;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;;;;"}
|
|
@@ -13,6 +13,8 @@ import { makeStyles } from '@material-ui/core/styles';
|
|
|
13
13
|
import { useState, useEffect } from 'react';
|
|
14
14
|
import { apiDocsConfigRef } from '../../config.esm.js';
|
|
15
15
|
import { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js';
|
|
16
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
17
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
16
18
|
|
|
17
19
|
const useStyles = makeStyles((theme) => ({
|
|
18
20
|
fullHeightDialog: {
|
|
@@ -72,6 +74,7 @@ function ApiDefinitionDialog(props) {
|
|
|
72
74
|
const { open, entity, onClose } = props;
|
|
73
75
|
const [activeTab, setActiveTab] = useState(0);
|
|
74
76
|
const classes = useStyles();
|
|
77
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
75
78
|
useEffect(() => {
|
|
76
79
|
setActiveTab(0);
|
|
77
80
|
}, [open]);
|
|
@@ -104,7 +107,7 @@ function ApiDefinitionDialog(props) {
|
|
|
104
107
|
variant: "scrollable",
|
|
105
108
|
value: activeTab,
|
|
106
109
|
onChange: (_, newValue) => setActiveTab(newValue),
|
|
107
|
-
"aria-label": "
|
|
110
|
+
"aria-label": t("apiDefinitionDialog.tabsAriaLabel"),
|
|
108
111
|
className: classes.tabs,
|
|
109
112
|
children: [
|
|
110
113
|
definitionWidget ? /* @__PURE__ */ jsx(Tab, { label: definitionWidget.title, ...a11yProps(tabIndex++) }) : null,
|
|
@@ -121,7 +124,7 @@ function ApiDefinitionDialog(props) {
|
|
|
121
124
|
}
|
|
122
125
|
) })
|
|
123
126
|
] }),
|
|
124
|
-
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, color: "primary", children: "
|
|
127
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, color: "primary", children: t("apiDefinitionDialog.closeButtonTitle") }) })
|
|
125
128
|
]
|
|
126
129
|
}
|
|
127
130
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiDefinitionDialog.esm.js","sources":["../../../src/components/ApiDefinitionDialog/ApiDefinitionDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ReactNode, useState, useEffect } from 'react';\nimport { apiDocsConfigRef } from '../../config';\nimport { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget';\n\nconst useStyles = makeStyles(theme => ({\n fullHeightDialog: {\n height: 'calc(100% - 64px)',\n },\n root: {\n display: 'flex',\n flexGrow: 1,\n width: '100%',\n height: '100%',\n },\n tabs: {\n borderRight: `1px solid ${theme.palette.divider}`,\n flexShrink: 0,\n },\n tabContents: {\n flexGrow: 1,\n overflowX: 'auto',\n },\n title: {\n color: theme.palette.text.primary,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.palette.text.primary,\n },\n}));\n\nfunction TabPanel(props: {\n children?: ReactNode;\n index: number;\n value: number;\n}) {\n const { children, value, index, ...other } = props;\n const classes = useStyles();\n return (\n <div\n role=\"tabpanel\"\n hidden={value !== index}\n id={`vertical-tabpanel-${index}`}\n aria-labelledby={`vertical-tab-${index}`}\n className={classes.tabContents}\n {...other}\n >\n {value === index && (\n <Box pl={3} pr={3}>\n {children}\n </Box>\n )}\n </div>\n );\n}\n\nfunction a11yProps(index: number) {\n return {\n id: `vertical-tab-${index}`,\n 'aria-controls': `vertical-tabpanel-${index}`,\n };\n}\n\n/**\n * A dialog that lets users inspect the API definition.\n *\n * @public\n */\nexport function ApiDefinitionDialog(props: {\n open: boolean;\n entity: ApiEntity;\n onClose: () => void;\n}) {\n const { open, entity, onClose } = props;\n const [activeTab, setActiveTab] = useState(0);\n const classes = useStyles();\n\n useEffect(() => {\n setActiveTab(0);\n }, [open]);\n\n const config = useApi(apiDocsConfigRef);\n const definitionWidget = config.getApiDefinitionWidget(entity);\n\n let tabIndex = 0;\n let tabPanelIndex = 0;\n\n return (\n <Dialog\n fullWidth\n maxWidth=\"xl\"\n open={open}\n onClose={onClose}\n aria-labelledby=\"api-definition-dialog-title\"\n PaperProps={{ className: classes.fullHeightDialog }}\n >\n <DialogTitle id=\"api-definition-dialog-title\" disableTypography>\n <Typography className={classes.type}>\n API - {definitionWidget?.title ?? 'Raw'}\n </Typography>\n <Typography className={classes.title} variant=\"h1\">\n {entity.metadata.title ?? entity.metadata.name}\n </Typography>\n </DialogTitle>\n <DialogContent dividers className={classes.root}>\n <Tabs\n orientation=\"vertical\"\n variant=\"scrollable\"\n value={activeTab}\n onChange={(_, newValue) => setActiveTab(newValue)}\n aria-label
|
|
1
|
+
{"version":3,"file":"ApiDefinitionDialog.esm.js","sources":["../../../src/components/ApiDefinitionDialog/ApiDefinitionDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ReactNode, useState, useEffect } from 'react';\nimport { apiDocsConfigRef } from '../../config';\nimport { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n fullHeightDialog: {\n height: 'calc(100% - 64px)',\n },\n root: {\n display: 'flex',\n flexGrow: 1,\n width: '100%',\n height: '100%',\n },\n tabs: {\n borderRight: `1px solid ${theme.palette.divider}`,\n flexShrink: 0,\n },\n tabContents: {\n flexGrow: 1,\n overflowX: 'auto',\n },\n title: {\n color: theme.palette.text.primary,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.palette.text.primary,\n },\n}));\n\nfunction TabPanel(props: {\n children?: ReactNode;\n index: number;\n value: number;\n}) {\n const { children, value, index, ...other } = props;\n const classes = useStyles();\n return (\n <div\n role=\"tabpanel\"\n hidden={value !== index}\n id={`vertical-tabpanel-${index}`}\n aria-labelledby={`vertical-tab-${index}`}\n className={classes.tabContents}\n {...other}\n >\n {value === index && (\n <Box pl={3} pr={3}>\n {children}\n </Box>\n )}\n </div>\n );\n}\n\nfunction a11yProps(index: number) {\n return {\n id: `vertical-tab-${index}`,\n 'aria-controls': `vertical-tabpanel-${index}`,\n };\n}\n\n/**\n * A dialog that lets users inspect the API definition.\n *\n * @public\n */\nexport function ApiDefinitionDialog(props: {\n open: boolean;\n entity: ApiEntity;\n onClose: () => void;\n}) {\n const { open, entity, onClose } = props;\n const [activeTab, setActiveTab] = useState(0);\n const classes = useStyles();\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n useEffect(() => {\n setActiveTab(0);\n }, [open]);\n\n const config = useApi(apiDocsConfigRef);\n const definitionWidget = config.getApiDefinitionWidget(entity);\n\n let tabIndex = 0;\n let tabPanelIndex = 0;\n\n return (\n <Dialog\n fullWidth\n maxWidth=\"xl\"\n open={open}\n onClose={onClose}\n aria-labelledby=\"api-definition-dialog-title\"\n PaperProps={{ className: classes.fullHeightDialog }}\n >\n <DialogTitle id=\"api-definition-dialog-title\" disableTypography>\n <Typography className={classes.type}>\n API - {definitionWidget?.title ?? 'Raw'}\n </Typography>\n <Typography className={classes.title} variant=\"h1\">\n {entity.metadata.title ?? entity.metadata.name}\n </Typography>\n </DialogTitle>\n <DialogContent dividers className={classes.root}>\n <Tabs\n orientation=\"vertical\"\n variant=\"scrollable\"\n value={activeTab}\n onChange={(_, newValue) => setActiveTab(newValue)}\n aria-label={t('apiDefinitionDialog.tabsAriaLabel')}\n className={classes.tabs}\n >\n {definitionWidget ? (\n <Tab label={definitionWidget.title} {...a11yProps(tabIndex++)} />\n ) : null}\n <Tab label=\"Raw\" {...a11yProps(tabIndex++)} />\n </Tabs>\n\n {definitionWidget ? (\n <TabPanel value={activeTab} index={tabPanelIndex++}>\n {definitionWidget.component(entity.spec.definition)}\n </TabPanel>\n ) : null}\n <TabPanel value={activeTab} index={tabPanelIndex++}>\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={definitionWidget?.rawLanguage ?? entity.spec.type}\n />\n </TabPanel>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose} color=\"primary\">\n {t('apiDefinitionDialog.closeButtonTitle')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,gBAAkB,EAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,CAAA;AAAA,IACV,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,WAAa,EAAA,CAAA,UAAA,E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EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,wBAAA;AAAA,YAAA;AAAA,cACC,UAAA,EAAY,OAAO,IAAK,CAAA,UAAA;AAAA,cACxB,QAAU,EAAA,gBAAA,EAAkB,WAAe,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA;AAAA,WAE3D,EAAA;AAAA,SACF,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,aACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAS,OAAS,EAAA,KAAA,EAAM,SAC7B,EAAA,QAAA,EAAA,CAAA,CAAE,sCAAsC,CAAA,EAC3C,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -6,6 +6,8 @@ import { EntityListProvider, CatalogFilterLayout, EntityKindPicker, EntityTypePi
|
|
|
6
6
|
import { registerComponentRouteRef } from '../../routes.esm.js';
|
|
7
7
|
import { usePermission } from '@backstage/plugin-permission-react';
|
|
8
8
|
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
|
|
9
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
10
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
9
11
|
|
|
10
12
|
const defaultColumns = [
|
|
11
13
|
CatalogTable.columns.createTitleColumn({ hidden: true }),
|
|
@@ -26,7 +28,10 @@ const DefaultApiExplorerPage = (props) => {
|
|
|
26
28
|
pagination
|
|
27
29
|
} = props;
|
|
28
30
|
const configApi = useApi(configApiRef);
|
|
29
|
-
const
|
|
31
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
32
|
+
const generatedSubtitle = t("defaultApiExplorerPage.subtitle", {
|
|
33
|
+
orgName: configApi.getOptionalString("organization.name") ?? "Backstage"
|
|
34
|
+
});
|
|
30
35
|
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
31
36
|
const { allowed } = usePermission({
|
|
32
37
|
permission: catalogEntityCreatePermission
|
|
@@ -35,19 +40,19 @@ const DefaultApiExplorerPage = (props) => {
|
|
|
35
40
|
PageWithHeader,
|
|
36
41
|
{
|
|
37
42
|
themeId: "apis",
|
|
38
|
-
title: "
|
|
43
|
+
title: t("defaultApiExplorerPage.title"),
|
|
39
44
|
subtitle: generatedSubtitle,
|
|
40
|
-
pageTitleOverride: "
|
|
45
|
+
pageTitleOverride: t("defaultApiExplorerPage.pageTitleOverride"),
|
|
41
46
|
children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
42
47
|
/* @__PURE__ */ jsxs(ContentHeader, { title: "", children: [
|
|
43
48
|
allowed && /* @__PURE__ */ jsx(
|
|
44
49
|
CreateButton,
|
|
45
50
|
{
|
|
46
|
-
title: "
|
|
51
|
+
title: t("defaultApiExplorerPage.createButtonTitle"),
|
|
47
52
|
to: registerComponentLink?.()
|
|
48
53
|
}
|
|
49
54
|
),
|
|
50
|
-
/* @__PURE__ */ jsx(SupportButton, { children: "
|
|
55
|
+
/* @__PURE__ */ jsx(SupportButton, { children: t("defaultApiExplorerPage.supportButtonTitle") })
|
|
51
56
|
] }),
|
|
52
57
|
/* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
|
|
53
58
|
/* @__PURE__ */ jsxs(CatalogFilterLayout.Filters, { children: [
|
|
@@ -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';\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 generatedSubtitle =
|
|
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,cAAiD,GAAA;AAAA,EACrD,aAAa,OAAQ,CAAA,iBAAA,CAAkB,EAAE,MAAA,EAAQ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stage/catalog-model';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import {
|
|
5
|
+
import { getApiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
8
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
9
|
|
|
8
10
|
const ConsumedApisCard = (props) => {
|
|
11
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
9
12
|
const {
|
|
10
13
|
variant = "gridItem",
|
|
11
|
-
title = "
|
|
12
|
-
columns =
|
|
14
|
+
title = t("consumedApisCard.title"),
|
|
15
|
+
columns = getApiEntityColumns(t),
|
|
13
16
|
tableOptions = {}
|
|
14
17
|
} = props;
|
|
15
18
|
const { entity } = useEntity();
|
|
@@ -24,7 +27,7 @@ const ConsumedApisCard = (props) => {
|
|
|
24
27
|
WarningPanel,
|
|
25
28
|
{
|
|
26
29
|
severity: "error",
|
|
27
|
-
title: "
|
|
30
|
+
title: t("consumedApisCard.error.title"),
|
|
28
31
|
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
32
|
}
|
|
30
33
|
) });
|
|
@@ -35,17 +38,15 @@ const ConsumedApisCard = (props) => {
|
|
|
35
38
|
title,
|
|
36
39
|
variant,
|
|
37
40
|
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
" does not consume any APIs."
|
|
42
|
-
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("consumedApisCard.emptyContent.title", {
|
|
42
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
43
|
+
}) }),
|
|
43
44
|
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
44
45
|
Link,
|
|
45
46
|
{
|
|
46
47
|
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional",
|
|
47
48
|
externalLinkIcon: true,
|
|
48
|
-
children: "
|
|
49
|
+
children: t("apisCardHelpLinkTitle")
|
|
49
50
|
}
|
|
50
51
|
) })
|
|
51
52
|
] }),
|
|
@@ -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 {
|
|
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":";;;;;;;;;AAwCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAA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E,qCAAuC,EAAA;AAAA,UACxC,MAAQ,EAAA,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO;AAAA,SAC9C,CACH,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,EAAG,EAAA,iGAAA;AAAA,YACH,gBAAgB,EAAA,IAAA;AAAA,YAEf,YAAE,uBAAuB;AAAA;AAAA,SAE9B,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -2,20 +2,26 @@ 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
4
|
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
5
|
+
import { useMemo } from 'react';
|
|
5
6
|
import { createSpecApiTypeColumn } from './presets.esm.js';
|
|
6
7
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
8
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
9
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
10
|
|
|
8
|
-
const presetColumns = [
|
|
9
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
10
|
-
EntityTable.columns.createOwnerColumn(),
|
|
11
|
-
createSpecApiTypeColumn(),
|
|
12
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
13
|
-
EntityTable.columns.createMetadataDescriptionColumn()
|
|
14
|
-
];
|
|
15
11
|
const HasApisCard = (props) => {
|
|
12
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
|
+
const presetColumns = useMemo(() => {
|
|
14
|
+
return [
|
|
15
|
+
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
16
|
+
EntityTable.columns.createOwnerColumn(),
|
|
17
|
+
createSpecApiTypeColumn(t),
|
|
18
|
+
EntityTable.columns.createSpecLifecycleColumn(),
|
|
19
|
+
EntityTable.columns.createMetadataDescriptionColumn()
|
|
20
|
+
];
|
|
21
|
+
}, [t]);
|
|
16
22
|
const {
|
|
17
23
|
variant = "gridItem",
|
|
18
|
-
title = "
|
|
24
|
+
title = t("hasApisCard.title"),
|
|
19
25
|
columns = presetColumns,
|
|
20
26
|
tableOptions = {}
|
|
21
27
|
} = props;
|
|
@@ -32,7 +38,7 @@ const HasApisCard = (props) => {
|
|
|
32
38
|
WarningPanel,
|
|
33
39
|
{
|
|
34
40
|
severity: "error",
|
|
35
|
-
title: "
|
|
41
|
+
title: t("hasApisCard.error.title"),
|
|
36
42
|
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
37
43
|
}
|
|
38
44
|
) });
|
|
@@ -43,12 +49,10 @@ const HasApisCard = (props) => {
|
|
|
43
49
|
title,
|
|
44
50
|
variant,
|
|
45
51
|
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
] }),
|
|
51
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api", children: "Learn how to change this." }) })
|
|
52
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("hasApisCard.emptyContent.title", {
|
|
53
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
54
|
+
}) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api", children: t("apisCardHelpLinkTitle") }) })
|
|
52
56
|
] }),
|
|
53
57
|
columns,
|
|
54
58
|
tableOptions,
|
|
@@ -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 { 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';\
|
|
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[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,OAAA;AAAA,QACT,KAAA,EAAO,EAAE,yBAAyB,CAAA;AAAA,QAClC,OAAA,sBAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA;AAAA;AAAA,KAE5D,EAAA,CAAA;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,8BACG,IAAA,CAAA,KAAA,EAAA,EAAI,OAAO,EAAE,SAAA,EAAW,UACvB,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,gCAAkC,EAAA;AAAA,UACnC,MAAQ,EAAA,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO;AAAA,SAC9C,CACH,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,gFACN,EAAA,QAAA,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -2,14 +2,17 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { RELATION_PROVIDES_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 {
|
|
5
|
+
import { getApiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
8
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
9
|
|
|
8
10
|
const ProvidedApisCard = (props) => {
|
|
11
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
9
12
|
const {
|
|
10
13
|
variant = "gridItem",
|
|
11
|
-
title = "
|
|
12
|
-
columns =
|
|
14
|
+
title = t("providedApisCard.title"),
|
|
15
|
+
columns = getApiEntityColumns(t),
|
|
13
16
|
tableOptions = {}
|
|
14
17
|
} = props;
|
|
15
18
|
const { entity } = useEntity();
|
|
@@ -24,7 +27,7 @@ const ProvidedApisCard = (props) => {
|
|
|
24
27
|
WarningPanel,
|
|
25
28
|
{
|
|
26
29
|
severity: "error",
|
|
27
|
-
title: "
|
|
30
|
+
title: t("providedApisCard.error.title"),
|
|
28
31
|
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
32
|
}
|
|
30
33
|
) });
|
|
@@ -35,17 +38,15 @@ const ProvidedApisCard = (props) => {
|
|
|
35
38
|
title,
|
|
36
39
|
variant,
|
|
37
40
|
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
" does not provide any APIs."
|
|
42
|
-
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("providedApisCard.emptyContent.title", {
|
|
42
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
43
|
+
}) }),
|
|
43
44
|
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
44
45
|
Link,
|
|
45
46
|
{
|
|
46
47
|
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional",
|
|
47
48
|
externalLinkIcon: true,
|
|
48
|
-
children: "
|
|
49
|
+
children: t("apisCardHelpLinkTitle")
|
|
49
50
|
}
|
|
50
51
|
) })
|
|
51
52
|
] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.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_PROVIDES_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 {
|
|
1
|
+
{"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.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_PROVIDES_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 ProvidedApisCard = (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('providedApisCard.title'),\n columns = getApiEntityColumns(t),\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_PROVIDES_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('providedApisCard.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('providedApisCard.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#specprovidesapis-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":";;;;;;;;;AAwCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAA,GAAQ,EAAE,wBAAwB,CAAA;AAAA,IAClC,OAAA,GAAU,oBAAoB,CAAC,CAAA;AAAA,IAC/B,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EA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,gBAAgB,EAAA,IAAA;AAAA,YAEf,YAAE,uBAAuB;AAAA;AAAA,SAE9B,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -13,21 +13,24 @@ import '../OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js';
|
|
|
13
13
|
import '@material-ui/core/styles';
|
|
14
14
|
import { ApiTypeTitle } from '../ApiDefinitionCard/ApiTypeTitle.esm.js';
|
|
15
15
|
import { ApiDefinitionDialog } from '../ApiDefinitionDialog/ApiDefinitionDialog.esm.js';
|
|
16
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
17
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
16
18
|
|
|
17
|
-
function createSpecApiTypeColumn() {
|
|
19
|
+
function createSpecApiTypeColumn(t) {
|
|
18
20
|
return {
|
|
19
|
-
title: "
|
|
21
|
+
title: t("apiEntityColumns.typeTitle"),
|
|
20
22
|
field: "spec.type",
|
|
21
23
|
render: (entity) => /* @__PURE__ */ jsx(ApiTypeTitle, { apiEntity: entity })
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
const ApiDefinitionButton = ({ apiEntity }) => {
|
|
25
27
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
28
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
26
29
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
30
|
/* @__PURE__ */ jsx(
|
|
28
31
|
ToggleButton,
|
|
29
32
|
{
|
|
30
|
-
"aria-label": "
|
|
33
|
+
"aria-label": t("apiDefinitionDialog.toggleButtonAriaLabel"),
|
|
31
34
|
onClick: () => setDialogOpen(!dialogOpen),
|
|
32
35
|
value: dialogOpen,
|
|
33
36
|
children: /* @__PURE__ */ jsx(ExtensionIcon, {})
|
|
@@ -43,21 +46,23 @@ const ApiDefinitionButton = ({ apiEntity }) => {
|
|
|
43
46
|
)
|
|
44
47
|
] });
|
|
45
48
|
};
|
|
46
|
-
function createApiDefinitionColumn() {
|
|
49
|
+
function createApiDefinitionColumn(t) {
|
|
47
50
|
return {
|
|
48
|
-
title: "
|
|
51
|
+
title: t("apiEntityColumns.apiDefinitionTitle"),
|
|
49
52
|
render: (entity) => /* @__PURE__ */ jsx(ApiDefinitionButton, { apiEntity: entity })
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const getApiEntityColumns = (t) => {
|
|
56
|
+
return [
|
|
57
|
+
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
58
|
+
EntityTable.columns.createSystemColumn(),
|
|
59
|
+
EntityTable.columns.createOwnerColumn(),
|
|
60
|
+
createSpecApiTypeColumn(t),
|
|
61
|
+
EntityTable.columns.createSpecLifecycleColumn(),
|
|
62
|
+
EntityTable.columns.createMetadataDescriptionColumn(),
|
|
63
|
+
createApiDefinitionColumn(t)
|
|
64
|
+
];
|
|
65
|
+
};
|
|
61
66
|
|
|
62
|
-
export {
|
|
67
|
+
export { createSpecApiTypeColumn, getApiEntityColumns };
|
|
63
68
|
//# sourceMappingURL=presets.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/ApisCards/presets.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 } from '@backstage/catalog-model';\nimport { TableColumn } from '@backstage/core-components';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport ExtensionIcon from '@material-ui/icons/Extension';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport { useState } from 'react';\nimport { ApiTypeTitle } from '../ApiDefinitionCard';\nimport { ApiDefinitionDialog } from '../ApiDefinitionDialog';\n\nexport function createSpecApiTypeColumn(): TableColumn<ApiEntity> {\n return {\n title: '
|
|
1
|
+
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/ApisCards/presets.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 } from '@backstage/catalog-model';\nimport { TableColumn } from '@backstage/core-components';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport ExtensionIcon from '@material-ui/icons/Extension';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport { useState } from 'react';\nimport { ApiTypeTitle } from '../ApiDefinitionCard';\nimport { ApiDefinitionDialog } from '../ApiDefinitionDialog';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { apiDocsTranslationRef } from '../../translation';\n\nexport function createSpecApiTypeColumn(\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity> {\n return {\n title: t('apiEntityColumns.typeTitle'),\n field: 'spec.type',\n render: entity => <ApiTypeTitle apiEntity={entity} />,\n };\n}\n\nconst ApiDefinitionButton = ({ apiEntity }: { apiEntity: ApiEntity }) => {\n const [dialogOpen, setDialogOpen] = useState(false);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n return (\n <>\n <ToggleButton\n aria-label={t('apiDefinitionDialog.toggleButtonAriaLabel')}\n onClick={() => setDialogOpen(!dialogOpen)}\n value={dialogOpen}\n >\n <ExtensionIcon />\n </ToggleButton>\n <ApiDefinitionDialog\n entity={apiEntity}\n open={dialogOpen}\n onClose={() => setDialogOpen(false)}\n />\n </>\n );\n};\n\nfunction createApiDefinitionColumn(\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity> {\n return {\n title: t('apiEntityColumns.apiDefinitionTitle'),\n render: entity => <ApiDefinitionButton apiEntity={entity} />,\n };\n}\n\nexport const getApiEntityColumns = (\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity>[] => {\n return [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createSystemColumn(),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(t),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n createApiDefinitionColumn(t),\n ];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8BO,SAAS,wBACd,CACwB,EAAA;AACxB,EAAO,OAAA;AAAA,IACL,KAAA,EAAO,EAAE,4BAA4B,CAAA;AAAA,IACrC,KAAO,EAAA,WAAA;AAAA,IACP,MAAQ,EAAA,CAAA,MAAA,qBAAW,GAAA,CAAA,YAAA,EAAA,EAAa,WAAW,MAAQ,EAAA;AAAA,GACrD;AACF;AAEA,MAAM,mBAAsB,GAAA,CAAC,EAAE,SAAA,EAA0C,KAAA;AACvE,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAClD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,YAAA,EAAY,EAAE,2CAA2C,CAAA;AAAA,QACzD,OAAS,EAAA,MAAM,aAAc,CAAA,CAAC,UAAU,CAAA;AAAA,QACxC,KAAO,EAAA,UAAA;AAAA,QAEP,8BAAC,aAAc,EAAA,EAAA;AAAA;AAAA,KACjB;AAAA,oBACA,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,MAAQ,EAAA,SAAA;AAAA,QACR,IAAM,EAAA,UAAA;AAAA,QACN,OAAA,EAAS,MAAM,aAAA,CAAc,KAAK;AAAA;AAAA;AACpC,GACF,EAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,0BACP,CACwB,EAAA;AACxB,EAAO,OAAA;AAAA,IACL,KAAA,EAAO,EAAE,qCAAqC,CAAA;AAAA,IAC9C,MAAQ,EAAA,CAAA,MAAA,qBAAW,GAAA,CAAA,mBAAA,EAAA,EAAoB,WAAW,MAAQ,EAAA;AAAA,GAC5D;AACF;AAEa,MAAA,mBAAA,GAAsB,CACjC,CAC6B,KAAA;AAC7B,EAAO,OAAA;AAAA,IACL,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,IAChE,WAAA,CAAY,QAAQ,kBAAmB,EAAA;AAAA,IACvC,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,IACtC,wBAAwB,CAAC,CAAA;AAAA,IACzB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,IAC9C,WAAA,CAAY,QAAQ,+BAAgC,EAAA;AAAA,IACpD,0BAA0B,CAAC;AAAA,GAC7B;AACF;;;;"}
|
|
@@ -3,6 +3,8 @@ import { RELATION_API_CONSUMED_BY } from '@backstage/catalog-model';
|
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
7
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
6
8
|
|
|
7
9
|
const ConsumingComponentsCard = (props) => {
|
|
8
10
|
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
@@ -10,15 +12,16 @@ const ConsumingComponentsCard = (props) => {
|
|
|
10
12
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
13
|
type: RELATION_API_CONSUMED_BY
|
|
12
14
|
});
|
|
15
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
16
|
if (loading) {
|
|
14
|
-
return /* @__PURE__ */ jsx(InfoCard, { variant, title: "
|
|
17
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("consumingComponentsCard.title"), children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
15
18
|
}
|
|
16
19
|
if (error || !entities) {
|
|
17
|
-
return /* @__PURE__ */ jsx(InfoCard, { variant, title: "
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("consumingComponentsCard.title"), children: /* @__PURE__ */ jsx(
|
|
18
21
|
WarningPanel,
|
|
19
22
|
{
|
|
20
23
|
severity: "error",
|
|
21
|
-
title: "
|
|
24
|
+
title: t("consumingComponentsCard.error.title"),
|
|
22
25
|
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
23
26
|
}
|
|
24
27
|
) });
|
|
@@ -26,11 +29,11 @@ const ConsumingComponentsCard = (props) => {
|
|
|
26
29
|
return /* @__PURE__ */ jsx(
|
|
27
30
|
EntityTable,
|
|
28
31
|
{
|
|
29
|
-
title: "
|
|
32
|
+
title: t("consumingComponentsCard.title"),
|
|
30
33
|
variant,
|
|
31
34
|
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: "
|
|
33
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional", children: "
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("consumingComponentsCard.emptyContent.title") }),
|
|
36
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional", children: t("apisCardHelpLinkTitle") }) })
|
|
34
37
|
] }),
|
|
35
38
|
columns,
|
|
36
39
|
entities
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.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 {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} 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 CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title
|
|
1
|
+
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.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 {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} 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 CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\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 ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={t('consumingComponentsCard.title')}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={t('consumingComponentsCard.title')}>\n <WarningPanel\n severity=\"error\"\n title={t('consumingComponentsCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={t('consumingComponentsCard.title')}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('consumingComponentsCard.emptyContent.title')}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA;AAAA,GACP,CAAA;AACD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AAErD,EAAA,IAAI,OAAS,EAAA;AACX,IACE,uBAAA,GAAA,CAAC,YAAS,OAAkB,EAAA,KAAA,EAAO,EAAE,+BAA+B,CAAA,EAClE,QAAC,kBAAA,GAAA,CAAA,QAAA,EAAA,EAAS,CACZ,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,2BACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAAO,EAAA,CAAA,CAAE,+BAA+B,CAClE,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAA,EAAO,EAAE,qCAAqC,CAAA;AAAA,QAC9C,OAAA,sBAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA;AAAA;AAAA,KAE5D,EAAA,CAAA;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,+BAA+B,CAAA;AAAA,MACxC,OAAA;AAAA,MACA,8BACG,IAAA,CAAA,KAAA,EAAA,EAAI,OAAO,EAAE,SAAA,EAAW,UACvB,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,4CAA4C,CACjD,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGACN,EAAA,QAAA,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -3,6 +3,8 @@ import { RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
|
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
7
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
6
8
|
|
|
7
9
|
const ProvidingComponentsCard = (props) => {
|
|
8
10
|
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
@@ -10,15 +12,16 @@ const ProvidingComponentsCard = (props) => {
|
|
|
10
12
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
13
|
type: RELATION_API_PROVIDED_BY
|
|
12
14
|
});
|
|
15
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
16
|
if (loading) {
|
|
14
|
-
return /* @__PURE__ */ jsx(InfoCard, { variant, title: "
|
|
17
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("providingComponentsCard.title"), children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
15
18
|
}
|
|
16
19
|
if (error || !entities) {
|
|
17
|
-
return /* @__PURE__ */ jsx(InfoCard, { variant, title: "
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("providingComponentsCard.title"), children: /* @__PURE__ */ jsx(
|
|
18
21
|
WarningPanel,
|
|
19
22
|
{
|
|
20
23
|
severity: "error",
|
|
21
|
-
title: "
|
|
24
|
+
title: t("providingComponentsCard.error.title"),
|
|
22
25
|
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
23
26
|
}
|
|
24
27
|
) });
|
|
@@ -26,11 +29,11 @@ const ProvidingComponentsCard = (props) => {
|
|
|
26
29
|
return /* @__PURE__ */ jsx(
|
|
27
30
|
EntityTable,
|
|
28
31
|
{
|
|
29
|
-
title: "
|
|
32
|
+
title: t("providingComponentsCard.title"),
|
|
30
33
|
variant,
|
|
31
34
|
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: "
|
|
33
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional", children: "
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("providingComponentsCard.emptyContent.title") }),
|
|
36
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional", children: t("apisCardHelpLinkTitle") }) })
|
|
34
37
|
] }),
|
|
35
38
|
columns,
|
|
36
39
|
entities
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.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 {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} 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 CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title
|
|
1
|
+
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.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 {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} 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 CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={t('providingComponentsCard.title')}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={t('providingComponentsCard.title')}>\n <WarningPanel\n severity=\"error\"\n title={t('providingComponentsCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={t('providingComponentsCard.title')}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('providingComponentsCard.emptyContent.title')}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuCa,MAAA,u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AQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,4CAA4C,CACjD,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGACN,EAAA,QAAA,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createTranslationRef } from '@backstage/frontend-plugin-api';
|
|
2
|
+
|
|
3
|
+
const apiDocsTranslationRef = createTranslationRef({
|
|
4
|
+
id: "api-docs",
|
|
5
|
+
messages: {
|
|
6
|
+
apiDefinitionDialog: {
|
|
7
|
+
closeButtonTitle: "Close",
|
|
8
|
+
tabsAriaLabel: "API definition options",
|
|
9
|
+
toggleButtonAriaLabel: "Toggle API Definition Dialog"
|
|
10
|
+
},
|
|
11
|
+
defaultApiExplorerPage: {
|
|
12
|
+
title: "APIs",
|
|
13
|
+
subtitle: "{{orgName}} API Explorer",
|
|
14
|
+
pageTitleOverride: "APIs",
|
|
15
|
+
createButtonTitle: "Register Existing API",
|
|
16
|
+
supportButtonTitle: "All your APIs"
|
|
17
|
+
},
|
|
18
|
+
consumedApisCard: {
|
|
19
|
+
title: "Consumed APIs",
|
|
20
|
+
error: {
|
|
21
|
+
title: "Could not load APIs"
|
|
22
|
+
},
|
|
23
|
+
emptyContent: {
|
|
24
|
+
title: "This {{entity}} does not consume any APIs."
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
hasApisCard: {
|
|
28
|
+
title: "APIs",
|
|
29
|
+
error: {
|
|
30
|
+
title: "Could not load APIs"
|
|
31
|
+
},
|
|
32
|
+
emptyContent: {
|
|
33
|
+
title: "This {{entity}} does not contain any APIs."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
providedApisCard: {
|
|
37
|
+
title: "Provided APIs",
|
|
38
|
+
error: {
|
|
39
|
+
title: "Could not load APIs"
|
|
40
|
+
},
|
|
41
|
+
emptyContent: {
|
|
42
|
+
title: "This {{entity}} does not provide any APIs."
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
apiEntityColumns: {
|
|
46
|
+
typeTitle: "Type",
|
|
47
|
+
apiDefinitionTitle: "API Definition"
|
|
48
|
+
},
|
|
49
|
+
consumingComponentsCard: {
|
|
50
|
+
title: "Consumers",
|
|
51
|
+
error: {
|
|
52
|
+
title: "Could not load components"
|
|
53
|
+
},
|
|
54
|
+
emptyContent: {
|
|
55
|
+
title: "No component consumes this API."
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
providingComponentsCard: {
|
|
59
|
+
title: "Providers",
|
|
60
|
+
error: {
|
|
61
|
+
title: "Could not load components"
|
|
62
|
+
},
|
|
63
|
+
emptyContent: {
|
|
64
|
+
title: "No component provides this API."
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
apisCardHelpLinkTitle: "Learn how to change this"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { apiDocsTranslationRef };
|
|
72
|
+
//# sourceMappingURL=translation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/**\n * @alpha\n */\nexport const apiDocsTranslationRef = createTranslationRef({\n id: 'api-docs',\n messages: {\n apiDefinitionDialog: {\n closeButtonTitle: 'Close',\n tabsAriaLabel: 'API definition options',\n toggleButtonAriaLabel: 'Toggle API Definition Dialog',\n },\n defaultApiExplorerPage: {\n title: 'APIs',\n subtitle: '{{orgName}} API Explorer',\n pageTitleOverride: 'APIs',\n createButtonTitle: 'Register Existing API',\n supportButtonTitle: 'All your APIs',\n },\n consumedApisCard: {\n title: 'Consumed APIs',\n error: {\n title: 'Could not load APIs',\n },\n emptyContent: {\n title: 'This {{entity}} does not consume any APIs.',\n },\n },\n hasApisCard: {\n title: 'APIs',\n error: {\n title: 'Could not load APIs',\n },\n emptyContent: {\n title: 'This {{entity}} does not contain any APIs.',\n },\n },\n providedApisCard: {\n title: 'Provided APIs',\n error: {\n title: 'Could not load APIs',\n },\n emptyContent: {\n title: 'This {{entity}} does not provide any APIs.',\n },\n },\n apiEntityColumns: {\n typeTitle: 'Type',\n apiDefinitionTitle: 'API Definition',\n },\n consumingComponentsCard: {\n title: 'Consumers',\n error: {\n title: 'Could not load components',\n },\n emptyContent: {\n title: 'No component consumes this API.',\n },\n },\n providingComponentsCard: {\n title: 'Providers',\n error: {\n title: 'Could not load components',\n },\n emptyContent: {\n title: 'No component provides this API.',\n },\n },\n apisCardHelpLinkTitle: 'Learn how to change this',\n },\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,wBAAwB,oBAAqB,CAAA;AAAA,EACxD,EAAI,EAAA,UAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,mBAAqB,EAAA;AAAA,MACnB,gBAAkB,EAAA,OAAA;AAAA,MAClB,aAAe,EAAA,wBAAA;AAAA,MACf,qBAAuB,EAAA;AAAA,KACzB;AAAA,IACA,sBAAwB,EAAA;AAAA,MACtB,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,0BAAA;AAAA,MACV,iBAAmB,EAAA,MAAA;AAAA,MACnB,iBAAmB,EAAA,uBAAA;AAAA,MACnB,kBAAoB,EAAA;AAAA,KACtB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,KAAO,EAAA,eAAA;AAAA,MACP,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,OACT;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA;AAAA;AACT,KACF;AAAA,IACA,WAAa,EAAA;AAAA,MACX,KAAO,EAAA,MAAA;AAAA,MACP,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,OACT;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA;AAAA;AACT,KACF;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,KAAO,EAAA,eAAA;AAAA,MACP,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,OACT;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA;AAAA;AACT,KACF;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,SAAW,EAAA,MAAA;AAAA,MACX,kBAAoB,EAAA;AAAA,KACtB;AAAA,IACA,uBAAyB,EAAA;AAAA,MACvB,KAAO,EAAA,WAAA;AAAA,MACP,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,OACT;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA;AAAA;AACT,KACF;AAAA,IACA,uBAAyB,EAAA;AAAA,MACvB,KAAO,EAAA,WAAA;AAAA,MACP,KAAO,EAAA;AAAA,QACL,KAAO,EAAA;AAAA,OACT;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA;AAAA;AACT,KACF;AAAA,IACA,qBAAuB,EAAA;AAAA;AAE3B,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-api-docs",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.7-next.0",
|
|
4
4
|
"description": "A Backstage plugin that helps represent API entities in the frontend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@asyncapi/react-component": "^2.3.3",
|
|
69
69
|
"@backstage/catalog-model": "1.7.3",
|
|
70
|
-
"@backstage/core-compat-api": "0.4.
|
|
71
|
-
"@backstage/core-components": "0.17.1
|
|
72
|
-
"@backstage/core-plugin-api": "1.10.6
|
|
73
|
-
"@backstage/frontend-plugin-api": "0.10.1
|
|
74
|
-
"@backstage/plugin-catalog": "1.29.
|
|
70
|
+
"@backstage/core-compat-api": "0.4.2-next.0",
|
|
71
|
+
"@backstage/core-components": "0.17.1",
|
|
72
|
+
"@backstage/core-plugin-api": "1.10.6",
|
|
73
|
+
"@backstage/frontend-plugin-api": "0.10.1",
|
|
74
|
+
"@backstage/plugin-catalog": "1.29.1-next.0",
|
|
75
75
|
"@backstage/plugin-catalog-common": "1.1.3",
|
|
76
|
-
"@backstage/plugin-catalog-react": "1.
|
|
77
|
-
"@backstage/plugin-permission-react": "0.4.33
|
|
76
|
+
"@backstage/plugin-catalog-react": "1.18.0-next.0",
|
|
77
|
+
"@backstage/plugin-permission-react": "0.4.33",
|
|
78
78
|
"@graphiql/react": "^0.23.0",
|
|
79
79
|
"@material-ui/core": "^4.12.2",
|
|
80
80
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"swagger-ui-react": "^5.0.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@backstage/cli": "0.32.
|
|
91
|
-
"@backstage/core-app-api": "1.16.1
|
|
92
|
-
"@backstage/dev-utils": "1.1.
|
|
93
|
-
"@backstage/test-utils": "1.7.7
|
|
90
|
+
"@backstage/cli": "0.32.1-next.0",
|
|
91
|
+
"@backstage/core-app-api": "1.16.1",
|
|
92
|
+
"@backstage/dev-utils": "1.1.10-next.0",
|
|
93
|
+
"@backstage/test-utils": "1.7.7",
|
|
94
94
|
"@testing-library/dom": "^10.0.0",
|
|
95
95
|
"@testing-library/jest-dom": "^6.0.0",
|
|
96
96
|
"@testing-library/react": "^16.0.0",
|