@backstage/plugin-api-docs 0.12.6-next.1 → 0.12.6
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 +39 -0
- package/dist/alpha.d.ts +43 -11
- package/dist/alpha.esm.js +15 -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 +48 -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 +40 -19
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApisCards/ConsumedApisCard.esm.js +26 -18
- package/dist/components/ApisCards/ConsumedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/HasApisCard.esm.js +27 -16
- package/dist/components/ApisCards/HasApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/ProvidedApisCard.esm.js +26 -18
- package/dist/components/ApisCards/ProvidedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/presets.esm.js +42 -33
- 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 +15 -9
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js +15 -9
- 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/dist/translation.esm.js +72 -0
- package/dist/translation.esm.js.map +1 -0
- package/package.json +17 -17
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
2
3
|
import Box from '@material-ui/core/Box';
|
|
3
4
|
import Button from '@material-ui/core/Button';
|
|
@@ -9,9 +10,11 @@ import Tab from '@material-ui/core/Tab';
|
|
|
9
10
|
import Tabs from '@material-ui/core/Tabs';
|
|
10
11
|
import Typography from '@material-ui/core/Typography';
|
|
11
12
|
import { makeStyles } from '@material-ui/core/styles';
|
|
12
|
-
import
|
|
13
|
+
import { useState, useEffect } from 'react';
|
|
13
14
|
import { apiDocsConfigRef } from '../../config.esm.js';
|
|
14
15
|
import { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js';
|
|
16
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
17
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
15
18
|
|
|
16
19
|
const useStyles = makeStyles((theme) => ({
|
|
17
20
|
fullHeightDialog: {
|
|
@@ -48,7 +51,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
48
51
|
function TabPanel(props) {
|
|
49
52
|
const { children, value, index, ...other } = props;
|
|
50
53
|
const classes = useStyles();
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
52
55
|
"div",
|
|
53
56
|
{
|
|
54
57
|
role: "tabpanel",
|
|
@@ -56,9 +59,9 @@ function TabPanel(props) {
|
|
|
56
59
|
id: `vertical-tabpanel-${index}`,
|
|
57
60
|
"aria-labelledby": `vertical-tab-${index}`,
|
|
58
61
|
className: classes.tabContents,
|
|
59
|
-
...other
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
...other,
|
|
63
|
+
children: value === index && /* @__PURE__ */ jsx(Box, { pl: 3, pr: 3, children })
|
|
64
|
+
}
|
|
62
65
|
);
|
|
63
66
|
}
|
|
64
67
|
function a11yProps(index) {
|
|
@@ -69,8 +72,9 @@ function a11yProps(index) {
|
|
|
69
72
|
}
|
|
70
73
|
function ApiDefinitionDialog(props) {
|
|
71
74
|
const { open, entity, onClose } = props;
|
|
72
|
-
const [activeTab, setActiveTab] =
|
|
75
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
73
76
|
const classes = useStyles();
|
|
77
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
74
78
|
useEffect(() => {
|
|
75
79
|
setActiveTab(0);
|
|
76
80
|
}, [open]);
|
|
@@ -78,7 +82,7 @@ function ApiDefinitionDialog(props) {
|
|
|
78
82
|
const definitionWidget = config.getApiDefinitionWidget(entity);
|
|
79
83
|
let tabIndex = 0;
|
|
80
84
|
let tabPanelIndex = 0;
|
|
81
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
82
86
|
Dialog,
|
|
83
87
|
{
|
|
84
88
|
fullWidth: true,
|
|
@@ -86,29 +90,43 @@ function ApiDefinitionDialog(props) {
|
|
|
86
90
|
open,
|
|
87
91
|
onClose,
|
|
88
92
|
"aria-labelledby": "api-definition-dialog-title",
|
|
89
|
-
PaperProps: { className: classes.fullHeightDialog }
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
PaperProps: { className: classes.fullHeightDialog },
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsxs(DialogTitle, { id: "api-definition-dialog-title", disableTypography: true, children: [
|
|
96
|
+
/* @__PURE__ */ jsxs(Typography, { className: classes.type, children: [
|
|
97
|
+
"API - ",
|
|
98
|
+
definitionWidget?.title ?? "Raw"
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.title, variant: "h1", children: entity.metadata.title ?? entity.metadata.name })
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ jsxs(DialogContent, { dividers: true, className: classes.root, children: [
|
|
103
|
+
/* @__PURE__ */ jsxs(
|
|
104
|
+
Tabs,
|
|
105
|
+
{
|
|
106
|
+
orientation: "vertical",
|
|
107
|
+
variant: "scrollable",
|
|
108
|
+
value: activeTab,
|
|
109
|
+
onChange: (_, newValue) => setActiveTab(newValue),
|
|
110
|
+
"aria-label": t("apiDefinitionDialog.tabsAriaLabel"),
|
|
111
|
+
className: classes.tabs,
|
|
112
|
+
children: [
|
|
113
|
+
definitionWidget ? /* @__PURE__ */ jsx(Tab, { label: definitionWidget.title, ...a11yProps(tabIndex++) }) : null,
|
|
114
|
+
/* @__PURE__ */ jsx(Tab, { label: "Raw", ...a11yProps(tabIndex++) })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
definitionWidget ? /* @__PURE__ */ jsx(TabPanel, { value: activeTab, index: tabPanelIndex++, children: definitionWidget.component(entity.spec.definition) }) : null,
|
|
119
|
+
/* @__PURE__ */ jsx(TabPanel, { value: activeTab, index: tabPanelIndex++, children: /* @__PURE__ */ jsx(
|
|
120
|
+
PlainApiDefinitionWidget,
|
|
121
|
+
{
|
|
122
|
+
definition: entity.spec.definition,
|
|
123
|
+
language: definitionWidget?.rawLanguage ?? entity.spec.type
|
|
124
|
+
}
|
|
125
|
+
) })
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, color: "primary", children: t("apiDefinitionDialog.closeButtonTitle") }) })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
112
130
|
);
|
|
113
131
|
}
|
|
114
132
|
|
|
@@ -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';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n fullHeightDialog: {\n height: 'calc(100% - 64px)',\n },\n root: {\n display: 'flex',\n flexGrow: 1,\n width: '100%',\n height: '100%',\n },\n tabs: {\n borderRight: `1px solid ${theme.palette.divider}`,\n flexShrink: 0,\n },\n tabContents: {\n flexGrow: 1,\n overflowX: 'auto',\n },\n title: {\n color: theme.palette.text.primary,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.palette.text.primary,\n },\n}));\n\nfunction TabPanel(props: {\n children?: ReactNode;\n index: number;\n value: number;\n}) {\n const { children, value, index, ...other } = props;\n const classes = useStyles();\n return (\n <div\n role=\"tabpanel\"\n hidden={value !== index}\n id={`vertical-tabpanel-${index}`}\n aria-labelledby={`vertical-tab-${index}`}\n className={classes.tabContents}\n {...other}\n >\n {value === index && (\n <Box pl={3} pr={3}>\n {children}\n </Box>\n )}\n </div>\n );\n}\n\nfunction a11yProps(index: number) {\n return {\n id: `vertical-tab-${index}`,\n 'aria-controls': `vertical-tabpanel-${index}`,\n };\n}\n\n/**\n * A dialog that lets users inspect the API definition.\n *\n * @public\n */\nexport function ApiDefinitionDialog(props: {\n open: boolean;\n entity: ApiEntity;\n onClose: () => void;\n}) {\n const { open, entity, onClose } = props;\n const [activeTab, setActiveTab] = useState(0);\n const classes = useStyles();\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n useEffect(() => {\n setActiveTab(0);\n }, [open]);\n\n const config = useApi(apiDocsConfigRef);\n const definitionWidget = config.getApiDefinitionWidget(entity);\n\n let tabIndex = 0;\n let tabPanelIndex = 0;\n\n return (\n <Dialog\n fullWidth\n maxWidth=\"xl\"\n open={open}\n onClose={onClose}\n aria-labelledby=\"api-definition-dialog-title\"\n PaperProps={{ className: classes.fullHeightDialog }}\n >\n <DialogTitle id=\"api-definition-dialog-title\" disableTypography>\n <Typography className={classes.type}>\n API - {definitionWidget?.title ?? 'Raw'}\n </Typography>\n <Typography className={classes.title} variant=\"h1\">\n {entity.metadata.title ?? entity.metadata.name}\n </Typography>\n </DialogTitle>\n <DialogContent dividers className={classes.root}>\n <Tabs\n orientation=\"vertical\"\n variant=\"scrollable\"\n value={activeTab}\n onChange={(_, newValue) => setActiveTab(newValue)}\n aria-label={t('apiDefinitionDialog.tabsAriaLabel')}\n className={classes.tabs}\n >\n {definitionWidget ? (\n <Tab label={definitionWidget.title} {...a11yProps(tabIndex++)} />\n ) : null}\n <Tab label=\"Raw\" {...a11yProps(tabIndex++)} />\n </Tabs>\n\n {definitionWidget ? (\n <TabPanel value={activeTab} index={tabPanelIndex++}>\n {definitionWidget.component(entity.spec.definition)}\n </TabPanel>\n ) : null}\n <TabPanel value={activeTab} index={tabPanelIndex++}>\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={definitionWidget?.rawLanguage ?? entity.spec.type}\n />\n </TabPanel>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose} color=\"primary\">\n {t('apiDefinitionDialog.closeButtonTitle')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,gBAAkB,EAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,I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B,SAAU,CAAA,MAAA,CAAO,IAAK,CAAA,UAAU,GACpD,CACE,GAAA,IAAA;AAAA,0BACH,GAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,SAAA,EAAW,OAAO,aACjC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,wBAAA;AAAA,YAAA;AAAA,cACC,UAAA,EAAY,OAAO,IAAK,CAAA,UAAA;AAAA,cACxB,QAAU,EAAA,gBAAA,EAAkB,WAAe,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA;AAAA,WAE3D,EAAA;AAAA,SACF,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,aACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAS,OAAS,EAAA,KAAA,EAAM,SAC7B,EAAA,QAAA,EAAA,CAAA,CAAE,sCAAsC,CAAA,EAC3C,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -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,11 +1,13 @@
|
|
|
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';
|
|
9
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
10
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
9
11
|
|
|
10
12
|
const defaultColumns = [
|
|
11
13
|
CatalogTable.columns.createTitleColumn({ hidden: true }),
|
|
@@ -26,32 +28,51 @@ const DefaultApiExplorerPage = (props) => {
|
|
|
26
28
|
pagination
|
|
27
29
|
} = props;
|
|
28
30
|
const configApi = useApi(configApiRef);
|
|
29
|
-
const
|
|
31
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
32
|
+
const generatedSubtitle = t("defaultApiExplorerPage.subtitle", {
|
|
33
|
+
orgName: configApi.getOptionalString("organization.name") ?? "Backstage"
|
|
34
|
+
});
|
|
30
35
|
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
31
36
|
const { allowed } = usePermission({
|
|
32
37
|
permission: catalogEntityCreatePermission
|
|
33
38
|
});
|
|
34
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
35
40
|
PageWithHeader,
|
|
36
41
|
{
|
|
37
42
|
themeId: "apis",
|
|
38
|
-
title: "
|
|
43
|
+
title: t("defaultApiExplorerPage.title"),
|
|
39
44
|
subtitle: generatedSubtitle,
|
|
40
|
-
pageTitleOverride: "
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
pageTitleOverride: t("defaultApiExplorerPage.pageTitleOverride"),
|
|
46
|
+
children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(ContentHeader, { title: "", children: [
|
|
48
|
+
allowed && /* @__PURE__ */ jsx(
|
|
49
|
+
CreateButton,
|
|
50
|
+
{
|
|
51
|
+
title: t("defaultApiExplorerPage.createButtonTitle"),
|
|
52
|
+
to: registerComponentLink?.()
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(SupportButton, { children: t("defaultApiExplorerPage.supportButtonTitle") })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
|
|
58
|
+
/* @__PURE__ */ jsxs(CatalogFilterLayout.Filters, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx(EntityKindPicker, { initialFilter: "api", hidden: true }),
|
|
60
|
+
/* @__PURE__ */ jsx(EntityTypePicker, {}),
|
|
61
|
+
/* @__PURE__ */ jsx(UserListPicker, { initialFilter: initiallySelectedFilter }),
|
|
62
|
+
/* @__PURE__ */ jsx(EntityOwnerPicker, { mode: ownerPickerMode }),
|
|
63
|
+
/* @__PURE__ */ jsx(EntityLifecyclePicker, {}),
|
|
64
|
+
/* @__PURE__ */ jsx(EntityTagPicker, {})
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsx(CatalogFilterLayout.Content, { children: /* @__PURE__ */ jsx(
|
|
67
|
+
CatalogTable,
|
|
68
|
+
{
|
|
69
|
+
columns: columns || defaultColumns,
|
|
70
|
+
actions
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
73
|
+
] }) })
|
|
74
|
+
] })
|
|
75
|
+
}
|
|
55
76
|
);
|
|
56
77
|
};
|
|
57
78
|
|
|
@@ -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';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\n CatalogTable.columns.createTitleColumn({ hidden: true }),\n CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),\n CatalogTable.columns.createSystemColumn(),\n CatalogTable.columns.createOwnerColumn(),\n CatalogTable.columns.createSpecTypeColumn(),\n CatalogTable.columns.createSpecLifecycleColumn(),\n CatalogTable.columns.createMetadataDescriptionColumn(),\n CatalogTable.columns.createTagsColumn(),\n];\n\n/**\n * DefaultApiExplorerPageProps\n * @public\n */\nexport type DefaultApiExplorerPageProps = {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n};\n\n/**\n * DefaultApiExplorerPage\n * @public\n */\nexport const DefaultApiExplorerPage = (props: DefaultApiExplorerPageProps) => {\n const {\n initiallySelectedFilter = 'all',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n } = props;\n\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const generatedSubtitle = t('defaultApiExplorerPage.subtitle', {\n orgName: configApi.getOptionalString('organization.name') ?? 'Backstage',\n });\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title={t('defaultApiExplorerPage.title')}\n subtitle={generatedSubtitle}\n pageTitleOverride={t('defaultApiExplorerPage.pageTitleOverride')}\n >\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('defaultApiExplorerPage.createButtonTitle')}\n to={registerComponentLink?.()}\n />\n )}\n <SupportButton>\n {t('defaultApiExplorerPage.supportButtonTitle')}\n </SupportButton>\n </ContentHeader>\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns || defaultColumns}\n actions={actions}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA8CA,MAAM,cAAiD,GAAA;AAAA,EACrD,aAAa,OAAQ,CAAA,iBAAA,CAAkB,EAAE,MAAA,EAAQ,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,EACvC,YAAA,CAAa,QAAQ,oBAAqB,EAAA;AAAA,EAC1C,YAAA,CAAa,QAAQ,yBAA0B,EAAA;AAAA,EAC/C,YAAA,CAAa,QAAQ,+BAAgC,EAAA;AAAA,EACrD,YAAA,CAAa,QAAQ,gBAAiB;AACxC,CAAA;AAkBa,MAAA,sBAAA,GAAyB,CAAC,KAAuC,KAAA;AAC5E,EAAM,MAAA;A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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,15 +1,18 @@
|
|
|
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
|
|
5
|
-
import { apiEntityColumns } from './presets.esm.js';
|
|
5
|
+
import { getApiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
8
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
9
|
|
|
8
10
|
const ConsumedApisCard = (props) => {
|
|
11
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
9
12
|
const {
|
|
10
13
|
variant = "gridItem",
|
|
11
|
-
title = "
|
|
12
|
-
columns =
|
|
14
|
+
title = t("consumedApisCard.title"),
|
|
15
|
+
columns = getApiEntityColumns(t),
|
|
13
16
|
tableOptions = {}
|
|
14
17
|
} = props;
|
|
15
18
|
const { entity } = useEntity();
|
|
@@ -17,31 +20,36 @@ const ConsumedApisCard = (props) => {
|
|
|
17
20
|
type: RELATION_CONSUMES_API
|
|
18
21
|
});
|
|
19
22
|
if (loading) {
|
|
20
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
21
24
|
}
|
|
22
25
|
if (error || !entities) {
|
|
23
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
24
27
|
WarningPanel,
|
|
25
28
|
{
|
|
26
29
|
severity: "error",
|
|
27
|
-
title: "
|
|
28
|
-
message: /* @__PURE__ */
|
|
30
|
+
title: t("consumedApisCard.error.title"),
|
|
31
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
32
|
}
|
|
30
|
-
));
|
|
33
|
+
) });
|
|
31
34
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
33
36
|
EntityTable,
|
|
34
37
|
{
|
|
35
38
|
title,
|
|
36
39
|
variant,
|
|
37
|
-
emptyContent: /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("consumedApisCard.emptyContent.title", {
|
|
42
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
45
|
+
Link,
|
|
46
|
+
{
|
|
47
|
+
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional",
|
|
48
|
+
externalLinkIcon: true,
|
|
49
|
+
children: t("apisCardHelpLinkTitle")
|
|
50
|
+
}
|
|
51
|
+
) })
|
|
52
|
+
] }),
|
|
45
53
|
columns,
|
|
46
54
|
tableOptions,
|
|
47
55
|
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 { getApiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const ConsumedApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const {\n variant = 'gridItem',\n title = t('consumedApisCard.title'),\n columns = getApiEntityColumns(t),\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_CONSUMES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('consumedApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('consumedApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link\n to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\"\n externalLinkIcon\n >\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[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AA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,qCAAuC,EAAA;AAAA,UACxC,MAAQ,EAAA,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO;AAAA,SAC9C,CACH,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,EAAG,EAAA,iGAAA;AAAA,YACH,gBAAgB,EAAA,IAAA;AAAA,YAEf,YAAE,uBAAuB;AAAA;AAAA,SAE9B,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_HAS_PART } from '@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
|
|
5
|
+
import { useMemo } from 'react';
|
|
5
6
|
import { createSpecApiTypeColumn } from './presets.esm.js';
|
|
6
7
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
8
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
9
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
10
|
|
|
8
|
-
const presetColumns = [
|
|
9
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
10
|
-
EntityTable.columns.createOwnerColumn(),
|
|
11
|
-
createSpecApiTypeColumn(),
|
|
12
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
13
|
-
EntityTable.columns.createMetadataDescriptionColumn()
|
|
14
|
-
];
|
|
15
11
|
const HasApisCard = (props) => {
|
|
12
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
|
+
const presetColumns = useMemo(() => {
|
|
14
|
+
return [
|
|
15
|
+
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
16
|
+
EntityTable.columns.createOwnerColumn(),
|
|
17
|
+
createSpecApiTypeColumn(t),
|
|
18
|
+
EntityTable.columns.createSpecLifecycleColumn(),
|
|
19
|
+
EntityTable.columns.createMetadataDescriptionColumn()
|
|
20
|
+
];
|
|
21
|
+
}, [t]);
|
|
16
22
|
const {
|
|
17
23
|
variant = "gridItem",
|
|
18
|
-
title = "
|
|
24
|
+
title = t("hasApisCard.title"),
|
|
19
25
|
columns = presetColumns,
|
|
20
26
|
tableOptions = {}
|
|
21
27
|
} = props;
|
|
@@ -25,24 +31,29 @@ const HasApisCard = (props) => {
|
|
|
25
31
|
kind: "API"
|
|
26
32
|
});
|
|
27
33
|
if (loading) {
|
|
28
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
29
35
|
}
|
|
30
36
|
if (error || !entities) {
|
|
31
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
32
38
|
WarningPanel,
|
|
33
39
|
{
|
|
34
40
|
severity: "error",
|
|
35
|
-
title: "
|
|
36
|
-
message: /* @__PURE__ */
|
|
41
|
+
title: t("hasApisCard.error.title"),
|
|
42
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
37
43
|
}
|
|
38
|
-
));
|
|
44
|
+
) });
|
|
39
45
|
}
|
|
40
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
41
47
|
EntityTable,
|
|
42
48
|
{
|
|
43
49
|
title,
|
|
44
50
|
variant,
|
|
45
|
-
emptyContent: /* @__PURE__ */
|
|
51
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("hasApisCard.emptyContent.title", {
|
|
53
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
54
|
+
}) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api", children: t("apisCardHelpLinkTitle") }) })
|
|
56
|
+
] }),
|
|
46
57
|
columns,
|
|
47
58
|
tableOptions,
|
|
48
59
|
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 { useMemo } from 'react';\nimport { createSpecApiTypeColumn } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const HasApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const presetColumns: TableColumn<ApiEntity>[] = useMemo(() => {\n return [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(t),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n ];\n }, [t]);\n const {\n variant = 'gridItem',\n title = t('hasApisCard.title'),\n columns = presetColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_HAS_PART,\n kind: 'API',\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('hasApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('hasApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyCa,MAAA,WAAA,GAAc,CAAC,KAKtB,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAM,MAAA,aAAA,GAA0C,QAAQ,MAAM;AAC5D,IAAO,OAAA;AAAA,MACL,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,MAChE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,MACtC,wBAAwB,CAAC,CAAA;AAAA,MACzB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,MAC9C,WAAA,CAAY,QAAQ,+BAAgC;AAAA,KACtD;AAAA,GACF,EAAG,CAAC,CAAC,CAAC,CAAA;AACN,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAA,GAAQ,EAAE,mBAAmB,CAAA;AAAA,IAC7B,OAAU,GAAA,aAAA;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,iBAAA;AAAA,IACN,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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core/Typography';
|
|
3
4
|
import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import
|
|
5
|
-
import { apiEntityColumns } from './presets.esm.js';
|
|
5
|
+
import { getApiEntityColumns } from './presets.esm.js';
|
|
6
6
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
7
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
8
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
7
9
|
|
|
8
10
|
const ProvidedApisCard = (props) => {
|
|
11
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
9
12
|
const {
|
|
10
13
|
variant = "gridItem",
|
|
11
|
-
title = "
|
|
12
|
-
columns =
|
|
14
|
+
title = t("providedApisCard.title"),
|
|
15
|
+
columns = getApiEntityColumns(t),
|
|
13
16
|
tableOptions = {}
|
|
14
17
|
} = props;
|
|
15
18
|
const { entity } = useEntity();
|
|
@@ -17,31 +20,36 @@ const ProvidedApisCard = (props) => {
|
|
|
17
20
|
type: RELATION_PROVIDES_API
|
|
18
21
|
});
|
|
19
22
|
if (loading) {
|
|
20
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
21
24
|
}
|
|
22
25
|
if (error || !entities) {
|
|
23
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title, children: /* @__PURE__ */ jsx(
|
|
24
27
|
WarningPanel,
|
|
25
28
|
{
|
|
26
29
|
severity: "error",
|
|
27
|
-
title: "
|
|
28
|
-
message: /* @__PURE__ */
|
|
30
|
+
title: t("providedApisCard.error.title"),
|
|
31
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
29
32
|
}
|
|
30
|
-
));
|
|
33
|
+
) });
|
|
31
34
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
33
36
|
EntityTable,
|
|
34
37
|
{
|
|
35
38
|
title,
|
|
36
39
|
variant,
|
|
37
|
-
emptyContent: /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("providedApisCard.emptyContent.title", {
|
|
42
|
+
entity: entity.kind.toLocaleLowerCase("en-US")
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(
|
|
45
|
+
Link,
|
|
46
|
+
{
|
|
47
|
+
to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional",
|
|
48
|
+
externalLinkIcon: true,
|
|
49
|
+
children: t("apisCardHelpLinkTitle")
|
|
50
|
+
}
|
|
51
|
+
) })
|
|
52
|
+
] }),
|
|
45
53
|
columns,
|
|
46
54
|
tableOptions,
|
|
47
55
|
entities
|