@backstage/plugin-techdocs 1.3.1 → 1.3.2-next.2
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 +49 -0
- package/dist/esm/{TechDocsCustomHome-6b908d56.esm.js → TechDocsCustomHome-eccef158.esm.js} +2 -5
- package/dist/esm/{TechDocsCustomHome-6b908d56.esm.js.map → TechDocsCustomHome-eccef158.esm.js.map} +1 -1
- package/dist/esm/{index-c58b4a4e.esm.js → index-b7cba14e.esm.js} +2 -5
- package/dist/esm/index-b7cba14e.esm.js.map +1 -0
- package/dist/esm/{index-c64ce4da.esm.js → index-b9f615fb.esm.js} +42 -62
- package/dist/esm/index-b9f615fb.esm.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +1 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +19 -21
- package/dist/esm/index-c58b4a4e.esm.js.map +0 -1
- package/dist/esm/index-c64ce4da.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.3.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eadf56bbbf: Bump `git-url-parse` version to `^13.0.0`
|
|
8
|
+
- 7a95c705fa: Fixed a bug where addons wouldn't render on sub pages when using React Route v6 stable.
|
|
9
|
+
- 667d917488: Updated dependency `msw` to `^0.47.0`.
|
|
10
|
+
- 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
|
|
11
|
+
- ca8d5a6eae: Use the new `SearchAutocomplete` component in the `TechDocsSearch` component to maintain consistency across search experiences and avoid code duplication.
|
|
12
|
+
- e97d616f08: Fixed a bug where scrolling for anchors where the id starts with number didn't work for the current page.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/integration@1.3.1-next.1
|
|
15
|
+
- @backstage/core-components@0.11.1-next.2
|
|
16
|
+
- @backstage/core-plugin-api@1.0.6-next.2
|
|
17
|
+
- @backstage/integration-react@1.1.4-next.1
|
|
18
|
+
- @backstage/plugin-search-react@1.1.0-next.2
|
|
19
|
+
|
|
20
|
+
## 1.3.2-next.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 817f3196f6: Updated React Router dependencies to be peer dependencies.
|
|
25
|
+
- 763fb81e82: Internal refactor to use more type safe code when dealing with route parameters.
|
|
26
|
+
- 817f3196f6: Updated the `TechDocsReaderPage` to be compatible with React Router v6 stable.
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/core-components@0.11.1-next.1
|
|
29
|
+
- @backstage/core-plugin-api@1.0.6-next.1
|
|
30
|
+
- @backstage/plugin-catalog-react@1.1.4-next.1
|
|
31
|
+
- @backstage/plugin-search-react@1.0.2-next.1
|
|
32
|
+
- @backstage/plugin-techdocs-react@1.0.4-next.1
|
|
33
|
+
|
|
34
|
+
## 1.3.2-next.0
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 3f739be9d9: Minor API signatures cleanup
|
|
39
|
+
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
|
|
40
|
+
- 829f14a9b0: Always update the title and sub-title when the location changes on a `TechDocs` reader page.
|
|
41
|
+
- ef9ab322de: Minor API signatures cleanup
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @backstage/core-plugin-api@1.0.6-next.0
|
|
44
|
+
- @backstage/core-components@0.11.1-next.0
|
|
45
|
+
- @backstage/integration-react@1.1.4-next.0
|
|
46
|
+
- @backstage/integration@1.3.1-next.0
|
|
47
|
+
- @backstage/plugin-catalog-react@1.1.4-next.0
|
|
48
|
+
- @backstage/plugin-search-react@1.0.2-next.0
|
|
49
|
+
- @backstage/plugin-techdocs-react@1.0.4-next.0
|
|
50
|
+
- @backstage/plugin-search-common@1.0.1-next.0
|
|
51
|
+
|
|
3
52
|
## 1.3.1
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import useAsync from 'react-use/lib/useAsync';
|
|
3
3
|
import { makeStyles } from '@material-ui/core';
|
|
4
4
|
import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-
|
|
5
|
+
import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-b9f615fb.esm.js';
|
|
6
6
|
import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
7
7
|
import { useApi } from '@backstage/core-plugin-api';
|
|
8
8
|
import '@backstage/errors';
|
|
@@ -11,10 +11,7 @@ import 'react-router-dom';
|
|
|
11
11
|
import '@backstage/plugin-techdocs-react';
|
|
12
12
|
import 'react-use/lib/useAsyncRetry';
|
|
13
13
|
import '@backstage/plugin-search-react';
|
|
14
|
-
import '@material-ui/icons/Search';
|
|
15
|
-
import '@material-ui/lab/Autocomplete';
|
|
16
14
|
import 'react-router';
|
|
17
|
-
import 'react-use/lib/useDebounce';
|
|
18
15
|
import '@material-ui/lab';
|
|
19
16
|
import '@material-ui/icons/Close';
|
|
20
17
|
import '@backstage/integration-react';
|
|
@@ -130,4 +127,4 @@ const TechDocsCustomHome = (props) => {
|
|
|
130
127
|
};
|
|
131
128
|
|
|
132
129
|
export { TechDocsCustomHome };
|
|
133
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
130
|
+
//# sourceMappingURL=TechDocsCustomHome-eccef158.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-6b908d56.esm.js.map → TechDocsCustomHome-eccef158.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-eccef158.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;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,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;AACpB,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AACA,MAAA,OAAO,cAAc,MAAM,CAAA,CAAA;AAAA,KAC7B;AAEA,IAAA,O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I,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;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-
|
|
1
|
+
export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-b9f615fb.esm.js';
|
|
2
2
|
import '@backstage/core-plugin-api';
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import 'event-source-polyfill';
|
|
@@ -10,10 +10,7 @@ import 'react-use/lib/useAsyncRetry';
|
|
|
10
10
|
import '@backstage/core-components';
|
|
11
11
|
import '@material-ui/core';
|
|
12
12
|
import '@backstage/plugin-search-react';
|
|
13
|
-
import '@material-ui/icons/Search';
|
|
14
|
-
import '@material-ui/lab/Autocomplete';
|
|
15
13
|
import 'react-router';
|
|
16
|
-
import 'react-use/lib/useDebounce';
|
|
17
14
|
import '@material-ui/lab';
|
|
18
15
|
import '@material-ui/icons/Close';
|
|
19
16
|
import '@backstage/integration-react';
|
|
@@ -34,4 +31,4 @@ import '@material-ui/icons/Share';
|
|
|
34
31
|
import '@material-ui/styles';
|
|
35
32
|
import '@material-ui/icons/Star';
|
|
36
33
|
import '@material-ui/icons/StarBorder';
|
|
37
|
-
//# sourceMappingURL=index-
|
|
34
|
+
//# sourceMappingURL=index-b7cba14e.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-b7cba14e.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createApiRef, useApi, useAnalytics, configApiRef, createRouteRef, useRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
1
|
+
import { createApiRef, useApi, useAnalytics, configApiRef, createRouteRef, useRouteRef, useRouteRefParams, getComponentData, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension } 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, { useReducer, useRef, useMemo, createContext, useContext, useState, useEffect, useCallback, Children } from 'react';
|
|
@@ -7,12 +7,9 @@ import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage
|
|
|
7
7
|
import useAsync from 'react-use/lib/useAsync';
|
|
8
8
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
9
9
|
import { Link, LogViewer, ErrorPage, useSidebarPinState, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, Progress, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
10
|
-
import { makeStyles, ListItemText, ListItem, ListItemIcon, Divider,
|
|
11
|
-
import { HighlightedSearchResultText, SearchContextProvider, useSearch } from '@backstage/plugin-search-react';
|
|
12
|
-
import SearchIcon from '@material-ui/icons/Search';
|
|
13
|
-
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
10
|
+
import { makeStyles, ListItemText, ListItem, ListItemIcon, Divider, Paper, createStyles, Button, Drawer, Grid, Typography, IconButton, CircularProgress, lighten, alpha, useTheme, withStyles, Tooltip, ThemeProvider, SvgIcon, useMediaQuery, Portal, Toolbar, Box, Menu, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
|
|
11
|
+
import { HighlightedSearchResultText, SearchContextProvider, useSearch, SearchAutocomplete } from '@backstage/plugin-search-react';
|
|
14
12
|
import { useNavigate, useOutlet as useOutlet$1 } from 'react-router';
|
|
15
|
-
import useDebounce from 'react-use/lib/useDebounce';
|
|
16
13
|
import { Alert, Skeleton } from '@material-ui/lab';
|
|
17
14
|
import Close from '@material-ui/icons/Close';
|
|
18
15
|
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
@@ -405,18 +402,22 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
405
402
|
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
406
403
|
};
|
|
407
404
|
|
|
408
|
-
const useStyles$3 = makeStyles({
|
|
405
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
409
406
|
root: {
|
|
410
407
|
width: "100%"
|
|
408
|
+
},
|
|
409
|
+
bar: {
|
|
410
|
+
padding: theme.spacing(1)
|
|
411
411
|
}
|
|
412
|
-
});
|
|
412
|
+
}));
|
|
413
|
+
const isTechDocsSearchResult = (option) => {
|
|
414
|
+
return option == null ? void 0 : option.document;
|
|
415
|
+
};
|
|
413
416
|
const TechDocsSearchBar = (props) => {
|
|
414
417
|
const { entityId, entityTitle, debounceTime = 150 } = props;
|
|
415
418
|
const [open, setOpen] = useState(false);
|
|
416
419
|
const navigate = useNavigate();
|
|
417
420
|
const {
|
|
418
|
-
term,
|
|
419
|
-
setTerm,
|
|
420
421
|
setFilters,
|
|
421
422
|
result: { loading, value: searchVal }
|
|
422
423
|
} = useSearch();
|
|
@@ -432,8 +433,6 @@ const TechDocsSearchBar = (props) => {
|
|
|
432
433
|
mounted = false;
|
|
433
434
|
};
|
|
434
435
|
}, [loading, searchVal]);
|
|
435
|
-
const [value, setValue] = useState(term);
|
|
436
|
-
useDebounce(() => setTerm(value), debounceTime, [value]);
|
|
437
436
|
const { kind, name, namespace } = entityId;
|
|
438
437
|
useEffect(() => {
|
|
439
438
|
setFilters((prevFilters) => {
|
|
@@ -445,19 +444,16 @@ const TechDocsSearchBar = (props) => {
|
|
|
445
444
|
};
|
|
446
445
|
});
|
|
447
446
|
}, [kind, namespace, name, setFilters]);
|
|
448
|
-
const handleQuery = (e) => {
|
|
449
|
-
if (!open) {
|
|
450
|
-
setOpen(true);
|
|
451
|
-
}
|
|
452
|
-
setValue(e.target.value);
|
|
453
|
-
};
|
|
454
447
|
const handleSelection = (_, selection) => {
|
|
455
|
-
if (selection
|
|
448
|
+
if (isTechDocsSearchResult(selection)) {
|
|
456
449
|
const { location } = selection.document;
|
|
457
450
|
navigate(location);
|
|
458
451
|
}
|
|
459
452
|
};
|
|
460
|
-
return /* @__PURE__ */ React.createElement(
|
|
453
|
+
return /* @__PURE__ */ React.createElement(Paper, {
|
|
454
|
+
className: classes.bar,
|
|
455
|
+
variant: "outlined"
|
|
456
|
+
}, /* @__PURE__ */ React.createElement(SearchAutocomplete, {
|
|
461
457
|
classes: { root: classes.root },
|
|
462
458
|
"data-testid": "techdocs-search-bar",
|
|
463
459
|
size: "small",
|
|
@@ -486,29 +482,10 @@ const TechDocsSearchBar = (props) => {
|
|
|
486
482
|
highlight
|
|
487
483
|
}),
|
|
488
484
|
loading,
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
fullWidth: true,
|
|
494
|
-
placeholder: `Search ${entityTitle || entityId.name} docs`,
|
|
495
|
-
value,
|
|
496
|
-
onChange: handleQuery,
|
|
497
|
-
InputProps: {
|
|
498
|
-
...params.InputProps,
|
|
499
|
-
startAdornment: /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
500
|
-
position: "start"
|
|
501
|
-
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
502
|
-
"aria-label": "Query",
|
|
503
|
-
disabled: true
|
|
504
|
-
}, /* @__PURE__ */ React.createElement(SearchIcon, null))),
|
|
505
|
-
endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
506
|
-
color: "inherit",
|
|
507
|
-
size: 20
|
|
508
|
-
}) : null, params.InputProps.endAdornment)
|
|
509
|
-
}
|
|
510
|
-
})
|
|
511
|
-
});
|
|
485
|
+
inputDebounceTime: debounceTime,
|
|
486
|
+
inputPlaceholder: `Search ${entityTitle || entityId.name} docs`,
|
|
487
|
+
freeSolo: false
|
|
488
|
+
}));
|
|
512
489
|
};
|
|
513
490
|
const TechDocsSearch = (props) => {
|
|
514
491
|
const initialState = {
|
|
@@ -1691,7 +1668,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1691
1668
|
window.open(`${parsedUrl.pathname}${parsedUrl.hash}`, "_blank");
|
|
1692
1669
|
} else {
|
|
1693
1670
|
navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
|
|
1694
|
-
(_a = transformedElement == null ? void 0 : transformedElement.querySelector(
|
|
1671
|
+
(_a = transformedElement == null ? void 0 : transformedElement.querySelector(`[id="${parsedUrl.hash.slice(1)}"]`)) == null ? void 0 : _a.scrollIntoView();
|
|
1695
1672
|
}
|
|
1696
1673
|
} else {
|
|
1697
1674
|
if (modifierActive) {
|
|
@@ -1890,16 +1867,13 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1890
1867
|
useEffect(() => {
|
|
1891
1868
|
if (!metadata)
|
|
1892
1869
|
return;
|
|
1893
|
-
setTitle(
|
|
1894
|
-
|
|
1895
|
-
return prevTitle || site_name;
|
|
1896
|
-
});
|
|
1897
|
-
setSubtitle((prevSubtitle) => {
|
|
1870
|
+
setTitle(metadata.site_name);
|
|
1871
|
+
setSubtitle(() => {
|
|
1898
1872
|
let { site_description } = metadata;
|
|
1899
1873
|
if (!site_description || site_description === "None") {
|
|
1900
1874
|
site_description = "Home";
|
|
1901
1875
|
}
|
|
1902
|
-
return
|
|
1876
|
+
return site_description;
|
|
1903
1877
|
});
|
|
1904
1878
|
}, [metadata, setTitle, setSubtitle]);
|
|
1905
1879
|
const appTitle = configApi.getOptional("app.title") || "Backstage";
|
|
@@ -1958,9 +1932,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
1958
1932
|
padding: theme.spacing(3, 3, 0)
|
|
1959
1933
|
}
|
|
1960
1934
|
}));
|
|
1961
|
-
const TechDocsReaderPageSubheader = ({
|
|
1962
|
-
toolbarProps
|
|
1963
|
-
}) => {
|
|
1935
|
+
const TechDocsReaderPageSubheader = (props) => {
|
|
1964
1936
|
const classes = useStyles();
|
|
1965
1937
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
1966
1938
|
const handleClick = useCallback((event) => {
|
|
@@ -1983,7 +1955,7 @@ const TechDocsReaderPageSubheader = ({
|
|
|
1983
1955
|
return null;
|
|
1984
1956
|
return /* @__PURE__ */ React.createElement(Toolbar, {
|
|
1985
1957
|
classes,
|
|
1986
|
-
...toolbarProps
|
|
1958
|
+
...props.toolbarProps
|
|
1987
1959
|
}, /* @__PURE__ */ React.createElement(Box, {
|
|
1988
1960
|
display: "flex",
|
|
1989
1961
|
justifyContent: "flex-end",
|
|
@@ -2017,15 +1989,23 @@ const TechDocsReaderLayout = ({
|
|
|
2017
1989
|
}));
|
|
2018
1990
|
};
|
|
2019
1991
|
const TechDocsReaderPage$1 = (props) => {
|
|
2020
|
-
const { kind, name, namespace } =
|
|
1992
|
+
const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);
|
|
2021
1993
|
const { children, entityRef = { kind, name, namespace } } = props;
|
|
2022
1994
|
const outlet = useOutlet();
|
|
2023
1995
|
if (!children) {
|
|
2024
1996
|
const childrenList = outlet ? Children.toArray(outlet.props.children) : [];
|
|
2025
1997
|
const page = childrenList.find((child) => {
|
|
2026
|
-
var _a
|
|
2027
|
-
|
|
2028
|
-
|
|
1998
|
+
var _a;
|
|
1999
|
+
if (getComponentData(child, TECHDOCS_ADDONS_WRAPPER_KEY)) {
|
|
2000
|
+
return false;
|
|
2001
|
+
}
|
|
2002
|
+
const nestedChildren = (_a = child == null ? void 0 : child.props) == null ? void 0 : _a.children;
|
|
2003
|
+
if (nestedChildren) {
|
|
2004
|
+
return !Children.toArray(nestedChildren).some(
|
|
2005
|
+
(nested) => getComponentData(nested, TECHDOCS_ADDONS_WRAPPER_KEY)
|
|
2006
|
+
);
|
|
2007
|
+
}
|
|
2008
|
+
return true;
|
|
2029
2009
|
});
|
|
2030
2010
|
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, {
|
|
2031
2011
|
entityRef
|
|
@@ -2362,7 +2342,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(
|
|
|
2362
2342
|
const TechDocsCustomHome = techdocsPlugin.provide(
|
|
2363
2343
|
createRoutableExtension({
|
|
2364
2344
|
name: "TechDocsCustomHome",
|
|
2365
|
-
component: () => import('./TechDocsCustomHome-
|
|
2345
|
+
component: () => import('./TechDocsCustomHome-eccef158.esm.js').then(
|
|
2366
2346
|
(m) => m.TechDocsCustomHome
|
|
2367
2347
|
),
|
|
2368
2348
|
mountPoint: rootRouteRef
|
|
@@ -2380,7 +2360,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(
|
|
|
2380
2360
|
const TechDocsReaderPage = techdocsPlugin.provide(
|
|
2381
2361
|
createRoutableExtension({
|
|
2382
2362
|
name: "TechDocsReaderPage",
|
|
2383
|
-
component: () => import('./index-
|
|
2363
|
+
component: () => import('./index-b7cba14e.esm.js').then(
|
|
2384
2364
|
(m) => m.TechDocsReaderPage
|
|
2385
2365
|
),
|
|
2386
2366
|
mountPoint: rootDocsRouteRef
|
|
@@ -2434,7 +2414,7 @@ const EmbeddedDocsRouter = (props) => {
|
|
|
2434
2414
|
}),
|
|
2435
2415
|
children: [
|
|
2436
2416
|
{
|
|
2437
|
-
path: "
|
|
2417
|
+
path: "*",
|
|
2438
2418
|
element: children
|
|
2439
2419
|
}
|
|
2440
2420
|
]
|
|
@@ -2457,4 +2437,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2457
2437
|
});
|
|
2458
2438
|
|
|
2459
2439
|
export { DocsTable as D, EntityTechdocsContent as E, Reader as R, TechDocsPageWrapper as T, DocsCardGrid as a, TechDocsReaderPage$1 as b, TechDocsReaderLayout as c, TechDocsCustomHome as d, TechDocsIndexPage$2 as e, TechdocsPage as f, TechDocsReaderPage as g, techdocsStorageApiRef as h, techdocsApiRef as i, TechDocsClient as j, TechDocsStorageClient as k, TechDocsReaderProvider as l, TechDocsReaderPageHeader as m, TechDocsReaderPageContent as n, TechDocsReaderPageSubheader as o, TechDocsSearchResultListItem as p, TechDocsSearch as q, EntityListDocsGrid as r, EntityListDocsTable as s, techdocsPlugin as t, DefaultTechDocsHome as u, TechDocsPicker as v, isTechDocsAvailable as w, Router as x, EmbeddedDocsRouter as y };
|
|
2460
|
-
//# sourceMappingURL=index-
|
|
2440
|
+
//# sourceMappingURL=index-b9f615fb.esm.js.map
|