@backstage/plugin-api-docs 0.6.20 → 0.6.21
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 +11 -0
- package/dist/esm/{index-00af9be1.esm.js → index-02cb4cdc.esm.js} +7 -5
- package/dist/esm/index-02cb4cdc.esm.js.map +1 -0
- package/dist/esm/{index-a8bf5768.esm.js → index-30e4d7f8.esm.js} +7 -5
- package/dist/esm/index-30e4d7f8.esm.js.map +1 -0
- package/dist/esm/{index-674cfd0b.esm.js → index-32c80387.esm.js} +7 -5
- package/dist/esm/index-32c80387.esm.js.map +1 -0
- package/dist/esm/index-89d097b6.esm.js +11 -0
- package/dist/esm/index-89d097b6.esm.js.map +1 -0
- package/dist/index.d.ts +26 -13
- package/dist/index.esm.js +482 -8
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -9
- package/dist/esm/index-00af9be1.esm.js.map +0 -1
- package/dist/esm/index-160e3ddd.esm.js +0 -51
- package/dist/esm/index-160e3ddd.esm.js.map +0 -1
- package/dist/esm/index-674cfd0b.esm.js.map +0 -1
- package/dist/esm/index-83f082c6.esm.js +0 -435
- package/dist/esm/index-83f082c6.esm.js.map +0 -1
- package/dist/esm/index-a8bf5768.esm.js.map +0 -1
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx","../src/components/ApiExplorerPage/ApiExplorerPage.tsx","../src/config.ts","../src/components/PlainApiDefinitionWidget/PlainApiDefinitionWidget.tsx","../src/components/ApiDefinitionCard/ApiDefinitionCard.tsx","../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx","../src/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.tsx","../src/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.tsx","../src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx","../src/components/ApiDefinitionCard/ApiTypeTitle.tsx","../src/components/ApisCards/presets.tsx","../src/components/ApisCards/ConsumedApisCard.tsx","../src/components/ApisCards/HasApisCard.tsx","../src/components/ApisCards/ProvidedApisCard.tsx","../src/components/ComponentsCards/ConsumingComponentsCard.tsx","../src/components/ComponentsCards/ProvidingComponentsCard.tsx","../src/plugin.ts"],"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 createExternalRouteRef,\n createRouteRef,\n} from '@backstage/core-plugin-api';\n\nexport const rootRoute = createRouteRef({\n id: 'api-docs',\n});\n\nexport const createComponentRouteRef = createExternalRouteRef({\n id: 'create-component',\n optional: true,\n});\n","/*\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 {\n CatalogTable,\n CatalogTableRow,\n FilteredEntityLayout,\n EntityListContainer,\n FilterContainer,\n} from '@backstage/plugin-catalog';\nimport {\n EntityKindPicker,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createComponentRouteRef } from '../../routes';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\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};\n\n/**\n * DefaultApiExplorerPage\n * @public\n */\nexport const DefaultApiExplorerPage = ({\n initiallySelectedFilter = 'all',\n columns,\n actions,\n}: DefaultApiExplorerPageProps) => {\n const configApi = useApi(configApiRef);\n const generatedSubtitle = `${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n } API Explorer`;\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title=\"APIs\"\n subtitle={generatedSubtitle}\n pageTitleOverride=\"APIs\"\n >\n <Content>\n <ContentHeader title=\"\">\n <CreateButton\n title=\"Register Existing API\"\n to={createComponentLink?.()}\n />\n <SupportButton>All your APIs</SupportButton>\n </ContentHeader>\n <EntityListProvider>\n <FilteredEntityLayout>\n <FilterContainer>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </FilterContainer>\n <EntityListContainer>\n <CatalogTable\n columns={columns || defaultColumns}\n actions={actions}\n />\n </EntityListContainer>\n </FilteredEntityLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n};\n","/*\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 React from 'react';\nimport { useOutlet } from 'react-router';\nimport {\n DefaultApiExplorerPage,\n DefaultApiExplorerPageProps,\n} from './DefaultApiExplorerPage';\n\n/**\n * ApiExplorerPage\n * @public\n */\nexport const ApiExplorerPage = (props: DefaultApiExplorerPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultApiExplorerPage {...props} />;\n};\n","/*\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 { ApiDefinitionWidget } from './components/ApiDefinitionCard/ApiDefinitionWidget';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\nexport const apiDocsConfigRef = createApiRef<ApiDocsConfig>({\n id: 'plugin.api-docs.config',\n});\n\nexport interface ApiDocsConfig {\n getApiDefinitionWidget: (\n apiEntity: ApiEntity,\n ) => ApiDefinitionWidget | undefined;\n}\n","/*\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 React from 'react';\nimport { CodeSnippet } from '@backstage/core-components';\n\nexport type PlainApiDefinitionWidgetProps = {\n definition: any;\n language: string;\n};\n\nexport const PlainApiDefinitionWidget = (\n props: PlainApiDefinitionWidgetProps,\n) => {\n return (\n <CodeSnippet\n text={props.definition}\n language={props.language}\n showCopyCodeButton\n />\n );\n};\n","/*\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 { useEntity } from '@backstage/plugin-catalog-react';\nimport { Alert } from '@material-ui/lab';\nimport React from 'react';\nimport { apiDocsConfigRef } from '../../config';\nimport { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget';\n\nimport { CardTab, TabbedCard } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype Props = {\n /** @deprecated The entity is now grabbed from context instead */\n apiEntity?: ApiEntity;\n};\n\nexport const ApiDefinitionCard = (_: Props) => {\n const { entity } = useEntity<ApiEntity>();\n const config = useApi(apiDocsConfigRef);\n const { getApiDefinitionWidget } = config;\n\n if (!entity) {\n return <Alert severity=\"error\">Could not fetch the API</Alert>;\n }\n\n const definitionWidget = getApiDefinitionWidget(entity);\n const entityTitle = entity.metadata.title ?? entity.metadata.name;\n\n if (definitionWidget) {\n return (\n <TabbedCard title={entityTitle}>\n <CardTab label={definitionWidget.title} key=\"widget\">\n {definitionWidget.component(entity.spec.definition)}\n </CardTab>\n <CardTab label=\"Raw\" key=\"raw\">\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={definitionWidget.rawLanguage || entity.spec.type}\n />\n </CardTab>\n </TabbedCard>\n );\n }\n\n return (\n <TabbedCard\n title={entityTitle}\n children={[\n // Has to be an array, otherwise typescript doesn't like that this has only a single child\n <CardTab label={entity.spec.type} key=\"raw\">\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={entity.spec.type}\n />\n </CardTab>,\n ]}\n />\n );\n};\n","/*\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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = React.lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n};\n\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n","/*\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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\n\n// The graphql component, graphql and related CSS has a significant size, only\n// load it if the element is actually used.\nconst LazyGraphQlDefinition = React.lazy(() =>\n import('./GraphQlDefinition').then(m => ({\n default: m.GraphQlDefinition,\n })),\n);\n\nexport type GraphQlDefinitionWidgetProps = {\n definition: string;\n};\n\nexport const GraphQlDefinitionWidget = (\n props: GraphQlDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyGraphQlDefinition {...props} />\n </Suspense>\n );\n};\n","/*\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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\n\n// The swagger-ui component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyOpenApiDefinition = React.lazy(() =>\n import('./OpenApiDefinition').then(m => ({\n default: m.OpenApiDefinition,\n })),\n);\n\nexport type OpenApiDefinitionWidgetProps = {\n definition: string;\n};\n\nexport const OpenApiDefinitionWidget = (\n props: OpenApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyOpenApiDefinition {...props} />\n </Suspense>\n );\n};\n","/*\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 */\nimport React from 'react';\nimport { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget';\nimport { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget';\nimport { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget';\n\nexport type ApiDefinitionWidget = {\n type: string;\n title: string;\n component: (definition: string) => React.ReactElement;\n rawLanguage?: string;\n};\n\nexport function defaultDefinitionWidgets(): ApiDefinitionWidget[] {\n return [\n {\n type: 'openapi',\n title: 'OpenAPI',\n rawLanguage: 'yaml',\n component: definition => (\n <OpenApiDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'asyncapi',\n title: 'AsyncAPI',\n rawLanguage: 'yaml',\n component: definition => (\n <AsyncApiDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'graphql',\n title: 'GraphQL',\n rawLanguage: 'graphql',\n component: definition => (\n <GraphQlDefinitionWidget definition={definition} />\n ),\n },\n ];\n}\n","/*\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 React from 'react';\nimport { apiDocsConfigRef } from '../../config';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ApiTypeTitle = ({ apiEntity }: { apiEntity: ApiEntity }) => {\n const config = useApi(apiDocsConfigRef);\n const definition = config.getApiDefinitionWidget(apiEntity);\n const type = definition ? definition.title : apiEntity.spec.type;\n\n return <span>{type}</span>;\n};\n","/*\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 { EntityTable } from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { ApiTypeTitle } from '../ApiDefinitionCard';\nimport { TableColumn } from '@backstage/core-components';\n\nexport function createSpecApiTypeColumn(): TableColumn<ApiEntity> {\n return {\n title: 'Type',\n field: 'spec.type',\n render: entity => <ApiTypeTitle apiEntity={entity} />,\n };\n}\n\n// TODO: This could be moved to plugin-catalog-react if we wouldn't have a\n// special createSpecApiTypeColumn. But this is required to use ApiTypeTitle to\n// resolve the display name of an entity. Is the display name really worth it?\n\nexport const apiEntityColumns: TableColumn<ApiEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createSystemColumn(),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\n","/*\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 ApiEntity,\n Entity,\n RELATION_CONSUMES_API,\n} from '@backstage/catalog-model';\nimport { Typography } from '@material-ui/core';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\ntype Props = {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: 'gridItem';\n};\n\nexport const ConsumedApisCard = ({ variant = 'gridItem' }: 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=\"Consumed APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumed APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumed APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not consume any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={apiEntityColumns}\n entities={entities as ApiEntity[]}\n />\n );\n};\n","/*\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';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createSpecApiTypeColumn } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\ntype Props = {\n variant?: 'gridItem';\n};\n\nconst columns: TableColumn<ApiEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\n\nexport const HasApisCard = ({ variant = 'gridItem' }: 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=\"APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not contain any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ApiEntity[]}\n />\n );\n};\n","/*\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 ApiEntity,\n Entity,\n RELATION_PROVIDES_API,\n} from '@backstage/catalog-model';\nimport { Typography } from '@material-ui/core';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\ntype Props = {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: 'gridItem';\n};\n\nexport const ProvidedApisCard = ({ variant = 'gridItem' }: 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=\"Provided APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Provided APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Provided APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not provide any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={apiEntityColumns}\n entities={entities as ApiEntity[]}\n />\n );\n};\n","/*\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 Entity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport { Typography } from '@material-ui/core';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\ntype Props = {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: 'gridItem';\n};\n\nexport const ConsumingComponentsCard = ({ variant = 'gridItem' }: 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=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n","/*\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 Entity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport { Typography } from '@material-ui/core';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\ntype Props = {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: 'gridItem';\n};\n\nexport const ProvidingComponentsCard = ({ variant = 'gridItem' }: 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=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n","/*\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 { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { apiDocsConfigRef } from './config';\nimport { createComponentRouteRef, rootRoute } from './routes';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nexport const apiDocsPlugin = createPlugin({\n id: 'api-docs',\n routes: {\n root: rootRoute,\n },\n apis: [\n 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 externalRoutes: {\n createComponent: createComponentRouteRef,\n },\n});\n\nexport const ApiExplorerPage = apiDocsPlugin.provide(\n createRoutableExtension({\n name: 'ApiExplorerPage',\n component: () =>\n import('./components/ApiExplorerPage').then(m => m.ApiExplorerIndexPage),\n mountPoint: rootRoute,\n }),\n);\n\nexport const EntityApiDefinitionCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityApiDefinitionCard',\n component: {\n lazy: () =>\n import('./components/ApiDefinitionCard').then(m => m.ApiDefinitionCard),\n },\n }),\n);\n\nexport const EntityConsumedApisCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityConsumedApisCard',\n component: {\n lazy: () =>\n import('./components/ApisCards').then(m => m.ConsumedApisCard),\n },\n }),\n);\n\nexport const EntityConsumingComponentsCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityConsumingComponentsCard',\n component: {\n lazy: () =>\n import('./components/ComponentsCards').then(\n m => m.ConsumingComponentsCard,\n ),\n },\n }),\n);\n\nexport const EntityProvidedApisCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityProvidedApisCard',\n component: {\n lazy: () =>\n import('./components/ApisCards').then(m => m.ProvidedApisCard),\n },\n }),\n);\n\nexport const EntityProvidingComponentsCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityProvidingComponentsCard',\n component: {\n lazy: () =>\n import('./components/ComponentsCards').then(\n m => m.ProvidingComponentsCard,\n ),\n },\n }),\n);\n\nexport const EntityHasApisCard = apiDocsPlugin.provide(\n createComponentExtension({\n name: 'EntityHasApisCard',\n component: {\n lazy: () => import('./components/ApisCards').then(m => m.HasApisCard),\n },\n }),\n);\n"],"names":["ApiExplorerPage"],"mappings":";;;;;;;;;;MAqBa,YAAY,eAAe;AAAA,EACtC,IAAI;AAAA;MAGO,0BAA0B,uBAAuB;AAAA,EAC5D,IAAI;AAAA,EACJ,UAAU;AAAA;;ACmBZ,MAAM,iBAAiD;AAAA,EACrD,aAAa,QAAQ,iBAAiB,EAAE,aAAa;AAAA,EACrD,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA;MAiBV,yBAAyB,CAAC;AAAA,EACrC,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,MACiC;AA1EnC;AA2EE,QAAM,YAAY,OAAO;AACzB,QAAM,oBAAoB,GACxB,gBAAU,kBAAkB,yBAA5B,YAAoD;AAEtD,QAAM,sBAAsB,YAAY;AAExC,6CACG,gBAAD;AAAA,IACE,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,UAAU;AAAA,IACV,mBAAkB;AAAA,yCAEjB,SAAD,0CACG,eAAD;AAAA,IAAe,OAAM;AAAA,yCAClB,cAAD;AAAA,IACE,OAAM;AAAA,IACN,IAAI;AAAA,0CAEL,eAAD,MAAe,uDAEhB,oBAAD,0CACG,sBAAD,0CACG,iBAAD,0CACG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hD,yBAAyB,cAAc,QAClD,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MACJ,OAAO,+BAA0B,KAAK,OAAK,EAAE;AAAA;AAAA;MAKxC,gCAAgC,cAAc,QACzD,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MACJ,OAAO,+BAAgC,KACrC,OAAK,EAAE;AAAA;AAAA;MAMJ,yBAAyB,cAAc,QAClD,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MACJ,OAAO,+BAA0B,KAAK,OAAK,EAAE;AAAA;AAAA;MAKxC,gCAAgC,cAAc,QACzD,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MACJ,OAAO,+BAAgC,KACrC,OAAK,EAAE;AAAA;AAAA;MAMJ,oBAAoB,cAAc,QAC7C,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MAAM,OAAO,+BAA0B,KAAK,OAAK,EAAE;AAAA;AAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-api-docs",
|
|
3
3
|
"description": "A Backstage plugin that helps represent API entities in the frontend",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.21",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@asyncapi/react-component": "^1.0.0-next.25",
|
|
34
34
|
"@backstage/catalog-model": "^0.9.7",
|
|
35
|
-
"@backstage/core-components": "^0.8.
|
|
36
|
-
"@backstage/core-plugin-api": "^0.4.
|
|
37
|
-
"@backstage/plugin-catalog": "^0.7.
|
|
38
|
-
"@backstage/plugin-catalog-react": "^0.6.
|
|
35
|
+
"@backstage/core-components": "^0.8.3",
|
|
36
|
+
"@backstage/core-plugin-api": "^0.4.1",
|
|
37
|
+
"@backstage/plugin-catalog": "^0.7.7",
|
|
38
|
+
"@backstage/plugin-catalog-react": "^0.6.10",
|
|
39
39
|
"@backstage/theme": "^0.2.14",
|
|
40
40
|
"@material-ui/core": "^4.12.2",
|
|
41
41
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"react": "^16.13.1 || ^17.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@backstage/cli": "^0.10.
|
|
58
|
-
"@backstage/core-app-api": "^0.3.
|
|
59
|
-
"@backstage/dev-utils": "^0.2.
|
|
57
|
+
"@backstage/cli": "^0.10.5",
|
|
58
|
+
"@backstage/core-app-api": "^0.3.1",
|
|
59
|
+
"@backstage/dev-utils": "^0.2.16",
|
|
60
60
|
"@backstage/test-utils": "^0.2.1",
|
|
61
61
|
"@testing-library/jest-dom": "^5.10.1",
|
|
62
62
|
"@testing-library/react": "^11.2.5",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"files": [
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "ffdb98aa2973366d48ff1774a7f892bc0c926e7e"
|
|
74
74
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-00af9be1.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { PageWithHeader, Content, ContentHeader, CreateButton, SupportButton } from '@backstage/core-components';
|
|
2
|
-
import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
3
|
-
import { CatalogTable, FilteredEntityLayout, FilterContainer, EntityListContainer } from '@backstage/plugin-catalog';
|
|
4
|
-
import { EntityListProvider, EntityKindPicker, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { c as createComponentRouteRef } from './index-83f082c6.esm.js';
|
|
7
|
-
import '@material-ui/lab';
|
|
8
|
-
import '@backstage/catalog-model';
|
|
9
|
-
import '@material-ui/core';
|
|
10
|
-
|
|
11
|
-
const defaultColumns = [
|
|
12
|
-
CatalogTable.columns.createNameColumn({ defaultKind: "API" }),
|
|
13
|
-
CatalogTable.columns.createSystemColumn(),
|
|
14
|
-
CatalogTable.columns.createOwnerColumn(),
|
|
15
|
-
CatalogTable.columns.createSpecTypeColumn(),
|
|
16
|
-
CatalogTable.columns.createSpecLifecycleColumn(),
|
|
17
|
-
CatalogTable.columns.createMetadataDescriptionColumn(),
|
|
18
|
-
CatalogTable.columns.createTagsColumn()
|
|
19
|
-
];
|
|
20
|
-
const ApiExplorerPage = ({
|
|
21
|
-
initiallySelectedFilter = "all",
|
|
22
|
-
columns,
|
|
23
|
-
actions
|
|
24
|
-
}) => {
|
|
25
|
-
var _a;
|
|
26
|
-
const configApi = useApi(configApiRef);
|
|
27
|
-
const generatedSubtitle = `${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"} API Explorer`;
|
|
28
|
-
const createComponentLink = useRouteRef(createComponentRouteRef);
|
|
29
|
-
return /* @__PURE__ */ React.createElement(PageWithHeader, {
|
|
30
|
-
themeId: "apis",
|
|
31
|
-
title: "APIs",
|
|
32
|
-
subtitle: generatedSubtitle,
|
|
33
|
-
pageTitleOverride: "APIs"
|
|
34
|
-
}, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
35
|
-
title: ""
|
|
36
|
-
}, /* @__PURE__ */ React.createElement(CreateButton, {
|
|
37
|
-
title: "Register Existing API",
|
|
38
|
-
to: createComponentLink == null ? void 0 : createComponentLink()
|
|
39
|
-
}), /* @__PURE__ */ React.createElement(SupportButton, null, "All your APIs")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(FilteredEntityLayout, null, /* @__PURE__ */ React.createElement(FilterContainer, null, /* @__PURE__ */ React.createElement(EntityKindPicker, {
|
|
40
|
-
initialFilter: "api",
|
|
41
|
-
hidden: true
|
|
42
|
-
}), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
|
|
43
|
-
initialFilter: initiallySelectedFilter
|
|
44
|
-
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(EntityListContainer, null, /* @__PURE__ */ React.createElement(CatalogTable, {
|
|
45
|
-
columns: columns || defaultColumns,
|
|
46
|
-
actions
|
|
47
|
-
}))))));
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { ApiExplorerPage };
|
|
51
|
-
//# sourceMappingURL=index-160e3ddd.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-160e3ddd.esm.js","sources":["../../src/components/ApiExplorerPage/ApiExplorerPage.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 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 {\n CatalogTable,\n CatalogTableRow,\n FilteredEntityLayout,\n EntityListContainer,\n FilterContainer,\n} from '@backstage/plugin-catalog';\nimport {\n EntityKindPicker,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createComponentRouteRef } from '../../routes';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\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\ntype ApiExplorerPageProps = {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n};\n\nexport const ApiExplorerPage = ({\n initiallySelectedFilter = 'all',\n columns,\n actions,\n}: ApiExplorerPageProps) => {\n const configApi = useApi(configApiRef);\n const generatedSubtitle = `${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n } API Explorer`;\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title=\"APIs\"\n subtitle={generatedSubtitle}\n pageTitleOverride=\"APIs\"\n >\n <Content>\n <ContentHeader title=\"\">\n <CreateButton\n title=\"Register Existing API\"\n to={createComponentLink?.()}\n />\n <SupportButton>All your APIs</SupportButton>\n </ContentHeader>\n <EntityListProvider>\n <FilteredEntityLayout>\n <FilterContainer>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </FilterContainer>\n <EntityListContainer>\n <CatalogTable\n columns={columns || defaultColumns}\n actions={actions}\n />\n </EntityListContainer>\n </FilteredEntityLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8CA,MAAM,iBAAiD;AAAA,EACrD,aAAa,QAAQ,iBAAiB,EAAE,aAAa;AAAA,EACrD,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA;MASV,kBAAkB,CAAC;AAAA,EAC9B,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,MAC0B;AAlE5B;AAmEE,QAAM,YAAY,OAAO;AACzB,QAAM,oBAAoB,GACxB,gBAAU,kBAAkB,yBAA5B,YAAoD;AAEtD,QAAM,sBAAsB,YAAY;AAExC,6CACG,gBAAD;AAAA,IACE,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,UAAU;AAAA,IACV,mBAAkB;AAAA,yCAEjB,SAAD,0CACG,eAAD;AAAA,IAAe,OAAM;AAAA,yCAClB,cAAD;AAAA,IACE,OAAM;AAAA,IACN,IAAI;AAAA,0CAEL,eAAD,MAAe,uDAEhB,oBAAD,0CACG,sBAAD,0CACG,iBAAD,0CACG,kBAAD;AAAA,IAAkB,eAAc;AAAA,IAAM,QAAM;AAAA,0CAC3C,kBAAD,2CACC,gBAAD;AAAA,IAAgB,eAAe;AAAA,0CAC9B,mBAAD,2CACC,uBAAD,2CACC,iBAAD,4CAED,qBAAD,0CACG,cAAD;AAAA,IACE,SAAS,WAAW;AAAA,IACpB;AAAA;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-674cfd0b.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
import { useEntity, EntityTable, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
2
|
-
import { Alert } from '@material-ui/lab';
|
|
3
|
-
import React, { Suspense } from 'react';
|
|
4
|
-
import { createApiRef, useApi, createRouteRef, createExternalRouteRef, createPlugin, createApiFactory, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
5
|
-
import { CodeSnippet, TabbedCard, CardTab, Progress, InfoCard, WarningPanel, Link } from '@backstage/core-components';
|
|
6
|
-
import { RELATION_CONSUMES_API, RELATION_HAS_PART, RELATION_PROVIDES_API, RELATION_API_CONSUMED_BY, RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
|
|
7
|
-
import { Typography } from '@material-ui/core';
|
|
8
|
-
|
|
9
|
-
const apiDocsConfigRef = createApiRef({
|
|
10
|
-
id: "plugin.api-docs.config"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const PlainApiDefinitionWidget = (props) => {
|
|
14
|
-
return /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
15
|
-
text: props.definition,
|
|
16
|
-
language: props.language,
|
|
17
|
-
showCopyCodeButton: true
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const ApiDefinitionCard = (_) => {
|
|
22
|
-
var _a;
|
|
23
|
-
const { entity } = useEntity();
|
|
24
|
-
const config = useApi(apiDocsConfigRef);
|
|
25
|
-
const { getApiDefinitionWidget } = config;
|
|
26
|
-
if (!entity) {
|
|
27
|
-
return /* @__PURE__ */ React.createElement(Alert, {
|
|
28
|
-
severity: "error"
|
|
29
|
-
}, "Could not fetch the API");
|
|
30
|
-
}
|
|
31
|
-
const definitionWidget = getApiDefinitionWidget(entity);
|
|
32
|
-
const entityTitle = (_a = entity.metadata.title) != null ? _a : entity.metadata.name;
|
|
33
|
-
if (definitionWidget) {
|
|
34
|
-
return /* @__PURE__ */ React.createElement(TabbedCard, {
|
|
35
|
-
title: entityTitle
|
|
36
|
-
}, /* @__PURE__ */ React.createElement(CardTab, {
|
|
37
|
-
label: definitionWidget.title,
|
|
38
|
-
key: "widget"
|
|
39
|
-
}, definitionWidget.component(entity.spec.definition)), /* @__PURE__ */ React.createElement(CardTab, {
|
|
40
|
-
label: "Raw",
|
|
41
|
-
key: "raw"
|
|
42
|
-
}, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
|
|
43
|
-
definition: entity.spec.definition,
|
|
44
|
-
language: definitionWidget.rawLanguage || entity.spec.type
|
|
45
|
-
})));
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */ React.createElement(TabbedCard, {
|
|
48
|
-
title: entityTitle,
|
|
49
|
-
children: [
|
|
50
|
-
/* @__PURE__ */ React.createElement(CardTab, {
|
|
51
|
-
label: entity.spec.type,
|
|
52
|
-
key: "raw"
|
|
53
|
-
}, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
|
|
54
|
-
definition: entity.spec.definition,
|
|
55
|
-
language: entity.spec.type
|
|
56
|
-
}))
|
|
57
|
-
]
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const LazyAsyncApiDefinition = React.lazy(() => import('./AsyncApiDefinition-c39ae15d.esm.js').then((m) => ({
|
|
62
|
-
default: m.AsyncApiDefinition
|
|
63
|
-
})));
|
|
64
|
-
const AsyncApiDefinitionWidget = (props) => {
|
|
65
|
-
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
66
|
-
fallback: /* @__PURE__ */ React.createElement(Progress, null)
|
|
67
|
-
}, /* @__PURE__ */ React.createElement(LazyAsyncApiDefinition, {
|
|
68
|
-
...props
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const LazyGraphQlDefinition = React.lazy(() => import('./GraphQlDefinition-fa85d425.esm.js').then((m) => ({
|
|
73
|
-
default: m.GraphQlDefinition
|
|
74
|
-
})));
|
|
75
|
-
const GraphQlDefinitionWidget = (props) => {
|
|
76
|
-
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
77
|
-
fallback: /* @__PURE__ */ React.createElement(Progress, null)
|
|
78
|
-
}, /* @__PURE__ */ React.createElement(LazyGraphQlDefinition, {
|
|
79
|
-
...props
|
|
80
|
-
}));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const LazyOpenApiDefinition = React.lazy(() => import('./OpenApiDefinition-48ae3040.esm.js').then((m) => ({
|
|
84
|
-
default: m.OpenApiDefinition
|
|
85
|
-
})));
|
|
86
|
-
const OpenApiDefinitionWidget = (props) => {
|
|
87
|
-
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
88
|
-
fallback: /* @__PURE__ */ React.createElement(Progress, null)
|
|
89
|
-
}, /* @__PURE__ */ React.createElement(LazyOpenApiDefinition, {
|
|
90
|
-
...props
|
|
91
|
-
}));
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
function defaultDefinitionWidgets() {
|
|
95
|
-
return [
|
|
96
|
-
{
|
|
97
|
-
type: "openapi",
|
|
98
|
-
title: "OpenAPI",
|
|
99
|
-
rawLanguage: "yaml",
|
|
100
|
-
component: (definition) => /* @__PURE__ */ React.createElement(OpenApiDefinitionWidget, {
|
|
101
|
-
definition
|
|
102
|
-
})
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type: "asyncapi",
|
|
106
|
-
title: "AsyncAPI",
|
|
107
|
-
rawLanguage: "yaml",
|
|
108
|
-
component: (definition) => /* @__PURE__ */ React.createElement(AsyncApiDefinitionWidget, {
|
|
109
|
-
definition
|
|
110
|
-
})
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
type: "graphql",
|
|
114
|
-
title: "GraphQL",
|
|
115
|
-
rawLanguage: "graphql",
|
|
116
|
-
component: (definition) => /* @__PURE__ */ React.createElement(GraphQlDefinitionWidget, {
|
|
117
|
-
definition
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const ApiTypeTitle = ({ apiEntity }) => {
|
|
124
|
-
const config = useApi(apiDocsConfigRef);
|
|
125
|
-
const definition = config.getApiDefinitionWidget(apiEntity);
|
|
126
|
-
const type = definition ? definition.title : apiEntity.spec.type;
|
|
127
|
-
return /* @__PURE__ */ React.createElement("span", null, type);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
function createSpecApiTypeColumn() {
|
|
131
|
-
return {
|
|
132
|
-
title: "Type",
|
|
133
|
-
field: "spec.type",
|
|
134
|
-
render: (entity) => /* @__PURE__ */ React.createElement(ApiTypeTitle, {
|
|
135
|
-
apiEntity: entity
|
|
136
|
-
})
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
const apiEntityColumns = [
|
|
140
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
141
|
-
EntityTable.columns.createSystemColumn(),
|
|
142
|
-
EntityTable.columns.createOwnerColumn(),
|
|
143
|
-
createSpecApiTypeColumn(),
|
|
144
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
145
|
-
EntityTable.columns.createMetadataDescriptionColumn()
|
|
146
|
-
];
|
|
147
|
-
|
|
148
|
-
const ConsumedApisCard = ({ variant = "gridItem" }) => {
|
|
149
|
-
const { entity } = useEntity();
|
|
150
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
151
|
-
type: RELATION_CONSUMES_API
|
|
152
|
-
});
|
|
153
|
-
if (loading) {
|
|
154
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
155
|
-
variant,
|
|
156
|
-
title: "Consumed APIs"
|
|
157
|
-
}, /* @__PURE__ */ React.createElement(Progress, null));
|
|
158
|
-
}
|
|
159
|
-
if (error || !entities) {
|
|
160
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
161
|
-
variant,
|
|
162
|
-
title: "Consumed APIs"
|
|
163
|
-
}, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
164
|
-
severity: "error",
|
|
165
|
-
title: "Could not load APIs",
|
|
166
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
167
|
-
text: `${error}`,
|
|
168
|
-
language: "text"
|
|
169
|
-
})
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
return /* @__PURE__ */ React.createElement(EntityTable, {
|
|
173
|
-
title: "Consumed APIs",
|
|
174
|
-
variant,
|
|
175
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", {
|
|
176
|
-
style: { textAlign: "center" }
|
|
177
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
178
|
-
variant: "body1"
|
|
179
|
-
}, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography, {
|
|
180
|
-
variant: "body2"
|
|
181
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
182
|
-
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
|
|
183
|
-
}, "Learn how to change this."))),
|
|
184
|
-
columns: apiEntityColumns,
|
|
185
|
-
entities
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const columns = [
|
|
190
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
191
|
-
EntityTable.columns.createOwnerColumn(),
|
|
192
|
-
createSpecApiTypeColumn(),
|
|
193
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
194
|
-
EntityTable.columns.createMetadataDescriptionColumn()
|
|
195
|
-
];
|
|
196
|
-
const HasApisCard = ({ variant = "gridItem" }) => {
|
|
197
|
-
const { entity } = useEntity();
|
|
198
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
199
|
-
type: RELATION_HAS_PART,
|
|
200
|
-
kind: "API"
|
|
201
|
-
});
|
|
202
|
-
if (loading) {
|
|
203
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
204
|
-
variant,
|
|
205
|
-
title: "APIs"
|
|
206
|
-
}, /* @__PURE__ */ React.createElement(Progress, null));
|
|
207
|
-
}
|
|
208
|
-
if (error || !entities) {
|
|
209
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
210
|
-
variant,
|
|
211
|
-
title: "APIs"
|
|
212
|
-
}, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
213
|
-
severity: "error",
|
|
214
|
-
title: "Could not load APIs",
|
|
215
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
216
|
-
text: `${error}`,
|
|
217
|
-
language: "text"
|
|
218
|
-
})
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
return /* @__PURE__ */ React.createElement(EntityTable, {
|
|
222
|
-
title: "APIs",
|
|
223
|
-
variant,
|
|
224
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", {
|
|
225
|
-
style: { textAlign: "center" }
|
|
226
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
227
|
-
variant: "body1"
|
|
228
|
-
}, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography, {
|
|
229
|
-
variant: "body2"
|
|
230
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
231
|
-
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api"
|
|
232
|
-
}, "Learn how to change this."))),
|
|
233
|
-
columns,
|
|
234
|
-
entities
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const ProvidedApisCard = ({ variant = "gridItem" }) => {
|
|
239
|
-
const { entity } = useEntity();
|
|
240
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
241
|
-
type: RELATION_PROVIDES_API
|
|
242
|
-
});
|
|
243
|
-
if (loading) {
|
|
244
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
245
|
-
variant,
|
|
246
|
-
title: "Provided APIs"
|
|
247
|
-
}, /* @__PURE__ */ React.createElement(Progress, null));
|
|
248
|
-
}
|
|
249
|
-
if (error || !entities) {
|
|
250
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
251
|
-
variant,
|
|
252
|
-
title: "Provided APIs"
|
|
253
|
-
}, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
254
|
-
severity: "error",
|
|
255
|
-
title: "Could not load APIs",
|
|
256
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
257
|
-
text: `${error}`,
|
|
258
|
-
language: "text"
|
|
259
|
-
})
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
|
-
return /* @__PURE__ */ React.createElement(EntityTable, {
|
|
263
|
-
title: "Provided APIs",
|
|
264
|
-
variant,
|
|
265
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", {
|
|
266
|
-
style: { textAlign: "center" }
|
|
267
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
268
|
-
variant: "body1"
|
|
269
|
-
}, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography, {
|
|
270
|
-
variant: "body2"
|
|
271
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
272
|
-
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
|
|
273
|
-
}, "Learn how to change this."))),
|
|
274
|
-
columns: apiEntityColumns,
|
|
275
|
-
entities
|
|
276
|
-
});
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
const ConsumingComponentsCard = ({ variant = "gridItem" }) => {
|
|
280
|
-
const { entity } = useEntity();
|
|
281
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
282
|
-
type: RELATION_API_CONSUMED_BY
|
|
283
|
-
});
|
|
284
|
-
if (loading) {
|
|
285
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
286
|
-
variant,
|
|
287
|
-
title: "Consumers"
|
|
288
|
-
}, /* @__PURE__ */ React.createElement(Progress, null));
|
|
289
|
-
}
|
|
290
|
-
if (error || !entities) {
|
|
291
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
292
|
-
variant,
|
|
293
|
-
title: "Consumers"
|
|
294
|
-
}, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
295
|
-
severity: "error",
|
|
296
|
-
title: "Could not load components",
|
|
297
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
298
|
-
text: `${error}`,
|
|
299
|
-
language: "text"
|
|
300
|
-
})
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
return /* @__PURE__ */ React.createElement(EntityTable, {
|
|
304
|
-
title: "Consumers",
|
|
305
|
-
variant,
|
|
306
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", {
|
|
307
|
-
style: { textAlign: "center" }
|
|
308
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
309
|
-
variant: "body1"
|
|
310
|
-
}, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, {
|
|
311
|
-
variant: "body2"
|
|
312
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
313
|
-
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
|
|
314
|
-
}, "Learn how to change this."))),
|
|
315
|
-
columns: EntityTable.componentEntityColumns,
|
|
316
|
-
entities
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const ProvidingComponentsCard = ({ variant = "gridItem" }) => {
|
|
321
|
-
const { entity } = useEntity();
|
|
322
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
323
|
-
type: RELATION_API_PROVIDED_BY
|
|
324
|
-
});
|
|
325
|
-
if (loading) {
|
|
326
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
327
|
-
variant,
|
|
328
|
-
title: "Providers"
|
|
329
|
-
}, /* @__PURE__ */ React.createElement(Progress, null));
|
|
330
|
-
}
|
|
331
|
-
if (error || !entities) {
|
|
332
|
-
return /* @__PURE__ */ React.createElement(InfoCard, {
|
|
333
|
-
variant,
|
|
334
|
-
title: "Providers"
|
|
335
|
-
}, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
336
|
-
severity: "error",
|
|
337
|
-
title: "Could not load components",
|
|
338
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
339
|
-
text: `${error}`,
|
|
340
|
-
language: "text"
|
|
341
|
-
})
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
return /* @__PURE__ */ React.createElement(EntityTable, {
|
|
345
|
-
title: "Providers",
|
|
346
|
-
variant,
|
|
347
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", {
|
|
348
|
-
style: { textAlign: "center" }
|
|
349
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
350
|
-
variant: "body1"
|
|
351
|
-
}, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, {
|
|
352
|
-
variant: "body2"
|
|
353
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
354
|
-
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
|
|
355
|
-
}, "Learn how to change this."))),
|
|
356
|
-
columns: EntityTable.componentEntityColumns,
|
|
357
|
-
entities
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
const rootRoute = createRouteRef({
|
|
362
|
-
id: "api-docs"
|
|
363
|
-
});
|
|
364
|
-
const createComponentRouteRef = createExternalRouteRef({
|
|
365
|
-
id: "create-component",
|
|
366
|
-
optional: true
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
const apiDocsPlugin = createPlugin({
|
|
370
|
-
id: "api-docs",
|
|
371
|
-
routes: {
|
|
372
|
-
root: rootRoute
|
|
373
|
-
},
|
|
374
|
-
apis: [
|
|
375
|
-
createApiFactory({
|
|
376
|
-
api: apiDocsConfigRef,
|
|
377
|
-
deps: {},
|
|
378
|
-
factory: () => {
|
|
379
|
-
const definitionWidgets = defaultDefinitionWidgets();
|
|
380
|
-
return {
|
|
381
|
-
getApiDefinitionWidget: (apiEntity) => {
|
|
382
|
-
return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
})
|
|
387
|
-
],
|
|
388
|
-
externalRoutes: {
|
|
389
|
-
createComponent: createComponentRouteRef
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
const ApiExplorerPage = apiDocsPlugin.provide(createRoutableExtension({
|
|
393
|
-
name: "ApiExplorerPage",
|
|
394
|
-
component: () => import('./index-160e3ddd.esm.js').then((m) => m.ApiExplorerPage),
|
|
395
|
-
mountPoint: rootRoute
|
|
396
|
-
}));
|
|
397
|
-
const EntityApiDefinitionCard = apiDocsPlugin.provide(createComponentExtension({
|
|
398
|
-
name: "EntityApiDefinitionCard",
|
|
399
|
-
component: {
|
|
400
|
-
lazy: () => import('./index-00af9be1.esm.js').then((m) => m.ApiDefinitionCard)
|
|
401
|
-
}
|
|
402
|
-
}));
|
|
403
|
-
const EntityConsumedApisCard = apiDocsPlugin.provide(createComponentExtension({
|
|
404
|
-
name: "EntityConsumedApisCard",
|
|
405
|
-
component: {
|
|
406
|
-
lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.ConsumedApisCard)
|
|
407
|
-
}
|
|
408
|
-
}));
|
|
409
|
-
const EntityConsumingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
|
|
410
|
-
name: "EntityConsumingComponentsCard",
|
|
411
|
-
component: {
|
|
412
|
-
lazy: () => import('./index-674cfd0b.esm.js').then((m) => m.ConsumingComponentsCard)
|
|
413
|
-
}
|
|
414
|
-
}));
|
|
415
|
-
const EntityProvidedApisCard = apiDocsPlugin.provide(createComponentExtension({
|
|
416
|
-
name: "EntityProvidedApisCard",
|
|
417
|
-
component: {
|
|
418
|
-
lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.ProvidedApisCard)
|
|
419
|
-
}
|
|
420
|
-
}));
|
|
421
|
-
const EntityProvidingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
|
|
422
|
-
name: "EntityProvidingComponentsCard",
|
|
423
|
-
component: {
|
|
424
|
-
lazy: () => import('./index-674cfd0b.esm.js').then((m) => m.ProvidingComponentsCard)
|
|
425
|
-
}
|
|
426
|
-
}));
|
|
427
|
-
const EntityHasApisCard = apiDocsPlugin.provide(createComponentExtension({
|
|
428
|
-
name: "EntityHasApisCard",
|
|
429
|
-
component: {
|
|
430
|
-
lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.HasApisCard)
|
|
431
|
-
}
|
|
432
|
-
}));
|
|
433
|
-
|
|
434
|
-
export { ApiDefinitionCard as A, ConsumedApisCard as C, EntityApiDefinitionCard as E, HasApisCard as H, OpenApiDefinitionWidget as O, ProvidedApisCard as P, ApiTypeTitle as a, ConsumingComponentsCard as b, createComponentRouteRef as c, defaultDefinitionWidgets as d, ProvidingComponentsCard as e, apiDocsConfigRef as f, apiDocsPlugin as g, ApiExplorerPage as h, EntityConsumedApisCard as i, EntityConsumingComponentsCard as j, EntityHasApisCard as k, EntityProvidedApisCard as l, EntityProvidingComponentsCard as m, AsyncApiDefinitionWidget as n, PlainApiDefinitionWidget as o };
|
|
435
|
-
//# sourceMappingURL=index-83f082c6.esm.js.map
|