@backstage/plugin-techdocs 0.15.1 → 1.0.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 +65 -0
- package/config.d.ts +0 -7
- package/dist/esm/{TechDocsCustomHome-a4f542cd.esm.js → TechDocsCustomHome-a2958b1a.esm.js} +1 -2
- package/dist/esm/{TechDocsCustomHome-a4f542cd.esm.js.map → TechDocsCustomHome-a2958b1a.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -32
- package/dist/index.esm.js +129 -114
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.0.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0152c0de22: Some documentation layout tweaks:
|
|
8
|
+
|
|
9
|
+
- drawer toggle margins
|
|
10
|
+
- code block margins
|
|
11
|
+
- sidebar drawer width
|
|
12
|
+
- inner content width
|
|
13
|
+
- footer link width
|
|
14
|
+
- sidebar table of contents scroll
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/integration@1.1.0-next.1
|
|
18
|
+
- @backstage/plugin-catalog-react@1.0.1-next.1
|
|
19
|
+
- @backstage/integration-react@1.0.1-next.1
|
|
20
|
+
|
|
21
|
+
## 1.0.1-next.0
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/catalog-model@1.0.1-next.0
|
|
28
|
+
- @backstage/plugin-search@0.7.5-next.0
|
|
29
|
+
- @backstage/integration@1.0.1-next.0
|
|
30
|
+
- @backstage/plugin-catalog-react@1.0.1-next.0
|
|
31
|
+
- @backstage/core-components@0.9.3-next.0
|
|
32
|
+
- @backstage/integration-react@1.0.1-next.0
|
|
33
|
+
|
|
34
|
+
## 1.0.0
|
|
35
|
+
|
|
36
|
+
### Major Changes
|
|
37
|
+
|
|
38
|
+
- 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).
|
|
39
|
+
|
|
40
|
+
### Minor Changes
|
|
41
|
+
|
|
42
|
+
- 700d93ff41: Removed deprecated exports, including:
|
|
43
|
+
|
|
44
|
+
- deprecated `DocsResultListItem` is now deleted and fully replaced with `TechDocsSearchResultListItem`
|
|
45
|
+
- deprecated `TechDocsPage` is now deleted and fully replaced with `TechDocsReaderPage`
|
|
46
|
+
- deprecated `TechDocsPageHeader` is now deleted and fully replaced with `TechDocsReaderPageHeader`
|
|
47
|
+
- deprecated `TechDocsPageHeaderProps` is now deleted and fully replaced with `TechDocsReaderPageHeaderProps`
|
|
48
|
+
- deprecated `TechDocsPageRenderFunction` is now deleted and fully replaced with `TechDocsReaderPageRenderFunction`
|
|
49
|
+
- deprecated config `techdocs.requestUrl` is now deleted and fully replaced with the discoveryApi
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
54
|
+
- c689d7a94c: Switched to using `CatalogFilterLayout` from `@backstage/plugin-catalog-react`.
|
|
55
|
+
- f24ef7864e: Minor typo fixes
|
|
56
|
+
- 06af9e8d17: Long sidebars will no longer overflow the footer and will properly show a scrollbar when needed.
|
|
57
|
+
- Updated dependencies
|
|
58
|
+
- @backstage/core-components@0.9.2
|
|
59
|
+
- @backstage/core-plugin-api@1.0.0
|
|
60
|
+
- @backstage/integration-react@1.0.0
|
|
61
|
+
- @backstage/plugin-catalog-react@1.0.0
|
|
62
|
+
- @backstage/plugin-search@0.7.4
|
|
63
|
+
- @backstage/catalog-model@1.0.0
|
|
64
|
+
- @backstage/integration@1.0.0
|
|
65
|
+
- @backstage/config@1.0.0
|
|
66
|
+
- @backstage/errors@1.0.0
|
|
67
|
+
|
|
3
68
|
## 0.15.1
|
|
4
69
|
|
|
5
70
|
### Patch Changes
|
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
|
|
@@ -32,7 +32,6 @@ import '@material-ui/icons/Share';
|
|
|
32
32
|
import '@material-ui/styles';
|
|
33
33
|
import '@material-ui/icons/Star';
|
|
34
34
|
import '@material-ui/icons/StarBorder';
|
|
35
|
-
import '@backstage/plugin-catalog';
|
|
36
35
|
|
|
37
36
|
const panels = {
|
|
38
37
|
DocsTable,
|
|
@@ -129,4 +128,4 @@ const TechDocsCustomHome = (props) => {
|
|
|
129
128
|
};
|
|
130
129
|
|
|
131
130
|
export { TechDocsCustomHome };
|
|
132
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
131
|
+
//# sourceMappingURL=TechDocsCustomHome-a2958b1a.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-a4f542cd.esm.js.map → TechDocsCustomHome-a2958b1a.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-a2958b1a.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":"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"}
|
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, sidebarConfig, 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';
|
|
@@ -24,14 +24,13 @@ import useAsync from 'react-use/lib/useAsync';
|
|
|
24
24
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
25
25
|
import CodeIcon from '@material-ui/icons/Code';
|
|
26
26
|
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
27
|
-
import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList, humanizeEntityRef, useStarredEntities, CATALOG_FILTER_EXISTS, EntityListProvider, UserListPicker, EntityOwnerPicker, EntityTagPicker, useEntity } from '@backstage/plugin-catalog-react';
|
|
27
|
+
import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList, humanizeEntityRef, useStarredEntities, CATALOG_FILTER_EXISTS, EntityListProvider, CatalogFilterLayout, UserListPicker, EntityOwnerPicker, EntityTagPicker, useEntity } from '@backstage/plugin-catalog-react';
|
|
28
28
|
import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
|
|
29
29
|
import { capitalize } from 'lodash';
|
|
30
30
|
import ShareIcon from '@material-ui/icons/Share';
|
|
31
31
|
import { withStyles as withStyles$1 } from '@material-ui/styles';
|
|
32
32
|
import Star from '@material-ui/icons/Star';
|
|
33
33
|
import StarBorder from '@material-ui/icons/StarBorder';
|
|
34
|
-
import { FilteredEntityLayout, FilterContainer, EntityListContainer } from '@backstage/plugin-catalog';
|
|
35
34
|
|
|
36
35
|
const techdocsStorageApiRef = createApiRef({
|
|
37
36
|
id: "plugin.techdocs.storageservice"
|
|
@@ -47,8 +46,7 @@ class TechDocsClient {
|
|
|
47
46
|
this.fetchApi = options.fetchApi;
|
|
48
47
|
}
|
|
49
48
|
async getApiOrigin() {
|
|
50
|
-
|
|
51
|
-
return (_a = this.configApi.getOptionalString("techdocs.requestUrl")) != null ? _a : await this.discoveryApi.getBaseUrl("techdocs");
|
|
49
|
+
return await this.discoveryApi.getBaseUrl("techdocs");
|
|
52
50
|
}
|
|
53
51
|
async getTechDocsMetadata(entityId) {
|
|
54
52
|
const { kind, namespace, name } = entityId;
|
|
@@ -79,8 +77,7 @@ class TechDocsStorageClient {
|
|
|
79
77
|
this.fetchApi = options.fetchApi;
|
|
80
78
|
}
|
|
81
79
|
async getApiOrigin() {
|
|
82
|
-
|
|
83
|
-
return (_a = this.configApi.getOptionalString("techdocs.requestUrl")) != null ? _a : await this.discoveryApi.getBaseUrl("techdocs");
|
|
80
|
+
return await this.discoveryApi.getBaseUrl("techdocs");
|
|
84
81
|
}
|
|
85
82
|
async getStorageUrl() {
|
|
86
83
|
var _a;
|
|
@@ -246,10 +243,11 @@ const addSidebarToggle = () => {
|
|
|
246
243
|
}
|
|
247
244
|
const toggleSidebar = mkdocsToggleSidebar.cloneNode();
|
|
248
245
|
ReactDOM.render(React.createElement(MenuIcon), toggleSidebar);
|
|
249
|
-
toggleSidebar.style.paddingLeft = "5px";
|
|
250
|
-
toggleSidebar.classList.add("md-content__button");
|
|
251
|
-
toggleSidebar.title = "Toggle Sidebar";
|
|
252
246
|
toggleSidebar.id = "toggle-sidebar";
|
|
247
|
+
toggleSidebar.title = "Toggle Sidebar";
|
|
248
|
+
toggleSidebar.classList.add("md-content__button");
|
|
249
|
+
toggleSidebar.style.setProperty("padding", "0 0 0 5px");
|
|
250
|
+
toggleSidebar.style.setProperty("margin", "0.4rem 0 0.4rem 0.4rem");
|
|
253
251
|
article == null ? void 0 : article.prepend(toggleSidebar);
|
|
254
252
|
return dom;
|
|
255
253
|
};
|
|
@@ -467,7 +465,7 @@ const scrollIntoAnchor = () => {
|
|
|
467
465
|
var _a;
|
|
468
466
|
if (window.location.hash) {
|
|
469
467
|
const hash = window.location.hash.slice(1);
|
|
470
|
-
(_a = dom == null ? void 0 : dom.querySelector(
|
|
468
|
+
(_a = dom == null ? void 0 : dom.querySelector(`[id="${hash}"]`)) == null ? void 0 : _a.scrollIntoView();
|
|
471
469
|
}
|
|
472
470
|
}, 200);
|
|
473
471
|
return dom;
|
|
@@ -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;
|
|
1221
|
+
}
|
|
1222
|
+
.md-sidebar::-webkit-scrollbar {
|
|
1223
|
+
width: 5px;
|
|
1224
|
+
}
|
|
1225
|
+
.md-sidebar::-webkit-scrollbar-button {
|
|
1226
|
+
width: 5px;
|
|
1227
|
+
height: 5px;
|
|
1220
1228
|
}
|
|
1221
|
-
.md-sidebar
|
|
1222
|
-
|
|
1229
|
+
.md-sidebar::-webkit-scrollbar-track {
|
|
1230
|
+
background: #eee;
|
|
1231
|
+
border: 1 px solid rgb(250, 250, 250);
|
|
1232
|
+
box-shadow: 0px 0px 3px #dfdfdf inset;
|
|
1233
|
+
border-radius: 3px;
|
|
1234
|
+
}
|
|
1235
|
+
.md-sidebar::-webkit-scrollbar-thumb {
|
|
1236
|
+
width: 5px;
|
|
1237
|
+
background: rgb(193, 193, 193);
|
|
1238
|
+
border: transparent;
|
|
1239
|
+
border-radius: 3px;
|
|
1240
|
+
}
|
|
1241
|
+
.md-sidebar::-webkit-scrollbar-thumb:hover {
|
|
1242
|
+
background: rgb(125, 125, 125);
|
|
1223
1243
|
}
|
|
1224
1244
|
.md-sidebar--secondary {
|
|
1225
1245
|
right: ${theme.spacing(3)}px;
|
|
1226
1246
|
}
|
|
1247
|
+
.md-sidebar__scrollwrap {
|
|
1248
|
+
overflow: unset !important;
|
|
1249
|
+
}
|
|
1227
1250
|
|
|
1228
1251
|
.md-content {
|
|
1229
1252
|
max-width: calc(100% - 16rem * 2);
|
|
@@ -1238,7 +1261,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1238
1261
|
.md-footer__title {
|
|
1239
1262
|
background-color: unset;
|
|
1240
1263
|
}
|
|
1241
|
-
.md-footer-nav__link {
|
|
1264
|
+
.md-footer__link, .md-footer-nav__link {
|
|
1242
1265
|
width: 16rem;
|
|
1243
1266
|
}
|
|
1244
1267
|
|
|
@@ -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;
|
|
@@ -1296,18 +1325,28 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1296
1325
|
height: 100%;
|
|
1297
1326
|
}
|
|
1298
1327
|
.md-sidebar--primary {
|
|
1299
|
-
width:
|
|
1328
|
+
width: 16rem !important;
|
|
1300
1329
|
z-index: 200;
|
|
1301
|
-
left: ${isPinned ?
|
|
1330
|
+
left: ${isPinned ? `calc(-16rem + ${sidebarConfig.drawerWidthOpen}px)` : `calc(-16rem + ${sidebarConfig.drawerWidthClosed}px)`} !important;
|
|
1302
1331
|
}
|
|
1303
1332
|
.md-sidebar--secondary:not([hidden]) {
|
|
1304
1333
|
display: none;
|
|
1305
1334
|
}
|
|
1335
|
+
[data-md-toggle=drawer]:checked~.md-container .md-sidebar--primary {
|
|
1336
|
+
transform: translateX(16rem);
|
|
1337
|
+
}
|
|
1306
1338
|
|
|
1307
1339
|
.md-content {
|
|
1308
1340
|
max-width: 100%;
|
|
1309
1341
|
margin-left: 0;
|
|
1310
1342
|
}
|
|
1343
|
+
.md-content__inner {
|
|
1344
|
+
margin: 0;
|
|
1345
|
+
}
|
|
1346
|
+
.md-content__inner .highlighttable {
|
|
1347
|
+
max-width: 100%;
|
|
1348
|
+
margin: 1em 0;
|
|
1349
|
+
}
|
|
1311
1350
|
|
|
1312
1351
|
.md-header__button {
|
|
1313
1352
|
margin: 0.4rem 0;
|
|
@@ -1323,7 +1362,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1323
1362
|
position: static;
|
|
1324
1363
|
padding-left: 0;
|
|
1325
1364
|
}
|
|
1326
|
-
.md-footer-nav__link {
|
|
1365
|
+
.md-footer__link, .md-footer-nav__link {
|
|
1327
1366
|
/* footer links begin to overlap at small sizes without setting width */
|
|
1328
1367
|
width: 50%;
|
|
1329
1368
|
}
|
|
@@ -1331,8 +1370,11 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1331
1370
|
|
|
1332
1371
|
@media screen and (max-width: 600px) {
|
|
1333
1372
|
.md-sidebar--primary {
|
|
1334
|
-
left: -
|
|
1335
|
-
width:
|
|
1373
|
+
left: -16rem !important;
|
|
1374
|
+
width: 16rem;
|
|
1375
|
+
}
|
|
1376
|
+
.md-sidebar--primary .md-sidebar__scrollwrap {
|
|
1377
|
+
bottom: ${sidebarConfig.mobileSidebarHeight}px;
|
|
1336
1378
|
}
|
|
1337
1379
|
}
|
|
1338
1380
|
`
|
|
@@ -1435,7 +1477,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1435
1477
|
.highlight .md-clipboard:after {
|
|
1436
1478
|
content: unset;
|
|
1437
1479
|
}
|
|
1438
|
-
|
|
1480
|
+
|
|
1439
1481
|
.highlight .nx {
|
|
1440
1482
|
color: ${isDarkTheme ? "#ff53a3" : "#ec407a"};
|
|
1441
1483
|
}
|
|
@@ -1669,90 +1711,6 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1669
1711
|
typeLink: docsRootLink
|
|
1670
1712
|
}, labels, children);
|
|
1671
1713
|
};
|
|
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
1714
|
|
|
1757
1715
|
function toLowerMaybe(str, config) {
|
|
1758
1716
|
return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
|
|
@@ -1993,9 +1951,9 @@ const DefaultTechDocsHome = (props) => {
|
|
|
1993
1951
|
const { initialFilter = "all", columns, actions } = props;
|
|
1994
1952
|
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
1995
1953
|
title: ""
|
|
1996
|
-
}, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(
|
|
1954
|
+
}, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(TechDocsPicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
|
|
1997
1955
|
initialFilter
|
|
1998
|
-
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(
|
|
1956
|
+
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, {
|
|
1999
1957
|
actions,
|
|
2000
1958
|
columns
|
|
2001
1959
|
}))))));
|
|
@@ -2051,7 +2009,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2051
2009
|
}));
|
|
2052
2010
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2053
2011
|
name: "TechDocsCustomHome",
|
|
2054
|
-
component: () => import('./esm/TechDocsCustomHome-
|
|
2012
|
+
component: () => import('./esm/TechDocsCustomHome-a2958b1a.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2055
2013
|
mountPoint: rootRouteRef
|
|
2056
2014
|
}));
|
|
2057
2015
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2059,9 +2017,9 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2059
2017
|
component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then((m) => m.TechDocsIndexPage),
|
|
2060
2018
|
mountPoint: rootRouteRef
|
|
2061
2019
|
}));
|
|
2062
|
-
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2020
|
+
const TechDocsReaderPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
2063
2021
|
name: "TechDocsReaderPage",
|
|
2064
|
-
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$
|
|
2022
|
+
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$1; }).then((m) => m.TechDocsReaderPage),
|
|
2065
2023
|
mountPoint: rootDocsRouteRef
|
|
2066
2024
|
}));
|
|
2067
2025
|
|
|
@@ -2075,6 +2033,63 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
2075
2033
|
TechDocsIndexPage: TechDocsIndexPage
|
|
2076
2034
|
});
|
|
2077
2035
|
|
|
2036
|
+
const TechDocsReaderPage = (props) => {
|
|
2037
|
+
const { children } = props;
|
|
2038
|
+
const { NotFoundErrorPage } = useApp().getComponents();
|
|
2039
|
+
const outlet = useOutlet();
|
|
2040
|
+
const [documentReady, setDocumentReady] = useState(false);
|
|
2041
|
+
const { namespace, kind, name } = useParams();
|
|
2042
|
+
const techdocsApi = useApi(techdocsApiRef);
|
|
2043
|
+
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
2044
|
+
if (documentReady) {
|
|
2045
|
+
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
2046
|
+
}
|
|
2047
|
+
return Promise.resolve(void 0);
|
|
2048
|
+
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
2049
|
+
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
2050
|
+
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
2051
|
+
}, [kind, namespace, name, techdocsApi]);
|
|
2052
|
+
const onReady = useCallback(() => {
|
|
2053
|
+
setDocumentReady(true);
|
|
2054
|
+
}, [setDocumentReady]);
|
|
2055
|
+
if (entityMetadataError)
|
|
2056
|
+
return /* @__PURE__ */ React.createElement(NotFoundErrorPage, null);
|
|
2057
|
+
if (!children)
|
|
2058
|
+
return outlet || /* @__PURE__ */ React.createElement(Page, {
|
|
2059
|
+
themeId: "documentation"
|
|
2060
|
+
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, {
|
|
2061
|
+
techDocsMetadata: techdocsMetadataValue,
|
|
2062
|
+
entityMetadata: entityMetadataValue,
|
|
2063
|
+
entityRef: {
|
|
2064
|
+
kind,
|
|
2065
|
+
namespace,
|
|
2066
|
+
name
|
|
2067
|
+
}
|
|
2068
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
2069
|
+
"data-testid": "techdocs-content"
|
|
2070
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
2071
|
+
onReady,
|
|
2072
|
+
entityRef: {
|
|
2073
|
+
kind,
|
|
2074
|
+
namespace,
|
|
2075
|
+
name
|
|
2076
|
+
}
|
|
2077
|
+
})));
|
|
2078
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
2079
|
+
themeId: "documentation"
|
|
2080
|
+
}, children instanceof Function ? children({
|
|
2081
|
+
techdocsMetadataValue,
|
|
2082
|
+
entityMetadataValue,
|
|
2083
|
+
entityRef: { kind, namespace, name },
|
|
2084
|
+
onReady
|
|
2085
|
+
}) : children);
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
var TechDocsReaderPage$1 = /*#__PURE__*/Object.freeze({
|
|
2089
|
+
__proto__: null,
|
|
2090
|
+
TechDocsReaderPage: TechDocsReaderPage
|
|
2091
|
+
});
|
|
2092
|
+
|
|
2078
2093
|
const EntityPageDocs = ({ entity }) => {
|
|
2079
2094
|
var _a;
|
|
2080
2095
|
const config = useApi(configApiRef);
|
|
@@ -2099,7 +2114,7 @@ const Router = () => {
|
|
|
2099
2114
|
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
2100
2115
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
2101
2116
|
path: "/:namespace/:kind/:name/*",
|
|
2102
|
-
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage
|
|
2117
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage, null)
|
|
2103
2118
|
}));
|
|
2104
2119
|
};
|
|
2105
2120
|
const EmbeddedDocsRouter = () => {
|
|
@@ -2126,5 +2141,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2126
2141
|
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
2127
2142
|
});
|
|
2128
2143
|
|
|
2129
|
-
export { DefaultTechDocsHome, DocsCardGrid,
|
|
2144
|
+
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
2145
|
//# sourceMappingURL=index.esm.js.map
|