@backstage/plugin-techdocs 0.0.0-nightly-20220315022536 → 0.0.0-nightly-20220316022902
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 +27 -9
- package/config.d.ts +0 -7
- package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js → TechDocsCustomHome-9a692794.esm.js} +1 -1
- package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js.map → TechDocsCustomHome-9a692794.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -32
- package/dist/index.esm.js +66 -96
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20220316022902
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 700d93ff41: Removed deprecated exports, including:
|
|
12
|
+
|
|
13
|
+
- deprecated `DocsResultListItem` is now deleted and fully replaced with `TechDocsSearchResultListItem`
|
|
14
|
+
- deprecated `TechDocsPage` is now deleted and fully replaced with `TechDocsReaderPage`
|
|
15
|
+
- deprecated `TechDocsPageHeader` is now deleted and fully replaced with `TechDocsReaderPageHeader`
|
|
16
|
+
- deprecated `TechDocsPageHeaderProps` is now deleted and fully replaced with `TechDocsReaderPageHeaderProps`
|
|
17
|
+
- deprecated `TechDocsPageRenderFunction` is now deleted and fully replaced with `TechDocsReaderPageRenderFunction`
|
|
18
|
+
- deprecated config `techdocs.requestUrl` is now deleted and fully replaced with the discoveryApi
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
6
21
|
|
|
7
22
|
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
23
|
+
- f24ef7864e: Minor typo fixes
|
|
8
24
|
- 06af9e8d17: Long sidebars will no longer overflow the footer and will properly show a scrollbar when needed.
|
|
9
25
|
- Updated dependencies
|
|
10
|
-
- @backstage/core-components@0.0.0-nightly-
|
|
11
|
-
- @backstage/core-plugin-api@0.0.0-nightly-
|
|
12
|
-
- @backstage/integration-react@0.0.0-nightly-
|
|
13
|
-
- @backstage/plugin-catalog-react@0.0.0-nightly-
|
|
14
|
-
- @backstage/plugin-catalog@0.0.0-nightly-
|
|
15
|
-
- @backstage/plugin-search@0.0.0-nightly-
|
|
16
|
-
- @backstage/catalog-model@0.0.0-nightly-
|
|
17
|
-
- @backstage/integration@0.0.0-nightly-
|
|
26
|
+
- @backstage/core-components@0.0.0-nightly-20220316022902
|
|
27
|
+
- @backstage/core-plugin-api@0.0.0-nightly-20220316022902
|
|
28
|
+
- @backstage/integration-react@0.0.0-nightly-20220316022902
|
|
29
|
+
- @backstage/plugin-catalog-react@0.0.0-nightly-20220316022902
|
|
30
|
+
- @backstage/plugin-catalog@0.0.0-nightly-20220316022902
|
|
31
|
+
- @backstage/plugin-search@0.0.0-nightly-20220316022902
|
|
32
|
+
- @backstage/catalog-model@0.0.0-nightly-20220316022902
|
|
33
|
+
- @backstage/integration@0.0.0-nightly-20220316022902
|
|
34
|
+
- @backstage/config@0.0.0-nightly-20220316022902
|
|
35
|
+
- @backstage/errors@0.0.0-nightly-20220316022902
|
|
18
36
|
|
|
19
37
|
## 0.15.1
|
|
20
38
|
|
package/config.d.ts
CHANGED
|
@@ -33,13 +33,6 @@ export interface Config {
|
|
|
33
33
|
*/
|
|
34
34
|
legacyUseCaseSensitiveTripletPaths?: boolean;
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* @example http://localhost:7007/api/techdocs
|
|
38
|
-
* @visibility frontend
|
|
39
|
-
* @deprecated
|
|
40
|
-
*/
|
|
41
|
-
requestUrl?: string;
|
|
42
|
-
|
|
43
36
|
sanitizer?: {
|
|
44
37
|
/**
|
|
45
38
|
* Allows iframe tag only for listed hosts
|
package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js.map → TechDocsCustomHome-9a692794.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-9a692794.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AAAA,CAAA,CAAA;AAwCF,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,CAKI,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACV,GAAA,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,QAAW,GAAA,EAAA;AAAA,KAAA;AAAA,GAAA,CAAA,CAAA;AAG5C,EAAA,MAAM,OAAU,GAAA,SAAA,EAAA,CAAA;AAChB,EAAM,MAAA,EAAE,OAAS,EAAA,gBAAA,EAAkB,aAAkB,EAAA,GAAA,kBAAA,EAAA,CAAA;AAErD,EAAM,MAAA,KAAA,GAAQ,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AA,aAAA,CAAC,UAAD,EAAA;AAAA,IACE,aAAe,EAAA,WAAA;AAAA,IACf,QAAA,EAAU,WAAS,cAAe,CAAA,KAAA,CAAA;AAAA,IAClC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,SAAS,KAAW,MAAA;AAAA,MAC1C,IAAI,KAAM,CAAA,QAAA,EAAA;AAAA,MACV,KAAA;AAAA,KAAA,CAAA,CAAA;AAAA,GAAA,CAAA,sCAGH,OAAD,EAAA;AAAA,IAAS,aAAY,EAAA,kBAAA;AAAA,GAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAQ,EAAA,KAAA,yCACnC,WAAD,EAAA;AAAA,IACE,GAAK,EAAA,KAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,QAAW,GAAA,EAAA;AAAA,IAClC,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -53,9 +53,6 @@ declare type SyncResult = 'cached' | 'updated';
|
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
55
|
interface TechDocsStorageApi {
|
|
56
|
-
/**
|
|
57
|
-
* Set to techdocs.requestUrl as the URL for techdocs-backend API.
|
|
58
|
-
*/
|
|
59
56
|
getApiOrigin(): Promise<string>;
|
|
60
57
|
getStorageUrl(): Promise<string>;
|
|
61
58
|
getBuilder(): Promise<string>;
|
|
@@ -69,9 +66,6 @@ interface TechDocsStorageApi {
|
|
|
69
66
|
* @public
|
|
70
67
|
*/
|
|
71
68
|
interface TechDocsApi {
|
|
72
|
-
/**
|
|
73
|
-
* Set to techdocs.requestUrl as the URL for techdocs-backend API.
|
|
74
|
-
*/
|
|
75
69
|
getApiOrigin(): Promise<string>;
|
|
76
70
|
getTechDocsMetadata(entityId: CompoundEntityRef): Promise<TechDocsMetadata>;
|
|
77
71
|
getEntityMetadata(entityId: CompoundEntityRef): Promise<TechDocsEntityMetadata>;
|
|
@@ -188,16 +182,6 @@ declare type TechDocsReaderPageRenderFunction = ({ techdocsMetadataValue, entity
|
|
|
188
182
|
declare type TechDocsReaderPageProps = {
|
|
189
183
|
children?: TechDocsReaderPageRenderFunction | React.ReactNode;
|
|
190
184
|
};
|
|
191
|
-
/**
|
|
192
|
-
* @public
|
|
193
|
-
* @deprecated use {@link TechDocsReaderPage} instead
|
|
194
|
-
*/
|
|
195
|
-
declare const TechDocsPage: (props: TechDocsReaderPageProps) => JSX.Element;
|
|
196
|
-
/**
|
|
197
|
-
* @public
|
|
198
|
-
* @deprecated use {@link TechDocsReaderPageRenderFunction} instead
|
|
199
|
-
*/
|
|
200
|
-
declare type TechDocsPageRenderFunction = TechDocsReaderPageRenderFunction;
|
|
201
185
|
|
|
202
186
|
/**
|
|
203
187
|
* Props for {@link TechDocsReaderPageHeader}
|
|
@@ -215,16 +199,6 @@ declare type TechDocsReaderPageHeaderProps = PropsWithChildren<{
|
|
|
215
199
|
* @public
|
|
216
200
|
*/
|
|
217
201
|
declare const TechDocsReaderPageHeader: (props: TechDocsReaderPageHeaderProps) => JSX.Element;
|
|
218
|
-
/**
|
|
219
|
-
* @public
|
|
220
|
-
* @deprecated use {@link TechDocsReaderPageHeader} instead
|
|
221
|
-
*/
|
|
222
|
-
declare const TechDocsPageHeader: (props: TechDocsReaderPageHeaderProps) => JSX.Element;
|
|
223
|
-
/**
|
|
224
|
-
* @public
|
|
225
|
-
* @deprecated use {@link TechDocsReaderPageHeader} instead
|
|
226
|
-
*/
|
|
227
|
-
declare type TechDocsPageHeaderProps = TechDocsReaderPageHeaderProps;
|
|
228
202
|
|
|
229
203
|
/**
|
|
230
204
|
* Props for {@link TechDocsSearchResultListItem}.
|
|
@@ -244,11 +218,6 @@ declare type TechDocsSearchResultListItemProps = {
|
|
|
244
218
|
* @public
|
|
245
219
|
*/
|
|
246
220
|
declare const TechDocsSearchResultListItem: (props: TechDocsSearchResultListItemProps) => JSX.Element;
|
|
247
|
-
/**
|
|
248
|
-
* @public
|
|
249
|
-
* @deprecated use {@link TechDocsSearchResultListItem} instead
|
|
250
|
-
*/
|
|
251
|
-
declare const DocsResultListItem: (props: TechDocsSearchResultListItemProps) => JSX.Element;
|
|
252
221
|
|
|
253
222
|
/**
|
|
254
223
|
* Props for {@link TechDocsSearch}
|
|
@@ -526,4 +495,4 @@ declare const Router: () => JSX.Element;
|
|
|
526
495
|
*/
|
|
527
496
|
declare const EmbeddedDocsRouter: () => JSX.Element;
|
|
528
497
|
|
|
529
|
-
export { DefaultTechDocsHome, DefaultTechDocsHomeProps, DocsCardGrid, DocsCardGridProps,
|
|
498
|
+
export { DefaultTechDocsHome, DefaultTechDocsHomeProps, DocsCardGrid, DocsCardGridProps, DocsTable, DocsTableProps, DocsTableRow, EmbeddedDocsRouter, EntityListDocsGrid, EntityListDocsTable, EntityListDocsTableProps, EntityTechdocsContent, PanelConfig, PanelType, Reader, ReaderProps, Router, SyncResult, TabConfig, TabsConfig, TechDocsApi, TechDocsClient, TechDocsCustomHome, TechDocsCustomHomeProps, TechDocsEntityMetadata, TechDocsIndexPage, TechDocsMetadata, TechDocsPageWrapper, TechDocsPageWrapperProps, TechDocsPicker, TechDocsReaderPage, TechDocsReaderPageHeader, TechDocsReaderPageHeaderProps, TechDocsReaderPageProps, TechDocsReaderPageRenderFunction, TechDocsSearch, TechDocsSearchProps, TechDocsSearchResultListItem, TechDocsSearchResultListItemProps, TechDocsStorageApi, TechDocsStorageClient, TechdocsPage, isTechDocsAvailable, techdocsPlugin as plugin, techdocsApiRef, techdocsPlugin, techdocsStorageApiRef };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createApiRef, useApi, configApiRef, createRouteRef, useRouteRef,
|
|
1
|
+
import { createApiRef, useApi, configApiRef, createRouteRef, useRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension, useApp } from '@backstage/core-plugin-api';
|
|
2
2
|
import { ResponseError, NotFoundError } from '@backstage/errors';
|
|
3
3
|
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
4
4
|
import React, { useState, useCallback, useEffect, useReducer, useRef, useMemo, createContext, useContext } from 'react';
|
|
5
5
|
import { useNavigate as useNavigate$1, useParams, Routes, Route } from 'react-router-dom';
|
|
6
6
|
import { withStyles, Tooltip, ThemeProvider, SvgIcon, makeStyles, ListItemText, ListItem, Divider, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button, Drawer, Grid, Typography, useTheme, lighten, alpha, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
|
|
7
7
|
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
8
|
-
import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, HeaderLabel, Header,
|
|
8
|
+
import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, HeaderLabel, Header, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, SubvalueCell, Table, EmptyState, PageWithHeader, Content, ContentHeader, SupportButton, Page, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
9
9
|
import { replaceGitHubUrlType } from '@backstage/integration';
|
|
10
10
|
import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
|
|
11
11
|
import ReactDOM from 'react-dom';
|
|
@@ -47,8 +47,7 @@ class TechDocsClient {
|
|
|
47
47
|
this.fetchApi = options.fetchApi;
|
|
48
48
|
}
|
|
49
49
|
async getApiOrigin() {
|
|
50
|
-
|
|
51
|
-
return (_a = this.configApi.getOptionalString("techdocs.requestUrl")) != null ? _a : await this.discoveryApi.getBaseUrl("techdocs");
|
|
50
|
+
return await this.discoveryApi.getBaseUrl("techdocs");
|
|
52
51
|
}
|
|
53
52
|
async getTechDocsMetadata(entityId) {
|
|
54
53
|
const { kind, namespace, name } = entityId;
|
|
@@ -79,8 +78,7 @@ class TechDocsStorageClient {
|
|
|
79
78
|
this.fetchApi = options.fetchApi;
|
|
80
79
|
}
|
|
81
80
|
async getApiOrigin() {
|
|
82
|
-
|
|
83
|
-
return (_a = this.configApi.getOptionalString("techdocs.requestUrl")) != null ? _a : await this.discoveryApi.getBaseUrl("techdocs");
|
|
81
|
+
return await this.discoveryApi.getBaseUrl("techdocs");
|
|
84
82
|
}
|
|
85
83
|
async getStorageUrl() {
|
|
86
84
|
var _a;
|
|
@@ -532,7 +530,6 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
532
530
|
})) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
533
531
|
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
534
532
|
};
|
|
535
|
-
const DocsResultListItem = TechDocsSearchResultListItem;
|
|
536
533
|
|
|
537
534
|
const useStyles$2 = makeStyles({
|
|
538
535
|
root: {
|
|
@@ -1701,90 +1698,6 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1701
1698
|
typeLink: docsRootLink
|
|
1702
1699
|
}, labels, children);
|
|
1703
1700
|
};
|
|
1704
|
-
const TechDocsPageHeader = TechDocsReaderPageHeader;
|
|
1705
|
-
|
|
1706
|
-
const LegacyTechDocsPage = () => {
|
|
1707
|
-
const [documentReady, setDocumentReady] = useState(false);
|
|
1708
|
-
const { namespace, kind, name } = useParams();
|
|
1709
|
-
const techdocsApi = useApi(techdocsApiRef);
|
|
1710
|
-
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
1711
|
-
if (documentReady) {
|
|
1712
|
-
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
1713
|
-
}
|
|
1714
|
-
return Promise.resolve(void 0);
|
|
1715
|
-
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
1716
|
-
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
1717
|
-
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
1718
|
-
}, [kind, namespace, name, techdocsApi]);
|
|
1719
|
-
const onReady = useCallback(() => {
|
|
1720
|
-
setDocumentReady(true);
|
|
1721
|
-
}, [setDocumentReady]);
|
|
1722
|
-
if (entityMetadataError) {
|
|
1723
|
-
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1724
|
-
errorMessage: entityMetadataError.message
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
return /* @__PURE__ */ React.createElement(Page, {
|
|
1728
|
-
themeId: "documentation"
|
|
1729
|
-
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, {
|
|
1730
|
-
techDocsMetadata: techdocsMetadataValue,
|
|
1731
|
-
entityMetadata: entityMetadataValue,
|
|
1732
|
-
entityRef: {
|
|
1733
|
-
kind,
|
|
1734
|
-
namespace,
|
|
1735
|
-
name
|
|
1736
|
-
}
|
|
1737
|
-
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1738
|
-
"data-testid": "techdocs-content"
|
|
1739
|
-
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
1740
|
-
onReady,
|
|
1741
|
-
entityRef: {
|
|
1742
|
-
kind,
|
|
1743
|
-
namespace,
|
|
1744
|
-
name
|
|
1745
|
-
}
|
|
1746
|
-
})));
|
|
1747
|
-
};
|
|
1748
|
-
|
|
1749
|
-
const TechDocsReaderPage$1 = (props) => {
|
|
1750
|
-
const { children } = props;
|
|
1751
|
-
const { NotFoundErrorPage } = useApp().getComponents();
|
|
1752
|
-
const outlet = useOutlet();
|
|
1753
|
-
const [documentReady, setDocumentReady] = useState(false);
|
|
1754
|
-
const { namespace, kind, name } = useParams();
|
|
1755
|
-
const techdocsApi = useApi(techdocsApiRef);
|
|
1756
|
-
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
1757
|
-
if (documentReady) {
|
|
1758
|
-
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
1759
|
-
}
|
|
1760
|
-
return Promise.resolve(void 0);
|
|
1761
|
-
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
1762
|
-
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
1763
|
-
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
1764
|
-
}, [kind, namespace, name, techdocsApi]);
|
|
1765
|
-
const onReady = useCallback(() => {
|
|
1766
|
-
setDocumentReady(true);
|
|
1767
|
-
}, [setDocumentReady]);
|
|
1768
|
-
if (entityMetadataError)
|
|
1769
|
-
return /* @__PURE__ */ React.createElement(NotFoundErrorPage, null);
|
|
1770
|
-
if (!children)
|
|
1771
|
-
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsPage, null);
|
|
1772
|
-
return /* @__PURE__ */ React.createElement(Page, {
|
|
1773
|
-
themeId: "documentation"
|
|
1774
|
-
}, children instanceof Function ? children({
|
|
1775
|
-
techdocsMetadataValue,
|
|
1776
|
-
entityMetadataValue,
|
|
1777
|
-
entityRef: { kind, namespace, name },
|
|
1778
|
-
onReady
|
|
1779
|
-
}) : children);
|
|
1780
|
-
};
|
|
1781
|
-
const TechDocsPage = TechDocsReaderPage$1;
|
|
1782
|
-
|
|
1783
|
-
var TechDocsReaderPage$2 = /*#__PURE__*/Object.freeze({
|
|
1784
|
-
__proto__: null,
|
|
1785
|
-
TechDocsReaderPage: TechDocsReaderPage$1,
|
|
1786
|
-
TechDocsPage: TechDocsPage
|
|
1787
|
-
});
|
|
1788
1701
|
|
|
1789
1702
|
function toLowerMaybe(str, config) {
|
|
1790
1703
|
return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
|
|
@@ -2083,7 +1996,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2083
1996
|
}));
|
|
2084
1997
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2085
1998
|
name: "TechDocsCustomHome",
|
|
2086
|
-
component: () => import('./esm/TechDocsCustomHome-
|
|
1999
|
+
component: () => import('./esm/TechDocsCustomHome-9a692794.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2087
2000
|
mountPoint: rootRouteRef
|
|
2088
2001
|
}));
|
|
2089
2002
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2091,9 +2004,9 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2091
2004
|
component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then((m) => m.TechDocsIndexPage),
|
|
2092
2005
|
mountPoint: rootRouteRef
|
|
2093
2006
|
}));
|
|
2094
|
-
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2007
|
+
const TechDocsReaderPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
2095
2008
|
name: "TechDocsReaderPage",
|
|
2096
|
-
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$
|
|
2009
|
+
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$1; }).then((m) => m.TechDocsReaderPage),
|
|
2097
2010
|
mountPoint: rootDocsRouteRef
|
|
2098
2011
|
}));
|
|
2099
2012
|
|
|
@@ -2107,6 +2020,63 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
2107
2020
|
TechDocsIndexPage: TechDocsIndexPage
|
|
2108
2021
|
});
|
|
2109
2022
|
|
|
2023
|
+
const TechDocsReaderPage = (props) => {
|
|
2024
|
+
const { children } = props;
|
|
2025
|
+
const { NotFoundErrorPage } = useApp().getComponents();
|
|
2026
|
+
const outlet = useOutlet();
|
|
2027
|
+
const [documentReady, setDocumentReady] = useState(false);
|
|
2028
|
+
const { namespace, kind, name } = useParams();
|
|
2029
|
+
const techdocsApi = useApi(techdocsApiRef);
|
|
2030
|
+
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
2031
|
+
if (documentReady) {
|
|
2032
|
+
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
2033
|
+
}
|
|
2034
|
+
return Promise.resolve(void 0);
|
|
2035
|
+
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
2036
|
+
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
2037
|
+
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
2038
|
+
}, [kind, namespace, name, techdocsApi]);
|
|
2039
|
+
const onReady = useCallback(() => {
|
|
2040
|
+
setDocumentReady(true);
|
|
2041
|
+
}, [setDocumentReady]);
|
|
2042
|
+
if (entityMetadataError)
|
|
2043
|
+
return /* @__PURE__ */ React.createElement(NotFoundErrorPage, null);
|
|
2044
|
+
if (!children)
|
|
2045
|
+
return outlet || /* @__PURE__ */ React.createElement(Page, {
|
|
2046
|
+
themeId: "documentation"
|
|
2047
|
+
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, {
|
|
2048
|
+
techDocsMetadata: techdocsMetadataValue,
|
|
2049
|
+
entityMetadata: entityMetadataValue,
|
|
2050
|
+
entityRef: {
|
|
2051
|
+
kind,
|
|
2052
|
+
namespace,
|
|
2053
|
+
name
|
|
2054
|
+
}
|
|
2055
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
2056
|
+
"data-testid": "techdocs-content"
|
|
2057
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
2058
|
+
onReady,
|
|
2059
|
+
entityRef: {
|
|
2060
|
+
kind,
|
|
2061
|
+
namespace,
|
|
2062
|
+
name
|
|
2063
|
+
}
|
|
2064
|
+
})));
|
|
2065
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
2066
|
+
themeId: "documentation"
|
|
2067
|
+
}, children instanceof Function ? children({
|
|
2068
|
+
techdocsMetadataValue,
|
|
2069
|
+
entityMetadataValue,
|
|
2070
|
+
entityRef: { kind, namespace, name },
|
|
2071
|
+
onReady
|
|
2072
|
+
}) : children);
|
|
2073
|
+
};
|
|
2074
|
+
|
|
2075
|
+
var TechDocsReaderPage$1 = /*#__PURE__*/Object.freeze({
|
|
2076
|
+
__proto__: null,
|
|
2077
|
+
TechDocsReaderPage: TechDocsReaderPage
|
|
2078
|
+
});
|
|
2079
|
+
|
|
2110
2080
|
const EntityPageDocs = ({ entity }) => {
|
|
2111
2081
|
var _a;
|
|
2112
2082
|
const config = useApi(configApiRef);
|
|
@@ -2131,7 +2101,7 @@ const Router = () => {
|
|
|
2131
2101
|
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
2132
2102
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
2133
2103
|
path: "/:namespace/:kind/:name/*",
|
|
2134
|
-
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage
|
|
2104
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage, null)
|
|
2135
2105
|
}));
|
|
2136
2106
|
};
|
|
2137
2107
|
const EmbeddedDocsRouter = () => {
|
|
@@ -2158,5 +2128,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2158
2128
|
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
2159
2129
|
});
|
|
2160
2130
|
|
|
2161
|
-
export { DefaultTechDocsHome, DocsCardGrid,
|
|
2131
|
+
export { DefaultTechDocsHome, DocsCardGrid, DocsTable, EmbeddedDocsRouter, EntityListDocsGrid, EntityListDocsTable, EntityTechdocsContent, Reader, Router, TechDocsClient, TechDocsCustomHome, TechDocsIndexPage$2 as TechDocsIndexPage, TechDocsPageWrapper, TechDocsPicker, TechDocsReaderPage$2 as TechDocsReaderPage, TechDocsReaderPageHeader, TechDocsSearch, TechDocsSearchResultListItem, TechDocsStateIndicator, TechDocsStorageClient, TechdocsPage, isTechDocsAvailable, techdocsPlugin as plugin, techdocsApiRef, techdocsPlugin, techdocsStorageApiRef, useTechDocsReader, useTechDocsReaderDom, withTechDocsReaderProvider };
|
|
2162
2132
|
//# sourceMappingURL=index.esm.js.map
|