@backstage/plugin-techdocs 1.1.0-next.3 → 1.1.1-next.1
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 +114 -0
- package/dist/esm/{TechDocsCustomHome-b1e53b51.esm.js → TechDocsCustomHome-e3ec7aed.esm.js} +2 -3
- package/dist/esm/{TechDocsCustomHome-b1e53b51.esm.js.map → TechDocsCustomHome-e3ec7aed.esm.js.map} +1 -1
- package/dist/esm/{index-fba8389b.esm.js → index-76cc1cd7.esm.js} +57 -29
- package/dist/esm/index-76cc1cd7.esm.js.map +1 -0
- package/dist/esm/{index-7b32409a.esm.js → index-998ae86b.esm.js} +2 -3
- package/dist/esm/index-998ae86b.esm.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.esm.js +1 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -17
- package/dist/esm/index-7b32409a.esm.js.map +0 -1
- package/dist/esm/index-fba8389b.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.1.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 52fddad92d: The `TechDocsStorageApi` and its associated ref are now exported by `@backstage/plugin-techdocs-react`. The API interface, ref, and types are now deprecated in `@backstage/plugin-techdocs` and will be removed in a future release.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/core-components@0.9.4-next.0
|
|
10
|
+
- @backstage/core-plugin-api@1.0.2-next.0
|
|
11
|
+
- @backstage/plugin-catalog-react@1.1.0-next.1
|
|
12
|
+
- @backstage/plugin-search-react@0.2.0-next.1
|
|
13
|
+
- @backstage/plugin-techdocs-react@0.1.1-next.1
|
|
14
|
+
- @backstage/integration-react@1.1.0-next.1
|
|
15
|
+
|
|
16
|
+
## 1.1.1-next.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- a307a14be0: Removed dependency on `@backstage/core-app-api`.
|
|
21
|
+
- bed0d64ce9: Fixed bugs that prevented a 404 error from being shown when it should have been.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/integration@1.2.0-next.0
|
|
24
|
+
- @backstage/plugin-catalog-react@1.1.0-next.0
|
|
25
|
+
- @backstage/integration-react@1.1.0-next.0
|
|
26
|
+
- @backstage/plugin-search-react@0.1.1-next.0
|
|
27
|
+
- @backstage/plugin-techdocs-react@0.1.1-next.0
|
|
28
|
+
|
|
29
|
+
## 1.1.0
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- ace749b785: TechDocs supports a new, experimental method of customization: addons!
|
|
34
|
+
|
|
35
|
+
To customize the standalone TechDocs reader page experience, update your `/packages/app/src/App.tsx` in the following way:
|
|
36
|
+
|
|
37
|
+
```diff
|
|
38
|
+
import { TechDocsIndexPage, TechDocsReaderPage } from '@backstage/plugin-techdocs';
|
|
39
|
+
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
40
|
+
+ import { SomeAddon } from '@backstage/plugin-some-plugin';
|
|
41
|
+
|
|
42
|
+
// ...
|
|
43
|
+
|
|
44
|
+
<Route path="/docs" element={<TechDocsIndexPage />} />
|
|
45
|
+
<Route
|
|
46
|
+
path="/docs/:namespace/:kind/:name/*"
|
|
47
|
+
element={<TechDocsReaderPage />}
|
|
48
|
+
>
|
|
49
|
+
+ <TechDocsAddons>
|
|
50
|
+
+ <SomeAddon />
|
|
51
|
+
+ </TechDocsAddons>
|
|
52
|
+
</Route>
|
|
53
|
+
|
|
54
|
+
// ...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To customize the TechDocs reader experience on the Catalog entity page, update your `packages/app/src/components/catalog/EntityPage.tsx` in the following way:
|
|
58
|
+
|
|
59
|
+
```diff
|
|
60
|
+
import { EntityTechdocsContent } from '@backstage/plugin-techdocs';
|
|
61
|
+
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
62
|
+
+ import { SomeAddon } from '@backstage/plugin-some-plugin';
|
|
63
|
+
|
|
64
|
+
// ...
|
|
65
|
+
|
|
66
|
+
<EntityLayoutWrapper>
|
|
67
|
+
<EntityLayout.Route path="/" title="Overview">
|
|
68
|
+
{overviewContent}
|
|
69
|
+
</EntityLayout.Route>
|
|
70
|
+
|
|
71
|
+
<EntityLayout.Route path="/docs" title="Docs">
|
|
72
|
+
- <EntityTechDocsContent />
|
|
73
|
+
+ <EntityTechdocsContent>
|
|
74
|
+
+ <TechDocsAddons>
|
|
75
|
+
+ <SomeAddon />
|
|
76
|
+
+ </TechDocsAddons>
|
|
77
|
+
+ </EntityTechdocsContent>
|
|
78
|
+
</EntityLayout.Route>
|
|
79
|
+
</EntityLayoutWrapper>
|
|
80
|
+
|
|
81
|
+
// ...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If you do not wish to customize your TechDocs reader experience in this way at this time, no changes are necessary!
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- ab230a433f: imports from `@backstage/plugin-search-react` instead of `@backstage/plugin-search`
|
|
89
|
+
- 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
|
|
90
|
+
- 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
|
|
91
|
+
- 230ad0826f: Bump to using `@types/node` v16
|
|
92
|
+
- f0fb9153b7: Fix broken query selectors on techdocs
|
|
93
|
+
- 9975ff9852: Applied the fix from version 1.0.1 of this package, which is part of the v1.0.2 release of Backstage.
|
|
94
|
+
- 3ba256c389: Fixed a bug preventing custom TechDocs reader page implementations from rendering without being double-wrapped in the `<TechDocsReaderPage />` component.
|
|
95
|
+
- fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
|
|
96
|
+
- 0152c0de22: Some documentation layout tweaks:
|
|
97
|
+
|
|
98
|
+
- drawer toggle margins
|
|
99
|
+
- code block margins
|
|
100
|
+
- sidebar drawer width
|
|
101
|
+
- inner content width
|
|
102
|
+
- footer link width
|
|
103
|
+
- sidebar table of contents scroll
|
|
104
|
+
|
|
105
|
+
- 3ba256c389: Fixed a bug that caused addons in the `Subheader` location to break the default TechDocs reader page layout.
|
|
106
|
+
- Updated dependencies
|
|
107
|
+
- @backstage/integration@1.1.0
|
|
108
|
+
- @backstage/plugin-catalog-react@1.0.1
|
|
109
|
+
- @backstage/catalog-model@1.0.1
|
|
110
|
+
- @backstage/core-app-api@1.0.1
|
|
111
|
+
- @backstage/core-components@0.9.3
|
|
112
|
+
- @backstage/core-plugin-api@1.0.1
|
|
113
|
+
- @backstage/plugin-search-react@0.1.0
|
|
114
|
+
- @backstage/plugin-techdocs-react@0.1.0
|
|
115
|
+
- @backstage/integration-react@1.0.1
|
|
116
|
+
|
|
3
117
|
## 1.1.0-next.3
|
|
4
118
|
|
|
5
119
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import useAsync from 'react-use/lib/useAsync';
|
|
3
3
|
import { makeStyles } from '@material-ui/core';
|
|
4
4
|
import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-
|
|
5
|
+
import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-76cc1cd7.esm.js';
|
|
6
6
|
import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
7
7
|
import { useApi } from '@backstage/core-plugin-api';
|
|
8
8
|
import '@backstage/errors';
|
|
@@ -36,7 +36,6 @@ import 'lodash';
|
|
|
36
36
|
import '@material-ui/icons/Share';
|
|
37
37
|
import '@material-ui/icons/Star';
|
|
38
38
|
import '@material-ui/icons/StarBorder';
|
|
39
|
-
import '@backstage/core-app-api';
|
|
40
39
|
|
|
41
40
|
const panels = {
|
|
42
41
|
DocsTable,
|
|
@@ -133,4 +132,4 @@ const TechDocsCustomHome = (props) => {
|
|
|
133
132
|
};
|
|
134
133
|
|
|
135
134
|
export { TechDocsCustomHome };
|
|
136
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
135
|
+
//# sourceMappingURL=TechDocsCustomHome-e3ec7aed.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-b1e53b51.esm.js.map → TechDocsCustomHome-e3ec7aed.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-e3ec7aed.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/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\nimport { CSSProperties } from '@material-ui/styles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\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}\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\nconst CustomPanel = ({\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 return (\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 <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = 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 'metadata.annotations.backstage.io/techdocs-ref': 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?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\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>\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 <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,MAAM,GAAG;AACf,EAAE,SAAS;AACX,EAAE,YAAY;AACd,CAAC,CAAC;AACF,MAAM,WAAW,GAAG,CAAC;AACrB,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,CAAC,KAAK;AACN,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC;AAC/B,IAAI,cAAc,EAAE;AACpB,MAAM,YAAY,EAAE,MAAM;AAC1B,MAAM,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,GAAG,EAAE;AAC/C,KAAK;AACL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AAC,CAAC;AACR;;;;"}
|
|
@@ -4,7 +4,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
|
4
4
|
import React, { useState, useEffect, useReducer, useRef, useMemo, createContext, useContext, useCallback, Children } from 'react';
|
|
5
5
|
import { useParams, useNavigate as useNavigate$1, useOutlet, Routes, Route } from 'react-router-dom';
|
|
6
6
|
import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
7
|
-
import { useTechDocsReaderPage, useTechDocsAddons, TechDocsAddonLocations, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider } from '@backstage/plugin-techdocs-react';
|
|
7
|
+
import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage, useTechDocsAddons, TechDocsAddonLocations, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider, techdocsApiRef as techdocsApiRef$1 } from '@backstage/plugin-techdocs-react';
|
|
8
8
|
import { create } from 'jss';
|
|
9
9
|
import { makeStyles, ListItemText, ListItem, Divider, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button, Drawer, Grid, Typography, withStyles, Tooltip, ThemeProvider, SvgIcon, useTheme, Portal, Toolbar, Box, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
|
|
10
10
|
import { jssPreset, StylesProvider, withStyles as withStyles$1 } from '@material-ui/styles';
|
|
@@ -35,7 +35,6 @@ import { capitalize } from 'lodash';
|
|
|
35
35
|
import ShareIcon from '@material-ui/icons/Share';
|
|
36
36
|
import Star from '@material-ui/icons/Star';
|
|
37
37
|
import StarBorder from '@material-ui/icons/StarBorder';
|
|
38
|
-
import { FlatRoutes } from '@backstage/core-app-api';
|
|
39
38
|
|
|
40
39
|
const techdocsStorageApiRef = createApiRef({
|
|
41
40
|
id: "plugin.techdocs.storageservice"
|
|
@@ -154,7 +153,7 @@ class TechDocsStorageClient {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
|
|
157
|
-
const useStyles$
|
|
156
|
+
const useStyles$4 = makeStyles({
|
|
158
157
|
flexContainer: {
|
|
159
158
|
flexWrap: "wrap"
|
|
160
159
|
},
|
|
@@ -171,7 +170,7 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
171
170
|
asLink = true,
|
|
172
171
|
title
|
|
173
172
|
} = props;
|
|
174
|
-
const classes = useStyles$
|
|
173
|
+
const classes = useStyles$4();
|
|
175
174
|
const TextItem = () => {
|
|
176
175
|
var _a;
|
|
177
176
|
return /* @__PURE__ */ React.createElement(ListItemText, {
|
|
@@ -198,7 +197,7 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
198
197
|
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
199
198
|
};
|
|
200
199
|
|
|
201
|
-
const useStyles$
|
|
200
|
+
const useStyles$3 = makeStyles({
|
|
202
201
|
root: {
|
|
203
202
|
width: "100%"
|
|
204
203
|
}
|
|
@@ -213,7 +212,7 @@ const TechDocsSearchBar = (props) => {
|
|
|
213
212
|
setFilters,
|
|
214
213
|
result: { loading, value: searchVal }
|
|
215
214
|
} = useSearch();
|
|
216
|
-
const classes = useStyles$
|
|
215
|
+
const classes = useStyles$3();
|
|
217
216
|
const [options, setOptions] = useState([]);
|
|
218
217
|
useEffect(() => {
|
|
219
218
|
let mounted = true;
|
|
@@ -396,7 +395,7 @@ const TechDocsNotFound = ({ errorMessage }) => {
|
|
|
396
395
|
});
|
|
397
396
|
};
|
|
398
397
|
|
|
399
|
-
const useStyles$
|
|
398
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
400
399
|
root: {
|
|
401
400
|
marginBottom: theme.spacing(2)
|
|
402
401
|
},
|
|
@@ -407,7 +406,7 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
407
406
|
}));
|
|
408
407
|
const TechDocsStateIndicator = () => {
|
|
409
408
|
let StateAlert = null;
|
|
410
|
-
const classes = useStyles$
|
|
409
|
+
const classes = useStyles$2();
|
|
411
410
|
const {
|
|
412
411
|
state,
|
|
413
412
|
contentReload,
|
|
@@ -551,7 +550,7 @@ function useReaderState(kind, namespace, name, path) {
|
|
|
551
550
|
contentLoading: true,
|
|
552
551
|
buildLog: []
|
|
553
552
|
});
|
|
554
|
-
const techdocsStorageApi = useApi(techdocsStorageApiRef);
|
|
553
|
+
const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
|
|
555
554
|
const { retry: contentReload } = useAsyncRetry(async () => {
|
|
556
555
|
dispatch({ type: "contentLoading" });
|
|
557
556
|
try {
|
|
@@ -688,6 +687,7 @@ const addBaseUrl = ({
|
|
|
688
687
|
|
|
689
688
|
const addGitFeedbackLink = (scmIntegrationsApi) => {
|
|
690
689
|
return (dom) => {
|
|
690
|
+
var _a;
|
|
691
691
|
const sourceAnchor = dom.querySelector('[title="Edit this page"]');
|
|
692
692
|
if (!sourceAnchor || !sourceAnchor.href) {
|
|
693
693
|
return dom;
|
|
@@ -697,7 +697,7 @@ const addGitFeedbackLink = (scmIntegrationsApi) => {
|
|
|
697
697
|
if ((integration == null ? void 0 : integration.type) !== "github" && (integration == null ? void 0 : integration.type) !== "gitlab") {
|
|
698
698
|
return dom;
|
|
699
699
|
}
|
|
700
|
-
const title = dom.querySelector("article>h1").childNodes[0].textContent;
|
|
700
|
+
const title = ((_a = dom.querySelector("article>h1")) == null ? void 0 : _a.childNodes[0].textContent) || "";
|
|
701
701
|
const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
|
|
702
702
|
const issueDesc = encodeURIComponent(`Page source:
|
|
703
703
|
${sourceAnchor.href}
|
|
@@ -983,7 +983,7 @@ const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
|
983
983
|
const useTechDocsReaderDom = (entityRef) => {
|
|
984
984
|
const navigate = useNavigate$1();
|
|
985
985
|
const theme = useTheme();
|
|
986
|
-
const techdocsStorageApi = useApi(techdocsStorageApiRef);
|
|
986
|
+
const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
|
|
987
987
|
const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
|
|
988
988
|
const techdocsSanitizer = useApi(configApiRef);
|
|
989
989
|
const { namespace, kind, name } = entityRef;
|
|
@@ -1591,7 +1591,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1591
1591
|
return dom;
|
|
1592
1592
|
};
|
|
1593
1593
|
|
|
1594
|
-
const useStyles = makeStyles({
|
|
1594
|
+
const useStyles$1 = makeStyles({
|
|
1595
1595
|
search: {
|
|
1596
1596
|
width: "100%",
|
|
1597
1597
|
"@media (min-width: 76.1875em)": {
|
|
@@ -1602,9 +1602,14 @@ const useStyles = makeStyles({
|
|
|
1602
1602
|
});
|
|
1603
1603
|
const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
|
|
1604
1604
|
const { withSearch = true, onReady } = props;
|
|
1605
|
-
const classes = useStyles();
|
|
1605
|
+
const classes = useStyles$1();
|
|
1606
1606
|
const addons = useTechDocsAddons();
|
|
1607
|
-
const {
|
|
1607
|
+
const {
|
|
1608
|
+
entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
|
|
1609
|
+
entityRef,
|
|
1610
|
+
shadowRoot,
|
|
1611
|
+
setShadowRoot
|
|
1612
|
+
} = useTechDocsReaderPage();
|
|
1608
1613
|
const dom = useTechDocsReaderDom(entityRef);
|
|
1609
1614
|
const [jss, setJss] = useState(create({
|
|
1610
1615
|
...jssPreset(),
|
|
@@ -1633,8 +1638,18 @@ const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
|
|
|
1633
1638
|
primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
|
|
1634
1639
|
const secondarySidebarAddonLocation = document.createElement("div");
|
|
1635
1640
|
secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
|
|
1641
|
+
if (entityMetadataLoading === false && !entityMetadata)
|
|
1642
|
+
return /* @__PURE__ */ React.createElement(ErrorPage, {
|
|
1643
|
+
status: "404",
|
|
1644
|
+
statusMessage: "PAGE NOT FOUND"
|
|
1645
|
+
});
|
|
1636
1646
|
if (!dom) {
|
|
1637
|
-
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(
|
|
1647
|
+
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
1648
|
+
container: true
|
|
1649
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
1650
|
+
xs: 12,
|
|
1651
|
+
item: true
|
|
1652
|
+
}, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
|
|
1638
1653
|
}
|
|
1639
1654
|
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
1640
1655
|
container: true
|
|
@@ -1692,8 +1707,8 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1692
1707
|
subtitle,
|
|
1693
1708
|
setSubtitle,
|
|
1694
1709
|
entityRef,
|
|
1695
|
-
metadata: { value: metadata },
|
|
1696
|
-
entityMetadata: { value: entityMetadata }
|
|
1710
|
+
metadata: { value: metadata, loading: metadataLoading },
|
|
1711
|
+
entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
|
|
1697
1712
|
} = useTechDocsReaderPage();
|
|
1698
1713
|
useEffect(() => {
|
|
1699
1714
|
if (!metadata)
|
|
@@ -1743,6 +1758,10 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1743
1758
|
style: { marginTop: "-25px", fill: "#fff" }
|
|
1744
1759
|
}))
|
|
1745
1760
|
}) : null);
|
|
1761
|
+
const noEntMetadata = !entityMetadataLoading && entityMetadata === void 0;
|
|
1762
|
+
const noTdMetadata = !metadataLoading && metadata === void 0;
|
|
1763
|
+
if (noEntMetadata || noTdMetadata)
|
|
1764
|
+
return null;
|
|
1746
1765
|
return /* @__PURE__ */ React.createElement(Header, {
|
|
1747
1766
|
type: "Documentation",
|
|
1748
1767
|
typeLink: docsRootLink,
|
|
@@ -1753,19 +1772,29 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1753
1772
|
}, /* @__PURE__ */ React.createElement("title", null, tabTitle)), labels, children, addons.renderComponentsByLocation(TechDocsAddonLocations.Header));
|
|
1754
1773
|
};
|
|
1755
1774
|
|
|
1756
|
-
const
|
|
1775
|
+
const useStyles = makeStyles((theme) => ({
|
|
1757
1776
|
root: {
|
|
1758
1777
|
gridArea: "pageSubheader",
|
|
1759
1778
|
flexDirection: "column",
|
|
1760
1779
|
minHeight: "auto",
|
|
1761
1780
|
padding: theme.spacing(3, 3, 0)
|
|
1762
1781
|
}
|
|
1763
|
-
}))
|
|
1782
|
+
}));
|
|
1783
|
+
const TechDocsReaderPageSubheader = ({
|
|
1784
|
+
toolbarProps
|
|
1785
|
+
}) => {
|
|
1786
|
+
const classes = useStyles();
|
|
1787
|
+
const {
|
|
1788
|
+
entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
|
|
1789
|
+
} = useTechDocsReaderPage();
|
|
1764
1790
|
const addons = useTechDocsAddons();
|
|
1765
1791
|
const subheaderAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Subheader);
|
|
1766
1792
|
if (!subheaderAddons)
|
|
1767
1793
|
return null;
|
|
1794
|
+
if (entityMetadataLoading === false && !entityMetadata)
|
|
1795
|
+
return null;
|
|
1768
1796
|
return /* @__PURE__ */ React.createElement(Toolbar, {
|
|
1797
|
+
classes,
|
|
1769
1798
|
...toolbarProps
|
|
1770
1799
|
}, subheaderAddons && /* @__PURE__ */ React.createElement(Box, {
|
|
1771
1800
|
display: "flex",
|
|
@@ -1773,7 +1802,7 @@ const TechDocsReaderPageSubheader = withStyles((theme) => ({
|
|
|
1773
1802
|
width: "100%",
|
|
1774
1803
|
flexWrap: "wrap"
|
|
1775
1804
|
}, subheaderAddons));
|
|
1776
|
-
}
|
|
1805
|
+
};
|
|
1777
1806
|
|
|
1778
1807
|
const TechDocsReaderLayout = ({
|
|
1779
1808
|
withSearch,
|
|
@@ -1796,9 +1825,9 @@ const TechDocsReaderPage$1 = (props) => {
|
|
|
1796
1825
|
const { type } = child;
|
|
1797
1826
|
return !((_b = (_a = type == null ? void 0 : type.__backstage_data) == null ? void 0 : _a.map) == null ? void 0 : _b.get(TECHDOCS_ADDONS_WRAPPER_KEY));
|
|
1798
1827
|
});
|
|
1799
|
-
return
|
|
1828
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, {
|
|
1800
1829
|
entityRef
|
|
1801
|
-
}, /* @__PURE__ */ React.createElement(TechDocsReaderLayout, null));
|
|
1830
|
+
}, page || /* @__PURE__ */ React.createElement(TechDocsReaderLayout, null));
|
|
1802
1831
|
}
|
|
1803
1832
|
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, {
|
|
1804
1833
|
entityRef
|
|
@@ -2063,7 +2092,7 @@ const techdocsPlugin = createPlugin({
|
|
|
2063
2092
|
id: "techdocs",
|
|
2064
2093
|
apis: [
|
|
2065
2094
|
createApiFactory({
|
|
2066
|
-
api: techdocsStorageApiRef,
|
|
2095
|
+
api: techdocsStorageApiRef$1,
|
|
2067
2096
|
deps: {
|
|
2068
2097
|
configApi: configApiRef,
|
|
2069
2098
|
discoveryApi: discoveryApiRef,
|
|
@@ -2078,7 +2107,7 @@ const techdocsPlugin = createPlugin({
|
|
|
2078
2107
|
})
|
|
2079
2108
|
}),
|
|
2080
2109
|
createApiFactory({
|
|
2081
|
-
api: techdocsApiRef,
|
|
2110
|
+
api: techdocsApiRef$1,
|
|
2082
2111
|
deps: {
|
|
2083
2112
|
configApi: configApiRef,
|
|
2084
2113
|
discoveryApi: discoveryApiRef,
|
|
@@ -2109,7 +2138,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2109
2138
|
}));
|
|
2110
2139
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2111
2140
|
name: "TechDocsCustomHome",
|
|
2112
|
-
component: () => import('./TechDocsCustomHome-
|
|
2141
|
+
component: () => import('./TechDocsCustomHome-e3ec7aed.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2113
2142
|
mountPoint: rootRouteRef
|
|
2114
2143
|
}));
|
|
2115
2144
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2119,7 +2148,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2119
2148
|
}));
|
|
2120
2149
|
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2121
2150
|
name: "TechDocsReaderPage",
|
|
2122
|
-
component: () => import('./index-
|
|
2151
|
+
component: () => import('./index-998ae86b.esm.js').then((m) => m.TechDocsReaderPage),
|
|
2123
2152
|
mountPoint: rootDocsRouteRef
|
|
2124
2153
|
}));
|
|
2125
2154
|
|
|
@@ -2166,8 +2195,7 @@ const EmbeddedDocsRouter = (props) => {
|
|
|
2166
2195
|
annotation: TECHDOCS_ANNOTATION
|
|
2167
2196
|
});
|
|
2168
2197
|
}
|
|
2169
|
-
return /* @__PURE__ */ React.createElement(
|
|
2170
|
-
path: "/*",
|
|
2198
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
2171
2199
|
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
2172
2200
|
entity
|
|
2173
2201
|
})
|
|
@@ -2182,4 +2210,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2182
2210
|
});
|
|
2183
2211
|
|
|
2184
2212
|
export { isTechDocsAvailable as A, Router as B, EmbeddedDocsRouter as C, DocsTable as D, EntityTechdocsContent as E, Reader as R, TechDocsPageWrapper as T, DocsCardGrid as a, TechDocsReaderPage$1 as b, TechDocsReaderLayout as c, TechDocsCustomHome as d, TechDocsIndexPage$2 as e, TechdocsPage as f, TechDocsReaderPage as g, techdocsStorageApiRef as h, techdocsApiRef as i, TechDocsClient as j, TechDocsStorageClient as k, TechDocsReaderPageHeader as l, TechDocsReaderPageContent as m, TechDocsReaderProvider as n, useTechDocsReaderDom as o, TechDocsReaderPageSubheader as p, TechDocsStateIndicator as q, TechDocsSearchResultListItem as r, TechDocsSearch as s, techdocsPlugin as t, useTechDocsReader as u, EntityListDocsGrid as v, withTechDocsReaderProvider as w, EntityListDocsTable as x, DefaultTechDocsHome as y, TechDocsPicker as z };
|
|
2185
|
-
//# sourceMappingURL=index-
|
|
2213
|
+
//# sourceMappingURL=index-76cc1cd7.esm.js.map
|