@backstage/plugin-techdocs 1.14.0-next.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/EntityPageDocs.esm.js.map +1 -1
- package/dist/Router.esm.js.map +1 -1
- package/dist/alpha/hooks/useTechdocsReaderIconLinkProps.esm.js.map +1 -1
- package/dist/alpha.d.ts +29 -24
- package/dist/alpha.esm.js +7 -7
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api.esm.js.map +1 -1
- package/dist/client.esm.js +1 -1
- package/dist/client.esm.js.map +1 -1
- package/dist/helpers.esm.js.map +1 -1
- package/dist/home/components/DefaultTechDocsHome.esm.js.map +1 -1
- package/dist/home/components/Grids/DocsCardGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/InfoCardGrid.esm.js.map +1 -1
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/DocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/EntityListDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/actions.esm.js.map +1 -1
- package/dist/home/components/Tables/columns.esm.js.map +1 -1
- package/dist/home/components/Tables/helpers.esm.js.map +1 -1
- package/dist/home/components/TechDocsCustomHome.esm.js +2 -2
- package/dist/home/components/TechDocsCustomHome.esm.js.map +1 -1
- package/dist/home/components/TechDocsIndexPage.esm.js.map +1 -1
- package/dist/home/components/TechDocsPageWrapper.esm.js.map +1 -1
- package/dist/home/components/TechDocsPicker.esm.js.map +1 -1
- package/dist/package.json.esm.js +1 -1
- package/dist/plugin.esm.js +2 -2
- package/dist/plugin.esm.js.map +1 -1
- package/dist/reader/components/TechDocsBuildLogs.esm.js.map +1 -1
- package/dist/reader/components/TechDocsNotFound.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js +1 -1
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/dom.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/useNavigateUrl.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderProvider.esm.js.map +1 -1
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js.map +1 -1
- package/dist/reader/components/TechDocsStateIndicator.esm.js.map +1 -1
- package/dist/reader/components/useReaderState.esm.js.map +1 -1
- package/dist/reader/transformers/addBaseUrl.esm.js.map +1 -1
- package/dist/reader/transformers/addGitFeedbackLink.esm.js.map +1 -1
- package/dist/reader/transformers/addLinkClickListener.esm.js.map +1 -1
- package/dist/reader/transformers/addNavLinkKeyboardToggle.esm.js.map +1 -1
- package/dist/reader/transformers/addSidebarToggle.esm.js.map +1 -1
- package/dist/reader/transformers/copyToClipboard.esm.js.map +1 -1
- package/dist/reader/transformers/handleMetaRedirects.esm.js.map +1 -1
- package/dist/reader/transformers/html/hooks/iframes.esm.js.map +1 -1
- package/dist/reader/transformers/html/hooks/links.esm.js.map +1 -1
- package/dist/reader/transformers/html/transformer.esm.js.map +1 -1
- package/dist/reader/transformers/onCssReady.esm.js.map +1 -1
- package/dist/reader/transformers/removeMkdocsHeader.esm.js.map +1 -1
- package/dist/reader/transformers/renderReactElement.esm.js.map +1 -1
- package/dist/reader/transformers/rewriteDocLinks.esm.js.map +1 -1
- package/dist/reader/transformers/scrollIntoNavigation.esm.js.map +1 -1
- package/dist/reader/transformers/simplifyMkdocsFooter.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/extensions.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/layout.esm.js +16 -5
- package/dist/reader/transformers/styles/rules/layout.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/palette.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/reset.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/rules.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/typeset.esm.js.map +1 -1
- package/dist/reader/transformers/styles/rules/variables.esm.js.map +1 -1
- package/dist/reader/transformers/styles/transformer.esm.js +13 -1
- package/dist/reader/transformers/styles/transformer.esm.js.map +1 -1
- package/dist/reader/transformers/transformer.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearch.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearchResultListItem.esm.js.map +1 -1
- package/dist/search/hooks/useTechDocsLocation.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +24 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.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 { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n entities.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n );\n\n return (\n <Content>\n {(props.groups || [allEntitiesGroup]).map((group, index: number) => (\n <EntityListDocsGridGroup\n entities={entities}\n group={group}\n key={`${group.title}-${index}`}\n />\n ))}\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAoDA,MAAM,
|
|
1
|
+
{"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.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 { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n entities.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n );\n\n return (\n <Content>\n {(props.groups || [allEntitiesGroup]).map((group, index: number) => (\n <EntityListDocsGridGroup\n entities={entities}\n group={group}\n key={`${group.title}-${index}`}\n />\n ))}\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAoDA,MAAM,gBAAA,GAAoC;AAAA,EACxC,KAAA,EAAO,mBAAA;AAAA,EACP,iBAAiB,MAAM;AACzB,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,KAAA,KAG3B;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,KAA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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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={entity.metadata.name}\n data-testid={entity?.metadata?.title}\n title={\n entityRefToPresentation?.get(stringifyEntityRef(entity))\n ?.primaryTitle\n }\n >\n <div>{entity?.metadata?.description}</div>\n <div className={classes.linkSpacer} />\n <Link\n to={linkRoute(entity)}\n className={classes.readMoreLink}\n data-testid=\"read-docs-link\"\n >\n {linkContent || 'Read Docs'}\n </Link>\n </InfoCard>\n ))}\n </ItemCardGrid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAoCA,MAAM,
|
|
1
|
+
{"version":3,"file":"InfoCardGrid.esm.js","sources":["../../../../src/home/components/Grids/InfoCardGrid.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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={entity.metadata.name}\n data-testid={entity?.metadata?.title}\n title={\n entityRefToPresentation?.get(stringifyEntityRef(entity))\n ?.primaryTitle\n }\n >\n <div>{entity?.metadata?.description}</div>\n <div className={classes.linkSpacer} />\n <Link\n to={linkRoute(entity)}\n className={classes.readMoreLink}\n data-testid=\"read-docs-link\"\n >\n {linkContent || 'Read Docs'}\n </Link>\n </InfoCard>\n ))}\n </ItemCardGrid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,UAAA,EAAY;AAAA,MACV,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA,KAC/B;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA;AAC/B,GACF,CAAA;AAAA,EACA,EAAE,MAAM,uBAAA;AACV,CAAA;AAkBO,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACxD,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAa,eAAA,EAAgB,GAAI,KAAA;AACnD,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,uBAAA,GAA0B,YAAY,gBAAgB,CAAA;AAC5D,EAAA,MAAM,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAA,MAAM,SAAA,GAAY,CAAC,MAAA,KAAmB;AACpC,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA,MAAM,WAAA,GAAc,gBAAgB,MAAM,CAAA;AAC1C,MAAA,IAAI,WAAA,EAAa;AACf,QAAA,OAAO,WAAA;AAAA,MACT;AAAA,IACF;AACA,IAAA,OAAO,uBAAA,CAAwB;AAAA,MAC7B,WAAW,YAAA,CAAa,MAAA,CAAO,QAAA,CAAS,SAAA,IAAa,WAAW,MAAM,CAAA;AAAA,MACtE,IAAA,EAAM,YAAA,CAAa,MAAA,CAAO,IAAA,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AAY,CAAA;AAAA,wBACpC,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAI,UAAU,MAAM,CAAA;AAAA,YACpB,WAAW,OAAA,CAAQ,YAAA;AAAA,YACnB,aAAA,EAAY,gBAAA;AAAA,YAEX,QAAA,EAAA,WAAA,IAAe;AAAA;AAAA;AAClB;AAAA,KAAA;AAAA,IAfK,OAAO,QAAA,CAAS;AAAA,GAiBxB,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/CursorPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { DocsTableRow } from './types';\n\ntype PaginatedDocsTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<DocsTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedDocsTable(props: PaginatedDocsTableProps) {\n const {\n actions,\n columns,\n data,\n next,\n prev,\n title,\n isLoading,\n options,\n ...restProps\n } = props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n ...options,\n // These settings are configured to force server side pagination\n pageSizeOptions: [],\n showFirstLastPageButtons: false,\n pageSize: Number.MAX_SAFE_INTEGER,\n emptyRowsWhenPaging: false,\n actionsColumnIndex: -1,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\n }}\n /* this will enable the prev button accordingly */\n page={prev ? 1 : 0}\n /* this will enable the next button accordingly */\n totalCount={next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;AA4BO,SAAS,yBAAyB,
|
|
1
|
+
{"version":3,"file":"CursorPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/CursorPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { DocsTableRow } from './types';\n\ntype PaginatedDocsTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<DocsTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedDocsTable(props: PaginatedDocsTableProps) {\n const {\n actions,\n columns,\n data,\n next,\n prev,\n title,\n isLoading,\n options,\n ...restProps\n } = props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n ...options,\n // These settings are configured to force server side pagination\n pageSizeOptions: [],\n showFirstLastPageButtons: false,\n pageSize: Number.MAX_SAFE_INTEGER,\n emptyRowsWhenPaging: false,\n actionsColumnIndex: -1,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\n }}\n /* this will enable the prev button accordingly */\n page={prev ? 1 : 0}\n /* this will enable the next button accordingly */\n totalCount={next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;AA4BO,SAAS,yBAAyB,KAAA,EAAgC;AACvE,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAY,EAAA,GAAK,KAAA;AAAA,MACxB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAA,EAAS;AAAA,QACP,kBAAA,EAAoB,MAAA;AAAA,QACpB,GAAG,OAAA;AAAA;AAAA,QAEH,iBAAiB,EAAC;AAAA,QAClB,wBAAA,EAA0B,KAAA;AAAA,QAC1B,UAAU,MAAA,CAAO,gBAAA;AAAA,QACjB,mBAAA,EAAqB,KAAA;AAAA,QACrB,kBAAA,EAAoB;AAAA,OACtB;AAAA,MACA,cAAc,CAAA,IAAA,KAAQ;AACpB,QAAA,IAAI,OAAO,CAAA,EAAG;AACZ,UAAA,IAAA,IAAO;AAAA,QACT,CAAA,MAAO;AACL,UAAA,IAAA,IAAO;AAAA,QACT;AAAA,MACF,CAAA;AAAA,MAEA,IAAA,EAAM,OAAO,CAAA,GAAI,CAAA;AAAA,MAEjB,UAAA,EAAY,IAAA,GAAO,MAAA,CAAO,SAAA,GAAY,MAAA,CAAO,gBAAA;AAAA,MAC7C,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAG,EAAE;AAAA,MACvD,SAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsTable.esm.js","sources":["../../../../src/home/components/Tables/DocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\n\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n EmptyState,\n LinkButton,\n Table,\n TableColumn,\n TableOptions,\n TableProps,\n} from '@backstage/core-components';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport { DocsTableRow } from './types';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link DocsTable}.\n *\n * @public\n */\nexport type DocsTableProps = {\n entities: Entity[] | undefined;\n title?: string | undefined;\n loading?: boolean | undefined;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table documents\n *\n * @public\n */\nexport const DocsTable = (props: DocsTableProps) => {\n const { entities, title, loading, columns, actions, options } = props;\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n const defaultActions: TableProps<DocsTableRow>['actions'] = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard),\n ];\n\n const pageSize = 20;\n const paging = documents && documents.length > pageSize;\n\n return (\n <>\n {loading || (documents && documents.length > 0) ? (\n <Table<DocsTableRow>\n isLoading={loading}\n options={{\n paging,\n pageSize,\n search: true,\n actionsColumnIndex: -1,\n ...options,\n }}\n data={documents}\n columns={columns || defaultColumns}\n actions={actions || defaultActions}\n title={\n title\n ? `${title} (${documents.length})`\n : `All (${documents.length})`\n }\n />\n ) : (\n <EmptyState\n missing=\"data\"\n title=\"No documents to show\"\n description=\"Create your own document. Check out our Getting Started Information\"\n action={\n <LinkButton\n color=\"primary\"\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n DOCS\n </LinkButton>\n }\n />\n )}\n </>\n );\n};\n\nDocsTable.columns = columnFactories;\nDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DocsTable.esm.js","sources":["../../../../src/home/components/Tables/DocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\n\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n EmptyState,\n LinkButton,\n Table,\n TableColumn,\n TableOptions,\n TableProps,\n} from '@backstage/core-components';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport { DocsTableRow } from './types';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link DocsTable}.\n *\n * @public\n */\nexport type DocsTableProps = {\n entities: Entity[] | undefined;\n title?: string | undefined;\n loading?: boolean | undefined;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table documents\n *\n * @public\n */\nexport const DocsTable = (props: DocsTableProps) => {\n const { entities, title, loading, columns, actions, options } = props;\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n const defaultActions: TableProps<DocsTableRow>['actions'] = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard),\n ];\n\n const pageSize = 20;\n const paging = documents && documents.length > pageSize;\n\n return (\n <>\n {loading || (documents && documents.length > 0) ? (\n <Table<DocsTableRow>\n isLoading={loading}\n options={{\n paging,\n pageSize,\n search: true,\n actionsColumnIndex: -1,\n ...options,\n }}\n data={documents}\n columns={columns || defaultColumns}\n actions={actions || defaultActions}\n title={\n title\n ? `${title} (${documents.length})`\n : `All (${documents.length})`\n }\n />\n ) : (\n <EmptyState\n missing=\"data\"\n title=\"No documents to show\"\n description=\"Create your own document. Check out our Getting Started Information\"\n action={\n <LinkButton\n color=\"primary\"\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n DOCS\n </LinkButton>\n }\n />\n )}\n </>\n );\n};\n\nDocsTable.columns = columnFactories;\nDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;AAqDO,MAAM,SAAA,GAAY,CAAC,KAAA,KAA0B;AAClD,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,SAAS,OAAA,EAAS,OAAA,EAAS,SAAQ,GAAI,KAAA;AAChE,EAAA,MAAM,GAAG,eAAe,CAAA,GAAI,kBAAA,EAAmB;AAC/C,EAAA,MAAM,uBAAA,GAA0B,YAAY,gBAAgB,CAAA;AAC5D,EAAA,MAAM,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AAEt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AAA;AAEJ;AAEA,SAAA,CAAU,OAAA,GAAU,eAAA;AACpB,SAAA,CAAU,OAAA,GAAU,eAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListDocsTable.esm.js","sources":["../../../../src/home/components/Tables/EntityListDocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { capitalize } from 'lodash';\nimport {\n CodeSnippet,\n TableColumn,\n TableOptions,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { DocsTable } from './DocsTable';\nimport { OffsetPaginatedDocsTable } from './OffsetPaginatedDocsTable';\nimport { CursorPaginatedDocsTable } from './CursorPaginatedDocsTable';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport { DocsTableRow } from './types';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link EntityListDocsTable}.\n *\n * @public\n */\nexport type EntityListDocsTableProps = {\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table with entities from catalog.\n *\n * @public\n */\nexport const EntityListDocsTable = (props: EntityListDocsTableProps) => {\n const { columns, actions, options } = props;\n const { loading, error, entities, filters, paginationMode, pageInfo } =\n useEntityList();\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n\n const title = capitalize(filters.user?.value ?? 'all');\n\n const defaultActions = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard),\n actionFactories.createStarEntityAction(\n isStarredEntity,\n toggleStarredEntity,\n ),\n ];\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n if (paginationMode === 'cursor') {\n return (\n <CursorPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n next={pageInfo?.next}\n prev={pageInfo?.prev}\n />\n );\n } else if (paginationMode === 'offset') {\n return (\n <OffsetPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n />\n );\n }\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n return (\n <DocsTable\n title={title}\n entities={entities}\n loading={loading}\n actions={actions || defaultActions}\n columns={columns}\n options={options}\n />\n );\n};\n\nEntityListDocsTable.columns = columnFactories;\nEntityListDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"EntityListDocsTable.esm.js","sources":["../../../../src/home/components/Tables/EntityListDocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { capitalize } from 'lodash';\nimport {\n CodeSnippet,\n TableColumn,\n TableOptions,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { DocsTable } from './DocsTable';\nimport { OffsetPaginatedDocsTable } from './OffsetPaginatedDocsTable';\nimport { CursorPaginatedDocsTable } from './CursorPaginatedDocsTable';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport { DocsTableRow } from './types';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link EntityListDocsTable}.\n *\n * @public\n */\nexport type EntityListDocsTableProps = {\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table with entities from catalog.\n *\n * @public\n */\nexport const EntityListDocsTable = (props: EntityListDocsTableProps) => {\n const { columns, actions, options } = props;\n const { loading, error, entities, filters, paginationMode, pageInfo } =\n useEntityList();\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n\n const title = capitalize(filters.user?.value ?? 'all');\n\n const defaultActions = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard),\n actionFactories.createStarEntityAction(\n isStarredEntity,\n toggleStarredEntity,\n ),\n ];\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n if (paginationMode === 'cursor') {\n return (\n <CursorPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n next={pageInfo?.next}\n prev={pageInfo?.prev}\n />\n );\n } else if (paginationMode === 'offset') {\n return (\n <OffsetPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n />\n );\n }\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n return (\n <DocsTable\n title={title}\n entities={entities}\n loading={loading}\n actions={actions || defaultActions}\n columns={columns}\n options={options}\n />\n );\n};\n\nEntityListDocsTable.columns = columnFactories;\nEntityListDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuDO,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAoC;AACtE,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,OAAA,EAAQ,GAAI,KAAA;AACtC,EAAA,MAAM,EAAE,SAAS,KAAA,EAAO,QAAA,EAAU,SAAS,cAAA,EAAgB,QAAA,KACzD,aAAA,EAAc;AAChB,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAA,EAAoB,GAAI,kBAAA,EAAmB;AACpE,EAAA,MAAM,GAAG,eAAe,CAAA,GAAI,kBAAA,EAAmB;AAC/C,EAAA,MAAM,uBAAA,GAA0B,YAAY,gBAAgB,CAAA;AAC5D,EAAA,MAAM,MAAA,GAAS,OAAO,YAAY,CAAA;AAElC,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,OAAA,CAAQ,IAAA,EAAM,SAAS,KAAK,CAAA;AAErD,EAAA,MAAM,cAAA,GAAiB;AAAA,IACrB,eAAA,CAAgB,wBAAwB,eAAe,CAAA;AAAA,IACvD,eAAA,CAAgB,sBAAA;AAAA,MACd,eAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,MAAM,SAAA,GAAY,oBAAA;AAAA,IAChB,QAAA;AAAA,IACA,uBAAA;A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
{"version":3,"file":"OffsetPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/OffsetPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect } from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { DocsTableRow } from './types';\nimport {\n EntityTextFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedDocsTable(props: TableProps<DocsTableRow>) {\n const { actions, columns, data, isLoading, options } = props;\n const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =\n useEntityList();\n const [page, setPage] = useState(\n offset && limit ? Math.floor(offset / limit) : 0,\n );\n\n useEffect(() => {\n if (totalItems && page * limit >= totalItems) {\n setOffset!(Math.max(0, totalItems - limit));\n } else {\n setOffset!(Math.max(0, page * limit));\n }\n }, [setOffset, page, limit, totalItems]);\n\n return (\n <Table<DocsTableRow>\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n pageSizeOptions: [5, 10, 20, 50, 100],\n pageSize: limit,\n emptyRowsWhenPaging: false,\n actionsColumnIndex: -1,\n ...options,\n }}\n actions={actions}\n onSearchChange={(searchText: string) =>\n updateFilters({\n text: searchText ? new EntityTextFilter(searchText) : undefined,\n })\n }\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AA4BO,SAAS,yBAAyB,
|
|
1
|
+
{"version":3,"file":"OffsetPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/OffsetPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useEffect } from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { DocsTableRow } from './types';\nimport {\n EntityTextFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedDocsTable(props: TableProps<DocsTableRow>) {\n const { actions, columns, data, isLoading, options } = props;\n const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =\n useEntityList();\n const [page, setPage] = useState(\n offset && limit ? Math.floor(offset / limit) : 0,\n );\n\n useEffect(() => {\n if (totalItems && page * limit >= totalItems) {\n setOffset!(Math.max(0, totalItems - limit));\n } else {\n setOffset!(Math.max(0, page * limit));\n }\n }, [setOffset, page, limit, totalItems]);\n\n return (\n <Table<DocsTableRow>\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n pageSizeOptions: [5, 10, 20, 50, 100],\n pageSize: limit,\n emptyRowsWhenPaging: false,\n actionsColumnIndex: -1,\n ...options,\n }}\n actions={actions}\n onSearchChange={(searchText: string) =>\n updateFilters({\n text: searchText ? new EntityTextFilter(searchText) : undefined,\n })\n }\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading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A,QACZ,IAAA,EAAM,UAAA,GAAa,IAAI,gBAAA,CAAiB,UAAU,CAAA,GAAI;AAAA,OACvD,CAAA;AAAA,MAEH,IAAA;AAAA,MACA,cAAc,CAAA,OAAA,KAAW;AACvB,QAAA,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjB,CAAA;AAAA,MACA,qBAAqB,CAAA,QAAA,KAAY;AAC/B,QAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,MACnB,CAAA;AAAA,MACA,UAAA,EAAY,UAAA;AAAA,MACZ,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAG,EAAE;AAAA,MACvD;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.esm.js","sources":["../../../../src/home/components/Tables/actions.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 ShareIcon from '@material-ui/icons/Share';\nimport { DocsTableRow } from './types';\nimport { FavoriteToggleIcon } from '@backstage/core-components';\n\n/**\n * Not directly exported, but through DocsTable.actions and EntityListDocsTable.actions\n *\n * @public\n */\nexport const actionFactories = {\n createCopyDocsUrlAction(copyToClipboard: Function) {\n return (row: DocsTableRow) => {\n return {\n icon: () => <ShareIcon fontSize=\"small\" />,\n tooltip: 'Click to copy documentation link to clipboard',\n onClick: () =>\n copyToClipboard(`${window.location.origin}${row.resolved.docsUrl}`),\n };\n };\n },\n createStarEntityAction(\n isStarredEntity: Function,\n toggleStarredEntity: Function,\n ) {\n return (row: DocsTableRow) => {\n const entity = row.entity;\n const isStarred = isStarredEntity(entity);\n return {\n cellStyle: { paddingLeft: '1em' },\n icon: () => <FavoriteToggleIcon isFavorite={isStarred} />,\n tooltip: isStarred ? 'Remove from favorites' : 'Add to favorites',\n onClick: () => toggleStarredEntity(entity),\n };\n };\n },\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,
|
|
1
|
+
{"version":3,"file":"actions.esm.js","sources":["../../../../src/home/components/Tables/actions.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 ShareIcon from '@material-ui/icons/Share';\nimport { DocsTableRow } from './types';\nimport { FavoriteToggleIcon } from '@backstage/core-components';\n\n/**\n * Not directly exported, but through DocsTable.actions and EntityListDocsTable.actions\n *\n * @public\n */\nexport const actionFactories = {\n createCopyDocsUrlAction(copyToClipboard: Function) {\n return (row: DocsTableRow) => {\n return {\n icon: () => <ShareIcon fontSize=\"small\" />,\n tooltip: 'Click to copy documentation link to clipboard',\n onClick: () =>\n copyToClipboard(`${window.location.origin}${row.resolved.docsUrl}`),\n };\n };\n },\n createStarEntityAction(\n isStarredEntity: Function,\n toggleStarredEntity: Function,\n ) {\n return (row: DocsTableRow) => {\n const entity = row.entity;\n const isStarred = isStarredEntity(entity);\n return {\n cellStyle: { paddingLeft: '1em' },\n icon: () => <FavoriteToggleIcon isFavorite={isStarred} />,\n tooltip: isStarred ? 'Remove from favorites' : 'Add to favorites',\n onClick: () => toggleStarredEntity(entity),\n };\n };\n },\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,eAAA,GAAkB;AAAA,EAC7B,wBAAwB,eAAA,EAA2B;AACjD,IAAA,OAAO,CAAC,GAAA,KAAsB;AAC5B,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,sBAAM,GAAA,CAAC,SAAA,EAAA,EAAU,UAAS,OAAA,EAAQ,CAAA;AAAA,QACxC,OAAA,EAAS,+CAAA;AAAA,QACT,OAAA,EAAS,MACP,eAAA,CAAgB,CAAA,EAAG,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,EAAG,GAAA,CAAI,QAAA,CAAS,OAAO,CAAA,CAAE;AAAA,OACtE;AAAA,IACF,CAAA;AAAA,EACF,CAAA;AAAA,EACA,sBAAA,CACE,iBACA,mBAAA,EACA;AACA,IAAA,OAAO,CAAC,GAAA,KAAsB;AAC5B,MAAA,MAAM,SAAS,GAAA,CAAI,MAAA;AACnB,MAAA,MAAM,SAAA,GAAY,gBAAgB,MAAM,CAAA;AACxC,MAAA,OAAO;AAAA,QACL,SAAA,EAAW,EAAE,WAAA,EAAa,KAAA,EAAM;AAAA,QAChC,IAAA,EAAM,sBAAM,GAAA,CAAC,kBAAA,EAAA,EAAmB,YAAY,SAAA,EAAW,CAAA;AAAA,QACvD,OAAA,EAAS,YAAY,uBAAA,GAA0B,kBAAA;AAAA,QAC/C,OAAA,EAAS,MAAM,mBAAA,CAAoB,MAAM;AAAA,OAC3C;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.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 { Link, SubvalueCell, TableColumn } from '@backstage/core-components';\nimport { EntityRefLinks } from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(entity: Entity): string {\n return entity.metadata.title || entity.metadata.name;\n}\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: { hidden?: boolean }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn();\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n createNameColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Document',\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(row1.entity).toLocaleLowerCase();\n const title2 = customTitle(row2.entity).toLocaleLowerCase();\n return title1.localeCompare(title2);\n },\n render: (row: DocsTableRow) => (\n <SubvalueCell\n value={\n <Link to={row.resolved.docsUrl}>{customTitle(row.entity)}</Link>\n }\n subvalue={row.entity.metadata.description}\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Owner',\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createKindColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Kind',\n field: 'entity.kind',\n };\n },\n createTypeColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Type',\n field: 'entity.spec.type',\n };\n },\n};\n\nexport const defaultColumns: TableColumn<DocsTableRow>[] = [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createKindColumn(),\n columnFactories.createTypeColumn(),\n];\n"],"names":[],"mappings":";;;;AAqBA,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.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 { Link, SubvalueCell, TableColumn } from '@backstage/core-components';\nimport { EntityRefLinks } from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(entity: Entity): string {\n return entity.metadata.title || entity.metadata.name;\n}\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: { hidden?: boolean }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn();\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n createNameColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Document',\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(row1.entity).toLocaleLowerCase();\n const title2 = customTitle(row2.entity).toLocaleLowerCase();\n return title1.localeCompare(title2);\n },\n render: (row: DocsTableRow) => (\n <SubvalueCell\n value={\n <Link to={row.resolved.docsUrl}>{customTitle(row.entity)}</Link>\n }\n subvalue={row.entity.metadata.description}\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Owner',\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createKindColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Kind',\n field: 'entity.kind',\n };\n },\n createTypeColumn(): TableColumn<DocsTableRow> {\n return {\n title: 'Type',\n field: 'entity.spec.type',\n };\n },\n};\n\nexport const defaultColumns: TableColumn<DocsTableRow>[] = [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createKindColumn(),\n columnFactories.createTypeColumn(),\n];\n"],"names":[],"mappings":";;;;AAqBA,SAAS,YAAY,MAAA,EAAwB;AAC3C,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,KAAA,IAAS,MAAA,CAAO,QAAA,CAAS,IAAA;AAClD;AAOO,MAAM,eAAA,GAAkB;AAAA,EAC7B,kBAAkB,OAAA,EAA2D;AAC3E,IAAA,MAAM,OAAA,GAAU,gBAAgB,gBAAA,EAAiB;AACjD,IAAA,OAAO;AAAA,MACL,GAAG,OAAA;AAAA,MACH,KAAA,EAAO,uBAAA;AAAA,MACP,QAAQ,OAAA,EAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,UAAA;AAAA,MACP,KAAA,EAAO,sBAAA;AAAA,MACP,SAAA,EAAW,IAAA;AAAA,MACX,UAAA,EAAY,IAAA;AAAA,MACZ,WAAA,EAAa,KAAA;AAAA,MACb,UAAA,EAAY,CAAC,IAAA,EAAM,IAAA,KAAS;AAC1B,QAAA,MAAM,MAAA,GAAS,WAAA,CAAY,IAAA,CAAK,MAAM,EAAE,iBAAA,EAAkB;AAC1D,QAAA,MAAM,MAAA,GAAS,WAAA,CAAY,IAAA,CAAK,MAAM,EAAE,iBAAA,EAAkB;AAC1D,QAAA,OAAO,MAAA,CAAO,cAAc,MAAM,CAAA;AAAA,MACpC,CAAA;AAAA,MACA,MAAA,EAAQ,CAAC,GAAA,qBACP,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,KAAA,kBACE,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAI,GAAA,CAAI,SAAS,OAAA,EAAU,QAAA,EAAA,WAAA,CAAY,GAAA,CAAI,MAAM,CAAA,EAAE,CAAA;AAAA,UAE3D,QAAA,EAAU,GAAA,CAAI,MAAA,CAAO,QAAA,CAAS;AAAA;AAAA;AAChC,KAEJ;AAAA,EACF,CAAA;AAAA,EACA,iBAAA,GAA+C;AAC7C,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,OAAA;AAAA,MACP,KAAA,EAAO,gCAAA;AAAA,MACP,MAAA,EAAQ,CAAC,EAAE,QAAA,EAAS,qBAClB,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,YAAY,QAAA,CAAS,gBAAA;AAAA,UACrB,WAAA,EAAY;AAAA;AAAA;AACd,KAEJ;AAAA,EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,MAAA;AAAA,MACP,KAAA,EAAO;AAAA,KACT;AAAA,EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,MAAA;AAAA,MACP,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AACF;AAEO,MAAM,cAAA,GAA8C;AAAA,EACzD,eAAA,CAAgB,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EAClD,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,iBAAA,EAAkB;AAAA,EAClC,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,gBAAA;AAClB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.esm.js","sources":["../../../../src/home/components/Tables/helpers.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RELATION_OWNED_BY, Entity } from '@backstage/catalog-model';\nimport {\n getEntityRelations,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport { toLowerMaybe } from '../../../helpers';\nimport { ConfigApi, RouteFunc } from '@backstage/core-plugin-api';\n\ntype getRouteFunc = RouteFunc<{\n namespace: string;\n kind: string;\n name: string;\n}>;\n\nexport function entitiesToDocsMapper(\n entities: Entity[],\n getRouteToReaderPageFor: getRouteFunc,\n config: ConfigApi,\n) {\n return entities.map(entity => {\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n return {\n entity,\n resolved: {\n docsUrl: getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n }),\n ownedByRelations,\n ownedByRelationsTitle: ownedByRelations\n .map(r => humanizeEntityRef(r, { defaultKind: 'group' }))\n .join(', '),\n },\n };\n });\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"helpers.esm.js","sources":["../../../../src/home/components/Tables/helpers.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RELATION_OWNED_BY, Entity } from '@backstage/catalog-model';\nimport {\n getEntityRelations,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport { toLowerMaybe } from '../../../helpers';\nimport { ConfigApi, RouteFunc } from '@backstage/core-plugin-api';\n\ntype getRouteFunc = RouteFunc<{\n namespace: string;\n kind: string;\n name: string;\n}>;\n\nexport function entitiesToDocsMapper(\n entities: Entity[],\n getRouteToReaderPageFor: getRouteFunc,\n config: ConfigApi,\n) {\n return entities.map(entity => {\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n return {\n entity,\n resolved: {\n docsUrl: getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n }),\n ownedByRelations,\n ownedByRelationsTitle: ownedByRelations\n .map(r => humanizeEntityRef(r, { defaultKind: 'group' }))\n .join(', '),\n },\n };\n });\n}\n"],"names":[],"mappings":";;;;AA8BO,SAAS,oBAAA,CACd,QAAA,EACA,uBAAA,EACA,MAAA,EACA;AACA,EAAA,OAAO,QAAA,CAAS,IAAI,CAAA,MAAA,KAAU;AAC5B,IAAA,MAAM,gBAAA,GAAmB,kBAAA,CAAmB,MAAA,EAAQ,iBAAiB,CAAA;AACrE,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,QAAA,EAAU;AAAA,QACR,SAAS,uBAAA,CAAwB;AAAA,UAC/B,SAAA,EAAW,YAAA;AAAA,YACT,MAAA,CAAO,SAAS,SAAA,IAAa,SAAA;AAAA,YAC7B;AAAA,WACF;AAAA,UACA,IAAA,EAAM,YAAA,CAAa,MAAA,CAAO,IAAA,EAAM,MAAM,CAAA;AAAA,UACtC,IAAA,EAAM,YAAA,CAAa,MAAA,CAAO,QAAA,CAAS,MAAM,MAAM;AAAA,SAChD,CAAA;AAAA,QACD,gBAAA;AAAA,QACA,qBAAA,EAAuB,gBAAA,CACpB,GAAA,CAAI,CAAA,CAAA,KAAK,iBAAA,CAAkB,CAAA,EAAG,EAAE,WAAA,EAAa,OAAA,EAAS,CAAC,CAAA,CACvD,KAAK,IAAI;AAAA;AACd,KACF;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
|
|
@@ -2,11 +2,11 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import useAsync from 'react-use/esm/useAsync';
|
|
4
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
import {
|
|
5
|
+
import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership, EntityListProvider } from '@backstage/plugin-catalog-react';
|
|
6
6
|
import './Tables/EntityListDocsTable.esm.js';
|
|
7
7
|
import { DocsTable } from './Tables/DocsTable.esm.js';
|
|
8
8
|
import { DocsCardGrid } from './Grids/DocsCardGrid.esm.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
10
10
|
import '@material-ui/core/Typography';
|
|
11
11
|
import { InfoCardGrid } from './Grids/InfoCardGrid.esm.js';
|
|
12
12
|
import { TechDocsPageWrapper } from './TechDocsPageWrapper.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome.esm.js","sources":["../../../src/home/components/TechDocsCustomHome.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 { FC, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n useEntityOwnership,\n EntityListProvider,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable, DocsTableRow } from './Tables';\nimport { DocsCardGrid, InfoCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsIndexPage } from './TechDocsIndexPage';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n TechDocsIndexPage: TechDocsIndexPage,\n InfoCardGrid: InfoCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType =\n | 'DocsCardGrid'\n | 'DocsTable'\n | 'TechDocsIndexPage'\n | 'InfoCardGrid';\n\n/**\n * Type representing Panel props\n *\n * @public\n */\nexport interface PanelProps {\n options?: TableOptions<DocsTableRow>;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n PageWrapper?: FC;\n CustomHeader?: FC;\n}\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n panelProps?: PanelProps;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\n/**\n * Component which can be used to render entities in a custom way.\n *\n * @public\n */\nexport const CustomDocsPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n const Header: FC =\n config.panelProps?.CustomHeader ||\n (() => (\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n ));\n\n return (\n <>\n <Header />\n <div className={classes.panelContainer}>\n <EntityListProvider>\n <Panel\n data-testid=\"techdocs-custom-panel\"\n entities={shownEntities}\n {...config.panelProps}\n />\n </EntityListProvider>\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n filter?: EntityFilterQuery;\n CustomPageWrapper?: FC;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig, filter, CustomPageWrapper } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n ...filter,\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomDocsPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA;AA8DO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW;AAAC;AAC3C,GACD,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,kBAAmB,EAAA;AAExE,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,MAAA,CAAO,SAAS,CAA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AAIJ,EACE,uBAAA,IAAA,CAAC,uBAAoB,iBACnB,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,aAAe,EAAA,WAAA;AAAA,QACf,QAAA,EAAU,CAAS,KAAA,KAAA,cAAA,CAAe,KAAK,CAAA;AAAA,QACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAW,MAAA;AAAA,UAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,UACnB;AAAA,SACA,CAAA;AAAA;AAAA,KACJ;AAAA,oBACA,GAAA,CAAC,WAAQ,aAAY,EAAA,kBAAA,EAClB,2BAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KACpC,qBAAA,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QAEC,MAAA;AAAA,QACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,QACnC;AAAA,OAAA;AAAA,MAHK;AAAA,KAKR,CACH,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome.esm.js","sources":["../../../src/home/components/TechDocsCustomHome.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 { FC, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n useEntityOwnership,\n EntityListProvider,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable, DocsTableRow } from './Tables';\nimport { DocsCardGrid, InfoCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsIndexPage } from './TechDocsIndexPage';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n TechDocsIndexPage: TechDocsIndexPage,\n InfoCardGrid: InfoCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType =\n | 'DocsCardGrid'\n | 'DocsTable'\n | 'TechDocsIndexPage'\n | 'InfoCardGrid';\n\n/**\n * Type representing Panel props\n *\n * @public\n */\nexport interface PanelProps {\n options?: TableOptions<DocsTableRow>;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n PageWrapper?: FC;\n CustomHeader?: FC;\n}\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n panelProps?: PanelProps;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\n/**\n * Component which can be used to render entities in a custom way.\n *\n * @public\n */\nexport const CustomDocsPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n const Header: FC =\n config.panelProps?.CustomHeader ||\n (() => (\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n ));\n\n return (\n <>\n <Header />\n <div className={classes.panelContainer}>\n <EntityListProvider>\n <Panel\n data-testid=\"techdocs-custom-panel\"\n entities={shownEntities}\n {...config.panelProps}\n />\n </EntityListProvider>\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n filter?: EntityFilterQuery;\n CustomPageWrapper?: FC;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig, filter, CustomPageWrapper } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n ...filter,\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomDocsPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,MAAA,GAAS;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA;AA8DO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,YAAY,UAAA,CAAW;AAAA,IAC3B,cAAA,EAAgB;AAAA,MACd,YAAA,EAAc,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAA,GAAW,MAAA,CAAO,WAAW;AAAC;AAC3C,GACD,CAAA;AACD,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAkB,aAAA,KAAkB,kBAAA,EAAmB;AAExE,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,SAAS,CAAA;AAErC,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,MAAA,CAAO,CAAA,MAAA,KAAU;AAC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BAAA,EACnB,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAe,WAAA;AAAA,QACf,QAAA,EAAU,CAAA,KAAA,KAAS,cAAA,CAAe,KAAK,CAAA;AAAA,QACvC,MAAM,UAAA,CAAW,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAA,MAAW;AAAA,UAC1C,EAAA,EAAI,MAAM,QAAA,EAAS;AAAA,UACnB;AAAA,SACF,CAAE;AAAA;AAAA,KACJ;AAAA,oBACA,GAAA,CAAC,WAAQ,aAAA,EAAY,kBAAA,EAClB,2BAAiB,MAAA,CAAO,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,qBACpC,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QAEC,MAAA;AAAA,QACA,QAAA,EAAU,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,QACnC;AAAA,OAAA;AAAA,MAHK;AAAA,KAKR,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsIndexPage.esm.js","sources":["../../../src/home/components/TechDocsIndexPage.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 { FC } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport {\n TableColumn,\n TableProps,\n TableOptions,\n} from '@backstage/core-components';\nimport {\n EntityListPagination,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n options?: TableOptions<DocsTableRow>;\n PageWrapper?: FC;\n CustomHeader?: FC;\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n"],"names":[],"mappings":";;;;AA+
|
|
1
|
+
{"version":3,"file":"TechDocsIndexPage.esm.js","sources":["../../../src/home/components/TechDocsIndexPage.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 { FC } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport {\n TableColumn,\n TableProps,\n TableOptions,\n} from '@backstage/core-components';\nimport {\n EntityListPagination,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n options?: TableOptions<DocsTableRow>;\n PageWrapper?: FC;\n CustomHeader?: FC;\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n"],"names":[],"mappings":";;;;AA+CO,MAAM,iBAAA,GAAoB,CAAC,KAAA,KAAkC;AAClE,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,OAAO,MAAA,oBAAU,GAAA,CAAC,mBAAA,EAAA,EAAqB,GAAG,KAAA,EAAO,CAAA;AACnD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsPageWrapper.esm.js","sources":["../../../src/home/components/TechDocsPageWrapper.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 { ReactNode, FC } from 'react';\n\nimport { PageWithHeader } from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\n\n/**\n * Props for {@link TechDocsPageWrapper}\n *\n * @public\n */\nexport type TechDocsPageWrapperProps = {\n children?: ReactNode;\n CustomPageWrapper?: FC<{ children?: ReactNode }>;\n};\n\n/**\n * Component wrapping a TechDocs page with Page and Header components\n *\n * @public\n */\nexport const TechDocsPageWrapper = (props: TechDocsPageWrapperProps) => {\n const { children, CustomPageWrapper } = props;\n const configApi = useApi(configApiRef);\n const generatedSubtitle = `Documentation available in ${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n }`;\n\n return (\n <>\n {CustomPageWrapper ? (\n <CustomPageWrapper>{children}</CustomPageWrapper>\n ) : (\n <PageWithHeader\n title=\"Documentation\"\n subtitle={generatedSubtitle}\n themeId=\"documentation\"\n >\n {children}\n </PageWithHeader>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"TechDocsPageWrapper.esm.js","sources":["../../../src/home/components/TechDocsPageWrapper.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 { ReactNode, FC } from 'react';\n\nimport { PageWithHeader } from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\n\n/**\n * Props for {@link TechDocsPageWrapper}\n *\n * @public\n */\nexport type TechDocsPageWrapperProps = {\n children?: ReactNode;\n CustomPageWrapper?: FC<{ children?: ReactNode }>;\n};\n\n/**\n * Component wrapping a TechDocs page with Page and Header components\n *\n * @public\n */\nexport const TechDocsPageWrapper = (props: TechDocsPageWrapperProps) => {\n const { children, CustomPageWrapper } = props;\n const configApi = useApi(configApiRef);\n const generatedSubtitle = `Documentation available in ${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n }`;\n\n return (\n <>\n {CustomPageWrapper ? (\n <CustomPageWrapper>{children}</CustomPageWrapper>\n ) : (\n <PageWithHeader\n title=\"Documentation\"\n subtitle={generatedSubtitle}\n themeId=\"documentation\"\n >\n {children}\n </PageWithHeader>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAoCO,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAoC;AACtE,EAAA,MAAM,EAAE,QAAA,EAAU,iBAAA,EAAkB,GAAI,KAAA;AACxC,EAAA,MAAM,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,oBAAoB,CAAA,2BAAA,EACxB,SAAA,CAAU,iBAAA,CAAkB,mBAAmB,KAAK,WACtD,CAAA,CAAA;AAEA,EAAA,uBACE,GAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA,iBAAA,mBACC,GAAA,CAAC,iBAAA,EAAA,EAAmB,UAAS,CAAA,mBAE7B,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,eAAA;AAAA,MACN,QAAA,EAAU,iBAAA;AAAA,MACV,OAAA,EAAQ,eAAA;AAAA,MAEP;AAAA;AAAA,GACH,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsPicker.esm.js","sources":["../../../src/home/components/TechDocsPicker.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 { useEffect } from 'react';\nimport {\n CATALOG_FILTER_EXISTS,\n DefaultEntityFilters,\n EntityFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\n\nclass TechDocsFilter implements EntityFilter {\n getCatalogFilters(): Record<string, string | symbol | (string | symbol)[]> {\n return {\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n };\n }\n}\n\ntype CustomFilters = DefaultEntityFilters & {\n techdocs?: TechDocsFilter;\n};\n\n/**\n * Component responsible for updating TechDocs filters\n *\n * @public\n */\nexport const TechDocsPicker = () => {\n const { updateFilters } = useEntityList<CustomFilters>();\n\n useEffect(() => {\n updateFilters({\n techdocs: new TechDocsFilter(),\n });\n }, [updateFilters]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,
|
|
1
|
+
{"version":3,"file":"TechDocsPicker.esm.js","sources":["../../../src/home/components/TechDocsPicker.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 { useEffect } from 'react';\nimport {\n CATALOG_FILTER_EXISTS,\n DefaultEntityFilters,\n EntityFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\n\nclass TechDocsFilter implements EntityFilter {\n getCatalogFilters(): Record<string, string | symbol | (string | symbol)[]> {\n return {\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n };\n }\n}\n\ntype CustomFilters = DefaultEntityFilters & {\n techdocs?: TechDocsFilter;\n};\n\n/**\n * Component responsible for updating TechDocs filters\n *\n * @public\n */\nexport const TechDocsPicker = () => {\n const { updateFilters } = useEntityList<CustomFilters>();\n\n useEffect(() => {\n updateFilters({\n techdocs: new TechDocsFilter(),\n });\n }, [updateFilters]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,cAAA,CAAuC;AAAA,EAC3C,iBAAA,GAA2E;AACzE,IAAA,OAAO;AAAA,MACL,CAAC,CAAA,qBAAA,EAAwB,mBAAmB,CAAA,CAAE,GAAG;AAAA,KACnD;AAAA,EACF;AACF;AAWO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,aAAA,EAA6B;AAEvD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,aAAA,CAAc;AAAA,MACZ,QAAA,EAAU,IAAI,cAAA;AAAe,KAC9B,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,aAAa,CAAC,CAAA;AAElB,EAAA,OAAO,IAAA;AACT;;;;"}
|
package/dist/package.json.esm.js
CHANGED
package/dist/plugin.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { techdocsStorageApiRef, techdocsApiRef } from '@backstage/plugin-techdocs-react';
|
|
2
2
|
import { TechDocsStorageClient, TechDocsClient } from './client.esm.js';
|
|
3
|
-
import {
|
|
4
|
-
import { createPlugin, createApiFactory,
|
|
3
|
+
import { rootCatalogDocsRouteRef, rootDocsRouteRef, rootRouteRef } from './routes.esm.js';
|
|
4
|
+
import { createPlugin, createApiFactory, fetchApiRef, discoveryApiRef, configApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
5
5
|
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react';
|
|
6
6
|
|
|
7
7
|
const techdocsPlugin = createPlugin({
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsClient, TechDocsStorageClient } from './client';\nimport {\n rootDocsRouteRef,\n rootRouteRef,\n rootCatalogDocsRouteRef,\n} from './routes';\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n createSearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '@backstage/plugin-search-react';\nimport { TechDocsSearchResultListItemProps } from './search/components/TechDocsSearchResultListItem';\n\n/**\n * The Backstage plugin that renders technical documentation for your components\n *\n * @public\n */\nexport const techdocsPlugin = createPlugin({\n id: 'techdocs',\n apis: [\n createApiFactory({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n createApiFactory({\n api: techdocsApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n docRoot: rootDocsRouteRef,\n entityContent: rootCatalogDocsRouteRef,\n },\n});\n\n/**\n * Routable extension used to render docs\n *\n * @public\n */\nexport const TechdocsPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechdocsPage',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Routable extension used to render docs on Entity page\n *\n * @public\n */\nexport const EntityTechdocsContent = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechdocsContent',\n component: () => import('./Router').then(m => m.LegacyEmbeddedDocsRouter),\n mountPoint: rootCatalogDocsRouteRef,\n }),\n);\n\n/**\n * Component which takes a custom tabs config object and renders a documentation landing page.\n *\n * @public\n */\nexport const TechDocsCustomHome = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsCustomHome',\n component: () =>\n import('./home/components/TechDocsCustomHome').then(\n m => m.TechDocsCustomHome,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Responsible for rendering the provided router element\n *\n * @public\n */\nexport const TechDocsIndexPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsIndexPage',\n component: () =>\n import('./home/components/TechDocsIndexPage').then(\n m => m.TechDocsIndexPage,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @public\n */\nexport const TechDocsReaderPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsReaderPage',\n component: () =>\n import('./reader/components/TechDocsReaderPage').then(\n m => m.TechDocsReaderPage,\n ),\n mountPoint: rootDocsRouteRef,\n }),\n);\n\n/**\n * React extension used to render results on Search page or modal\n *\n * @public\n */\nexport const TechDocsSearchResultListItem: (\n props: SearchResultListItemExtensionProps<TechDocsSearchResultListItemProps>,\n) => JSX.Element | null = techdocsPlugin.provide(\n createSearchResultListItemExtension({\n name: 'TechDocsSearchResultListItem',\n component: () =>\n import('./search/components/TechDocsSearchResultListItem').then(\n m => m.TechDocsSearchResultListItem,\n ),\n predicate: result => result.type === 'techdocs',\n }),\n);\n"],"names":[],"mappings":";;;;;;AA6CO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsClient, TechDocsStorageClient } from './client';\nimport {\n rootDocsRouteRef,\n rootRouteRef,\n rootCatalogDocsRouteRef,\n} from './routes';\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n createSearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '@backstage/plugin-search-react';\nimport { TechDocsSearchResultListItemProps } from './search/components/TechDocsSearchResultListItem';\n\n/**\n * The Backstage plugin that renders technical documentation for your components\n *\n * @public\n */\nexport const techdocsPlugin = createPlugin({\n id: 'techdocs',\n apis: [\n createApiFactory({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n createApiFactory({\n api: techdocsApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n docRoot: rootDocsRouteRef,\n entityContent: rootCatalogDocsRouteRef,\n },\n});\n\n/**\n * Routable extension used to render docs\n *\n * @public\n */\nexport const TechdocsPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechdocsPage',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Routable extension used to render docs on Entity page\n *\n * @public\n */\nexport const EntityTechdocsContent = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechdocsContent',\n component: () => import('./Router').then(m => m.LegacyEmbeddedDocsRouter),\n mountPoint: rootCatalogDocsRouteRef,\n }),\n);\n\n/**\n * Component which takes a custom tabs config object and renders a documentation landing page.\n *\n * @public\n */\nexport const TechDocsCustomHome = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsCustomHome',\n component: () =>\n import('./home/components/TechDocsCustomHome').then(\n m => m.TechDocsCustomHome,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Responsible for rendering the provided router element\n *\n * @public\n */\nexport const TechDocsIndexPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsIndexPage',\n component: () =>\n import('./home/components/TechDocsIndexPage').then(\n m => m.TechDocsIndexPage,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @public\n */\nexport const TechDocsReaderPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsReaderPage',\n component: () =>\n import('./reader/components/TechDocsReaderPage').then(\n m => m.TechDocsReaderPage,\n ),\n mountPoint: rootDocsRouteRef,\n }),\n);\n\n/**\n * React extension used to render results on Search page or modal\n *\n * @public\n */\nexport const TechDocsSearchResultListItem: (\n props: SearchResultListItemExtensionProps<TechDocsSearchResultListItemProps>,\n) => JSX.Element | null = techdocsPlugin.provide(\n createSearchResultListItemExtension({\n name: 'TechDocsSearchResultListItem',\n component: () =>\n import('./search/components/TechDocsSearchResultListItem').then(\n m => m.TechDocsSearchResultListItem,\n ),\n predicate: result => result.type === 'techdocs',\n }),\n);\n"],"names":[],"mappings":";;;;;;AA6CO,MAAM,iBAAiB,YAAA,CAAa;AAAA,EACzC,EAAA,EAAI,UAAA;AAAA,EACJ,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,qBAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,SAAA,EAAW,YAAA;AAAA,QACX,YAAA,EAAc,eAAA;AAAA,QACd,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,c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AAE;AAAA,KACT;AAAA,IACF,UAAA,EAAY;AAAA,GACb;AACH;AAOO,MAAM,oBAAoB,cAAA,CAAe,OAAA;AAAA,EAC9C,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,mBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,4CAAqC,CAAA,CAAE,IAAA;AAAA,MAC5C,OAAK,CAAA,CAAE;AAAA,KACT;AAAA,IACF,UAAA,EAAY;AAAA,GACb;AACH;AAOO,MAAM,qBAAqB,cAAA,CAAe,OAAA;AAAA,EAC/C,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,oBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,qDAAwC,CAAA,CAAE,IAAA;AAAA,MAC/C,OAAK,CAAA,CAAE;AAAA,KACT;AAAA,IACF,UAAA,EAAY;AAAA,GACb;AACH;AAOO,MAAM,+BAEa,cAAA,CAAe,OAAA;AAAA,EACvC,mCAAA,CAAoC;AAAA,IAClC,IAAA,EAAM,8BAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,yDAAkD,CAAA,CAAE,IAAA;AAAA,MACzD,OAAK,CAAA,CAAE;AAAA,KACT;AAAA,IACF,SAAA,EAAW,CAAA,MAAA,KAAU,MAAA,CAAO,IAAA,KAAS;AAAA,GACtC;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsBuildLogs.esm.js","sources":["../../../src/reader/components/TechDocsBuildLogs.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 { LogViewer } from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport Drawer from '@material-ui/core/Drawer';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport Close from '@material-ui/icons/Close';\nimport { useState } from 'react';\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '100%',\n [theme.breakpoints.up('sm')]: {\n width: '75%',\n },\n [theme.breakpoints.up('md')]: {\n width: '50%',\n },\n padding: theme.spacing(2.5),\n },\n root: {\n height: '100%',\n overflow: 'hidden',\n },\n logs: {\n background: theme.palette.background.default,\n },\n }),\n);\n\nexport const TechDocsBuildLogsDrawerContent = ({\n buildLog,\n onClose,\n}: {\n buildLog: string[];\n onClose: () => void;\n}) => {\n const classes = useDrawerStyles();\n const logText =\n buildLog.length === 0 ? 'Waiting for logs...' : buildLog.join('\\n');\n return (\n <Grid\n container\n direction=\"column\"\n className={classes.root}\n spacing={0}\n wrap=\"nowrap\"\n >\n <Grid\n item\n container\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n wrap=\"nowrap\"\n >\n <Typography variant=\"h5\">Build Details</Typography>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={onClose}\n color=\"inherit\"\n >\n <Close />\n </IconButton>\n </Grid>\n <Grid item xs>\n <LogViewer text={logText} classes={{ root: classes.logs }} />\n </Grid>\n </Grid>\n );\n};\n\nexport const TechDocsBuildLogs = ({ buildLog }: { buildLog: string[] }) => {\n const classes = useDrawerStyles();\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Button color=\"inherit\" onClick={() => setOpen(true)}>\n Show Build Logs\n </Button>\n <Drawer\n classes={{ paper: classes.paper }}\n anchor=\"right\"\n open={open}\n onClose={() => setOpen(false)}\n >\n <TechDocsBuildLogsDrawerContent\n buildLog={buildLog}\n onClose={() => setOpen(false)}\n />\n </Drawer>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA0BA,MAAM,
|
|
1
|
+
{"version":3,"file":"TechDocsBuildLogs.esm.js","sources":["../../../src/reader/components/TechDocsBuildLogs.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 { LogViewer } from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport Drawer from '@material-ui/core/Drawer';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport Close from '@material-ui/icons/Close';\nimport { useState } from 'react';\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '100%',\n [theme.breakpoints.up('sm')]: {\n width: '75%',\n },\n [theme.breakpoints.up('md')]: {\n width: '50%',\n },\n padding: theme.spacing(2.5),\n },\n root: {\n height: '100%',\n overflow: 'hidden',\n },\n logs: {\n background: theme.palette.background.default,\n },\n }),\n);\n\nexport const TechDocsBuildLogsDrawerContent = ({\n buildLog,\n onClose,\n}: {\n buildLog: string[];\n onClose: () => void;\n}) => {\n const classes = useDrawerStyles();\n const logText =\n buildLog.length === 0 ? 'Waiting for logs...' : buildLog.join('\\n');\n return (\n <Grid\n container\n direction=\"column\"\n className={classes.root}\n spacing={0}\n wrap=\"nowrap\"\n >\n <Grid\n item\n container\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n wrap=\"nowrap\"\n >\n <Typography variant=\"h5\">Build Details</Typography>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={onClose}\n color=\"inherit\"\n >\n <Close />\n </IconButton>\n </Grid>\n <Grid item xs>\n <LogViewer text={logText} classes={{ root: classes.logs }} />\n </Grid>\n </Grid>\n );\n};\n\nexport const TechDocsBuildLogs = ({ buildLog }: { buildLog: string[] }) => {\n const classes = useDrawerStyles();\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Button color=\"inherit\" onClick={() => setOpen(true)}>\n Show Build Logs\n </Button>\n <Drawer\n classes={{ paper: classes.paper }}\n anchor=\"right\"\n open={open}\n onClose={() => setOpen(false)}\n >\n <TechDocsBuildLogsDrawerContent\n buildLog={buildLog}\n onClose={() => setOpen(false)}\n />\n </Drawer>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA0BA,MAAM,eAAA,GAAkB,UAAA;AAAA,EAAW,CAAC,UAClC,YAAA,CAAa;AAAA,IACX,KAAA,EAAO;AAAA,MACL,KAAA,EAAO,MAAA;AAAA,MACP,CAAC,KAAA,CAAM,WAAA,CAAY,EAAA,CAAG,IAAI,CAAC,GAAG;AAAA,QAC5B,KAAA,EAAO;AAAA,OACT;AAAA,MACA,CAAC,KAAA,CAAM,WAAA,CAAY,EAAA,CAAG,IAAI,CAAC,GAAG;AAAA,QAC5B,KAAA,EAAO;AAAA,OACT;AAAA,MACA,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA,KAC5B;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,MAAA,EAAQ,MAAA;AAAA,MACR,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA;AACvC,GACD;AACH,CAAA;AAEO,MAAM,iCAAiC,CAAC;AAAA,EAC7C,QAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,UAAU,eAAA,EAAgB;AAChC,EAAA,MAAM,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A,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AAEtC,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,OAAM,SAAA,EAAU,OAAA,EAAS,MAAM,OAAA,CAAQ,IAAI,GAAG,QAAA,EAAA,iBAAA,EAEtD,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,EAAE,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAM;AAAA,QAChC,MAAA,EAAO,OAAA;AAAA,QACP,IAAA;AAAA,QACA,OAAA,EAAS,MAAM,OAAA,CAAQ,KAAK,CAAA;AAAA,QAE5B,QAAA,kBAAA,GAAA;AAAA,UAAC,8BAAA;AAAA,UAAA;AAAA,YACC,QAAA;AAAA,YACA,OAAA,EAAS,MAAM,OAAA,CAAQ,KAAK;AAAA;AAAA;AAC9B;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsNotFound.esm.js","sources":["../../../src/reader/components/TechDocsNotFound.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 { useEffect } from 'react';\nimport { useApi, configApiRef, useAnalytics } from '@backstage/core-plugin-api';\nimport { ErrorPage } from '@backstage/core-components';\nimport { useTechDocsReaderPage } from '@backstage/plugin-techdocs-react';\nimport { useLocation } from 'react-router-dom';\n\ntype Props = {\n errorMessage?: string;\n};\n\nexport const TechDocsNotFound = ({ errorMessage }: Props) => {\n const techdocsBuilder =\n useApi(configApiRef).getOptionalString('techdocs.builder');\n const analyticsApi = useAnalytics();\n const { entityRef } = useTechDocsReaderPage();\n const location = useLocation();\n\n useEffect(() => {\n const { pathname, search, hash } = location;\n analyticsApi.captureEvent('not-found', `${pathname}${search}${hash}`, {\n attributes: entityRef,\n });\n }, [analyticsApi, entityRef, location]);\n\n let additionalInfo = '';\n if (![undefined, 'local'].includes(techdocsBuilder)) {\n additionalInfo =\n \"Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not \" +\n \"generate docs if they are not found. Make sure the project's docs are generated and published by some external \" +\n \"process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to generate docs from this Backstage \" +\n 'instance.';\n }\n\n return (\n <ErrorPage\n status=\"404\"\n statusMessage={errorMessage || 'Documentation not found'}\n additionalInfo={additionalInfo}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,
|
|
1
|
+
{"version":3,"file":"TechDocsNotFound.esm.js","sources":["../../../src/reader/components/TechDocsNotFound.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 { useEffect } from 'react';\nimport { useApi, configApiRef, useAnalytics } from '@backstage/core-plugin-api';\nimport { ErrorPage } from '@backstage/core-components';\nimport { useTechDocsReaderPage } from '@backstage/plugin-techdocs-react';\nimport { useLocation } from 'react-router-dom';\n\ntype Props = {\n errorMessage?: string;\n};\n\nexport const TechDocsNotFound = ({ errorMessage }: Props) => {\n const techdocsBuilder =\n useApi(configApiRef).getOptionalString('techdocs.builder');\n const analyticsApi = useAnalytics();\n const { entityRef } = useTechDocsReaderPage();\n const location = useLocation();\n\n useEffect(() => {\n const { pathname, search, hash } = location;\n analyticsApi.captureEvent('not-found', `${pathname}${search}${hash}`, {\n attributes: entityRef,\n });\n }, [analyticsApi, entityRef, location]);\n\n let additionalInfo = '';\n if (![undefined, 'local'].includes(techdocsBuilder)) {\n additionalInfo =\n \"Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not \" +\n \"generate docs if they are not found. Make sure the project's docs are generated and published by some external \" +\n \"process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to generate docs from this Backstage \" +\n 'instance.';\n }\n\n return (\n <ErrorPage\n status=\"404\"\n statusMessage={errorMessage || 'Documentation not found'}\n additionalInfo={additionalInfo}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,gBAAA,GAAmB,CAAC,EAAE,YAAA,EAAa,KAAa;AAC3D,EAAA,MAAM,eAAA,GACJ,MAAA,CAAO,YAAY,CAAA,CAAE,kBAAkB,kBAAkB,CAAA;AAC3D,EAAA,MAAM,eAAe,YAAA,EAAa;AAClC,EAAA,MAAM,EAAE,SAAA,EAAU,GAAI,qBAAA,EAAsB;AAC5C,EAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,MAAA,EAAQ,IAAA,EAAK,GAAI,QAAA;AACnC,IAAA,YAAA,CAAa,YAAA,CAAa,aAAa,CAAA,EAAG,QAAQ,GAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI;AAAA,MACpE,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,YAAA,EAAc,SAAA,EAAW,QAAQ,CAAC,CAAA;AAEtC,EAAA,IAAI,cAAA,GAAiB,EAAA;AACrB,EAAA,IAAI,CAAC,CAAC,MAAA,EAAW,OAAO,CAAA,CAAE,QAAA,CAAS,eAAe,CAAA,EAAG;AACnD,IAAA,cAAA,GACE,6UAAA;AAAA,EAIJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAO,KAAA;AAAA,MACP,eAAe,YAAA,IAAgB,yBAAA;AAAA,MAC/B;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsReaderPage.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { Children, ReactElement, ReactNode } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n });\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA+Ia,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAA,MAAM,EAAE,UAAA,EAAY,UAAa,GAAA,IAAA,EAAS,GAAA,KAAA;AAC1C,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,eACX,EAAA,QAAA,EAAA;AAAA,IAAA,UAAA,wBAAe,wBAAyB,EAAA,EAAA,CAAA;AAAA,wBACxC,2BAA4B,EAAA,EAAA,CAAA;AAAA,oBAC7B,GAAA,CAAC,6BAA0B,UAAwB,EAAA;AAAA,GACrD,EAAA,CAAA;AAEJ;AAcA,MAAM,UAAA,GAAa,MAAO,CAAA,IAAI,CAAE,CAAA;AAAA,EAC9B,MAAQ,EAAA,SAAA;AAAA,E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AAA,GAAA,CAAC,6BAA0B,QAAS,EAAA,UAAA,EAClC,QAAC,kBAAA,GAAA,CAAA,0BAAA,EAAA,EAA2B,WACzB,QAAC,EAAA,CAAA,EAAE,QAAU,EAAA,cAAA,EAAgB,SAC5B,qBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,eAAA;AAAA,MACR,SAAU,EAAA,sBAAA;AAAA,MAET,QAAA,EAAA,QAAA,YAAoB,WACjB,QAAS,CAAA;AAAA,QACP,SAAA;AAAA,QACA,uBAAuB,QAAS,CAAA,KAAA;AAAA,QAChC,qBAAqB,cAAe,CAAA,KAAA;AAAA,QACpC;AAAA,OACD,CACD,GAAA;AAAA;AAAA,GACN,EAEJ,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TechDocsReaderPage.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { Children, ReactElement, ReactNode } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n });\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA+IO,MAAM,oBAAA,GAAuB,CAAC,KAAA,KAAqC;AACxE,EAAA,MAAM,EAAE,UAAA,EAAY,UAAA,GAAa,IAAA,EAAK,GAAI,KAAA;AAC1C,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,eAAA,EACX,QAAA,EAAA;AAAA,IAAA,UAAA,wBAAe,wBAAA,EAAA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