@backstage/plugin-techdocs 0.0.0-nightly-20220315022536 → 0.0.0-nightly-20220323023253
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 +53 -9
- package/config.d.ts +0 -7
- package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js → TechDocsCustomHome-ef44d6a8.esm.js} +1 -2
- package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js.map → TechDocsCustomHome-ef44d6a8.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -32
- package/dist/index.esm.js +70 -101
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,64 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20220323023253
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/catalog-model@0.0.0-nightly-20220323023253
|
|
10
|
+
- @backstage/plugin-search@0.0.0-nightly-20220323023253
|
|
11
|
+
- @backstage/integration@0.0.0-nightly-20220323023253
|
|
12
|
+
- @backstage/plugin-catalog-react@0.0.0-nightly-20220323023253
|
|
13
|
+
- @backstage/core-components@0.0.0-nightly-20220323023253
|
|
14
|
+
- @backstage/integration-react@0.0.0-nightly-20220323023253
|
|
15
|
+
|
|
16
|
+
## 1.0.1-next.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/catalog-model@1.0.1-next.0
|
|
23
|
+
- @backstage/plugin-search@0.7.5-next.0
|
|
24
|
+
- @backstage/integration@1.0.1-next.0
|
|
25
|
+
- @backstage/plugin-catalog-react@1.0.1-next.0
|
|
26
|
+
- @backstage/core-components@0.9.3-next.0
|
|
27
|
+
- @backstage/integration-react@1.0.1-next.0
|
|
28
|
+
|
|
29
|
+
## 1.0.0
|
|
30
|
+
|
|
31
|
+
### Major Changes
|
|
32
|
+
|
|
33
|
+
- 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).
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 700d93ff41: Removed deprecated exports, including:
|
|
38
|
+
|
|
39
|
+
- deprecated `DocsResultListItem` is now deleted and fully replaced with `TechDocsSearchResultListItem`
|
|
40
|
+
- deprecated `TechDocsPage` is now deleted and fully replaced with `TechDocsReaderPage`
|
|
41
|
+
- deprecated `TechDocsPageHeader` is now deleted and fully replaced with `TechDocsReaderPageHeader`
|
|
42
|
+
- deprecated `TechDocsPageHeaderProps` is now deleted and fully replaced with `TechDocsReaderPageHeaderProps`
|
|
43
|
+
- deprecated `TechDocsPageRenderFunction` is now deleted and fully replaced with `TechDocsReaderPageRenderFunction`
|
|
44
|
+
- deprecated config `techdocs.requestUrl` is now deleted and fully replaced with the discoveryApi
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
6
47
|
|
|
7
48
|
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
49
|
+
- c689d7a94c: Switched to using `CatalogFilterLayout` from `@backstage/plugin-catalog-react`.
|
|
50
|
+
- f24ef7864e: Minor typo fixes
|
|
8
51
|
- 06af9e8d17: Long sidebars will no longer overflow the footer and will properly show a scrollbar when needed.
|
|
9
52
|
- Updated dependencies
|
|
10
|
-
- @backstage/core-components@0.
|
|
11
|
-
- @backstage/core-plugin-api@
|
|
12
|
-
- @backstage/integration-react@
|
|
13
|
-
- @backstage/plugin-catalog-react@
|
|
14
|
-
- @backstage/plugin-
|
|
15
|
-
- @backstage/
|
|
16
|
-
- @backstage/
|
|
17
|
-
- @backstage/
|
|
53
|
+
- @backstage/core-components@0.9.2
|
|
54
|
+
- @backstage/core-plugin-api@1.0.0
|
|
55
|
+
- @backstage/integration-react@1.0.0
|
|
56
|
+
- @backstage/plugin-catalog-react@1.0.0
|
|
57
|
+
- @backstage/plugin-search@0.7.4
|
|
58
|
+
- @backstage/catalog-model@1.0.0
|
|
59
|
+
- @backstage/integration@1.0.0
|
|
60
|
+
- @backstage/config@1.0.0
|
|
61
|
+
- @backstage/errors@1.0.0
|
|
18
62
|
|
|
19
63
|
## 0.15.1
|
|
20
64
|
|
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-ef44d6a8.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-6c92b708.esm.js.map → TechDocsCustomHome-ef44d6a8.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-ef44d6a8.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;AACF,CAAA,CAAA;AAuCA,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,MAAA,GACV,MAAO,CAAA,QAAA,GAAW,MAAO,CAAA,QAAA,GAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,EAAA,GAAkB,kBAAmB,EAAA,CAAA;AAExE,EAAM,MAAA,KAAA,GAAQ,OAAO,MAAO,CAAA,SAAA,CAAA,CAAA;AAE5B,EAAM,MAAA,aAAA,GAAgB,QAAS,CAAA,MAAA,CAAO,CAAU,MAAA,KAAA;AAC9C,IAAI,IAAA,MAAA,CAAO,oBAAoB,aAAe,EAAA;AAC5C,MAAA,IAAI,gBAAkB,EAAA;AACp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CAAe,KAAK,CAAA;AAAA,IACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,SAAS,KAAW,MAAA;AAAA,MAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,MACnB,KAAA;AAAA,KACA,CAAA,CAAA;AAAA,GACJ,mBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,IAAQ,aAAY,EAAA,kBAAA;AAAA,GAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,0BACnC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACC,GAAK,EAAA,KAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,IACnC,KAAA;AAAA,GACF,CACD,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
|
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';
|
|
@@ -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;
|
|
@@ -467,7 +464,7 @@ const scrollIntoAnchor = () => {
|
|
|
467
464
|
var _a;
|
|
468
465
|
if (window.location.hash) {
|
|
469
466
|
const hash = window.location.hash.slice(1);
|
|
470
|
-
(_a = dom == null ? void 0 : dom.querySelector(
|
|
467
|
+
(_a = dom == null ? void 0 : dom.querySelector(`[id="${hash}"]`)) == null ? void 0 : _a.scrollIntoView();
|
|
471
468
|
}
|
|
472
469
|
}, 200);
|
|
473
470
|
return dom;
|
|
@@ -532,7 +529,6 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
532
529
|
})) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
533
530
|
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
534
531
|
};
|
|
535
|
-
const DocsResultListItem = TechDocsSearchResultListItem;
|
|
536
532
|
|
|
537
533
|
const useStyles$2 = makeStyles({
|
|
538
534
|
root: {
|
|
@@ -1701,90 +1697,6 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1701
1697
|
typeLink: docsRootLink
|
|
1702
1698
|
}, labels, children);
|
|
1703
1699
|
};
|
|
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
1700
|
|
|
1789
1701
|
function toLowerMaybe(str, config) {
|
|
1790
1702
|
return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
|
|
@@ -2025,9 +1937,9 @@ const DefaultTechDocsHome = (props) => {
|
|
|
2025
1937
|
const { initialFilter = "all", columns, actions } = props;
|
|
2026
1938
|
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
2027
1939
|
title: ""
|
|
2028
|
-
}, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(
|
|
1940
|
+
}, /* @__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, {
|
|
2029
1941
|
initialFilter
|
|
2030
|
-
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(
|
|
1942
|
+
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, {
|
|
2031
1943
|
actions,
|
|
2032
1944
|
columns
|
|
2033
1945
|
}))))));
|
|
@@ -2083,7 +1995,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2083
1995
|
}));
|
|
2084
1996
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2085
1997
|
name: "TechDocsCustomHome",
|
|
2086
|
-
component: () => import('./esm/TechDocsCustomHome-
|
|
1998
|
+
component: () => import('./esm/TechDocsCustomHome-ef44d6a8.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2087
1999
|
mountPoint: rootRouteRef
|
|
2088
2000
|
}));
|
|
2089
2001
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2091,9 +2003,9 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2091
2003
|
component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then((m) => m.TechDocsIndexPage),
|
|
2092
2004
|
mountPoint: rootRouteRef
|
|
2093
2005
|
}));
|
|
2094
|
-
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2006
|
+
const TechDocsReaderPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
2095
2007
|
name: "TechDocsReaderPage",
|
|
2096
|
-
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$
|
|
2008
|
+
component: () => Promise.resolve().then(function () { return TechDocsReaderPage$1; }).then((m) => m.TechDocsReaderPage),
|
|
2097
2009
|
mountPoint: rootDocsRouteRef
|
|
2098
2010
|
}));
|
|
2099
2011
|
|
|
@@ -2107,6 +2019,63 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
2107
2019
|
TechDocsIndexPage: TechDocsIndexPage
|
|
2108
2020
|
});
|
|
2109
2021
|
|
|
2022
|
+
const TechDocsReaderPage = (props) => {
|
|
2023
|
+
const { children } = props;
|
|
2024
|
+
const { NotFoundErrorPage } = useApp().getComponents();
|
|
2025
|
+
const outlet = useOutlet();
|
|
2026
|
+
const [documentReady, setDocumentReady] = useState(false);
|
|
2027
|
+
const { namespace, kind, name } = useParams();
|
|
2028
|
+
const techdocsApi = useApi(techdocsApiRef);
|
|
2029
|
+
const { value: techdocsMetadataValue } = useAsync(() => {
|
|
2030
|
+
if (documentReady) {
|
|
2031
|
+
return techdocsApi.getTechDocsMetadata({ kind, namespace, name });
|
|
2032
|
+
}
|
|
2033
|
+
return Promise.resolve(void 0);
|
|
2034
|
+
}, [kind, namespace, name, techdocsApi, documentReady]);
|
|
2035
|
+
const { value: entityMetadataValue, error: entityMetadataError } = useAsync(() => {
|
|
2036
|
+
return techdocsApi.getEntityMetadata({ kind, namespace, name });
|
|
2037
|
+
}, [kind, namespace, name, techdocsApi]);
|
|
2038
|
+
const onReady = useCallback(() => {
|
|
2039
|
+
setDocumentReady(true);
|
|
2040
|
+
}, [setDocumentReady]);
|
|
2041
|
+
if (entityMetadataError)
|
|
2042
|
+
return /* @__PURE__ */ React.createElement(NotFoundErrorPage, null);
|
|
2043
|
+
if (!children)
|
|
2044
|
+
return outlet || /* @__PURE__ */ React.createElement(Page, {
|
|
2045
|
+
themeId: "documentation"
|
|
2046
|
+
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, {
|
|
2047
|
+
techDocsMetadata: techdocsMetadataValue,
|
|
2048
|
+
entityMetadata: entityMetadataValue,
|
|
2049
|
+
entityRef: {
|
|
2050
|
+
kind,
|
|
2051
|
+
namespace,
|
|
2052
|
+
name
|
|
2053
|
+
}
|
|
2054
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
2055
|
+
"data-testid": "techdocs-content"
|
|
2056
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
2057
|
+
onReady,
|
|
2058
|
+
entityRef: {
|
|
2059
|
+
kind,
|
|
2060
|
+
namespace,
|
|
2061
|
+
name
|
|
2062
|
+
}
|
|
2063
|
+
})));
|
|
2064
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
2065
|
+
themeId: "documentation"
|
|
2066
|
+
}, children instanceof Function ? children({
|
|
2067
|
+
techdocsMetadataValue,
|
|
2068
|
+
entityMetadataValue,
|
|
2069
|
+
entityRef: { kind, namespace, name },
|
|
2070
|
+
onReady
|
|
2071
|
+
}) : children);
|
|
2072
|
+
};
|
|
2073
|
+
|
|
2074
|
+
var TechDocsReaderPage$1 = /*#__PURE__*/Object.freeze({
|
|
2075
|
+
__proto__: null,
|
|
2076
|
+
TechDocsReaderPage: TechDocsReaderPage
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2110
2079
|
const EntityPageDocs = ({ entity }) => {
|
|
2111
2080
|
var _a;
|
|
2112
2081
|
const config = useApi(configApiRef);
|
|
@@ -2131,7 +2100,7 @@ const Router = () => {
|
|
|
2131
2100
|
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
2132
2101
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
2133
2102
|
path: "/:namespace/:kind/:name/*",
|
|
2134
|
-
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage
|
|
2103
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage, null)
|
|
2135
2104
|
}));
|
|
2136
2105
|
};
|
|
2137
2106
|
const EmbeddedDocsRouter = () => {
|
|
@@ -2158,5 +2127,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2158
2127
|
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
2159
2128
|
});
|
|
2160
2129
|
|
|
2161
|
-
export { DefaultTechDocsHome, DocsCardGrid,
|
|
2130
|
+
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
2131
|
//# sourceMappingURL=index.esm.js.map
|