@backstage/plugin-techdocs 1.12.5-next.0 → 1.12.5-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/dist/EntityPageDocs.esm.js +11 -8
- package/dist/EntityPageDocs.esm.js.map +1 -1
- package/dist/Router.esm.js +15 -12
- package/dist/Router.esm.js.map +1 -1
- package/dist/alpha.d.ts +6 -6
- package/dist/alpha.esm.js +14 -10
- package/dist/alpha.esm.js.map +1 -1
- package/dist/home/components/DefaultTechDocsHome.esm.js +21 -10
- package/dist/home/components/DefaultTechDocsHome.esm.js.map +1 -1
- package/dist/home/components/Grids/DocsCardGrid.esm.js +26 -22
- package/dist/home/components/Grids/DocsCardGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js +22 -14
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/InfoCardGrid.esm.js +19 -17
- package/dist/home/components/Grids/InfoCardGrid.esm.js.map +1 -1
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js +2 -2
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/DocsTable.esm.js +8 -8
- package/dist/home/components/Tables/DocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/EntityListDocsTable.esm.js +8 -8
- package/dist/home/components/Tables/EntityListDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js +4 -3
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/actions.esm.js +3 -3
- package/dist/home/components/Tables/actions.esm.js.map +1 -1
- package/dist/home/components/Tables/columns.esm.js +4 -4
- package/dist/home/components/Tables/columns.esm.js.map +1 -1
- package/dist/home/components/TechDocsCustomHome.esm.js +41 -34
- package/dist/home/components/TechDocsCustomHome.esm.js.map +1 -1
- package/dist/home/components/TechDocsIndexPage.esm.js +2 -2
- package/dist/home/components/TechDocsIndexPage.esm.js.map +1 -1
- package/dist/home/components/TechDocsPageWrapper.esm.js +6 -6
- package/dist/home/components/TechDocsPageWrapper.esm.js.map +1 -1
- package/dist/index.d.ts +39 -38
- package/dist/reader/components/TechDocsBuildLogs.esm.js +48 -40
- package/dist/reader/components/TechDocsBuildLogs.esm.js.map +1 -1
- package/dist/reader/components/TechDocsNotFound.esm.js +3 -2
- package/dist/reader/components/TechDocsNotFound.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js +18 -13
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js +19 -11
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js +6 -2
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js +55 -44
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js +33 -27
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderProvider.esm.js +4 -3
- package/dist/reader/components/TechDocsReaderProvider.esm.js.map +1 -1
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js +7 -6
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js.map +1 -1
- package/dist/reader/components/TechDocsStateIndicator.esm.js +43 -36
- package/dist/reader/components/TechDocsStateIndicator.esm.js.map +1 -1
- package/dist/reader/transformers/addGitFeedbackLink.esm.js +2 -2
- package/dist/reader/transformers/addGitFeedbackLink.esm.js.map +1 -1
- package/dist/reader/transformers/addSidebarToggle.esm.js +2 -2
- package/dist/reader/transformers/addSidebarToggle.esm.js.map +1 -1
- package/dist/reader/transformers/copyToClipboard.esm.js +16 -15
- package/dist/reader/transformers/copyToClipboard.esm.js.map +1 -1
- package/dist/reader/transformers/handleMetaRedirects.esm.js +2 -2
- package/dist/reader/transformers/handleMetaRedirects.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearch.esm.js +5 -4
- package/dist/search/components/TechDocsSearch.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearchResultListItem.esm.js +28 -20
- package/dist/search/components/TechDocsSearchResultListItem.esm.js.map +1 -1
- package/package.json +21 -21
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import useAsync from 'react-use/esm/useAsync';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import { useEntityOwnership, EntityListProvider, catalogApiRef, CATALOG_FILTER_EXISTS } from '@backstage/plugin-catalog-react';
|
|
@@ -42,15 +43,18 @@ const CustomDocsPanel = ({
|
|
|
42
43
|
}
|
|
43
44
|
return typeof config.filterPredicate === "function" && config.filterPredicate(entity);
|
|
44
45
|
});
|
|
45
|
-
const Header = config.panelProps?.CustomHeader || (() => /* @__PURE__ */
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const Header = config.panelProps?.CustomHeader || (() => /* @__PURE__ */ jsx(ContentHeader, { title: config.title, description: config.description, children: index === 0 ? /* @__PURE__ */ jsx(SupportButton, { children: "Discover documentation in your ecosystem." }) : null }));
|
|
47
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Header, {}),
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: classes.panelContainer, children: /* @__PURE__ */ jsx(EntityListProvider, { children: /* @__PURE__ */ jsx(
|
|
50
|
+
Panel,
|
|
51
|
+
{
|
|
52
|
+
"data-testid": "techdocs-custom-panel",
|
|
53
|
+
entities: shownEntities,
|
|
54
|
+
...config.panelProps
|
|
55
|
+
}
|
|
56
|
+
) }) })
|
|
57
|
+
] });
|
|
54
58
|
};
|
|
55
59
|
const TechDocsCustomHome = (props) => {
|
|
56
60
|
const { tabsConfig, filter, CustomPageWrapper } = props;
|
|
@@ -81,37 +85,40 @@ const TechDocsCustomHome = (props) => {
|
|
|
81
85
|
});
|
|
82
86
|
const currentTabConfig = tabsConfig[selectedTab];
|
|
83
87
|
if (loading) {
|
|
84
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ jsx(TechDocsPageWrapper, { CustomPageWrapper, children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(Progress, {}) }) });
|
|
85
89
|
}
|
|
86
90
|
if (error) {
|
|
87
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ jsx(TechDocsPageWrapper, { CustomPageWrapper, children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
|
|
88
92
|
WarningPanel,
|
|
89
93
|
{
|
|
90
94
|
severity: "error",
|
|
91
|
-
title: "Could not load available documentation."
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)));
|
|
95
|
+
title: "Could not load available documentation.",
|
|
96
|
+
children: /* @__PURE__ */ jsx(CodeSnippet, { language: "text", text: error.toString() })
|
|
97
|
+
}
|
|
98
|
+
) }) });
|
|
95
99
|
}
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
return /* @__PURE__ */ jsxs(TechDocsPageWrapper, { CustomPageWrapper, children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
HeaderTabs,
|
|
103
|
+
{
|
|
104
|
+
selectedIndex: selectedTab,
|
|
105
|
+
onChange: (index) => setSelectedTab(index),
|
|
106
|
+
tabs: tabsConfig.map(({ label }, index) => ({
|
|
107
|
+
id: index.toString(),
|
|
108
|
+
label
|
|
109
|
+
}))
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(Content, { "data-testid": "techdocs-content", children: currentTabConfig.panels.map((config, index) => /* @__PURE__ */ jsx(
|
|
113
|
+
CustomDocsPanel,
|
|
114
|
+
{
|
|
115
|
+
config,
|
|
116
|
+
entities: !!entities ? entities : [],
|
|
117
|
+
index
|
|
118
|
+
},
|
|
112
119
|
index
|
|
113
|
-
}
|
|
114
|
-
)
|
|
120
|
+
)) })
|
|
121
|
+
] });
|
|
115
122
|
};
|
|
116
123
|
|
|
117
124
|
export { CustomDocsPanel, TechDocsCustomHome };
|
|
@@ -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 React, { 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 CatalogApi,\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?: React.FC;\n CustomHeader?: React.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: React.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?: React.FC;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig, filter, CustomPageWrapper } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: 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":";;;;;;;;;;;;;;;AA+CA,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,CAAA;AAErC,EAAM,MAAA,aAAA,G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CAAA;AAAA;AAIJ,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,uBAAoB,iBACnB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,WAAA;AAAA,MACf,QAAA,EAAU,CAAS,KAAA,KAAA,cAAA,CAAe,KAAK,CAAA;AAAA,MACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAW,MAAA;AAAA,QAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,QACnB;AAAA,OACA,CAAA;AAAA;AAAA,GACJ,kBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,aAAY,EAAA,kBAAA,EAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KACpC,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,KAAA;AAAA,MACL,MAAA;AAAA,MACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,MACnC;AAAA;AAAA,GAEH,CACH,CACF,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 CatalogApi,\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: 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":";;;;;;;;;;;;;;;;AA+CA,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,CAAA;AAErC,EAAM,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BAAA,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,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useOutlet } from 'react-router-dom';
|
|
3
3
|
import { DefaultTechDocsHome } from './DefaultTechDocsHome.esm.js';
|
|
4
4
|
|
|
5
5
|
const TechDocsIndexPage = (props) => {
|
|
6
6
|
const outlet = useOutlet();
|
|
7
|
-
return outlet || /* @__PURE__ */
|
|
7
|
+
return outlet || /* @__PURE__ */ jsx(DefaultTechDocsHome, { ...props });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { TechDocsIndexPage };
|
|
@@ -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
|
|
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+Ca,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAA,MAAM,SAAS,SAAU,EAAA;AAEzB,EAAA,OAAO,MAAU,oBAAA,GAAA,CAAC,mBAAqB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AACnD;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { PageWithHeader } from '@backstage/core-components';
|
|
3
3
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
4
|
|
|
@@ -6,15 +6,15 @@ const TechDocsPageWrapper = (props) => {
|
|
|
6
6
|
const { children, CustomPageWrapper } = props;
|
|
7
7
|
const configApi = useApi(configApiRef);
|
|
8
8
|
const generatedSubtitle = `Documentation available in ${configApi.getOptionalString("organization.name") ?? "Backstage"}`;
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: CustomPageWrapper ? /* @__PURE__ */ jsx(CustomPageWrapper, { children }) : /* @__PURE__ */ jsx(
|
|
10
10
|
PageWithHeader,
|
|
11
11
|
{
|
|
12
12
|
title: "Documentation",
|
|
13
13
|
subtitle: generatedSubtitle,
|
|
14
|
-
themeId: "documentation"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
));
|
|
14
|
+
themeId: "documentation",
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
) });
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export { TechDocsPageWrapper };
|
|
@@ -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
|
|
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":";;;;AAoCa,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAM,MAAA,EAAE,QAAU,EAAA,iBAAA,EAAsB,GAAA,KAAA;AACxC,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,oBAAoB,CACxB,2BAAA,EAAA,SAAA,CAAU,iBAAkB,CAAA,mBAAmB,KAAK,WACtD,CAAA,CAAA;AAEA,EAAA,uBAEK,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA,iBAAA,mBACE,GAAA,CAAA,iBAAA,EAAA,EAAmB,UAAS,CAE7B,mBAAA,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,eAAA;AAAA,MACN,QAAU,EAAA,iBAAA;AAAA,MACV,OAAQ,EAAA,eAAA;AAAA,MAEP;AAAA;AAAA,GAGP,EAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
|
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
4
|
import { DiscoveryApi, FetchApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { Config } from '@backstage/config';
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import * as react from 'react';
|
|
8
|
+
import { ReactNode, PropsWithChildren, FC } from 'react';
|
|
8
9
|
import { ThemeOptions } from '@material-ui/core/styles';
|
|
9
10
|
import { ToolbarProps } from '@material-ui/core/Toolbar';
|
|
10
11
|
import { TableColumn, TableProps, TableOptions } from '@backstage/core-components';
|
|
@@ -203,7 +204,7 @@ type TechDocsReaderProviderProps = {
|
|
|
203
204
|
*
|
|
204
205
|
* @public
|
|
205
206
|
*/
|
|
206
|
-
declare const TechDocsReaderProvider: (props: TechDocsReaderProviderProps) =>
|
|
207
|
+
declare const TechDocsReaderProvider: (props: TechDocsReaderProviderProps) => react_jsx_runtime.JSX.Element;
|
|
207
208
|
|
|
208
209
|
/**
|
|
209
210
|
* Props for {@link TechDocsReaderLayout}
|
|
@@ -223,7 +224,7 @@ type TechDocsReaderLayoutProps = {
|
|
|
223
224
|
* Default TechDocs reader page structure composed with a header and content
|
|
224
225
|
* @public
|
|
225
226
|
*/
|
|
226
|
-
declare const TechDocsReaderLayout: (props: TechDocsReaderLayoutProps) =>
|
|
227
|
+
declare const TechDocsReaderLayout: (props: TechDocsReaderLayoutProps) => react_jsx_runtime.JSX.Element;
|
|
227
228
|
/**
|
|
228
229
|
* @public
|
|
229
230
|
*/
|
|
@@ -250,7 +251,7 @@ type TechDocsReaderPageHeaderProps = PropsWithChildren<{
|
|
|
250
251
|
* the Tech Docs add-ons to customize it
|
|
251
252
|
* @public
|
|
252
253
|
*/
|
|
253
|
-
declare const TechDocsReaderPageHeader: (props: TechDocsReaderPageHeaderProps) =>
|
|
254
|
+
declare const TechDocsReaderPageHeader: (props: TechDocsReaderPageHeaderProps) => react_jsx_runtime.JSX.Element | null;
|
|
254
255
|
|
|
255
256
|
/**
|
|
256
257
|
* Props for {@link TechDocsReaderPageContent}
|
|
@@ -281,13 +282,13 @@ type TechDocsReaderPageContentProps = {
|
|
|
281
282
|
* Renders the reader page content
|
|
282
283
|
* @public
|
|
283
284
|
*/
|
|
284
|
-
declare const TechDocsReaderPageContent: (props: TechDocsReaderPageContentProps) =>
|
|
285
|
+
declare const TechDocsReaderPageContent: (props: TechDocsReaderPageContentProps) => react_jsx_runtime.JSX.Element;
|
|
285
286
|
/**
|
|
286
287
|
* Component responsible for rendering TechDocs documentation
|
|
287
288
|
* @public
|
|
288
289
|
* @deprecated use `TechDocsReaderPageContent` component instead.
|
|
289
290
|
*/
|
|
290
|
-
declare const Reader: (props: TechDocsReaderPageContentProps) =>
|
|
291
|
+
declare const Reader: (props: TechDocsReaderPageContentProps) => react_jsx_runtime.JSX.Element;
|
|
291
292
|
|
|
292
293
|
/**
|
|
293
294
|
* Renders the reader page subheader.
|
|
@@ -296,7 +297,7 @@ declare const Reader: (props: TechDocsReaderPageContentProps) => React__default.
|
|
|
296
297
|
*/
|
|
297
298
|
declare const TechDocsReaderPageSubheader: (props: {
|
|
298
299
|
toolbarProps?: ToolbarProps;
|
|
299
|
-
}) =>
|
|
300
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
300
301
|
|
|
301
302
|
/**
|
|
302
303
|
* Props for {@link TechDocsSearch}
|
|
@@ -314,7 +315,7 @@ type TechDocsSearchProps = {
|
|
|
314
315
|
*
|
|
315
316
|
* @public
|
|
316
317
|
*/
|
|
317
|
-
declare const TechDocsSearch: (props: TechDocsSearchProps) =>
|
|
318
|
+
declare const TechDocsSearch: (props: TechDocsSearchProps) => react_jsx_runtime.JSX.Element;
|
|
318
319
|
|
|
319
320
|
/**
|
|
320
321
|
* Props for {@link EntityListDocsGrid}
|
|
@@ -322,7 +323,7 @@ declare const TechDocsSearch: (props: TechDocsSearchProps) => React__default.JSX
|
|
|
322
323
|
* @public
|
|
323
324
|
*/
|
|
324
325
|
type DocsGroupConfig = {
|
|
325
|
-
title:
|
|
326
|
+
title: ReactNode;
|
|
326
327
|
filterPredicate: ((entity: Entity) => boolean) | string;
|
|
327
328
|
};
|
|
328
329
|
/**
|
|
@@ -338,7 +339,7 @@ type EntityListDocsGridPageProps = {
|
|
|
338
339
|
*
|
|
339
340
|
* @public
|
|
340
341
|
*/
|
|
341
|
-
declare const EntityListDocsGrid: (props: EntityListDocsGridPageProps) =>
|
|
342
|
+
declare const EntityListDocsGrid: (props: EntityListDocsGridPageProps) => react_jsx_runtime.JSX.Element;
|
|
342
343
|
|
|
343
344
|
/**
|
|
344
345
|
* Props for {@link DocsCardGrid}
|
|
@@ -353,7 +354,7 @@ type DocsCardGridProps = {
|
|
|
353
354
|
*
|
|
354
355
|
* @public
|
|
355
356
|
*/
|
|
356
|
-
declare const DocsCardGrid: (props: DocsCardGridProps) =>
|
|
357
|
+
declare const DocsCardGrid: (props: DocsCardGridProps) => react_jsx_runtime.JSX.Element | null;
|
|
357
358
|
|
|
358
359
|
/** @public */
|
|
359
360
|
type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';
|
|
@@ -372,7 +373,7 @@ type InfoCardGridProps = {
|
|
|
372
373
|
*
|
|
373
374
|
* @public
|
|
374
375
|
*/
|
|
375
|
-
declare const InfoCardGrid: (props: InfoCardGridProps) =>
|
|
376
|
+
declare const InfoCardGrid: (props: InfoCardGridProps) => react_jsx_runtime.JSX.Element | null;
|
|
376
377
|
|
|
377
378
|
/**
|
|
378
379
|
* Generic representing the metadata structure for a docs table row.
|
|
@@ -404,7 +405,7 @@ type EntityListDocsTableProps = {
|
|
|
404
405
|
* @public
|
|
405
406
|
*/
|
|
406
407
|
declare const EntityListDocsTable: {
|
|
407
|
-
(props: EntityListDocsTableProps):
|
|
408
|
+
(props: EntityListDocsTableProps): react_jsx_runtime.JSX.Element;
|
|
408
409
|
columns: {
|
|
409
410
|
createTitleColumn(options?: {
|
|
410
411
|
hidden?: boolean;
|
|
@@ -416,7 +417,7 @@ declare const EntityListDocsTable: {
|
|
|
416
417
|
};
|
|
417
418
|
actions: {
|
|
418
419
|
createCopyDocsUrlAction(copyToClipboard: Function): (row: DocsTableRow) => {
|
|
419
|
-
icon: () =>
|
|
420
|
+
icon: () => react_jsx_runtime.JSX.Element;
|
|
420
421
|
tooltip: string;
|
|
421
422
|
onClick: () => any;
|
|
422
423
|
};
|
|
@@ -424,7 +425,7 @@ declare const EntityListDocsTable: {
|
|
|
424
425
|
cellStyle: {
|
|
425
426
|
paddingLeft: string;
|
|
426
427
|
};
|
|
427
|
-
icon: () =>
|
|
428
|
+
icon: () => react_jsx_runtime.JSX.Element;
|
|
428
429
|
tooltip: string;
|
|
429
430
|
onClick: () => any;
|
|
430
431
|
};
|
|
@@ -450,7 +451,7 @@ type DocsTableProps = {
|
|
|
450
451
|
* @public
|
|
451
452
|
*/
|
|
452
453
|
declare const DocsTable: {
|
|
453
|
-
(props: DocsTableProps):
|
|
454
|
+
(props: DocsTableProps): react_jsx_runtime.JSX.Element | null;
|
|
454
455
|
columns: {
|
|
455
456
|
createTitleColumn(options?: {
|
|
456
457
|
hidden?: boolean;
|
|
@@ -462,7 +463,7 @@ declare const DocsTable: {
|
|
|
462
463
|
};
|
|
463
464
|
actions: {
|
|
464
465
|
createCopyDocsUrlAction(copyToClipboard: Function): (row: DocsTableRow) => {
|
|
465
|
-
icon: () =>
|
|
466
|
+
icon: () => react_jsx_runtime.JSX.Element;
|
|
466
467
|
tooltip: string;
|
|
467
468
|
onClick: () => any;
|
|
468
469
|
};
|
|
@@ -470,7 +471,7 @@ declare const DocsTable: {
|
|
|
470
471
|
cellStyle: {
|
|
471
472
|
paddingLeft: string;
|
|
472
473
|
};
|
|
473
|
-
icon: () =>
|
|
474
|
+
icon: () => react_jsx_runtime.JSX.Element;
|
|
474
475
|
tooltip: string;
|
|
475
476
|
onClick: () => any;
|
|
476
477
|
};
|
|
@@ -489,8 +490,8 @@ type TechDocsIndexPageProps = {
|
|
|
489
490
|
ownerPickerMode?: EntityOwnerPickerProps['mode'];
|
|
490
491
|
pagination?: EntityListPagination;
|
|
491
492
|
options?: TableOptions<DocsTableRow>;
|
|
492
|
-
PageWrapper?:
|
|
493
|
-
CustomHeader?:
|
|
493
|
+
PageWrapper?: FC;
|
|
494
|
+
CustomHeader?: FC;
|
|
494
495
|
};
|
|
495
496
|
|
|
496
497
|
/**
|
|
@@ -505,7 +506,7 @@ type DefaultTechDocsHomeProps = TechDocsIndexPageProps;
|
|
|
505
506
|
*
|
|
506
507
|
* @public
|
|
507
508
|
*/
|
|
508
|
-
declare const DefaultTechDocsHome: (props: TechDocsIndexPageProps) =>
|
|
509
|
+
declare const DefaultTechDocsHome: (props: TechDocsIndexPageProps) => react_jsx_runtime.JSX.Element;
|
|
509
510
|
|
|
510
511
|
/**
|
|
511
512
|
* Available panel types
|
|
@@ -522,8 +523,8 @@ interface PanelProps {
|
|
|
522
523
|
options?: TableOptions<DocsTableRow>;
|
|
523
524
|
linkContent?: string | JSX.Element;
|
|
524
525
|
linkDestination?: (entity: Entity) => string | undefined;
|
|
525
|
-
PageWrapper?:
|
|
526
|
-
CustomHeader?:
|
|
526
|
+
PageWrapper?: FC;
|
|
527
|
+
CustomHeader?: FC;
|
|
527
528
|
}
|
|
528
529
|
/**
|
|
529
530
|
* Type representing a TechDocsCustomHome panel.
|
|
@@ -562,7 +563,7 @@ declare const CustomDocsPanel: ({ config, entities, index, }: {
|
|
|
562
563
|
config: PanelConfig;
|
|
563
564
|
entities: Entity[];
|
|
564
565
|
index: number;
|
|
565
|
-
}) =>
|
|
566
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
566
567
|
/**
|
|
567
568
|
* Props for {@link TechDocsCustomHome}
|
|
568
569
|
*
|
|
@@ -571,7 +572,7 @@ declare const CustomDocsPanel: ({ config, entities, index, }: {
|
|
|
571
572
|
type TechDocsCustomHomeProps = {
|
|
572
573
|
tabsConfig: TabsConfig;
|
|
573
574
|
filter?: EntityFilterQuery;
|
|
574
|
-
CustomPageWrapper?:
|
|
575
|
+
CustomPageWrapper?: FC;
|
|
575
576
|
};
|
|
576
577
|
|
|
577
578
|
/**
|
|
@@ -580,9 +581,9 @@ type TechDocsCustomHomeProps = {
|
|
|
580
581
|
* @public
|
|
581
582
|
*/
|
|
582
583
|
type TechDocsPageWrapperProps = {
|
|
583
|
-
children?:
|
|
584
|
-
CustomPageWrapper?:
|
|
585
|
-
children?:
|
|
584
|
+
children?: ReactNode;
|
|
585
|
+
CustomPageWrapper?: FC<{
|
|
586
|
+
children?: ReactNode;
|
|
586
587
|
}>;
|
|
587
588
|
};
|
|
588
589
|
/**
|
|
@@ -590,7 +591,7 @@ type TechDocsPageWrapperProps = {
|
|
|
590
591
|
*
|
|
591
592
|
* @public
|
|
592
593
|
*/
|
|
593
|
-
declare const TechDocsPageWrapper: (props: TechDocsPageWrapperProps) =>
|
|
594
|
+
declare const TechDocsPageWrapper: (props: TechDocsPageWrapperProps) => react_jsx_runtime.JSX.Element;
|
|
594
595
|
|
|
595
596
|
/**
|
|
596
597
|
* Component responsible for updating TechDocs filters
|
|
@@ -634,33 +635,33 @@ declare const techdocsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
634
635
|
*
|
|
635
636
|
* @public
|
|
636
637
|
*/
|
|
637
|
-
declare const TechdocsPage: () =>
|
|
638
|
+
declare const TechdocsPage: () => react_jsx_runtime.JSX.Element;
|
|
638
639
|
/**
|
|
639
640
|
* Routable extension used to render docs on Entity page
|
|
640
641
|
*
|
|
641
642
|
* @public
|
|
642
643
|
*/
|
|
643
|
-
declare const EntityTechdocsContent: ({ children, withSearch, }:
|
|
644
|
+
declare const EntityTechdocsContent: ({ children, withSearch, }: react.PropsWithChildren<{
|
|
644
645
|
withSearch?: boolean;
|
|
645
|
-
}>) =>
|
|
646
|
+
}>) => react_jsx_runtime.JSX.Element;
|
|
646
647
|
/**
|
|
647
648
|
* Component which takes a custom tabs config object and renders a documentation landing page.
|
|
648
649
|
*
|
|
649
650
|
* @public
|
|
650
651
|
*/
|
|
651
|
-
declare const TechDocsCustomHome: (props: TechDocsCustomHomeProps) =>
|
|
652
|
+
declare const TechDocsCustomHome: (props: TechDocsCustomHomeProps) => react_jsx_runtime.JSX.Element;
|
|
652
653
|
/**
|
|
653
654
|
* Responsible for rendering the provided router element
|
|
654
655
|
*
|
|
655
656
|
* @public
|
|
656
657
|
*/
|
|
657
|
-
declare const TechDocsIndexPage: (props: TechDocsIndexPageProps) =>
|
|
658
|
+
declare const TechDocsIndexPage: (props: TechDocsIndexPageProps) => react_jsx_runtime.JSX.Element;
|
|
658
659
|
/**
|
|
659
660
|
* Component responsible for composing a TechDocs reader page experience
|
|
660
661
|
*
|
|
661
662
|
* @public
|
|
662
663
|
*/
|
|
663
|
-
declare const TechDocsReaderPage: (props: TechDocsReaderPageProps) =>
|
|
664
|
+
declare const TechDocsReaderPage: (props: TechDocsReaderPageProps) => react_jsx_runtime.JSX.Element;
|
|
664
665
|
/**
|
|
665
666
|
* React extension used to render results on Search page or modal
|
|
666
667
|
*
|
|
@@ -679,7 +680,7 @@ declare const isTechDocsAvailable: (entity: Entity) => boolean;
|
|
|
679
680
|
*
|
|
680
681
|
* @public
|
|
681
682
|
*/
|
|
682
|
-
declare const Router: () =>
|
|
683
|
+
declare const Router: () => react_jsx_runtime.JSX.Element;
|
|
683
684
|
/**
|
|
684
685
|
* Responsible for registering route to view docs on Entity page
|
|
685
686
|
*
|
|
@@ -687,7 +688,7 @@ declare const Router: () => React__default.JSX.Element;
|
|
|
687
688
|
*/
|
|
688
689
|
declare const LegacyEmbeddedDocsRouter: ({ children, withSearch, }: PropsWithChildren<{
|
|
689
690
|
withSearch?: boolean;
|
|
690
|
-
}>) =>
|
|
691
|
+
}>) => react_jsx_runtime.JSX.Element;
|
|
691
692
|
|
|
692
693
|
/** @public */
|
|
693
694
|
type CatalogReactComponentsNameToClassKey = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { LogViewer } from '@backstage/core-components';
|
|
2
3
|
import Button from '@material-ui/core/Button';
|
|
3
4
|
import Drawer from '@material-ui/core/Drawer';
|
|
@@ -6,7 +7,7 @@ import IconButton from '@material-ui/core/IconButton';
|
|
|
6
7
|
import Typography from '@material-ui/core/Typography';
|
|
7
8
|
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
8
9
|
import Close from '@material-ui/icons/Close';
|
|
9
|
-
import
|
|
10
|
+
import { useState } from 'react';
|
|
10
11
|
|
|
11
12
|
const useDrawerStyles = makeStyles(
|
|
12
13
|
(theme) => createStyles({
|
|
@@ -35,59 +36,66 @@ const TechDocsBuildLogsDrawerContent = ({
|
|
|
35
36
|
}) => {
|
|
36
37
|
const classes = useDrawerStyles();
|
|
37
38
|
const logText = buildLog.length === 0 ? "Waiting for logs..." : buildLog.join("\n");
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
39
40
|
Grid,
|
|
40
41
|
{
|
|
41
42
|
container: true,
|
|
42
43
|
direction: "column",
|
|
43
44
|
className: classes.root,
|
|
44
45
|
spacing: 0,
|
|
45
|
-
wrap: "nowrap"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
46
|
+
wrap: "nowrap",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
Grid,
|
|
50
|
+
{
|
|
51
|
+
item: true,
|
|
52
|
+
container: true,
|
|
53
|
+
justifyContent: "space-between",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
spacing: 0,
|
|
56
|
+
wrap: "nowrap",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Build Details" }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
IconButton,
|
|
61
|
+
{
|
|
62
|
+
title: "Close the drawer",
|
|
63
|
+
onClick: onClose,
|
|
64
|
+
color: "inherit",
|
|
65
|
+
children: /* @__PURE__ */ jsx(Close, {})
|
|
66
|
+
},
|
|
67
|
+
"dismiss"
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(LogViewer, { text: logText, classes: { root: classes.logs } }) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
70
75
|
);
|
|
71
76
|
};
|
|
72
77
|
const TechDocsBuildLogs = ({ buildLog }) => {
|
|
73
78
|
const classes = useDrawerStyles();
|
|
74
79
|
const [open, setOpen] = useState(false);
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
anchor: "right",
|
|
80
|
-
open,
|
|
81
|
-
onClose: () => setOpen(false)
|
|
82
|
-
},
|
|
83
|
-
/* @__PURE__ */ React.createElement(
|
|
84
|
-
TechDocsBuildLogsDrawerContent,
|
|
80
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
+
/* @__PURE__ */ jsx(Button, { color: "inherit", onClick: () => setOpen(true), children: "Show Build Logs" }),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Drawer,
|
|
85
84
|
{
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
classes: { paper: classes.paper },
|
|
86
|
+
anchor: "right",
|
|
87
|
+
open,
|
|
88
|
+
onClose: () => setOpen(false),
|
|
89
|
+
children: /* @__PURE__ */ jsx(
|
|
90
|
+
TechDocsBuildLogsDrawerContent,
|
|
91
|
+
{
|
|
92
|
+
buildLog,
|
|
93
|
+
onClose: () => setOpen(false)
|
|
94
|
+
}
|
|
95
|
+
)
|
|
88
96
|
}
|
|
89
97
|
)
|
|
90
|
-
)
|
|
98
|
+
] });
|
|
91
99
|
};
|
|
92
100
|
|
|
93
101
|
export { TechDocsBuildLogs, TechDocsBuildLogsDrawerContent };
|