@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_PROVIDES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport
|
|
1
|
+
{"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity, RELATION_PROVIDES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport { getApiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const ProvidedApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const { t } = useTranslationRef(apiDocsTranslationRef);\n const {\n variant = 'gridItem',\n title = t('providedApisCard.title'),\n columns = getApiEntityColumns(t),\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_PROVIDES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title={t('providedApisCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('providedApisCard.emptyContent.title', {\n entity: entity.kind.toLocaleLowerCase('en-US'),\n })}\n </Typography>\n <Typography variant=\"body2\">\n <Link\n to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\"\n externalLinkIcon\n >\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAA,GAAQ,EAAE,wBAAwB,CAAA;AAAA,IAClC,OAAA,GAAU,oBAAoB,CAAC,CAAA;AAAA,IAC/B,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,E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AAuB;AAAA;AAAA,SAE9B,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';
|
|
@@ -12,48 +13,56 @@ import '../OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js';
|
|
|
12
13
|
import '@material-ui/core/styles';
|
|
13
14
|
import { ApiTypeTitle } from '../ApiDefinitionCard/ApiTypeTitle.esm.js';
|
|
14
15
|
import { ApiDefinitionDialog } from '../ApiDefinitionDialog/ApiDefinitionDialog.esm.js';
|
|
16
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
17
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
15
18
|
|
|
16
|
-
function createSpecApiTypeColumn() {
|
|
19
|
+
function createSpecApiTypeColumn(t) {
|
|
17
20
|
return {
|
|
18
|
-
title: "
|
|
21
|
+
title: t("apiEntityColumns.typeTitle"),
|
|
19
22
|
field: "spec.type",
|
|
20
|
-
render: (entity) => /* @__PURE__ */
|
|
23
|
+
render: (entity) => /* @__PURE__ */ jsx(ApiTypeTitle, { apiEntity: entity })
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
26
|
const ApiDefinitionButton = ({ apiEntity }) => {
|
|
24
27
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
ToggleButton,
|
|
32
|
+
{
|
|
33
|
+
"aria-label": t("apiDefinitionDialog.toggleButtonAriaLabel"),
|
|
34
|
+
onClick: () => setDialogOpen(!dialogOpen),
|
|
35
|
+
value: dialogOpen,
|
|
36
|
+
children: /* @__PURE__ */ jsx(ExtensionIcon, {})
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
ApiDefinitionDialog,
|
|
41
|
+
{
|
|
42
|
+
entity: apiEntity,
|
|
43
|
+
open: dialogOpen,
|
|
44
|
+
onClose: () => setDialogOpen(false)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] });
|
|
41
48
|
};
|
|
42
|
-
function createApiDefinitionColumn() {
|
|
49
|
+
function createApiDefinitionColumn(t) {
|
|
43
50
|
return {
|
|
44
|
-
title: "
|
|
45
|
-
render: (entity) => /* @__PURE__ */
|
|
51
|
+
title: t("apiEntityColumns.apiDefinitionTitle"),
|
|
52
|
+
render: (entity) => /* @__PURE__ */ jsx(ApiDefinitionButton, { apiEntity: entity })
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const getApiEntityColumns = (t) => {
|
|
56
|
+
return [
|
|
57
|
+
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
58
|
+
EntityTable.columns.createSystemColumn(),
|
|
59
|
+
EntityTable.columns.createOwnerColumn(),
|
|
60
|
+
createSpecApiTypeColumn(t),
|
|
61
|
+
EntityTable.columns.createSpecLifecycleColumn(),
|
|
62
|
+
EntityTable.columns.createMetadataDescriptionColumn(),
|
|
63
|
+
createApiDefinitionColumn(t)
|
|
64
|
+
];
|
|
65
|
+
};
|
|
57
66
|
|
|
58
|
-
export {
|
|
67
|
+
export { createSpecApiTypeColumn, getApiEntityColumns };
|
|
59
68
|
//# sourceMappingURL=presets.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/ApisCards/presets.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity } from '@backstage/catalog-model';\nimport { TableColumn } from '@backstage/core-components';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport ExtensionIcon from '@material-ui/icons/Extension';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport
|
|
1
|
+
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/ApisCards/presets.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiEntity } from '@backstage/catalog-model';\nimport { TableColumn } from '@backstage/core-components';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport ExtensionIcon from '@material-ui/icons/Extension';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport { useState } from 'react';\nimport { ApiTypeTitle } from '../ApiDefinitionCard';\nimport { ApiDefinitionDialog } from '../ApiDefinitionDialog';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { apiDocsTranslationRef } from '../../translation';\n\nexport function createSpecApiTypeColumn(\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity> {\n return {\n title: t('apiEntityColumns.typeTitle'),\n field: 'spec.type',\n render: entity => <ApiTypeTitle apiEntity={entity} />,\n };\n}\n\nconst ApiDefinitionButton = ({ apiEntity }: { apiEntity: ApiEntity }) => {\n const [dialogOpen, setDialogOpen] = useState(false);\n const { t } = useTranslationRef(apiDocsTranslationRef);\n return (\n <>\n <ToggleButton\n aria-label={t('apiDefinitionDialog.toggleButtonAriaLabel')}\n onClick={() => setDialogOpen(!dialogOpen)}\n value={dialogOpen}\n >\n <ExtensionIcon />\n </ToggleButton>\n <ApiDefinitionDialog\n entity={apiEntity}\n open={dialogOpen}\n onClose={() => setDialogOpen(false)}\n />\n </>\n );\n};\n\nfunction createApiDefinitionColumn(\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity> {\n return {\n title: t('apiEntityColumns.apiDefinitionTitle'),\n render: entity => <ApiDefinitionButton apiEntity={entity} />,\n };\n}\n\nexport const getApiEntityColumns = (\n t: TranslationFunction<typeof apiDocsTranslationRef.T>,\n): TableColumn<ApiEntity>[] => {\n return [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createSystemColumn(),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(t),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n createApiDefinitionColumn(t),\n ];\n};\n"],"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O,OAAA;AAAA,IACL,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,IAChE,WAAA,CAAY,QAAQ,kBAAmB,EAAA;AAAA,IACvC,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,IACtC,wBAAwB,CAAC,CAAA;AAAA,IACzB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,IAC9C,WAAA,CAAY,QAAQ,+BAAgC,EAAA;AAAA,IACpD,0BAA0B,CAAC;AAAA,GAC7B;AACF;;;;"}
|
|
@@ -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,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA,KACtC;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,KACzC;AAAA,IACA,iBAAmB,EAAA;AAAA,MACjB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KAC9B;AAAA,IACA,iBAAmB,EAAA;AAAA,MACjB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA;AAAA,KAC7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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,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,QA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AA;AAAA;AAEzB,CAAA;AAEA,MAAM,iBAAsC,GAAA;AAAA,EAC1C,MAAQ,EAAA,MAAA;AAAA,EACR,KAAO,EAAA,CAAA;AAAA,EACP,OAAS,EAAA,IAAA;AAAA,EACT,MAAM,KAAK,GAAU,EAAA;AACnB,IAAA,MAAM,QAAW,GAAA,MAAM,KAAM,CAAA,GAAA,CAAI,UAAU,CAAA;AAC3C,IAAA,OAAO,SAAS,IAAK,EAAA;AAAA;AAEzB,CAAA;AAOO,MAAM,qBAAqB,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,GAAA,CAAC,SAAI,SAAW,EAAA,UAAA,EACd,8BAAC,QAAS,EAAA,EAAA,MAAA,EAAQ,UAAY,EAAA,MAAA,EAAgB,CAChD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { Progress } from '@backstage/core-components';
|
|
2
|
-
import
|
|
3
|
+
import { lazy, Suspense } from 'react';
|
|
3
4
|
|
|
4
|
-
const LazyAsyncApiDefinition =
|
|
5
|
+
const LazyAsyncApiDefinition = lazy(
|
|
5
6
|
() => import('./AsyncApiDefinition.esm.js').then((m) => ({
|
|
6
7
|
default: m.AsyncApiDefinition
|
|
7
8
|
}))
|
|
8
9
|
);
|
|
9
10
|
const AsyncApiDefinitionWidget = (props) => {
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: /* @__PURE__ */ jsx(LazyAsyncApiDefinition, { ...props }) });
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { AsyncApiDefinitionWidget };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport
|
|
1
|
+
{"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport { lazy, Suspense } from 'react';\nimport { AsyncApiResolver } from './AsyncApiDefinition';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;;AAsBA,MAAM,sBAAyB,GAAA,IAAA;AAAA,EAAK,MAClC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACxC,SAAS,CAAE,CAAA;AAAA,GACX,CAAA;AACJ,CAAA;AASa,MAAA,wBAAA,GAA2B,CACtC,KACG,KAAA;AACH,EACE,uBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,GAAA,CAAA,QAAA,EAAA,EAAS,GAC5B,QAAC,kBAAA,GAAA,CAAA,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CACrC,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_API_CONSUMED_BY } 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 React from 'react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
7
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
6
8
|
|
|
7
9
|
const ConsumingComponentsCard = (props) => {
|
|
8
10
|
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
@@ -10,25 +12,29 @@ const ConsumingComponentsCard = (props) => {
|
|
|
10
12
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
13
|
type: RELATION_API_CONSUMED_BY
|
|
12
14
|
});
|
|
15
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
16
|
if (loading) {
|
|
14
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("consumingComponentsCard.title"), children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
15
18
|
}
|
|
16
19
|
if (error || !entities) {
|
|
17
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("consumingComponentsCard.title"), children: /* @__PURE__ */ jsx(
|
|
18
21
|
WarningPanel,
|
|
19
22
|
{
|
|
20
23
|
severity: "error",
|
|
21
|
-
title: "
|
|
22
|
-
message: /* @__PURE__ */
|
|
24
|
+
title: t("consumingComponentsCard.error.title"),
|
|
25
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
23
26
|
}
|
|
24
|
-
));
|
|
27
|
+
) });
|
|
25
28
|
}
|
|
26
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
27
30
|
EntityTable,
|
|
28
31
|
{
|
|
29
|
-
title: "
|
|
32
|
+
title: t("consumingComponentsCard.title"),
|
|
30
33
|
variant,
|
|
31
|
-
emptyContent: /* @__PURE__ */
|
|
34
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("consumingComponentsCard.emptyContent.title") }),
|
|
36
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional", children: t("apisCardHelpLinkTitle") }) })
|
|
37
|
+
] }),
|
|
32
38
|
columns,
|
|
33
39
|
entities
|
|
34
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport
|
|
1
|
+
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={t('consumingComponentsCard.title')}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={t('consumingComponentsCard.title')}>\n <WarningPanel\n severity=\"error\"\n title={t('consumingComponentsCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={t('consumingComponentsCard.title')}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('consumingComponentsCard.emptyContent.title')}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EA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AA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_API_PROVIDED_BY } 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 React from 'react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
7
|
+
import { apiDocsTranslationRef } from '../../translation.esm.js';
|
|
6
8
|
|
|
7
9
|
const ProvidingComponentsCard = (props) => {
|
|
8
10
|
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
@@ -10,25 +12,29 @@ const ProvidingComponentsCard = (props) => {
|
|
|
10
12
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
13
|
type: RELATION_API_PROVIDED_BY
|
|
12
14
|
});
|
|
15
|
+
const { t } = useTranslationRef(apiDocsTranslationRef);
|
|
13
16
|
if (loading) {
|
|
14
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("providingComponentsCard.title"), children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
15
18
|
}
|
|
16
19
|
if (error || !entities) {
|
|
17
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(InfoCard, { variant, title: t("providingComponentsCard.title"), children: /* @__PURE__ */ jsx(
|
|
18
21
|
WarningPanel,
|
|
19
22
|
{
|
|
20
23
|
severity: "error",
|
|
21
|
-
title: "
|
|
22
|
-
message: /* @__PURE__ */
|
|
24
|
+
title: t("providingComponentsCard.error.title"),
|
|
25
|
+
message: /* @__PURE__ */ jsx(CodeSnippet, { text: `${error}`, language: "text" })
|
|
23
26
|
}
|
|
24
|
-
));
|
|
27
|
+
) });
|
|
25
28
|
}
|
|
26
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
27
30
|
EntityTable,
|
|
28
31
|
{
|
|
29
|
-
title: "
|
|
32
|
+
title: t("providingComponentsCard.title"),
|
|
30
33
|
variant,
|
|
31
|
-
emptyContent: /* @__PURE__ */
|
|
34
|
+
emptyContent: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: t("providingComponentsCard.emptyContent.title") }),
|
|
36
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional", children: t("apisCardHelpLinkTitle") }) })
|
|
37
|
+
] }),
|
|
32
38
|
columns,
|
|
33
39
|
entities
|
|
34
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport
|
|
1
|
+
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { apiDocsTranslationRef } from '../../translation';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n const { t } = useTranslationRef(apiDocsTranslationRef);\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={t('providingComponentsCard.title')}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={t('providingComponentsCard.title')}>\n <WarningPanel\n severity=\"error\"\n title={t('providingComponentsCard.error.title')}\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={t('providingComponentsCard.title')}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n {t('providingComponentsCard.emptyContent.title')}\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n {t('apisCardHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA;AAAA,GACP,CAAA;AACD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AAErD,EAAA,IAAI,OAAS,EAAA;AACX,IACE,uBAAA,GAAA,CAAC,YAAS,OAAkB,EAAA,KAAA,EAAO,EAAE,+BAA+B,CAAA,EAClE,QAAC,kBAAA,GAAA,CAAA,QAAA,EAAA,EAAS,CACZ,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,2BACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAAO,EAAA,CAAA,CAAE,+BAA+B,CAClE,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAA,EAAO,EAAE,qCAAqC,CAAA;AAAA,QAC9C,OAAA,sBAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA;AAAA;AAAA,KAE5D,EAAA,CAAA;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,+BAA+B,CAAA;AAAA,MACxC,OAAA;AAAA,MACA,8BACG,IAAA,CAAA,KAAA,EAAA,EAAI,OAAO,EAAE,SAAA,EAAW,UACvB,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,4CAA4C,CACjD,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGACN,EAAA,QAAA,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC5B,CACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA,MAEF,OAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
3
|
import { EditorContextProvider, SchemaContextProvider, ExplorerContextProvider, DocExplorer } from '@graphiql/react';
|
|
3
4
|
import 'graphiql/graphiql.css';
|
|
4
5
|
import { buildSchema } from 'graphql';
|
|
5
|
-
import React from 'react';
|
|
6
6
|
|
|
7
7
|
const useStyles = makeStyles({
|
|
8
8
|
root: {
|
|
@@ -28,14 +28,14 @@ const useStyles = makeStyles({
|
|
|
28
28
|
const GraphQlDefinition = ({ definition }) => {
|
|
29
29
|
const classes = useStyles();
|
|
30
30
|
const schema = buildSchema(definition);
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { className: classes.root, children: /* @__PURE__ */ jsx("div", { className: classes.graphiQlWrapper, children: /* @__PURE__ */ jsx(EditorContextProvider, { children: /* @__PURE__ */ jsx(
|
|
32
32
|
SchemaContextProvider,
|
|
33
33
|
{
|
|
34
34
|
schema,
|
|
35
|
-
fetcher: () => Promise.resolve(null)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
))));
|
|
35
|
+
fetcher: () => Promise.resolve(null),
|
|
36
|
+
children: /* @__PURE__ */ jsx("div", { className: "graphiql-container", children: /* @__PURE__ */ jsx("div", { className: "graphiql-sidebar", children: /* @__PURE__ */ jsx("div", { className: "graphiql-sidebar-section", children: /* @__PURE__ */ jsx(ExplorerContextProvider, { children: /* @__PURE__ */ jsx(DocExplorer, {}) }) }) }) })
|
|
37
|
+
}
|
|
38
|
+
) }) }) });
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export { GraphQlDefinition };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlDefinition.esm.js","sources":["../../../src/components/GraphQlDefinitionWidget/GraphQlDefinition.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 { makeStyles } from '@material-ui/core/styles';\nimport {\n DocExplorer,\n EditorContextProvider,\n ExplorerContextProvider,\n SchemaContextProvider,\n} from '@graphiql/react';\nimport 'graphiql/graphiql.css';\nimport { buildSchema } from 'graphql';\
|
|
1
|
+
{"version":3,"file":"GraphQlDefinition.esm.js","sources":["../../../src/components/GraphQlDefinitionWidget/GraphQlDefinition.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 { makeStyles } from '@material-ui/core/styles';\nimport {\n DocExplorer,\n EditorContextProvider,\n ExplorerContextProvider,\n SchemaContextProvider,\n} from '@graphiql/react';\nimport 'graphiql/graphiql.css';\nimport { buildSchema } from 'graphql';\n\nconst useStyles = makeStyles({\n root: {\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n graphiQlWrapper: {\n flex: 1,\n '@global': {\n '.graphiql-container': {\n boxSizing: 'initial',\n height: '100%',\n minHeight: '600px',\n flex: '1 1 auto',\n },\n '.graphiql-sidebar': {\n width: '100%',\n },\n },\n },\n});\n\ntype Props = {\n definition: string;\n};\n\nexport const GraphQlDefinition = ({ definition }: Props) => {\n const classes = useStyles();\n const schema = buildSchema(definition);\n\n return (\n <div className={classes.root}>\n <div className={classes.graphiQlWrapper}>\n <EditorContextProvider>\n <SchemaContextProvider\n schema={schema}\n fetcher={() => Promise.resolve(null) as any}\n >\n <div className=\"graphiql-container\">\n <div className=\"graphiql-sidebar\">\n <div className=\"graphiql-sidebar-section\">\n <ExplorerContextProvider>\n <DocExplorer />\n </ExplorerContextProvider>\n </div>\n </div>\n </div>\n </SchemaContextProvider>\n </EditorContextProvider>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,IAAM,EAAA,CAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,qBAAuB,EAAA;AAAA,QACrB,SAAW,EAAA,SAAA;AAAA,QACX,MAAQ,EAAA,MAAA;AAAA,QACR,SAAW,EAAA,OAAA;AAAA,QACX,IAAM,EAAA;AAAA,OACR;AAAA,MACA,mBAAqB,EAAA;AAAA,QACnB,KAAO,EAAA;AAAA;AACT;AACF;AAEJ,CAAC,CAAA;AAMM,MAAM,iBAAoB,GAAA,CAAC,EAAE,UAAA,EAAwB,KAAA;AAC1D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,MAAA,GAAS,YAAY,UAAU,CAAA;AAErC,EACE,uBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EACtB,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,eACtB,EAAA,QAAA,kBAAA,GAAA,CAAC,qBACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,OAAS,EAAA,MAAM,OAAQ,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MAEnC,8BAAC,KAAI,EAAA,EAAA,SAAA,EAAU,sBACb,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,WAAU,kBACb,EAAA,QAAA,kBAAA,GAAA,CAAC,SAAI,SAAU,EAAA,0BAAA,EACb,8BAAC,uBACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,eAAY,CACf,EAAA,CAAA,EACF,GACF,CACF,EAAA;AAAA;AAAA,GACF,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { Progress } from '@backstage/core-components';
|
|
2
|
-
import
|
|
3
|
+
import { lazy, Suspense } from 'react';
|
|
3
4
|
|
|
4
|
-
const LazyGraphQlDefinition =
|
|
5
|
+
const LazyGraphQlDefinition = lazy(
|
|
5
6
|
() => import('./GraphQlDefinition.esm.js').then((m) => ({
|
|
6
7
|
default: m.GraphQlDefinition
|
|
7
8
|
}))
|
|
8
9
|
);
|
|
9
10
|
const GraphQlDefinitionWidget = (props) => {
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: /* @__PURE__ */ jsx(LazyGraphQlDefinition, { ...props }) });
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { GraphQlDefinitionWidget };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlDefinitionWidget.esm.js","sources":["../../../src/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport
|
|
1
|
+
{"version":3,"file":"GraphQlDefinitionWidget.esm.js","sources":["../../../src/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport { lazy, Suspense } from 'react';\n\n// The graphql component, graphql and related CSS has a significant size, only\n// load it if the element is actually used.\nconst LazyGraphQlDefinition = lazy(() =>\n import('./GraphQlDefinition').then(m => ({\n default: m.GraphQlDefinition,\n })),\n);\n\n/** @public */\nexport type GraphQlDefinitionWidgetProps = {\n definition: string;\n};\n\n/** @public */\nexport const GraphQlDefinitionWidget = (\n props: GraphQlDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyGraphQlDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;;AAqBA,MAAM,qBAAwB,GAAA,IAAA;AAAA,EAAK,MACjC,OAAO,4BAAqB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACvC,SAAS,CAAE,CAAA;AAAA,GACX,CAAA;AACJ,CAAA;AAQa,MAAA,uBAAA,GAA0B,CACrC,KACG,KAAA;AACH,EACE,uBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,GAAA,CAAA,QAAA,EAAA,EAAS,GAC5B,QAAC,kBAAA,GAAA,CAAA,qBAAA,EAAA,EAAuB,GAAG,KAAA,EAAO,CACpC,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { CodeSnippet } from '@backstage/core-components';
|
|
3
3
|
import { useTheme } from '@material-ui/core/styles';
|
|
4
4
|
|
|
5
5
|
const GrpcApiDefinitionWidget = (props) => {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
8
|
CodeSnippet,
|
|
9
9
|
{
|
|
10
10
|
customStyle: { backgroundColor: theme.palette.background.default },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrpcApiDefinitionWidget.esm.js","sources":["../../../src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.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
|
|
1
|
+
{"version":3,"file":"GrpcApiDefinitionWidget.esm.js","sources":["../../../src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.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 { CodeSnippet } from '@backstage/core-components';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type GrpcApiDefinitionWidgetProps = {\n definition: string;\n};\n\n/** @public */\nexport const GrpcApiDefinitionWidget = (\n props: GrpcApiDefinitionWidgetProps,\n) => {\n const theme = useTheme();\n return (\n <CodeSnippet\n customStyle={{ backgroundColor: theme.palette.background.default }}\n text={props.definition}\n language=\"protobuf\"\n showCopyCodeButton\n />\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,uBAAA,GAA0B,CACrC,KACG,KAAA;AACH,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,aAAa,EAAE,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,WAAW,OAAQ,EAAA;AAAA,MACjE,MAAM,KAAM,CAAA,UAAA;AAAA,MACZ,QAAS,EAAA,UAAA;AAAA,MACT,kBAAkB,EAAA;AAAA;AAAA,GACpB;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import SwaggerUI from 'swagger-ui-react';
|
|
4
5
|
import 'swagger-ui-react/swagger-ui.css';
|
|
5
6
|
|
|
@@ -168,7 +169,7 @@ const OpenApiDefinition = ({
|
|
|
168
169
|
const timer = setTimeout(() => setDef(definition), 0);
|
|
169
170
|
return () => clearTimeout(timer);
|
|
170
171
|
}, [definition, setDef]);
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ jsx("div", { className: classes.root, children: /* @__PURE__ */ jsx(
|
|
172
173
|
SwaggerUI,
|
|
173
174
|
{
|
|
174
175
|
spec: def,
|
|
@@ -177,7 +178,7 @@ const OpenApiDefinition = ({
|
|
|
177
178
|
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}/oauth2-redirect.html`,
|
|
178
179
|
...swaggerUiProps
|
|
179
180
|
}
|
|
180
|
-
));
|
|
181
|
+
) });
|
|
181
182
|
};
|
|
182
183
|
|
|
183
184
|
export { OpenApiDefinition };
|