@backstage/plugin-techdocs 0.12.3 → 0.12.7
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 +71 -0
- package/config.d.ts +1 -1
- package/dist/index.esm.js +142 -129
- package/dist/index.esm.js.map +1 -1
- package/package.json +18 -18
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createApiRef, createRouteRef, useRouteRef, useApi, configApiRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
2
2
|
import { ResponseError, NotFoundError } from '@backstage/errors';
|
|
3
3
|
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
4
|
-
import
|
|
5
|
-
import React__default, { useEffect, useState, useReducer, useRef, useMemo, useContext, createContext, useCallback } from 'react';
|
|
4
|
+
import React, { useEffect, useState, Suspense, useReducer, useRef, useMemo, useContext, createContext, useCallback } from 'react';
|
|
6
5
|
import { makeStyles, ListItemText, ListItem, Divider, Card, CardMedia, CardContent, CardActions, Grid, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button as Button$1, Drawer, Typography, useTheme } from '@material-ui/core';
|
|
7
6
|
import { Link, SubvalueCell, Table, EmptyState, Button, WarningPanel, CodeSnippet, PageWithHeader, Content, ContentHeader, SupportButton, ItemCardGrid, ItemCardHeader, Progress, ErrorPage, HeaderLabel, Header, Page, HeaderTabs, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
8
7
|
import TextTruncate from 'react-text-truncate';
|
|
@@ -19,13 +18,12 @@ import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
|
|
|
19
18
|
import ReactDOM from 'react-dom';
|
|
20
19
|
import parseGitUrl from 'git-url-parse';
|
|
21
20
|
import DOMPurify from 'dompurify';
|
|
22
|
-
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
23
21
|
import { SearchContextProvider, useSearch } from '@backstage/plugin-search';
|
|
24
22
|
import SearchIcon from '@material-ui/icons/Search';
|
|
23
|
+
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
25
24
|
import { useNavigate, useOutlet } from 'react-router';
|
|
26
25
|
import { Alert } from '@material-ui/lab';
|
|
27
26
|
import Close from '@material-ui/icons/Close';
|
|
28
|
-
import { LazyLog } from 'react-lazylog';
|
|
29
27
|
import CodeIcon from '@material-ui/icons/Code';
|
|
30
28
|
|
|
31
29
|
const techdocsStorageApiRef = createApiRef({
|
|
@@ -183,11 +181,11 @@ const DocsResultListItem = ({
|
|
|
183
181
|
const classes = useStyles$2();
|
|
184
182
|
const TextItem = () => {
|
|
185
183
|
var _a;
|
|
186
|
-
return /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ React.createElement(ListItemText, {
|
|
187
185
|
className: classes.itemText,
|
|
188
186
|
primaryTypographyProps: {variant: "h6"},
|
|
189
187
|
primary: title ? title : `${result.title} | ${(_a = result.entityTitle) != null ? _a : result.name} docs`,
|
|
190
|
-
secondary: /* @__PURE__ */
|
|
188
|
+
secondary: /* @__PURE__ */ React.createElement(TextTruncate, {
|
|
191
189
|
line: lineClamp,
|
|
192
190
|
truncateText: "\u2026",
|
|
193
191
|
text: result.text,
|
|
@@ -195,36 +193,33 @@ const DocsResultListItem = ({
|
|
|
195
193
|
})
|
|
196
194
|
});
|
|
197
195
|
};
|
|
198
|
-
const LinkWrapper = ({children}) => asLink ? /* @__PURE__ */
|
|
196
|
+
const LinkWrapper = ({children}) => asLink ? /* @__PURE__ */ React.createElement(Link, {
|
|
199
197
|
to: result.location
|
|
200
|
-
}, children) : /* @__PURE__ */
|
|
201
|
-
const ListItemWrapper = ({children}) => asListItem ? /* @__PURE__ */
|
|
198
|
+
}, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
199
|
+
const ListItemWrapper = ({children}) => asListItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ListItem, {
|
|
202
200
|
alignItems: "flex-start",
|
|
203
201
|
className: classes.flexContainer
|
|
204
|
-
}, children), /* @__PURE__ */
|
|
202
|
+
}, children), /* @__PURE__ */ React.createElement(Divider, {
|
|
205
203
|
component: "li"
|
|
206
|
-
})) : /* @__PURE__ */
|
|
207
|
-
return /* @__PURE__ */
|
|
204
|
+
})) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
205
|
+
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
208
206
|
};
|
|
209
207
|
|
|
210
208
|
const rootRouteRef = createRouteRef({
|
|
211
|
-
id: "techdocs
|
|
212
|
-
title: "TechDocs Landing Page"
|
|
209
|
+
id: "techdocs:index-page"
|
|
213
210
|
});
|
|
214
211
|
const rootDocsRouteRef = createRouteRef({
|
|
215
|
-
id: "techdocs
|
|
216
|
-
title: "Docs",
|
|
212
|
+
id: "techdocs:reader-page",
|
|
217
213
|
params: ["namespace", "kind", "name"]
|
|
218
214
|
});
|
|
219
215
|
const rootCatalogDocsRouteRef = createRouteRef({
|
|
220
|
-
id: "catalog-
|
|
221
|
-
title: "Docs"
|
|
216
|
+
id: "techdocs:catalog-reader-view"
|
|
222
217
|
});
|
|
223
218
|
|
|
224
219
|
function createCopyDocsUrlAction(copyToClipboard) {
|
|
225
220
|
return (row) => {
|
|
226
221
|
return {
|
|
227
|
-
icon: () => /* @__PURE__ */
|
|
222
|
+
icon: () => /* @__PURE__ */ React.createElement(ShareIcon, {
|
|
228
223
|
fontSize: "small"
|
|
229
224
|
}),
|
|
230
225
|
tooltip: "Click to copy documentation link to clipboard",
|
|
@@ -258,8 +253,8 @@ function createNameColumn() {
|
|
|
258
253
|
title: "Document",
|
|
259
254
|
field: "entity.metadata.name",
|
|
260
255
|
highlight: true,
|
|
261
|
-
render: (row) => /* @__PURE__ */
|
|
262
|
-
value: /* @__PURE__ */
|
|
256
|
+
render: (row) => /* @__PURE__ */ React.createElement(SubvalueCell, {
|
|
257
|
+
value: /* @__PURE__ */ React.createElement(Link, {
|
|
263
258
|
to: row.resolved.docsUrl
|
|
264
259
|
}, customTitle(row.entity)),
|
|
265
260
|
subvalue: row.entity.metadata.description
|
|
@@ -270,7 +265,7 @@ function createOwnerColumn() {
|
|
|
270
265
|
return {
|
|
271
266
|
title: "Owner",
|
|
272
267
|
field: "resolved.ownedByRelationsTitle",
|
|
273
|
-
render: ({resolved}) => /* @__PURE__ */
|
|
268
|
+
render: ({resolved}) => /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
274
269
|
entityRefs: resolved.ownedByRelations,
|
|
275
270
|
defaultKind: "group"
|
|
276
271
|
})
|
|
@@ -299,7 +294,7 @@ const DocsTable$1 = ({
|
|
|
299
294
|
}) => {
|
|
300
295
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
301
296
|
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
|
302
|
-
const toLowerMaybe = useApi(configApiRef).getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? (str) => str : (str) => str.toLocaleLowerCase();
|
|
297
|
+
const toLowerMaybe = useApi(configApiRef).getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? (str) => str : (str) => str.toLocaleLowerCase("en-US");
|
|
303
298
|
if (!entities)
|
|
304
299
|
return null;
|
|
305
300
|
const documents = entities.map((entity) => {
|
|
@@ -326,7 +321,7 @@ const DocsTable$1 = ({
|
|
|
326
321
|
const defaultActions = [
|
|
327
322
|
createCopyDocsUrlAction(copyToClipboard)
|
|
328
323
|
];
|
|
329
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, loading || documents && documents.length > 0 ? /* @__PURE__ */ React.createElement(Table, {
|
|
330
325
|
isLoading: loading,
|
|
331
326
|
options: {
|
|
332
327
|
paging: true,
|
|
@@ -338,11 +333,11 @@ const DocsTable$1 = ({
|
|
|
338
333
|
columns: columns || defaultColumns,
|
|
339
334
|
actions: actions || defaultActions,
|
|
340
335
|
title: title ? `${title} (${documents.length})` : `All (${documents.length})`
|
|
341
|
-
}) : /* @__PURE__ */
|
|
336
|
+
}) : /* @__PURE__ */ React.createElement(EmptyState, {
|
|
342
337
|
missing: "data",
|
|
343
338
|
title: "No documents to show",
|
|
344
339
|
description: "Create your own document. Check out our Getting Started Information",
|
|
345
|
-
action: /* @__PURE__ */
|
|
340
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
346
341
|
color: "primary",
|
|
347
342
|
to: "https://backstage.io/docs/features/techdocs/getting-started",
|
|
348
343
|
variant: "contained"
|
|
@@ -369,15 +364,15 @@ const EntityListDocsTable = ({
|
|
|
369
364
|
createStarEntityAction(isStarredEntity, toggleStarredEntity)
|
|
370
365
|
];
|
|
371
366
|
if (error) {
|
|
372
|
-
return /* @__PURE__ */
|
|
367
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
373
368
|
severity: "error",
|
|
374
369
|
title: "Could not load available documentation."
|
|
375
|
-
}, /* @__PURE__ */
|
|
370
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
376
371
|
language: "text",
|
|
377
372
|
text: error.toString()
|
|
378
373
|
}));
|
|
379
374
|
}
|
|
380
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ React.createElement(DocsTable$1, {
|
|
381
376
|
title,
|
|
382
377
|
entities,
|
|
383
378
|
loading,
|
|
@@ -392,7 +387,7 @@ const TechDocsPageWrapper = ({children}) => {
|
|
|
392
387
|
var _a;
|
|
393
388
|
const configApi = useApi(configApiRef);
|
|
394
389
|
const generatedSubtitle = `Documentation available in ${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"}`;
|
|
395
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ React.createElement(PageWithHeader, {
|
|
396
391
|
title: "Documentation",
|
|
397
392
|
subtitle: generatedSubtitle,
|
|
398
393
|
themeId: "documentation"
|
|
@@ -421,11 +416,11 @@ const DefaultTechDocsHome = ({
|
|
|
421
416
|
columns,
|
|
422
417
|
actions
|
|
423
418
|
}) => {
|
|
424
|
-
return /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
425
420
|
title: ""
|
|
426
|
-
}, /* @__PURE__ */
|
|
421
|
+
}, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(FilteredEntityLayout, null, /* @__PURE__ */ React.createElement(FilterContainer, null, /* @__PURE__ */ React.createElement(TechDocsPicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
|
|
427
422
|
initialFilter
|
|
428
|
-
}), /* @__PURE__ */
|
|
423
|
+
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(EntityListContainer, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, {
|
|
429
424
|
actions,
|
|
430
425
|
columns
|
|
431
426
|
}))))));
|
|
@@ -435,18 +430,18 @@ const DocsCardGrid$1 = ({
|
|
|
435
430
|
entities
|
|
436
431
|
}) => {
|
|
437
432
|
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
|
438
|
-
const toLowerMaybe = useApi(configApiRef).getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? (str) => str : (str) => str.toLocaleLowerCase();
|
|
433
|
+
const toLowerMaybe = useApi(configApiRef).getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? (str) => str : (str) => str.toLocaleLowerCase("en-US");
|
|
439
434
|
if (!entities)
|
|
440
435
|
return null;
|
|
441
|
-
return /* @__PURE__ */
|
|
436
|
+
return /* @__PURE__ */ React.createElement(ItemCardGrid, {
|
|
442
437
|
"data-testid": "docs-explore"
|
|
443
438
|
}, !(entities == null ? void 0 : entities.length) ? null : entities.map((entity, index) => {
|
|
444
439
|
var _a, _b;
|
|
445
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
446
441
|
key: index
|
|
447
|
-
}, /* @__PURE__ */
|
|
442
|
+
}, /* @__PURE__ */ React.createElement(CardMedia, null, /* @__PURE__ */ React.createElement(ItemCardHeader, {
|
|
448
443
|
title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
|
|
449
|
-
})), /* @__PURE__ */
|
|
444
|
+
})), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
450
445
|
to: getRouteToReaderPageFor({
|
|
451
446
|
namespace: toLowerMaybe((_b = entity.metadata.namespace) != null ? _b : "default"),
|
|
452
447
|
kind: toLowerMaybe(entity.kind),
|
|
@@ -466,22 +461,22 @@ var DocsCardGrid$2 = /*#__PURE__*/Object.freeze({
|
|
|
466
461
|
const EntityListDocsGrid = () => {
|
|
467
462
|
const {loading, error, entities} = useEntityListProvider();
|
|
468
463
|
if (error) {
|
|
469
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
470
465
|
severity: "error",
|
|
471
466
|
title: "Could not load available documentation."
|
|
472
|
-
}, /* @__PURE__ */
|
|
467
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
473
468
|
language: "text",
|
|
474
469
|
text: error.toString()
|
|
475
470
|
}));
|
|
476
471
|
}
|
|
477
472
|
if (loading || !entities) {
|
|
478
|
-
return /* @__PURE__ */
|
|
473
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
479
474
|
}
|
|
480
475
|
entities.sort((a, b) => {
|
|
481
476
|
var _a, _b;
|
|
482
477
|
return ((_a = a.metadata.title) != null ? _a : a.metadata.name).localeCompare((_b = b.metadata.title) != null ? _b : b.metadata.name);
|
|
483
478
|
});
|
|
484
|
-
return /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ React.createElement(DocsCardGrid$1, {
|
|
485
480
|
entities
|
|
486
481
|
});
|
|
487
482
|
};
|
|
@@ -635,7 +630,7 @@ Feedback:`);
|
|
|
635
630
|
default:
|
|
636
631
|
return dom;
|
|
637
632
|
}
|
|
638
|
-
ReactDOM.render(
|
|
633
|
+
ReactDOM.render(React.createElement(FeedbackOutlinedIcon), feedbackLink);
|
|
639
634
|
feedbackLink.style.paddingLeft = "5px";
|
|
640
635
|
feedbackLink.title = "Leave feedback for this page";
|
|
641
636
|
feedbackLink.id = "git-feedback-link";
|
|
@@ -800,11 +795,6 @@ const transform = async (html, transformers) => {
|
|
|
800
795
|
return dom;
|
|
801
796
|
};
|
|
802
797
|
|
|
803
|
-
const buildInitialFilters = (legacyPaths, entityId) => {
|
|
804
|
-
return legacyPaths ? entityId : Object.entries(entityId).reduce((acc, [key, value]) => {
|
|
805
|
-
return {...acc, [key]: value == null ? void 0 : value.toLocaleLowerCase("en-US")};
|
|
806
|
-
}, {});
|
|
807
|
-
};
|
|
808
798
|
const TechDocsSearchBar = ({
|
|
809
799
|
entityId,
|
|
810
800
|
debounceTime = 150
|
|
@@ -841,10 +831,10 @@ const TechDocsSearchBar = ({
|
|
|
841
831
|
navigate(location);
|
|
842
832
|
}
|
|
843
833
|
};
|
|
844
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ React.createElement(Grid, {
|
|
845
835
|
item: true,
|
|
846
836
|
xs: 12
|
|
847
|
-
}, /* @__PURE__ */
|
|
837
|
+
}, /* @__PURE__ */ React.createElement(Autocomplete, {
|
|
848
838
|
"data-testid": "techdocs-search-bar",
|
|
849
839
|
size: "small",
|
|
850
840
|
open,
|
|
@@ -863,7 +853,7 @@ const TechDocsSearchBar = ({
|
|
|
863
853
|
noOptionsText: "No results found",
|
|
864
854
|
value: null,
|
|
865
855
|
options,
|
|
866
|
-
renderOption: ({document}) => /* @__PURE__ */
|
|
856
|
+
renderOption: ({document}) => /* @__PURE__ */ React.createElement(DocsResultListItem, {
|
|
867
857
|
result: document,
|
|
868
858
|
lineClamp: 3,
|
|
869
859
|
asListItem: false,
|
|
@@ -871,7 +861,7 @@ const TechDocsSearchBar = ({
|
|
|
871
861
|
title: document.title
|
|
872
862
|
}),
|
|
873
863
|
loading,
|
|
874
|
-
renderInput: (params) => /* @__PURE__ */
|
|
864
|
+
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
|
|
875
865
|
...params,
|
|
876
866
|
"data-testid": "techdocs-search-bar-input",
|
|
877
867
|
variant: "outlined",
|
|
@@ -881,13 +871,13 @@ const TechDocsSearchBar = ({
|
|
|
881
871
|
onChange: handleQuery,
|
|
882
872
|
InputProps: {
|
|
883
873
|
...params.InputProps,
|
|
884
|
-
startAdornment: /* @__PURE__ */
|
|
874
|
+
startAdornment: /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
885
875
|
position: "start"
|
|
886
|
-
}, /* @__PURE__ */
|
|
876
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
887
877
|
"aria-label": "Query",
|
|
888
878
|
disabled: true
|
|
889
|
-
}, /* @__PURE__ */
|
|
890
|
-
endAdornment: /* @__PURE__ */
|
|
879
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null))),
|
|
880
|
+
endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
891
881
|
color: "inherit",
|
|
892
882
|
size: 20
|
|
893
883
|
}) : null, params.InputProps.endAdornment)
|
|
@@ -896,21 +886,20 @@ const TechDocsSearchBar = ({
|
|
|
896
886
|
}));
|
|
897
887
|
};
|
|
898
888
|
const TechDocsSearch = (props) => {
|
|
899
|
-
const configApi = useApi(configApiRef);
|
|
900
|
-
const legacyPaths = configApi.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths");
|
|
901
889
|
const initialState = {
|
|
902
890
|
term: "",
|
|
903
891
|
types: ["techdocs"],
|
|
904
892
|
pageCursor: "",
|
|
905
|
-
filters:
|
|
893
|
+
filters: props.entityId
|
|
906
894
|
};
|
|
907
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, {
|
|
908
896
|
initialState
|
|
909
|
-
}, /* @__PURE__ */
|
|
897
|
+
}, /* @__PURE__ */ React.createElement(TechDocsSearchBar, {
|
|
910
898
|
...props
|
|
911
899
|
}));
|
|
912
900
|
};
|
|
913
901
|
|
|
902
|
+
const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog'));
|
|
914
903
|
const useDrawerStyles = makeStyles((theme) => createStyles({
|
|
915
904
|
paper: {
|
|
916
905
|
width: "100%",
|
|
@@ -952,13 +941,15 @@ const TechDocsBuildLogsDrawerContent = ({
|
|
|
952
941
|
title: "Close the drawer",
|
|
953
942
|
onClick: onClose,
|
|
954
943
|
color: "inherit"
|
|
955
|
-
}, /* @__PURE__ */ React.createElement(Close, null))), /* @__PURE__ */ React.createElement(
|
|
944
|
+
}, /* @__PURE__ */ React.createElement(Close, null))), /* @__PURE__ */ React.createElement(Suspense, {
|
|
945
|
+
fallback: /* @__PURE__ */ React.createElement(Progress, null)
|
|
946
|
+
}, /* @__PURE__ */ React.createElement(LazyLog, {
|
|
956
947
|
text: buildLog.length === 0 ? "Waiting for logs..." : buildLog.join("\n"),
|
|
957
948
|
extraLines: 1,
|
|
958
949
|
follow: true,
|
|
959
950
|
selectableLines: true,
|
|
960
951
|
enableSearch: true
|
|
961
|
-
}));
|
|
952
|
+
})));
|
|
962
953
|
};
|
|
963
954
|
const TechDocsBuildLogs = ({buildLog}) => {
|
|
964
955
|
const classes = useDrawerStyles();
|
|
@@ -983,7 +974,7 @@ const TechDocsNotFound = ({errorMessage}) => {
|
|
|
983
974
|
if (techdocsBuilder !== "local") {
|
|
984
975
|
additionalInfo = "Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not generate docs if they are not found. Make sure the project's docs are generated and published by some external process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to generate docs from this Backstage instance.";
|
|
985
976
|
}
|
|
986
|
-
return /* @__PURE__ */
|
|
977
|
+
return /* @__PURE__ */ React.createElement(ErrorPage, {
|
|
987
978
|
status: "404",
|
|
988
979
|
statusMessage: errorMessage || "Documentation not found",
|
|
989
980
|
additionalInfo
|
|
@@ -1006,64 +997,64 @@ const TechDocsStateIndicator = () => {
|
|
|
1006
997
|
syncErrorMessage,
|
|
1007
998
|
buildLog
|
|
1008
999
|
} = useTechDocsReader();
|
|
1009
|
-
const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */
|
|
1000
|
+
const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */ React.createElement(Progress, null) : null;
|
|
1010
1001
|
if (state === "INITIAL_BUILD") {
|
|
1011
|
-
StateAlert = /* @__PURE__ */
|
|
1002
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1012
1003
|
variant: "outlined",
|
|
1013
1004
|
severity: "info",
|
|
1014
|
-
icon: /* @__PURE__ */
|
|
1005
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
1015
1006
|
size: "24px"
|
|
1016
1007
|
}),
|
|
1017
|
-
action: /* @__PURE__ */
|
|
1008
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1018
1009
|
buildLog
|
|
1019
1010
|
})
|
|
1020
1011
|
}, "Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster.");
|
|
1021
1012
|
}
|
|
1022
1013
|
if (state === "CONTENT_STALE_REFRESHING") {
|
|
1023
|
-
StateAlert = /* @__PURE__ */
|
|
1014
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1024
1015
|
variant: "outlined",
|
|
1025
1016
|
severity: "info",
|
|
1026
|
-
icon: /* @__PURE__ */
|
|
1017
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
1027
1018
|
size: "24px"
|
|
1028
1019
|
}),
|
|
1029
|
-
action: /* @__PURE__ */
|
|
1020
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1030
1021
|
buildLog
|
|
1031
1022
|
})
|
|
1032
1023
|
}, "A newer version of this documentation is being prepared and will be available shortly.");
|
|
1033
1024
|
}
|
|
1034
1025
|
if (state === "CONTENT_STALE_READY") {
|
|
1035
|
-
StateAlert = /* @__PURE__ */
|
|
1026
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1036
1027
|
variant: "outlined",
|
|
1037
1028
|
severity: "success",
|
|
1038
|
-
action: /* @__PURE__ */
|
|
1029
|
+
action: /* @__PURE__ */ React.createElement(Button$1, {
|
|
1039
1030
|
color: "inherit",
|
|
1040
1031
|
onClick: () => contentReload()
|
|
1041
1032
|
}, "Refresh")
|
|
1042
1033
|
}, "A newer version of this documentation is now available, please refresh to view.");
|
|
1043
1034
|
}
|
|
1044
1035
|
if (state === "CONTENT_STALE_ERROR") {
|
|
1045
|
-
StateAlert = /* @__PURE__ */
|
|
1036
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1046
1037
|
variant: "outlined",
|
|
1047
1038
|
severity: "error",
|
|
1048
|
-
action: /* @__PURE__ */
|
|
1039
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1049
1040
|
buildLog
|
|
1050
1041
|
}),
|
|
1051
1042
|
classes: {message: classes.message}
|
|
1052
1043
|
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage);
|
|
1053
1044
|
}
|
|
1054
1045
|
if (state === "CONTENT_NOT_FOUND") {
|
|
1055
|
-
StateAlert = /* @__PURE__ */
|
|
1046
|
+
StateAlert = /* @__PURE__ */ React.createElement(React.Fragment, null, syncErrorMessage && /* @__PURE__ */ React.createElement(Alert, {
|
|
1056
1047
|
variant: "outlined",
|
|
1057
1048
|
severity: "error",
|
|
1058
|
-
action: /* @__PURE__ */
|
|
1049
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1059
1050
|
buildLog
|
|
1060
1051
|
}),
|
|
1061
1052
|
classes: {message: classes.message}
|
|
1062
|
-
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage), /* @__PURE__ */
|
|
1053
|
+
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage), /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1063
1054
|
errorMessage: contentErrorMessage
|
|
1064
1055
|
}));
|
|
1065
1056
|
}
|
|
1066
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, ReaderProgress, StateAlert);
|
|
1067
1058
|
};
|
|
1068
1059
|
|
|
1069
1060
|
function calculateDisplayState({
|
|
@@ -1224,23 +1215,29 @@ const useStyles = makeStyles((theme) => ({
|
|
|
1224
1215
|
}
|
|
1225
1216
|
}));
|
|
1226
1217
|
const TechDocsReaderContext = createContext({});
|
|
1227
|
-
const TechDocsReaderProvider = ({
|
|
1228
|
-
|
|
1218
|
+
const TechDocsReaderProvider = ({
|
|
1219
|
+
children,
|
|
1220
|
+
entityRef
|
|
1221
|
+
}) => {
|
|
1222
|
+
const {"*": path} = useParams();
|
|
1223
|
+
const {kind, namespace, name} = entityRef;
|
|
1229
1224
|
const value = useReaderState(kind, namespace, name, path);
|
|
1230
|
-
return /* @__PURE__ */
|
|
1225
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
|
|
1231
1226
|
value
|
|
1232
1227
|
}, children);
|
|
1233
1228
|
};
|
|
1234
|
-
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */
|
|
1229
|
+
const withTechDocsReaderProvider = (Component, entityRef) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, {
|
|
1230
|
+
entityRef
|
|
1231
|
+
}, /* @__PURE__ */ React.createElement(Component, {
|
|
1235
1232
|
...props
|
|
1236
1233
|
}));
|
|
1237
1234
|
const useTechDocsReader = () => useContext(TechDocsReaderContext);
|
|
1238
|
-
const useTechDocsReaderDom = () => {
|
|
1235
|
+
const useTechDocsReaderDom = (entityRef) => {
|
|
1239
1236
|
const navigate = useNavigate$1();
|
|
1240
1237
|
const theme = useTheme();
|
|
1241
1238
|
const techdocsStorageApi = useApi(techdocsStorageApiRef);
|
|
1242
1239
|
const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
|
|
1243
|
-
const {namespace = "", kind = "", name = ""} =
|
|
1240
|
+
const {namespace = "", kind = "", name = ""} = entityRef;
|
|
1244
1241
|
const {state, path, content: rawPage} = useTechDocsReader();
|
|
1245
1242
|
const [sidebars, setSidebars] = useState();
|
|
1246
1243
|
const [dom, setDom] = useState(null);
|
|
@@ -1295,6 +1292,7 @@ const useTechDocsReaderDom = () => {
|
|
|
1295
1292
|
.md-footer-nav__link { width: 20rem;}
|
|
1296
1293
|
.md-content { margin-left: 20rem; max-width: calc(100% - 20rem * 2 - 3rem); }
|
|
1297
1294
|
.md-typeset { font-size: 1rem; }
|
|
1295
|
+
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-weight: bold; }
|
|
1298
1296
|
.md-nav { font-size: 1rem; }
|
|
1299
1297
|
.md-grid { max-width: 90vw; margin: 0 }
|
|
1300
1298
|
.md-typeset table:not([class]) {
|
|
@@ -1310,6 +1308,16 @@ const useTechDocsReaderDom = () => {
|
|
|
1310
1308
|
.md-typeset .admonition, .md-typeset details {
|
|
1311
1309
|
font-size: 1rem;
|
|
1312
1310
|
}
|
|
1311
|
+
|
|
1312
|
+
/* style the checkmarks of the task list */
|
|
1313
|
+
.md-typeset .task-list-control .task-list-indicator::before {
|
|
1314
|
+
background-color: ${theme.palette.action.disabledBackground};
|
|
1315
|
+
}
|
|
1316
|
+
.md-typeset .task-list-control [type="checkbox"]:checked + .task-list-indicator:before {
|
|
1317
|
+
background-color: ${theme.palette.success.main};
|
|
1318
|
+
}
|
|
1319
|
+
/**/
|
|
1320
|
+
|
|
1313
1321
|
@media screen and (max-width: 76.1875em) {
|
|
1314
1322
|
.md-nav {
|
|
1315
1323
|
background-color: ${theme.palette.background.default};
|
|
@@ -1376,8 +1384,8 @@ const useTechDocsReaderDom = () => {
|
|
|
1376
1384
|
--md-details-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
|
|
1377
1385
|
}
|
|
1378
1386
|
:host {
|
|
1379
|
-
--md-tasklist-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="
|
|
1380
|
-
--md-tasklist-icon--checked: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="
|
|
1387
|
+
--md-tasklist-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>');
|
|
1388
|
+
--md-tasklist-icon--checked: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
|
|
1381
1389
|
}
|
|
1382
1390
|
`
|
|
1383
1391
|
})
|
|
@@ -1387,9 +1395,11 @@ const useTechDocsReaderDom = () => {
|
|
|
1387
1395
|
namespace,
|
|
1388
1396
|
scmIntegrationsApi,
|
|
1389
1397
|
techdocsStorageApi,
|
|
1398
|
+
theme.palette.action.disabledBackground,
|
|
1390
1399
|
theme.palette.background.default,
|
|
1391
1400
|
theme.palette.background.paper,
|
|
1392
1401
|
theme.palette.primary.main,
|
|
1402
|
+
theme.palette.success.main,
|
|
1393
1403
|
theme.palette.text.primary,
|
|
1394
1404
|
theme.typography.fontFamily
|
|
1395
1405
|
]);
|
|
@@ -1398,13 +1408,14 @@ const useTechDocsReaderDom = () => {
|
|
|
1398
1408
|
addLinkClickListener({
|
|
1399
1409
|
baseUrl: window.location.origin,
|
|
1400
1410
|
onClick: (_, url) => {
|
|
1401
|
-
var _a;
|
|
1411
|
+
var _a, _b;
|
|
1402
1412
|
const parsedUrl = new URL(url);
|
|
1403
1413
|
if (parsedUrl.hash) {
|
|
1404
1414
|
navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
|
|
1405
1415
|
(_a = transformedElement == null ? void 0 : transformedElement.querySelector(`#${parsedUrl.hash.slice(1)}`)) == null ? void 0 : _a.scrollIntoView();
|
|
1406
1416
|
} else {
|
|
1407
1417
|
navigate(parsedUrl.pathname);
|
|
1418
|
+
(_b = transformedElement == null ? void 0 : transformedElement.querySelector(".md-content__inner")) == null ? void 0 : _b.scrollIntoView();
|
|
1408
1419
|
}
|
|
1409
1420
|
}
|
|
1410
1421
|
}),
|
|
@@ -1451,7 +1462,7 @@ const TheReader = ({
|
|
|
1451
1462
|
}) => {
|
|
1452
1463
|
var _a, _b;
|
|
1453
1464
|
const classes = useStyles();
|
|
1454
|
-
const dom = useTechDocsReaderDom();
|
|
1465
|
+
const dom = useTechDocsReaderDom(entityRef);
|
|
1455
1466
|
const shadowDomRef = useRef(null);
|
|
1456
1467
|
const onReadyRef = useRef(onReady);
|
|
1457
1468
|
useEffect(() => {
|
|
@@ -1466,12 +1477,12 @@ const TheReader = ({
|
|
|
1466
1477
|
shadowRoot.appendChild(dom);
|
|
1467
1478
|
onReadyRef.current();
|
|
1468
1479
|
}, [dom]);
|
|
1469
|
-
return /* @__PURE__ */
|
|
1480
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null), withSearch && ((_b = (_a = shadowDomRef == null ? void 0 : shadowDomRef.current) == null ? void 0 : _a.shadowRoot) == null ? void 0 : _b.innerHTML) && /* @__PURE__ */ React.createElement(Grid, {
|
|
1470
1481
|
container: true,
|
|
1471
1482
|
className: classes.searchBar
|
|
1472
|
-
}, /* @__PURE__ */
|
|
1483
|
+
}, /* @__PURE__ */ React.createElement(TechDocsSearch, {
|
|
1473
1484
|
entityId: entityRef
|
|
1474
|
-
})), /* @__PURE__ */
|
|
1485
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1475
1486
|
"data-testid": "techdocs-content-shadowroot",
|
|
1476
1487
|
ref: shadowDomRef
|
|
1477
1488
|
}));
|
|
@@ -1481,7 +1492,9 @@ const Reader = ({
|
|
|
1481
1492
|
onReady = () => {
|
|
1482
1493
|
},
|
|
1483
1494
|
withSearch = true
|
|
1484
|
-
}) => /* @__PURE__ */
|
|
1495
|
+
}) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, {
|
|
1496
|
+
entityRef
|
|
1497
|
+
}, /* @__PURE__ */ React.createElement(TheReader, {
|
|
1485
1498
|
entityRef,
|
|
1486
1499
|
onReady,
|
|
1487
1500
|
withSearch
|
|
@@ -1498,34 +1511,34 @@ const TechDocsPageHeader = ({
|
|
|
1498
1511
|
const lifecycle = spec == null ? void 0 : spec.lifecycle;
|
|
1499
1512
|
const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
|
|
1500
1513
|
const docsRootLink = useRouteRef(rootRouteRef)();
|
|
1501
|
-
const labels = /* @__PURE__ */
|
|
1514
|
+
const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1502
1515
|
label: "Component",
|
|
1503
|
-
value: /* @__PURE__ */
|
|
1516
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLink, {
|
|
1504
1517
|
color: "inherit",
|
|
1505
1518
|
entityRef,
|
|
1506
1519
|
defaultKind: "Component"
|
|
1507
1520
|
})
|
|
1508
|
-
}), ownedByRelations.length > 0 && /* @__PURE__ */
|
|
1521
|
+
}), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1509
1522
|
label: "Owner",
|
|
1510
|
-
value: /* @__PURE__ */
|
|
1523
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
1511
1524
|
color: "inherit",
|
|
1512
1525
|
entityRefs: ownedByRelations,
|
|
1513
1526
|
defaultKind: "group"
|
|
1514
1527
|
})
|
|
1515
|
-
}), lifecycle ? /* @__PURE__ */
|
|
1528
|
+
}), lifecycle ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1516
1529
|
label: "Lifecycle",
|
|
1517
1530
|
value: lifecycle
|
|
1518
|
-
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */
|
|
1531
|
+
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1519
1532
|
label: "",
|
|
1520
|
-
value: /* @__PURE__ */
|
|
1533
|
+
value: /* @__PURE__ */ React.createElement("a", {
|
|
1521
1534
|
href: locationMetadata.target,
|
|
1522
1535
|
target: "_blank",
|
|
1523
1536
|
rel: "noopener noreferrer"
|
|
1524
|
-
}, /* @__PURE__ */
|
|
1537
|
+
}, /* @__PURE__ */ React.createElement(CodeIcon, {
|
|
1525
1538
|
style: {marginTop: "-25px", fill: "#fff"}
|
|
1526
1539
|
}))
|
|
1527
1540
|
}) : null);
|
|
1528
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ React.createElement(Header, {
|
|
1529
1542
|
title: siteName ? siteName : ".",
|
|
1530
1543
|
pageTitleOverride: siteName || name,
|
|
1531
1544
|
subtitle: siteDescription && siteDescription !== "None" ? siteDescription : "",
|
|
@@ -1551,13 +1564,13 @@ const LegacyTechDocsPage = () => {
|
|
|
1551
1564
|
setDocumentReady(true);
|
|
1552
1565
|
}, [setDocumentReady]);
|
|
1553
1566
|
if (entityMetadataError) {
|
|
1554
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1555
1568
|
errorMessage: entityMetadataError.message
|
|
1556
1569
|
});
|
|
1557
1570
|
}
|
|
1558
|
-
return /* @__PURE__ */
|
|
1571
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1559
1572
|
themeId: "documentation"
|
|
1560
|
-
}, /* @__PURE__ */
|
|
1573
|
+
}, /* @__PURE__ */ React.createElement(TechDocsPageHeader, {
|
|
1561
1574
|
techDocsMetadata: techdocsMetadataValue,
|
|
1562
1575
|
entityMetadata: entityMetadataValue,
|
|
1563
1576
|
entityRef: {
|
|
@@ -1565,9 +1578,9 @@ const LegacyTechDocsPage = () => {
|
|
|
1565
1578
|
namespace,
|
|
1566
1579
|
name
|
|
1567
1580
|
}
|
|
1568
|
-
}), /* @__PURE__ */
|
|
1581
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1569
1582
|
"data-testid": "techdocs-content"
|
|
1570
|
-
}, /* @__PURE__ */
|
|
1583
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
1571
1584
|
onReady,
|
|
1572
1585
|
entityRef: {
|
|
1573
1586
|
kind,
|
|
@@ -1595,13 +1608,13 @@ const TechDocsPage = ({children}) => {
|
|
|
1595
1608
|
setDocumentReady(true);
|
|
1596
1609
|
}, [setDocumentReady]);
|
|
1597
1610
|
if (entityMetadataError) {
|
|
1598
|
-
return /* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1599
1612
|
errorMessage: entityMetadataError.message
|
|
1600
1613
|
});
|
|
1601
1614
|
}
|
|
1602
1615
|
if (!children)
|
|
1603
|
-
return outlet || /* @__PURE__ */
|
|
1604
|
-
return /* @__PURE__ */
|
|
1616
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsPage, null);
|
|
1617
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1605
1618
|
themeId: "documentation"
|
|
1606
1619
|
}, children instanceof Function ? children({
|
|
1607
1620
|
techdocsMetadataValue,
|
|
@@ -1643,12 +1656,12 @@ const CustomPanel = ({
|
|
|
1643
1656
|
}
|
|
1644
1657
|
return typeof config.filterPredicate === "function" && config.filterPredicate(entity);
|
|
1645
1658
|
});
|
|
1646
|
-
return /* @__PURE__ */
|
|
1659
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
1647
1660
|
title: config.title,
|
|
1648
1661
|
description: config.description
|
|
1649
|
-
}, index === 0 ? /* @__PURE__ */
|
|
1662
|
+
}, index === 0 ? /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.") : null), /* @__PURE__ */ React.createElement("div", {
|
|
1650
1663
|
className: classes.panelContainer
|
|
1651
|
-
}, /* @__PURE__ */
|
|
1664
|
+
}, /* @__PURE__ */ React.createElement(Panel, {
|
|
1652
1665
|
"data-testid": "techdocs-custom-panel",
|
|
1653
1666
|
entities: shownEntities
|
|
1654
1667
|
})));
|
|
@@ -1683,27 +1696,27 @@ const TechDocsCustomHome = ({
|
|
|
1683
1696
|
});
|
|
1684
1697
|
const currentTabConfig = tabsConfig[selectedTab];
|
|
1685
1698
|
if (loading) {
|
|
1686
|
-
return /* @__PURE__ */
|
|
1699
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Progress, null)));
|
|
1687
1700
|
}
|
|
1688
1701
|
if (error) {
|
|
1689
|
-
return /* @__PURE__ */
|
|
1702
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
1690
1703
|
severity: "error",
|
|
1691
1704
|
title: "Could not load available documentation."
|
|
1692
|
-
}, /* @__PURE__ */
|
|
1705
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
1693
1706
|
language: "text",
|
|
1694
1707
|
text: error.toString()
|
|
1695
1708
|
}))));
|
|
1696
1709
|
}
|
|
1697
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(HeaderTabs, {
|
|
1698
1711
|
selectedIndex: selectedTab,
|
|
1699
1712
|
onChange: (index) => setSelectedTab(index),
|
|
1700
1713
|
tabs: tabsConfig.map(({label}, index) => ({
|
|
1701
1714
|
id: index.toString(),
|
|
1702
1715
|
label
|
|
1703
1716
|
}))
|
|
1704
|
-
}), /* @__PURE__ */
|
|
1717
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1705
1718
|
"data-testid": "techdocs-content"
|
|
1706
|
-
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */
|
|
1719
|
+
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */ React.createElement(CustomPanel, {
|
|
1707
1720
|
key: index,
|
|
1708
1721
|
config,
|
|
1709
1722
|
entities: !!entities ? entities : [],
|
|
@@ -1741,14 +1754,14 @@ const LegacyTechDocsHome = () => {
|
|
|
1741
1754
|
]
|
|
1742
1755
|
}
|
|
1743
1756
|
];
|
|
1744
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ React.createElement(TechDocsCustomHome, {
|
|
1745
1758
|
tabsConfig
|
|
1746
1759
|
});
|
|
1747
1760
|
};
|
|
1748
1761
|
|
|
1749
1762
|
const TechDocsIndexPage = () => {
|
|
1750
1763
|
const outlet = useOutlet();
|
|
1751
|
-
return outlet || /* @__PURE__ */
|
|
1764
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsHome, null);
|
|
1752
1765
|
};
|
|
1753
1766
|
|
|
1754
1767
|
var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1758,7 +1771,7 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
1758
1771
|
|
|
1759
1772
|
const EntityPageDocs = ({entity}) => {
|
|
1760
1773
|
var _a;
|
|
1761
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ React.createElement(Reader, {
|
|
1762
1775
|
withSearch: false,
|
|
1763
1776
|
entityRef: {
|
|
1764
1777
|
kind: entity.kind,
|
|
@@ -1774,12 +1787,12 @@ const isTechDocsAvailable = (entity) => {
|
|
|
1774
1787
|
return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[TECHDOCS_ANNOTATION]);
|
|
1775
1788
|
};
|
|
1776
1789
|
const Router = () => {
|
|
1777
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1778
1791
|
path: "/",
|
|
1779
|
-
element: /* @__PURE__ */
|
|
1780
|
-
}), /* @__PURE__ */
|
|
1792
|
+
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
1793
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
1781
1794
|
path: "/:namespace/:kind/:name/*",
|
|
1782
|
-
element: /* @__PURE__ */
|
|
1795
|
+
element: /* @__PURE__ */ React.createElement(TechDocsPage, null)
|
|
1783
1796
|
}));
|
|
1784
1797
|
};
|
|
1785
1798
|
const EmbeddedDocsRouter = (_props) => {
|
|
@@ -1787,13 +1800,13 @@ const EmbeddedDocsRouter = (_props) => {
|
|
|
1787
1800
|
const {entity} = useEntity();
|
|
1788
1801
|
const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
|
|
1789
1802
|
if (!projectId) {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
|
|
1791
1804
|
annotation: TECHDOCS_ANNOTATION
|
|
1792
1805
|
});
|
|
1793
1806
|
}
|
|
1794
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1795
1808
|
path: "/*",
|
|
1796
|
-
element: /* @__PURE__ */
|
|
1809
|
+
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
1797
1810
|
entity
|
|
1798
1811
|
})
|
|
1799
1812
|
}));
|