@backstage/plugin-techdocs 1.1.1-next.3 → 1.1.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 +24 -0
- package/dist/esm/{TechDocsCustomHome-b77adc6d.esm.js → TechDocsCustomHome-cd82e45b.esm.js} +3 -3
- package/dist/esm/{TechDocsCustomHome-b77adc6d.esm.js.map → TechDocsCustomHome-cd82e45b.esm.js.map} +1 -1
- package/dist/esm/{index-52f21300.esm.js → index-aaf89f6d.esm.js} +5 -5
- package/dist/esm/index-aaf89f6d.esm.js.map +1 -0
- package/dist/esm/{index-c537b1f3.esm.js → index-dd16232a.esm.js} +172 -171
- package/dist/esm/index-dd16232a.esm.js.map +1 -0
- package/dist/index.d.ts +49 -49
- package/dist/index.esm.js +4 -4
- package/package.json +16 -16
- package/dist/esm/index-52f21300.esm.js.map +0 -1
- package/dist/esm/index-c537b1f3.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 52419be116: Create a menu in the sub header of documentation pages, it is responsible for rendering TechDocs addons that allow users to customize their reading experience.
|
|
8
|
+
- a307a14be0: Removed dependency on `@backstage/core-app-api`.
|
|
9
|
+
- bed0d64ce9: Fixed bugs that prevented a 404 error from being shown when it should have been.
|
|
10
|
+
- 2efee91251: Add a `sub-route` path on the EntityDocs page to fix the blank screen error when navigating using sidebar links.
|
|
11
|
+
- 2dcb2c9678: Loading SVGs correctly with `bota` with extended characters
|
|
12
|
+
- 52fddad92d: The `TechDocsStorageApi` and its associated ref are now exported by `@backstage/plugin-techdocs-react`. The API interface, ref, and types are now deprecated in `@backstage/plugin-techdocs` and will be removed in a future release.
|
|
13
|
+
- 0ad901569f: Hidden exports related to experimental TechDocs reader functionality have been removed and can no longer be imported. In the unlikely event you were using these exports, you can now take advantage of the officially supported and generally available TechDocs Addon framework instead.
|
|
14
|
+
- 3a74e203a8: Updated search result components to support rendering content with highlighted matched terms
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/core-components@0.9.4
|
|
17
|
+
- @backstage/integration@1.2.0
|
|
18
|
+
- @backstage/core-plugin-api@1.0.2
|
|
19
|
+
- @backstage/plugin-catalog-react@1.1.0
|
|
20
|
+
- @backstage/integration-react@1.1.0
|
|
21
|
+
- @backstage/plugin-techdocs-react@1.0.0
|
|
22
|
+
- @backstage/config@1.0.1
|
|
23
|
+
- @backstage/plugin-search-react@0.2.0
|
|
24
|
+
- @backstage/plugin-search-common@0.3.4
|
|
25
|
+
- @backstage/catalog-model@1.0.2
|
|
26
|
+
|
|
3
27
|
## 1.1.1-next.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -2,13 +2,14 @@ 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-dd16232a.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
11
|
import '@backstage/plugin-techdocs-react';
|
|
12
|
+
import 'react-use/lib/useAsyncRetry';
|
|
12
13
|
import 'jss';
|
|
13
14
|
import '@material-ui/styles';
|
|
14
15
|
import '@backstage/plugin-search-react';
|
|
@@ -18,7 +19,6 @@ import 'react-router';
|
|
|
18
19
|
import 'react-use/lib/useDebounce';
|
|
19
20
|
import '@material-ui/lab';
|
|
20
21
|
import '@material-ui/icons/Close';
|
|
21
|
-
import 'react-use/lib/useAsyncRetry';
|
|
22
22
|
import '@material-ui/core/styles';
|
|
23
23
|
import '@backstage/integration-react';
|
|
24
24
|
import '@backstage/integration';
|
|
@@ -132,4 +132,4 @@ const TechDocsCustomHome = (props) => {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
export { TechDocsCustomHome };
|
|
135
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
135
|
+
//# sourceMappingURL=TechDocsCustomHome-cd82e45b.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-b77adc6d.esm.js.map → TechDocsCustomHome-cd82e45b.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-cd82e45b.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,CAAC;AACF,MAAM,WAAW,GAAG,CAAC;AACrB,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,CAAC,KAAK;AACN,EAAE,MAAM,SAAS,G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;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;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-
|
|
1
|
+
export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-dd16232a.esm.js';
|
|
2
2
|
import '@backstage/core-plugin-api';
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import 'event-source-polyfill';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-router-dom';
|
|
7
|
-
import '@backstage/core-components';
|
|
8
7
|
import '@backstage/plugin-techdocs-react';
|
|
8
|
+
import 'react-use/lib/useAsync';
|
|
9
|
+
import 'react-use/lib/useAsyncRetry';
|
|
10
|
+
import '@backstage/core-components';
|
|
9
11
|
import 'jss';
|
|
10
12
|
import '@material-ui/core';
|
|
11
13
|
import '@material-ui/styles';
|
|
@@ -16,8 +18,6 @@ import 'react-router';
|
|
|
16
18
|
import 'react-use/lib/useDebounce';
|
|
17
19
|
import '@material-ui/lab';
|
|
18
20
|
import '@material-ui/icons/Close';
|
|
19
|
-
import 'react-use/lib/useAsync';
|
|
20
|
-
import 'react-use/lib/useAsyncRetry';
|
|
21
21
|
import '@material-ui/core/styles';
|
|
22
22
|
import '@backstage/integration-react';
|
|
23
23
|
import '@backstage/integration';
|
|
@@ -36,4 +36,4 @@ import 'lodash';
|
|
|
36
36
|
import '@material-ui/icons/Share';
|
|
37
37
|
import '@material-ui/icons/Star';
|
|
38
38
|
import '@material-ui/icons/StarBorder';
|
|
39
|
-
//# sourceMappingURL=index-
|
|
39
|
+
//# sourceMappingURL=index-aaf89f6d.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-aaf89f6d.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createApiRef, useApi, configApiRef, createRouteRef, useRouteRef, 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
|
-
import React, {
|
|
4
|
+
import React, { useReducer, useRef, useMemo, createContext, useContext, useState, useEffect, useCallback, Children } from 'react';
|
|
5
5
|
import { useParams, useNavigate as useNavigate$1, useOutlet, Routes, Route } from 'react-router-dom';
|
|
6
|
-
import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
7
6
|
import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage, useTechDocsAddons, TechDocsAddonLocations, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider, techdocsApiRef as techdocsApiRef$1 } from '@backstage/plugin-techdocs-react';
|
|
7
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
8
|
+
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
9
|
+
import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
8
10
|
import { create } from 'jss';
|
|
9
11
|
import { makeStyles, ListItemText, ListItem, Divider, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button, Drawer, Grid, Typography, withStyles, Tooltip, ThemeProvider, SvgIcon, useTheme, Portal, Toolbar, Box, Menu, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
|
|
10
12
|
import { jssPreset, StylesProvider, withStyles as withStyles$1 } from '@material-ui/styles';
|
|
@@ -15,8 +17,6 @@ import { useNavigate, useOutlet as useOutlet$1 } from 'react-router';
|
|
|
15
17
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
16
18
|
import { Alert, Skeleton } from '@material-ui/lab';
|
|
17
19
|
import Close from '@material-ui/icons/Close';
|
|
18
|
-
import useAsync from 'react-use/lib/useAsync';
|
|
19
|
-
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
20
20
|
import { lighten, alpha } from '@material-ui/core/styles';
|
|
21
21
|
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
22
22
|
import { replaceGitHubUrlType } from '@backstage/integration';
|
|
@@ -153,6 +153,169 @@ class TechDocsStorageClient {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
function calculateDisplayState({
|
|
157
|
+
contentLoading,
|
|
158
|
+
content,
|
|
159
|
+
activeSyncState
|
|
160
|
+
}) {
|
|
161
|
+
if (contentLoading) {
|
|
162
|
+
return "CHECKING";
|
|
163
|
+
}
|
|
164
|
+
if (activeSyncState === "BUILD_READY_RELOAD") {
|
|
165
|
+
return "CHECKING";
|
|
166
|
+
}
|
|
167
|
+
if (!content && activeSyncState === "CHECKING") {
|
|
168
|
+
return "CHECKING";
|
|
169
|
+
}
|
|
170
|
+
if (!content && activeSyncState === "BUILDING") {
|
|
171
|
+
return "INITIAL_BUILD";
|
|
172
|
+
}
|
|
173
|
+
if (!content) {
|
|
174
|
+
return "CONTENT_NOT_FOUND";
|
|
175
|
+
}
|
|
176
|
+
if (activeSyncState === "BUILDING") {
|
|
177
|
+
return "CONTENT_STALE_REFRESHING";
|
|
178
|
+
}
|
|
179
|
+
if (activeSyncState === "BUILD_READY") {
|
|
180
|
+
return "CONTENT_STALE_READY";
|
|
181
|
+
}
|
|
182
|
+
if (activeSyncState === "ERROR") {
|
|
183
|
+
return "CONTENT_STALE_ERROR";
|
|
184
|
+
}
|
|
185
|
+
return "CONTENT_FRESH";
|
|
186
|
+
}
|
|
187
|
+
function reducer(oldState, action) {
|
|
188
|
+
const newState = { ...oldState };
|
|
189
|
+
switch (action.type) {
|
|
190
|
+
case "sync":
|
|
191
|
+
if (action.state === "CHECKING") {
|
|
192
|
+
newState.buildLog = [];
|
|
193
|
+
}
|
|
194
|
+
newState.activeSyncState = action.state;
|
|
195
|
+
newState.syncError = action.syncError;
|
|
196
|
+
break;
|
|
197
|
+
case "contentLoading":
|
|
198
|
+
newState.contentLoading = true;
|
|
199
|
+
newState.contentError = void 0;
|
|
200
|
+
break;
|
|
201
|
+
case "content":
|
|
202
|
+
if (typeof action.path === "string") {
|
|
203
|
+
newState.path = action.path;
|
|
204
|
+
}
|
|
205
|
+
newState.contentLoading = false;
|
|
206
|
+
newState.content = action.content;
|
|
207
|
+
newState.contentError = action.contentError;
|
|
208
|
+
break;
|
|
209
|
+
case "buildLog":
|
|
210
|
+
newState.buildLog = newState.buildLog.concat(action.log);
|
|
211
|
+
break;
|
|
212
|
+
default:
|
|
213
|
+
throw new Error();
|
|
214
|
+
}
|
|
215
|
+
if (["BUILD_READY", "BUILD_READY_RELOAD"].includes(newState.activeSyncState) && ["contentLoading", "content"].includes(action.type)) {
|
|
216
|
+
newState.activeSyncState = "UP_TO_DATE";
|
|
217
|
+
newState.buildLog = [];
|
|
218
|
+
}
|
|
219
|
+
return newState;
|
|
220
|
+
}
|
|
221
|
+
function useReaderState(kind, namespace, name, path) {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
224
|
+
activeSyncState: "CHECKING",
|
|
225
|
+
path,
|
|
226
|
+
contentLoading: true,
|
|
227
|
+
buildLog: []
|
|
228
|
+
});
|
|
229
|
+
const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
|
|
230
|
+
const { retry: contentReload } = useAsyncRetry(async () => {
|
|
231
|
+
dispatch({ type: "contentLoading" });
|
|
232
|
+
try {
|
|
233
|
+
const entityDocs = await techdocsStorageApi.getEntityDocs({ kind, namespace, name }, path);
|
|
234
|
+
dispatch({ type: "content", content: entityDocs, path });
|
|
235
|
+
return entityDocs;
|
|
236
|
+
} catch (e) {
|
|
237
|
+
dispatch({ type: "content", contentError: e, path });
|
|
238
|
+
}
|
|
239
|
+
return void 0;
|
|
240
|
+
}, [techdocsStorageApi, kind, namespace, name, path]);
|
|
241
|
+
const contentRef = useRef({
|
|
242
|
+
content: void 0,
|
|
243
|
+
reload: () => {
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
contentRef.current = { content: state.content, reload: contentReload };
|
|
247
|
+
useAsync(async () => {
|
|
248
|
+
dispatch({ type: "sync", state: "CHECKING" });
|
|
249
|
+
const buildingTimeout = setTimeout(() => {
|
|
250
|
+
dispatch({ type: "sync", state: "BUILDING" });
|
|
251
|
+
}, 1e3);
|
|
252
|
+
try {
|
|
253
|
+
const result = await techdocsStorageApi.syncEntityDocs({
|
|
254
|
+
kind,
|
|
255
|
+
namespace,
|
|
256
|
+
name
|
|
257
|
+
}, (log) => {
|
|
258
|
+
dispatch({ type: "buildLog", log });
|
|
259
|
+
});
|
|
260
|
+
switch (result) {
|
|
261
|
+
case "updated":
|
|
262
|
+
if (!contentRef.current.content) {
|
|
263
|
+
contentRef.current.reload();
|
|
264
|
+
dispatch({ type: "sync", state: "BUILD_READY_RELOAD" });
|
|
265
|
+
} else {
|
|
266
|
+
dispatch({ type: "sync", state: "BUILD_READY" });
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "cached":
|
|
270
|
+
dispatch({ type: "sync", state: "UP_TO_DATE" });
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
dispatch({
|
|
274
|
+
type: "sync",
|
|
275
|
+
state: "ERROR",
|
|
276
|
+
syncError: new Error("Unexpected return state")
|
|
277
|
+
});
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
} catch (e) {
|
|
281
|
+
dispatch({ type: "sync", state: "ERROR", syncError: e });
|
|
282
|
+
} finally {
|
|
283
|
+
clearTimeout(buildingTimeout);
|
|
284
|
+
}
|
|
285
|
+
}, [kind, name, namespace, techdocsStorageApi, dispatch, contentRef]);
|
|
286
|
+
const displayState = useMemo(() => calculateDisplayState({
|
|
287
|
+
activeSyncState: state.activeSyncState,
|
|
288
|
+
contentLoading: state.contentLoading,
|
|
289
|
+
content: state.content
|
|
290
|
+
}), [state.activeSyncState, state.content, state.contentLoading]);
|
|
291
|
+
return {
|
|
292
|
+
state: displayState,
|
|
293
|
+
contentReload,
|
|
294
|
+
path: state.path,
|
|
295
|
+
content: state.content,
|
|
296
|
+
contentErrorMessage: (_a = state.contentError) == null ? void 0 : _a.toString(),
|
|
297
|
+
syncErrorMessage: (_b = state.syncError) == null ? void 0 : _b.toString(),
|
|
298
|
+
buildLog: state.buildLog
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const TechDocsReaderContext = createContext({});
|
|
303
|
+
const useTechDocsReader = () => useContext(TechDocsReaderContext);
|
|
304
|
+
const TechDocsReaderProvider = ({
|
|
305
|
+
children
|
|
306
|
+
}) => {
|
|
307
|
+
const { "*": path = "" } = useParams();
|
|
308
|
+
const { entityRef } = useTechDocsReaderPage();
|
|
309
|
+
const { kind, namespace, name } = entityRef;
|
|
310
|
+
const value = useReaderState(kind, namespace, name, path);
|
|
311
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
|
|
312
|
+
value
|
|
313
|
+
}, children instanceof Function ? children(value) : children);
|
|
314
|
+
};
|
|
315
|
+
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
|
|
316
|
+
...props
|
|
317
|
+
}));
|
|
318
|
+
|
|
156
319
|
const useStyles$4 = makeStyles({
|
|
157
320
|
flexContainer: {
|
|
158
321
|
flexWrap: "wrap"
|
|
@@ -499,169 +662,6 @@ const TechDocsStateIndicator = () => {
|
|
|
499
662
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, ReaderProgress, StateAlert);
|
|
500
663
|
};
|
|
501
664
|
|
|
502
|
-
function calculateDisplayState({
|
|
503
|
-
contentLoading,
|
|
504
|
-
content,
|
|
505
|
-
activeSyncState
|
|
506
|
-
}) {
|
|
507
|
-
if (contentLoading) {
|
|
508
|
-
return "CHECKING";
|
|
509
|
-
}
|
|
510
|
-
if (activeSyncState === "BUILD_READY_RELOAD") {
|
|
511
|
-
return "CHECKING";
|
|
512
|
-
}
|
|
513
|
-
if (!content && activeSyncState === "CHECKING") {
|
|
514
|
-
return "CHECKING";
|
|
515
|
-
}
|
|
516
|
-
if (!content && activeSyncState === "BUILDING") {
|
|
517
|
-
return "INITIAL_BUILD";
|
|
518
|
-
}
|
|
519
|
-
if (!content) {
|
|
520
|
-
return "CONTENT_NOT_FOUND";
|
|
521
|
-
}
|
|
522
|
-
if (activeSyncState === "BUILDING") {
|
|
523
|
-
return "CONTENT_STALE_REFRESHING";
|
|
524
|
-
}
|
|
525
|
-
if (activeSyncState === "BUILD_READY") {
|
|
526
|
-
return "CONTENT_STALE_READY";
|
|
527
|
-
}
|
|
528
|
-
if (activeSyncState === "ERROR") {
|
|
529
|
-
return "CONTENT_STALE_ERROR";
|
|
530
|
-
}
|
|
531
|
-
return "CONTENT_FRESH";
|
|
532
|
-
}
|
|
533
|
-
function reducer(oldState, action) {
|
|
534
|
-
const newState = { ...oldState };
|
|
535
|
-
switch (action.type) {
|
|
536
|
-
case "sync":
|
|
537
|
-
if (action.state === "CHECKING") {
|
|
538
|
-
newState.buildLog = [];
|
|
539
|
-
}
|
|
540
|
-
newState.activeSyncState = action.state;
|
|
541
|
-
newState.syncError = action.syncError;
|
|
542
|
-
break;
|
|
543
|
-
case "contentLoading":
|
|
544
|
-
newState.contentLoading = true;
|
|
545
|
-
newState.contentError = void 0;
|
|
546
|
-
break;
|
|
547
|
-
case "content":
|
|
548
|
-
if (typeof action.path === "string") {
|
|
549
|
-
newState.path = action.path;
|
|
550
|
-
}
|
|
551
|
-
newState.contentLoading = false;
|
|
552
|
-
newState.content = action.content;
|
|
553
|
-
newState.contentError = action.contentError;
|
|
554
|
-
break;
|
|
555
|
-
case "buildLog":
|
|
556
|
-
newState.buildLog = newState.buildLog.concat(action.log);
|
|
557
|
-
break;
|
|
558
|
-
default:
|
|
559
|
-
throw new Error();
|
|
560
|
-
}
|
|
561
|
-
if (["BUILD_READY", "BUILD_READY_RELOAD"].includes(newState.activeSyncState) && ["contentLoading", "content"].includes(action.type)) {
|
|
562
|
-
newState.activeSyncState = "UP_TO_DATE";
|
|
563
|
-
newState.buildLog = [];
|
|
564
|
-
}
|
|
565
|
-
return newState;
|
|
566
|
-
}
|
|
567
|
-
function useReaderState(kind, namespace, name, path) {
|
|
568
|
-
var _a, _b;
|
|
569
|
-
const [state, dispatch] = useReducer(reducer, {
|
|
570
|
-
activeSyncState: "CHECKING",
|
|
571
|
-
path,
|
|
572
|
-
contentLoading: true,
|
|
573
|
-
buildLog: []
|
|
574
|
-
});
|
|
575
|
-
const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
|
|
576
|
-
const { retry: contentReload } = useAsyncRetry(async () => {
|
|
577
|
-
dispatch({ type: "contentLoading" });
|
|
578
|
-
try {
|
|
579
|
-
const entityDocs = await techdocsStorageApi.getEntityDocs({ kind, namespace, name }, path);
|
|
580
|
-
dispatch({ type: "content", content: entityDocs, path });
|
|
581
|
-
return entityDocs;
|
|
582
|
-
} catch (e) {
|
|
583
|
-
dispatch({ type: "content", contentError: e, path });
|
|
584
|
-
}
|
|
585
|
-
return void 0;
|
|
586
|
-
}, [techdocsStorageApi, kind, namespace, name, path]);
|
|
587
|
-
const contentRef = useRef({
|
|
588
|
-
content: void 0,
|
|
589
|
-
reload: () => {
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
contentRef.current = { content: state.content, reload: contentReload };
|
|
593
|
-
useAsync(async () => {
|
|
594
|
-
dispatch({ type: "sync", state: "CHECKING" });
|
|
595
|
-
const buildingTimeout = setTimeout(() => {
|
|
596
|
-
dispatch({ type: "sync", state: "BUILDING" });
|
|
597
|
-
}, 1e3);
|
|
598
|
-
try {
|
|
599
|
-
const result = await techdocsStorageApi.syncEntityDocs({
|
|
600
|
-
kind,
|
|
601
|
-
namespace,
|
|
602
|
-
name
|
|
603
|
-
}, (log) => {
|
|
604
|
-
dispatch({ type: "buildLog", log });
|
|
605
|
-
});
|
|
606
|
-
switch (result) {
|
|
607
|
-
case "updated":
|
|
608
|
-
if (!contentRef.current.content) {
|
|
609
|
-
contentRef.current.reload();
|
|
610
|
-
dispatch({ type: "sync", state: "BUILD_READY_RELOAD" });
|
|
611
|
-
} else {
|
|
612
|
-
dispatch({ type: "sync", state: "BUILD_READY" });
|
|
613
|
-
}
|
|
614
|
-
break;
|
|
615
|
-
case "cached":
|
|
616
|
-
dispatch({ type: "sync", state: "UP_TO_DATE" });
|
|
617
|
-
break;
|
|
618
|
-
default:
|
|
619
|
-
dispatch({
|
|
620
|
-
type: "sync",
|
|
621
|
-
state: "ERROR",
|
|
622
|
-
syncError: new Error("Unexpected return state")
|
|
623
|
-
});
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
} catch (e) {
|
|
627
|
-
dispatch({ type: "sync", state: "ERROR", syncError: e });
|
|
628
|
-
} finally {
|
|
629
|
-
clearTimeout(buildingTimeout);
|
|
630
|
-
}
|
|
631
|
-
}, [kind, name, namespace, techdocsStorageApi, dispatch, contentRef]);
|
|
632
|
-
const displayState = useMemo(() => calculateDisplayState({
|
|
633
|
-
activeSyncState: state.activeSyncState,
|
|
634
|
-
contentLoading: state.contentLoading,
|
|
635
|
-
content: state.content
|
|
636
|
-
}), [state.activeSyncState, state.content, state.contentLoading]);
|
|
637
|
-
return {
|
|
638
|
-
state: displayState,
|
|
639
|
-
contentReload,
|
|
640
|
-
path: state.path,
|
|
641
|
-
content: state.content,
|
|
642
|
-
contentErrorMessage: (_a = state.contentError) == null ? void 0 : _a.toString(),
|
|
643
|
-
syncErrorMessage: (_b = state.syncError) == null ? void 0 : _b.toString(),
|
|
644
|
-
buildLog: state.buildLog
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
const TechDocsReaderContext = createContext({});
|
|
649
|
-
const useTechDocsReader = () => useContext(TechDocsReaderContext);
|
|
650
|
-
const TechDocsReaderProvider = ({
|
|
651
|
-
children
|
|
652
|
-
}) => {
|
|
653
|
-
const { "*": path = "" } = useParams();
|
|
654
|
-
const { entityRef } = useTechDocsReaderPage();
|
|
655
|
-
const { kind, namespace, name } = entityRef;
|
|
656
|
-
const value = useReaderState(kind, namespace, name, path);
|
|
657
|
-
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
|
|
658
|
-
value
|
|
659
|
-
}, children instanceof Function ? children(value) : children);
|
|
660
|
-
};
|
|
661
|
-
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
|
|
662
|
-
...props
|
|
663
|
-
}));
|
|
664
|
-
|
|
665
665
|
const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
|
|
666
666
|
const isSrcToSvg = attrName === "src" && attrVal.endsWith(".svg");
|
|
667
667
|
const isRelativeUrl = !attrVal.match(/^([a-z]*:)?\/\//i);
|
|
@@ -2182,7 +2182,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2182
2182
|
}));
|
|
2183
2183
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2184
2184
|
name: "TechDocsCustomHome",
|
|
2185
|
-
component: () => import('./TechDocsCustomHome-
|
|
2185
|
+
component: () => import('./TechDocsCustomHome-cd82e45b.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2186
2186
|
mountPoint: rootRouteRef
|
|
2187
2187
|
}));
|
|
2188
2188
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
@@ -2192,7 +2192,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2192
2192
|
}));
|
|
2193
2193
|
const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
|
|
2194
2194
|
name: "TechDocsReaderPage",
|
|
2195
|
-
component: () => import('./index-
|
|
2195
|
+
component: () => import('./index-aaf89f6d.esm.js').then((m) => m.TechDocsReaderPage),
|
|
2196
2196
|
mountPoint: rootDocsRouteRef
|
|
2197
2197
|
}));
|
|
2198
2198
|
|
|
@@ -2240,6 +2240,7 @@ const EmbeddedDocsRouter = (props) => {
|
|
|
2240
2240
|
});
|
|
2241
2241
|
}
|
|
2242
2242
|
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
2243
|
+
path: "*",
|
|
2243
2244
|
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
2244
2245
|
entity
|
|
2245
2246
|
})
|
|
@@ -2253,5 +2254,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2253
2254
|
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
2254
2255
|
});
|
|
2255
2256
|
|
|
2256
|
-
export {
|
|
2257
|
-
//# sourceMappingURL=index-
|
|
2257
|
+
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 };
|
|
2258
|
+
//# sourceMappingURL=index-dd16232a.esm.js.map
|