@backstage/plugin-api-docs 0.12.6-next.1 → 0.12.6-next.2
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 +19 -0
- package/dist/alpha.d.ts +10 -10
- package/dist/alpha.esm.js +14 -11
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiDefinitionCard.esm.js +15 -12
- package/dist/components/ApiDefinitionCard/ApiDefinitionCard.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiDefinitionWidget.esm.js +6 -6
- package/dist/components/ApiDefinitionCard/ApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiTypeTitle.esm.js +2 -2
- package/dist/components/ApiDefinitionCard/ApiTypeTitle.esm.js.map +1 -1
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js +45 -30
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js.map +1 -1
- package/dist/components/ApiExplorerPage/ApiExplorerPage.esm.js +2 -2
- package/dist/components/ApiExplorerPage/ApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js +33 -17
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApisCards/ConsumedApisCard.esm.js +21 -14
- package/dist/components/ApisCards/ConsumedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/HasApisCard.esm.js +14 -7
- package/dist/components/ApisCards/HasApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/ProvidedApisCard.esm.js +21 -14
- package/dist/components/ApisCards/ProvidedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/presets.esm.js +23 -19
- package/dist/components/ApisCards/presets.esm.js.map +1 -1
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinition.esm.js +2 -2
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinition.esm.js.map +1 -1
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.esm.js +4 -3
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js +10 -7
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js +10 -7
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js.map +1 -1
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinition.esm.js +6 -6
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinition.esm.js.map +1 -1
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.esm.js +4 -3
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.esm.js.map +1 -1
- package/dist/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.esm.js +2 -2
- package/dist/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinition.esm.js +4 -3
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinition.esm.js.map +1 -1
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js +5 -4
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js +2 -2
- package/dist/components/PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/TrpcDefinitionWidget/TrpcApiDefinitionWidget.esm.js +2 -2
- package/dist/components/TrpcDefinitionWidget/TrpcApiDefinitionWidget.esm.js.map +1 -1
- package/dist/index.d.ts +25 -25
- package/dist/plugin.esm.js +1 -1
- package/package.json +15 -15
|
@@ -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
|
|
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=\"API definition options\"\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 Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA,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,W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;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,iBACC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAO,SAAS,OAAS,EAAA,KAAA,EAAM,SAAU,EAAA,QAAA,EAAA,OAAA,EAE1C,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useOutlet } from 'react-router-dom';
|
|
3
3
|
import { DefaultApiExplorerPage } from './DefaultApiExplorerPage.esm.js';
|
|
4
4
|
|
|
5
5
|
const ApiExplorerPage = (props) => {
|
|
6
6
|
const outlet = useOutlet();
|
|
7
|
-
return outlet || /* @__PURE__ */
|
|
7
|
+
return outlet || /* @__PURE__ */ jsx(DefaultApiExplorerPage, { ...props });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { ApiExplorerPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiExplorerPage.esm.js","sources":["../../../src/components/ApiExplorerPage/ApiExplorerPage.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
|
|
1
|
+
{"version":3,"file":"ApiExplorerPage.esm.js","sources":["../../../src/components/ApiExplorerPage/ApiExplorerPage.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 { useOutlet } from 'react-router-dom';\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"],"names":[],"mappings":";;;;AA0Ba,MAAA,eAAA,GAAkB,CAAC,KAAuC,KAAA;AACrE,EAAA,MAAM,SAAS,SAAU,EAAA;AAEzB,EAAA,OAAO,MAAU,oBAAA,GAAA,CAAC,sBAAwB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AACtD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { PageWithHeader, Content, ContentHeader, CreateButton, SupportButton } from '@backstage/core-components';
|
|
2
3
|
import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
3
4
|
import { CatalogTable } from '@backstage/plugin-catalog';
|
|
4
5
|
import { EntityListProvider, CatalogFilterLayout, EntityKindPicker, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import React from 'react';
|
|
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';
|
|
@@ -31,27 +31,43 @@ const DefaultApiExplorerPage = (props) => {
|
|
|
31
31
|
const { allowed } = usePermission({
|
|
32
32
|
permission: catalogEntityCreatePermission
|
|
33
33
|
});
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
35
|
PageWithHeader,
|
|
36
36
|
{
|
|
37
37
|
themeId: "apis",
|
|
38
38
|
title: "APIs",
|
|
39
39
|
subtitle: generatedSubtitle,
|
|
40
|
-
pageTitleOverride: "APIs"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
pageTitleOverride: "APIs",
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(ContentHeader, { title: "", children: [
|
|
43
|
+
allowed && /* @__PURE__ */ jsx(
|
|
44
|
+
CreateButton,
|
|
45
|
+
{
|
|
46
|
+
title: "Register Existing API",
|
|
47
|
+
to: registerComponentLink?.()
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(SupportButton, { children: "All your APIs" })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(CatalogFilterLayout.Filters, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(EntityKindPicker, { initialFilter: "api", hidden: true }),
|
|
55
|
+
/* @__PURE__ */ jsx(EntityTypePicker, {}),
|
|
56
|
+
/* @__PURE__ */ jsx(UserListPicker, { initialFilter: initiallySelectedFilter }),
|
|
57
|
+
/* @__PURE__ */ jsx(EntityOwnerPicker, { mode: ownerPickerMode }),
|
|
58
|
+
/* @__PURE__ */ jsx(EntityLifecyclePicker, {}),
|
|
59
|
+
/* @__PURE__ */ jsx(EntityTagPicker, {})
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx(CatalogFilterLayout.Content, { children: /* @__PURE__ */ jsx(
|
|
62
|
+
CatalogTable,
|
|
63
|
+
{
|
|
64
|
+
columns: columns || defaultColumns,
|
|
65
|
+
actions
|
|
66
|
+
}
|
|
67
|
+
) })
|
|
68
|
+
] }) })
|
|
69
|
+
] })
|
|
70
|
+
}
|
|
55
71
|
);
|
|
56
72
|
};
|
|
57
73
|
|
|
@@ -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
|
|
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 = `${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n } API Explorer`;\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title=\"APIs\"\n subtitle={generatedSubtitle}\n pageTitleOverride=\"APIs\"\n >\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title=\"Register Existing API\"\n to={registerComponentLink?.()}\n />\n )}\n <SupportButton>All your APIs</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":";;;;;;;;;AA4CA,MAAM,cAAiD,GAAA;AAAA,EACrD,aAAa,OAAQ,CAAA,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACvD,aAAa,OAAQ,CAAA,gBAAA,CAAiB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,EAC5D,YAAA,CAAa,QAAQ,kBAAmB,EAAA;AAAA,EACxC,YAAA,CAAa,QAAQ,iBAAkB,EAAA;AAAA,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,EAAA,QAAA,kBAAA,IAAA,CAAC,mBACC,EAAA,EAAA,QAAA,EAAA;AAAA,0BAAC,IAAA,CAAA,mBAAA,CAAoB,SAApB,EACC,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,aAAA,EAAc,KAAM,EAAA,MAAA,EAAM,IAAC,EAAA,CAAA;AAAA,gCAC5C,gBAAiB,EAAA,EAAA,CAAA;AAAA,4BAClB,GAAA,CAAC,cAAe,EAAA,EAAA,aAAA,EAAe,uBAAyB,EAAA,CAAA;AAAA,4BACxD,GAAA,CAAC,iBAAkB,EAAA,EAAA,IAAA,EAAM,eAAiB,EAAA,CAAA;AAAA,gCACzC,qBAAsB,EAAA,EAAA,CAAA;AAAA,gCACtB,eAAgB,EAAA,EAAA;AAAA,WACnB,EAAA,CAAA;AAAA,0BACA,GAAA,CAAC,mBAAoB,CAAA,OAAA,EAApB,EACC,QAAA,kBAAA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,SAAS,OAAW,IAAA,cAAA;AAAA,cACpB;AAAA;AAAA,WAEJ,EAAA;AAAA,SAAA,EACF,CACF,EAAA;AAAA,OACF,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_CONSUMES_API } from '@backstage/catalog-model';
|
|
2
3
|
import Typography from '@material-ui/core/Typography';
|
|
3
4
|
import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
import { apiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
7
|
|
|
@@ -17,31 +17,38 @@ const ConsumedApisCard = (props) => {
|
|
|
17
17
|
type: RELATION_CONSUMES_API
|
|
18
18
|
});
|
|
19
19
|
if (loading) {
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
21
21
|
}
|
|
22
22
|
if (error || !entities) {
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
24
24
|
WarningPanel,
|
|
25
25
|
{
|
|
26
26
|
severity: "error",
|
|
27
27
|
title: "Could not load APIs",
|
|
28
|
-
message: /* @__PURE__ */
|
|
28
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
29
|
}
|
|
30
|
-
));
|
|
30
|
+
) });
|
|
31
31
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
33
|
EntityTable,
|
|
34
34
|
{
|
|
35
35
|
title,
|
|
36
36
|
variant,
|
|
37
|
-
emptyContent: /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
"
|
|
44
|
-
|
|
37
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body1", children: [
|
|
39
|
+
"This ",
|
|
40
|
+
entity.kind.toLocaleLowerCase("en-US"),
|
|
41
|
+
" does not consume any APIs."
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
44
|
+
Link,
|
|
45
|
+
{
|
|
46
|
+
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional",
|
|
47
|
+
externalLinkIcon: true,
|
|
48
|
+
children: "Learn how to change this"
|
|
49
|
+
}
|
|
50
|
+
) })
|
|
51
|
+
] }),
|
|
45
52
|
columns,
|
|
46
53
|
tableOptions,
|
|
47
54
|
entities
|
|
@@ -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 { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\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 {\n variant = 'gridItem',\n title = 'Consumed APIs',\n columns = apiEntityColumns,\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=\"Could not load APIs\"\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 This {entity.kind.toLocaleLowerCase('en-US')} does not consume any\n APIs.\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 Learn how to change this\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAQ,GAAA,eAAA;AAAA,IACR,OAAU,GAAA,gBAAA;AAAA,IACV,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,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;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA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@backstage/catalog-model';
|
|
2
3
|
import Typography from '@material-ui/core/Typography';
|
|
3
4
|
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
import { createSpecApiTypeColumn } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
7
|
|
|
@@ -25,24 +25,31 @@ const HasApisCard = (props) => {
|
|
|
25
25
|
kind: "API"
|
|
26
26
|
});
|
|
27
27
|
if (loading) {
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
29
29
|
}
|
|
30
30
|
if (error || !entities) {
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
32
32
|
WarningPanel,
|
|
33
33
|
{
|
|
34
34
|
severity: "error",
|
|
35
35
|
title: "Could not load APIs",
|
|
36
|
-
message: /* @__PURE__ */
|
|
36
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
37
37
|
}
|
|
38
|
-
));
|
|
38
|
+
) });
|
|
39
39
|
}
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
41
|
EntityTable,
|
|
42
42
|
{
|
|
43
43
|
title,
|
|
44
44
|
variant,
|
|
45
|
-
emptyContent: /* @__PURE__ */
|
|
45
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body1", children: [
|
|
47
|
+
"This ",
|
|
48
|
+
entity.kind.toLocaleLowerCase("en-US"),
|
|
49
|
+
" does not contain any APIs."
|
|
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
|
+
] }),
|
|
46
53
|
columns,
|
|
47
54
|
tableOptions,
|
|
48
55
|
entities
|
|
@@ -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
|
|
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';\n\nconst presetColumns: TableColumn<ApiEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\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 {\n variant = 'gridItem',\n title = 'APIs',\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=\"Could not load APIs\"\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 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 tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmCA,MAAM,aAA0C,GAAA;AAAA,EAC9C,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,EAChE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,uBAAwB,EAAA;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AAA,EAAA,EAAW,SAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,UAAA,OAAA;AAAA,UACpB,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,UAAE;AAAA,SAE/C,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAClB,8BAAC,IAAK,EAAA,EAAA,EAAA,EAAG,gFAAiF,EAAA,QAAA,EAAA,2BAAA,EAE1F,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_PROVIDES_API } from '@backstage/catalog-model';
|
|
2
3
|
import Typography from '@material-ui/core/Typography';
|
|
3
4
|
import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
import { apiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
7
|
|
|
@@ -17,31 +17,38 @@ const ProvidedApisCard = (props) => {
|
|
|
17
17
|
type: RELATION_PROVIDES_API
|
|
18
18
|
});
|
|
19
19
|
if (loading) {
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
21
21
|
}
|
|
22
22
|
if (error || !entities) {
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
24
24
|
WarningPanel,
|
|
25
25
|
{
|
|
26
26
|
severity: "error",
|
|
27
27
|
title: "Could not load APIs",
|
|
28
|
-
message: /* @__PURE__ */
|
|
28
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
29
|
}
|
|
30
|
-
));
|
|
30
|
+
) });
|
|
31
31
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
33
|
EntityTable,
|
|
34
34
|
{
|
|
35
35
|
title,
|
|
36
36
|
variant,
|
|
37
|
-
emptyContent: /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
"
|
|
44
|
-
|
|
37
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body1", children: [
|
|
39
|
+
"This ",
|
|
40
|
+
entity.kind.toLocaleLowerCase("en-US"),
|
|
41
|
+
" does not provide any APIs."
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
44
|
+
Link,
|
|
45
|
+
{
|
|
46
|
+
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional",
|
|
47
|
+
externalLinkIcon: true,
|
|
48
|
+
children: "Learn how to change this"
|
|
49
|
+
}
|
|
50
|
+
) })
|
|
51
|
+
] }),
|
|
45
52
|
columns,
|
|
46
53
|
tableOptions,
|
|
47
54
|
entities
|
|
@@ -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 { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\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 {\n variant = 'gridItem',\n title = 'Provided APIs',\n columns = apiEntityColumns,\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=\"Could not load APIs\"\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 This {entity.kind.toLocaleLowerCase('en-US')} does not provide any\n APIs.\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 Learn how to change this\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAQ,GAAA,eAAA;AAAA,IACR,OAAU,GAAA,gBAAA;AAAA,IACV,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,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;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,QAAA,kBAAA,GAAA,CAAC,YAAS,CACZ,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IACE,uBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,qBAAA;AAAA,QACN,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,wBAAC,IAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,UAAA,OAAA;AAAA,UACpB,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,UAAE;AAAA,SAE/C,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,YACjB,QAAA,EAAA;AAAA;AAAA,SAGH,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { EntityTable } from '@backstage/plugin-catalog-react';
|
|
2
3
|
import ExtensionIcon from '@material-ui/icons/Extension';
|
|
3
4
|
import ToggleButton from '@material-ui/lab/ToggleButton';
|
|
4
|
-
import
|
|
5
|
+
import { useState } from 'react';
|
|
5
6
|
import '@material-ui/lab/Alert';
|
|
6
7
|
import '../../config.esm.js';
|
|
7
8
|
import '@backstage/core-components';
|
|
@@ -17,32 +18,35 @@ function createSpecApiTypeColumn() {
|
|
|
17
18
|
return {
|
|
18
19
|
title: "Type",
|
|
19
20
|
field: "spec.type",
|
|
20
|
-
render: (entity) => /* @__PURE__ */
|
|
21
|
+
render: (entity) => /* @__PURE__ */ jsx(ApiTypeTitle, { apiEntity: entity })
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
const ApiDefinitionButton = ({ apiEntity }) => {
|
|
24
25
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
ToggleButton,
|
|
29
|
+
{
|
|
30
|
+
"aria-label": "Toggle API Definition Dialog",
|
|
31
|
+
onClick: () => setDialogOpen(!dialogOpen),
|
|
32
|
+
value: dialogOpen,
|
|
33
|
+
children: /* @__PURE__ */ jsx(ExtensionIcon, {})
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
ApiDefinitionDialog,
|
|
38
|
+
{
|
|
39
|
+
entity: apiEntity,
|
|
40
|
+
open: dialogOpen,
|
|
41
|
+
onClose: () => setDialogOpen(false)
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] });
|
|
41
45
|
};
|
|
42
46
|
function createApiDefinitionColumn() {
|
|
43
47
|
return {
|
|
44
48
|
title: "API Definition",
|
|
45
|
-
render: (entity) => /* @__PURE__ */
|
|
49
|
+
render: (entity) => /* @__PURE__ */ jsx(ApiDefinitionButton, { apiEntity: entity })
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
52
|
const apiEntityColumns = [
|
|
@@ -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
|
|
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: 'Type',\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 return (\n <>\n <ToggleButton\n aria-label=\"Toggle API Definition Dialog\"\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(): TableColumn<ApiEntity> {\n return {\n title: 'API Definition',\n render: entity => <ApiDefinitionButton apiEntity={entity} />,\n };\n}\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 createApiDefinitionColumn(),\n];\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAyBO,SAAS,uBAAkD,GAAA;AAChE,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,MAAA;AAAA,IACP,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,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,YAAW,EAAA,8BAAA;AAAA,QACX,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,yBAAoD,GAAA;AAC3D,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,gBAAA;AAAA,IACP,MAAQ,EAAA,CAAA,MAAA,qBAAW,GAAA,CAAA,mBAAA,EAAA,EAAoB,WAAW,MAAQ,EAAA;AAAA,GAC5D;AACF;AAEO,MAAM,gBAA6C,GAAA;AAAA,EACxD,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,EAChE,WAAA,CAAY,QAAQ,kBAAmB,EAAA;AAAA,EACvC,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,uBAAwB,EAAA;AAAA,EACxB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,EAC9C,WAAA,CAAY,QAAQ,+BAAgC,EAAA;AAAA,EACpD,yBAA0B;AAC5B;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import AsyncApi from '@asyncapi/react-component';
|
|
2
3
|
import '@asyncapi/react-component/styles/default.css';
|
|
3
4
|
import { makeStyles, alpha, darken, useTheme } from '@material-ui/core/styles';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
|
|
6
6
|
const useStyles = makeStyles((theme) => ({
|
|
7
7
|
root: {
|
|
@@ -162,7 +162,7 @@ const AsyncApiDefinition = ({
|
|
|
162
162
|
if (resolvers) {
|
|
163
163
|
config.parserOptions.__unstable.resolver.resolvers = resolvers;
|
|
164
164
|
}
|
|
165
|
-
return /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ jsx("div", { className: classNames, children: /* @__PURE__ */ jsx(AsyncApi, { schema: definition, config }) });
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
export { AsyncApiDefinition };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver: AsyncApiResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver: AsyncApiResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,SAAA;AAAA,IACZ,aAAe,EAAA;AAAA,MACb,UAAY,EAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA;AAAA,MACb,GAAG,MAAM,UAAW,CAAA;AAAA,KACtB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,MAAM,UAAW,CAAA;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,WAAa,EAAA,KAAA,CAAM,KAAM,CAAA,OAAA,CAAQ,QAAQ,GAAG;AAAA,KAC9C;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,OAAS,EAAA;AAAA,KACX;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KACxC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA,KACtC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,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B,CAAC;AAAA,EACjC,UAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,UAAA,GAAa,CAAG,EAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAChC,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,GAAS,OAAQ,CAAA,IAAA,GAAO,EACjD,CAAA,CAAA;AAEA,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,aAAe,EAAA;AAAA,MACb,UAAY,EAAA;AAAA,QACV,QAAU,EAAA;AAAA,UACR,SAAA,EAAW,CAAC,kBAAA,EAAoB,iBAAiB;AAAA;AACnD;AACF;AACF,GACF;AAGA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,MAAA,CAAA,aAAA,CAAc,UAAW,CAAA,QAAA,CAAS,SAAY,GAAA,SAAA;AAAA;AAGvD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,UAAA,EAAA,sCACb,QAAS,EAAA,EAAA,MAAA,EAAQ,UAAY,EAAA,MAAA,EAAgB,CAChD,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver: AsyncApiResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver: AsyncApiResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,E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