@backstage/plugin-techdocs 1.0.1 → 1.1.1-next.0

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 CHANGED
@@ -1,11 +1,226 @@
1
1
  # @backstage/plugin-techdocs
2
2
 
3
+ ## 1.1.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - a307a14be0: Removed dependency on `@backstage/core-app-api`.
8
+ - bed0d64ce9: Fixed bugs that prevented a 404 error from being shown when it should have been.
9
+ - Updated dependencies
10
+ - @backstage/integration@1.2.0-next.0
11
+ - @backstage/plugin-catalog-react@1.1.0-next.0
12
+ - @backstage/integration-react@1.1.0-next.0
13
+ - @backstage/plugin-search-react@0.1.1-next.0
14
+ - @backstage/plugin-techdocs-react@0.1.1-next.0
15
+
16
+ ## 1.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - ace749b785: TechDocs supports a new, experimental method of customization: addons!
21
+
22
+ To customize the standalone TechDocs reader page experience, update your `/packages/app/src/App.tsx` in the following way:
23
+
24
+ ```diff
25
+ import { TechDocsIndexPage, TechDocsReaderPage } from '@backstage/plugin-techdocs';
26
+ + import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
27
+ + import { SomeAddon } from '@backstage/plugin-some-plugin';
28
+
29
+ // ...
30
+
31
+ <Route path="/docs" element={<TechDocsIndexPage />} />
32
+ <Route
33
+ path="/docs/:namespace/:kind/:name/*"
34
+ element={<TechDocsReaderPage />}
35
+ >
36
+ + <TechDocsAddons>
37
+ + <SomeAddon />
38
+ + </TechDocsAddons>
39
+ </Route>
40
+
41
+ // ...
42
+ ```
43
+
44
+ To customize the TechDocs reader experience on the Catalog entity page, update your `packages/app/src/components/catalog/EntityPage.tsx` in the following way:
45
+
46
+ ```diff
47
+ import { EntityTechdocsContent } from '@backstage/plugin-techdocs';
48
+ + import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
49
+ + import { SomeAddon } from '@backstage/plugin-some-plugin';
50
+
51
+ // ...
52
+
53
+ <EntityLayoutWrapper>
54
+ <EntityLayout.Route path="/" title="Overview">
55
+ {overviewContent}
56
+ </EntityLayout.Route>
57
+
58
+ <EntityLayout.Route path="/docs" title="Docs">
59
+ - <EntityTechDocsContent />
60
+ + <EntityTechdocsContent>
61
+ + <TechDocsAddons>
62
+ + <SomeAddon />
63
+ + </TechDocsAddons>
64
+ + </EntityTechdocsContent>
65
+ </EntityLayout.Route>
66
+ </EntityLayoutWrapper>
67
+
68
+ // ...
69
+ ```
70
+
71
+ If you do not wish to customize your TechDocs reader experience in this way at this time, no changes are necessary!
72
+
73
+ ### Patch Changes
74
+
75
+ - ab230a433f: imports from `@backstage/plugin-search-react` instead of `@backstage/plugin-search`
76
+ - 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
77
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
78
+ - 230ad0826f: Bump to using `@types/node` v16
79
+ - f0fb9153b7: Fix broken query selectors on techdocs
80
+ - 9975ff9852: Applied the fix from version 1.0.1 of this package, which is part of the v1.0.2 release of Backstage.
81
+ - 3ba256c389: Fixed a bug preventing custom TechDocs reader page implementations from rendering without being double-wrapped in the `<TechDocsReaderPage />` component.
82
+ - fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
83
+ - 0152c0de22: Some documentation layout tweaks:
84
+
85
+ - drawer toggle margins
86
+ - code block margins
87
+ - sidebar drawer width
88
+ - inner content width
89
+ - footer link width
90
+ - sidebar table of contents scroll
91
+
92
+ - 3ba256c389: Fixed a bug that caused addons in the `Subheader` location to break the default TechDocs reader page layout.
93
+ - Updated dependencies
94
+ - @backstage/integration@1.1.0
95
+ - @backstage/plugin-catalog-react@1.0.1
96
+ - @backstage/catalog-model@1.0.1
97
+ - @backstage/core-app-api@1.0.1
98
+ - @backstage/core-components@0.9.3
99
+ - @backstage/core-plugin-api@1.0.1
100
+ - @backstage/plugin-search-react@0.1.0
101
+ - @backstage/plugin-techdocs-react@0.1.0
102
+ - @backstage/integration-react@1.0.1
103
+
104
+ ## 1.1.0-next.3
105
+
106
+ ### Minor Changes
107
+
108
+ - ace749b785: TechDocs supports a new, experimental method of customization: addons!
109
+
110
+ To customize the standalone TechDocs reader page experience, update your `/packages/app/src/App.tsx` in the following way:
111
+
112
+ ```diff
113
+ import { TechDocsIndexPage, TechDocsReaderPage } from '@backstage/plugin-techdocs';
114
+ + import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
115
+ + import { SomeAddon } from '@backstage/plugin-some-plugin';
116
+
117
+ // ...
118
+
119
+ <Route path="/docs" element={<TechDocsIndexPage />} />
120
+ <Route
121
+ path="/docs/:namespace/:kind/:name/*"
122
+ element={<TechDocsReaderPage />}
123
+ >
124
+ + <TechDocsAddons>
125
+ + <SomeAddon />
126
+ + </TechDocsAddons>
127
+ </Route>
128
+
129
+ // ...
130
+ ```
131
+
132
+ To customize the TechDocs reader experience on the Catalog entity page, update your `packages/app/src/components/catalog/EntityPage.tsx` in the following way:
133
+
134
+ ```diff
135
+ import { EntityTechdocsContent } from '@backstage/plugin-techdocs';
136
+ + import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
137
+ + import { SomeAddon } from '@backstage/plugin-some-plugin';
138
+
139
+ // ...
140
+
141
+ <EntityLayoutWrapper>
142
+ <EntityLayout.Route path="/" title="Overview">
143
+ {overviewContent}
144
+ </EntityLayout.Route>
145
+
146
+ <EntityLayout.Route path="/docs" title="Docs">
147
+ - <EntityTechDocsContent />
148
+ + <EntityTechdocsContent>
149
+ + <TechDocsAddons>
150
+ + <SomeAddon />
151
+ + </TechDocsAddons>
152
+ + </EntityTechdocsContent>
153
+ </EntityLayout.Route>
154
+ </EntityLayoutWrapper>
155
+
156
+ // ...
157
+ ```
158
+
159
+ If you do not wish to customize your TechDocs reader experience in this way at this time, no changes are necessary!
160
+
161
+ ### Patch Changes
162
+
163
+ - ab230a433f: imports from `@backstage/plugin-search-react` instead of `@backstage/plugin-search`
164
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
165
+ - 230ad0826f: Bump to using `@types/node` v16
166
+ - Updated dependencies
167
+ - @backstage/core-app-api@1.0.1-next.1
168
+ - @backstage/core-components@0.9.3-next.2
169
+ - @backstage/core-plugin-api@1.0.1-next.0
170
+ - @backstage/integration-react@1.0.1-next.2
171
+ - @backstage/plugin-catalog-react@1.0.1-next.3
172
+ - @backstage/plugin-search-react@0.1.0-next.0
173
+ - @backstage/integration@1.1.0-next.2
174
+ - @backstage/plugin-techdocs-react@0.1.0-next.0
175
+
176
+ ## 1.0.1-next.2
177
+
178
+ ### Patch Changes
179
+
180
+ - f0fb9153b7: Fix broken query selectors on techdocs
181
+ - 9975ff9852: Applied the fix from version 1.0.1 of this package, which is part of the v1.0.2 release of Backstage.
182
+ - Updated dependencies
183
+ - @backstage/core-components@0.9.3-next.1
184
+ - @backstage/plugin-catalog-react@1.0.1-next.2
185
+ - @backstage/catalog-model@1.0.1-next.1
186
+
3
187
  ## 1.0.1
4
188
 
5
189
  ### Patch Changes
6
190
 
7
191
  - Pin the `event-source-polyfill` dependency to version 1.0.25
8
192
 
193
+ ## 1.0.1-next.1
194
+
195
+ ### Patch Changes
196
+
197
+ - 0152c0de22: Some documentation layout tweaks:
198
+
199
+ - drawer toggle margins
200
+ - code block margins
201
+ - sidebar drawer width
202
+ - inner content width
203
+ - footer link width
204
+ - sidebar table of contents scroll
205
+
206
+ - Updated dependencies
207
+ - @backstage/integration@1.1.0-next.1
208
+ - @backstage/plugin-catalog-react@1.0.1-next.1
209
+ - @backstage/integration-react@1.0.1-next.1
210
+
211
+ ## 1.0.1-next.0
212
+
213
+ ### Patch Changes
214
+
215
+ - fe53fe97d7: Fix permalink scrolling for anchors where the id starts with a number.
216
+ - Updated dependencies
217
+ - @backstage/catalog-model@1.0.1-next.0
218
+ - @backstage/plugin-search@0.7.5-next.0
219
+ - @backstage/integration@1.0.1-next.0
220
+ - @backstage/plugin-catalog-react@1.0.1-next.0
221
+ - @backstage/core-components@0.9.3-next.0
222
+ - @backstage/integration-react@1.0.1-next.0
223
+
9
224
  ## 1.0.0
10
225
 
11
226
  ### Major Changes
@@ -2,21 +2,17 @@ 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 { TechDocsPageWrapper, DocsTable, DocsCardGrid } from '../index.esm.js';
5
+ import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-3d3f8718.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';
9
9
  import 'event-source-polyfill';
10
10
  import 'react-router-dom';
11
- import '@backstage/integration-react';
12
- import '@backstage/integration';
13
- import '@material-ui/icons/FeedbackOutlined';
14
- import 'react-dom';
15
- import 'git-url-parse';
16
- import '@material-ui/icons/Menu';
17
- import 'dompurify';
11
+ import '@backstage/plugin-techdocs-react';
12
+ import 'jss';
13
+ import '@material-ui/styles';
18
14
  import 'react-text-truncate';
19
- import '@backstage/plugin-search';
15
+ import '@backstage/plugin-search-react';
20
16
  import '@material-ui/icons/Search';
21
17
  import '@material-ui/lab/Autocomplete';
22
18
  import 'react-router';
@@ -24,12 +20,20 @@ import 'react-use/lib/useDebounce';
24
20
  import '@material-ui/lab';
25
21
  import '@material-ui/icons/Close';
26
22
  import 'react-use/lib/useAsyncRetry';
23
+ import '@material-ui/core/styles';
24
+ import '@backstage/integration-react';
25
+ import '@backstage/integration';
26
+ import '@material-ui/icons/FeedbackOutlined';
27
+ import 'react-dom';
28
+ import 'git-url-parse';
29
+ import '@material-ui/icons/Menu';
30
+ import 'dompurify';
31
+ import 'react-helmet';
27
32
  import '@material-ui/icons/Code';
28
33
  import '@backstage/catalog-model';
29
34
  import 'react-use/lib/useCopyToClipboard';
30
35
  import 'lodash';
31
36
  import '@material-ui/icons/Share';
32
- import '@material-ui/styles';
33
37
  import '@material-ui/icons/Star';
34
38
  import '@material-ui/icons/StarBorder';
35
39
 
@@ -128,4 +132,4 @@ const TechDocsCustomHome = (props) => {
128
132
  };
129
133
 
130
134
  export { TechDocsCustomHome };
131
- //# sourceMappingURL=TechDocsCustomHome-174c6f0d.esm.js.map
135
+ //# sourceMappingURL=TechDocsCustomHome-7836f59f.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TechDocsCustomHome-174c6f0d.esm.js","sources":["../../src/home/components/TechDocsCustomHome.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\nimport { CSSProperties } from '@material-ui/styles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\nconst CustomPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref': CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AAAA,CAAA,CAAA;AAwCF,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,CAKI,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACV,GAAA,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,QAAW,GAAA,EAAA;AAAA,KAAA;AAAA,GAAA,CAAA,CAAA;AAG5C,EAAA,MAAM,OAAU,GAAA,SAAA,EAAA,CAAA;AAChB,EAAM,MAAA,E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CAAA,CAAA;AAAA,GAAA;AAOnD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAD,IACE,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAD,EAAA;AAAA,IACE,aAAe,EAAA,WAAA;AAAA,IACf,QAAA,EAAU,WAAS,cAAe,CAAA,KAAA,CAAA;AAAA,IAClC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,SAAS,KAAW,MAAA;AAAA,MAC1C,IAAI,KAAM,CAAA,QAAA,EAAA;AAAA,MACV,KAAA;AAAA,KAAA,CAAA,CAAA;AAAA,GAAA,CAAA,sCAGH,OAAD,EAAA;AAAA,IAAS,aAAY,EAAA,kBAAA;AAAA,GAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAQ,EAAA,KAAA,yCACnC,WAAD,EAAA;AAAA,IACE,GAAK,EAAA,KAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,QAAW,GAAA,EAAA;AAAA,IAClC,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"TechDocsCustomHome-7836f59f.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,MAAM,GAAG;AACf,EAAE,SAAS;AACX,EAAE,YAAY;AACd,CAAC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AAkB;AACrC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,qBAAqB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACrG,IAAI,GAAG,EAAE,KAAK;AACd,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,GAAG,QAAQ,GAAG,EAAE;AACxC,IAAI,KAAK;AACT,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR;;;;"}
@@ -0,0 +1,39 @@
1
+ export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-3d3f8718.esm.js';
2
+ import '@backstage/core-plugin-api';
3
+ import '@backstage/errors';
4
+ import 'event-source-polyfill';
5
+ import 'react';
6
+ import 'react-router-dom';
7
+ import '@backstage/core-components';
8
+ import '@backstage/plugin-techdocs-react';
9
+ import 'jss';
10
+ import '@material-ui/core';
11
+ import '@material-ui/styles';
12
+ import 'react-text-truncate';
13
+ import '@backstage/plugin-search-react';
14
+ import '@material-ui/icons/Search';
15
+ import '@material-ui/lab/Autocomplete';
16
+ import 'react-router';
17
+ import 'react-use/lib/useDebounce';
18
+ import '@material-ui/lab';
19
+ import '@material-ui/icons/Close';
20
+ import 'react-use/lib/useAsync';
21
+ import 'react-use/lib/useAsyncRetry';
22
+ import '@material-ui/core/styles';
23
+ import '@backstage/integration-react';
24
+ import '@backstage/integration';
25
+ import '@material-ui/icons/FeedbackOutlined';
26
+ import 'react-dom';
27
+ import 'git-url-parse';
28
+ import '@material-ui/icons/Menu';
29
+ import 'dompurify';
30
+ import 'react-helmet';
31
+ import '@material-ui/icons/Code';
32
+ import '@backstage/plugin-catalog-react';
33
+ import '@backstage/catalog-model';
34
+ import 'react-use/lib/useCopyToClipboard';
35
+ import 'lodash';
36
+ import '@material-ui/icons/Share';
37
+ import '@material-ui/icons/Star';
38
+ import '@material-ui/icons/StarBorder';
39
+ //# sourceMappingURL=index-28e41621.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-28e41621.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}