@backstage/plugin-techdocs 0.0.0-nightly-20220313021839 → 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 +28 -8
- package/config.d.ts +0 -7
- package/dist/esm/{TechDocsCustomHome-a4f542cd.esm.js → TechDocsCustomHome-9a692794.esm.js} +1 -1
- package/dist/esm/{TechDocsCustomHome-a4f542cd.esm.js.map → TechDocsCustomHome-9a692794.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -32
- package/dist/index.esm.js +100 -98
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +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
|
|
24
|
+
- 06af9e8d17: Long sidebars will no longer overflow the footer and will properly show a scrollbar when needed.
|
|
8
25
|
- Updated dependencies
|
|
9
|
-
- @backstage/core-components@0.0.0-nightly-
|
|
10
|
-
- @backstage/core-plugin-api@0.0.0-nightly-
|
|
11
|
-
- @backstage/integration-react@0.0.0-nightly-
|
|
12
|
-
- @backstage/plugin-catalog-react@0.0.0-nightly-
|
|
13
|
-
- @backstage/plugin-catalog@0.0.0-nightly-
|
|
14
|
-
- @backstage/plugin-search@0.0.0-nightly-
|
|
15
|
-
- @backstage/catalog-model@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
|
|
16
36
|
|
|
17
37
|
## 0.15.1
|
|
18
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-a4f542cd.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,OAAO,MAAO,CAAA,SAAA,CAAA,CA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,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: {
|
|
@@ -1214,16 +1211,42 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1214
1211
|
}
|
|
1215
1212
|
|
|
1216
1213
|
.md-sidebar {
|
|
1217
|
-
|
|
1214
|
+
bottom: 75px;
|
|
1218
1215
|
position: fixed;
|
|
1219
1216
|
width: 16rem;
|
|
1217
|
+
overflow-y: auto;
|
|
1218
|
+
overflow-x: hidden;
|
|
1219
|
+
scrollbar-color: rgb(193, 193, 193) #eee;
|
|
1220
|
+
scrollbar-width: thin;
|
|
1220
1221
|
}
|
|
1221
1222
|
.md-sidebar .md-sidebar__scrollwrap {
|
|
1222
|
-
|
|
1223
|
+
width: calc(16rem - 10px);
|
|
1223
1224
|
}
|
|
1224
1225
|
.md-sidebar--secondary {
|
|
1225
1226
|
right: ${theme.spacing(3)}px;
|
|
1226
1227
|
}
|
|
1228
|
+
.md-sidebar::-webkit-scrollbar {
|
|
1229
|
+
width: 5px;
|
|
1230
|
+
}
|
|
1231
|
+
.md-sidebar::-webkit-scrollbar-button {
|
|
1232
|
+
width: 5px;
|
|
1233
|
+
height: 5px;
|
|
1234
|
+
}
|
|
1235
|
+
.md-sidebar::-webkit-scrollbar-track {
|
|
1236
|
+
background: #eee;
|
|
1237
|
+
border: 1 px solid rgb(250, 250, 250);
|
|
1238
|
+
box-shadow: 0px 0px 3px #dfdfdf inset;
|
|
1239
|
+
border-radius: 3px;
|
|
1240
|
+
}
|
|
1241
|
+
.md-sidebar::-webkit-scrollbar-thumb {
|
|
1242
|
+
width: 5px;
|
|
1243
|
+
background: rgb(193, 193, 193);
|
|
1244
|
+
border: transparent;
|
|
1245
|
+
border-radius: 3px;
|
|
1246
|
+
}
|
|
1247
|
+
.md-sidebar::-webkit-scrollbar-thumb:hover {
|
|
1248
|
+
background: rgb(125, 125, 125);
|
|
1249
|
+
}
|
|
1227
1250
|
|
|
1228
1251
|
.md-content {
|
|
1229
1252
|
max-width: calc(100% - 16rem * 2);
|
|
@@ -1246,6 +1269,12 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1246
1269
|
background-color: unset;
|
|
1247
1270
|
}
|
|
1248
1271
|
|
|
1272
|
+
@media screen and (min-width: 76.25em) {
|
|
1273
|
+
.md-sidebar {
|
|
1274
|
+
height: auto;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1249
1278
|
@media screen and (max-width: 76.1875em) {
|
|
1250
1279
|
.md-nav {
|
|
1251
1280
|
transition: none !important;
|
|
@@ -1669,90 +1698,6 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1669
1698
|
typeLink: docsRootLink
|
|
1670
1699
|
}, labels, children);
|
|
1671
1700
|
};
|
|
1672
|
-
const TechDocsPageHeader = TechDocsReaderPageHeader;
|
|
1673
|
-
|
|
1674
|
-
const LegacyTechDocsPage = () => {
|
|
1675
|
-
const [documentReady, setDocumentReady] = useState(false);
|
|
1676
|
-
const { namespace, kind, name } = useParams();
|
|
1677
|
-
const techdocsApi = useApi(techdocsApiRef);
|
|
1678
|
-
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
1679
|
-
if (documentReady) {
|
|
1680
|
-
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
1681
|
-
}
|
|
1682
|
-
return Promise.resolve(void 0);
|
|
1683
|
-
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
1684
|
-
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
1685
|
-
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
1686
|
-
}, [kind, namespace, name, techdocsApi]);
|
|
1687
|
-
const onReady = useCallback(() => {
|
|
1688
|
-
setDocumentReady(true);
|
|
1689
|
-
}, [setDocumentReady]);
|
|
1690
|
-
if (entityMetadataError) {
|
|
1691
|
-
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1692
|
-
errorMessage: entityMetadataError.message
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
return /* @__PURE__ */ React.createElement(Page, {
|
|
1696
|
-
themeId: "documentation"
|
|
1697
|
-
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, {
|
|
1698
|
-
techDocsMetadata: techdocsMetadataValue,
|
|
1699
|
-
entityMetadata: entityMetadataValue,
|
|
1700
|
-
entityRef: {
|
|
1701
|
-
kind,
|
|
1702
|
-
namespace,
|
|
1703
|
-
name
|
|
1704
|
-
}
|
|
1705
|
-
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1706
|
-
"data-testid": "techdocs-content"
|
|
1707
|
-
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
1708
|
-
onReady,
|
|
1709
|
-
entityRef: {
|
|
1710
|
-
kind,
|
|
1711
|
-
namespace,
|
|
1712
|
-
name
|
|
1713
|
-
}
|
|
1714
|
-
})));
|
|
1715
|
-
};
|
|
1716
|
-
|
|
1717
|
-
const TechDocsReaderPage$1 = (props) => {
|
|
1718
|
-
const { children } = props;
|
|
1719
|
-
const { NotFoundErrorPage } = useApp().getComponents();
|
|
1720
|
-
const outlet = useOutlet();
|
|
1721
|
-
const [documentReady, setDocumentReady] = useState(false);
|
|
1722
|
-
const { namespace, kind, name } = useParams();
|
|
1723
|
-
const techdocsApi = useApi(techdocsApiRef);
|
|
1724
|
-
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
1725
|
-
if (documentReady) {
|
|
1726
|
-
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
1727
|
-
}
|
|
1728
|
-
return Promise.resolve(void 0);
|
|
1729
|
-
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
1730
|
-
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
1731
|
-
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
1732
|
-
}, [kind, namespace, name, techdocsApi]);
|
|
1733
|
-
const onReady = useCallback(() => {
|
|
1734
|
-
setDocumentReady(true);
|
|
1735
|
-
}, [setDocumentReady]);
|
|
1736
|
-
if (entityMetadataError)
|
|
1737
|
-
return /* @__PURE__ */ React.createElement(NotFoundErrorPage, null);
|
|
1738
|
-
if (!children)
|
|
1739
|
-
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsPage, null);
|
|
1740
|
-
return /* @__PURE__ */ React.createElement(Page, {
|
|
1741
|
-
themeId: "documentation"
|
|
1742
|
-
}, children instanceof Function ? children({
|
|
1743
|
-
techdocsMetadataValue,
|
|
1744
|
-
entityMetadataValue,
|
|
1745
|
-
entityRef: { kind, namespace, name },
|
|
1746
|
-
onReady
|
|
1747
|
-
}) : children);
|
|
1748
|
-
};
|
|
1749
|
-
const TechDocsPage = TechDocsReaderPage$1;
|
|
1750
|
-
|
|
1751
|
-
var TechDocsReaderPage$2 = /*#__PURE__*/Object.freeze({
|
|
1752
|
-
__proto__: null,
|
|
1753
|
-
TechDocsReaderPage: TechDocsReaderPage$1,
|
|
1754
|
-
TechDocsPage: TechDocsPage
|
|
1755
|
-
});
|
|
1756
1701
|
|
|
1757
1702
|
function toLowerMaybe(str, config) {
|
|
1758
1703
|
return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
|
|
@@ -2051,7 +1996,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2051
1996
|
}));
|
|
2052
1997
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2053
1998
|
name: "TechDocsCustomHome",
|
|
2054
|
-
component: () => import('./esm/TechDocsCustomHome-
|
|
1999
|
+
component: () => import('./esm/TechDocsCustomHome-9a692794.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2055
2000
|
mountPoint: rootRouteRef
|
|
2056
2001
|
}));
|
|
2057
2002
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2059,9 +2004,9 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2059
2004
|
component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then((m) => m.TechDocsIndexPage),
|
|
2060
2005
|
mountPoint: rootRouteRef
|
|
2061
2006
|
}));
|
|
2062
|
-
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2007
|
+
const TechDocsReaderPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
2063
2008
|
name: "TechDocsReaderPage",
|
|
2064
|
-
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$
|
|
2009
|
+
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$1; }).then((m) => m.TechDocsReaderPage),
|
|
2065
2010
|
mountPoint: rootDocsRouteRef
|
|
2066
2011
|
}));
|
|
2067
2012
|
|
|
@@ -2075,6 +2020,63 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
2075
2020
|
TechDocsIndexPage: TechDocsIndexPage
|
|
2076
2021
|
});
|
|
2077
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
|
+
|
|
2078
2080
|
const EntityPageDocs = ({ entity }) => {
|
|
2079
2081
|
var _a;
|
|
2080
2082
|
const config = useApi(configApiRef);
|
|
@@ -2099,7 +2101,7 @@ const Router = () => {
|
|
|
2099
2101
|
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
2100
2102
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
2101
2103
|
path: "/:namespace/:kind/:name/*",
|
|
2102
|
-
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage
|
|
2104
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage, null)
|
|
2103
2105
|
}));
|
|
2104
2106
|
};
|
|
2105
2107
|
const EmbeddedDocsRouter = () => {
|
|
@@ -2126,5 +2128,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2126
2128
|
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
2127
2129
|
});
|
|
2128
2130
|
|
|
2129
|
-
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 };
|
|
2130
2132
|
//# sourceMappingURL=index.esm.js.map
|