@backstage/plugin-techdocs 0.0.0-nightly-202192722215 → 0.0.0-nightly-2021101422237
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 +41 -8
- package/dist/index.esm.js +108 -113
- package/dist/index.esm.js.map +1 -1
- package/package.json +17 -17
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,16 +193,16 @@ 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({
|
|
@@ -224,7 +222,7 @@ const rootCatalogDocsRouteRef = createRouteRef({
|
|
|
224
222
|
function createCopyDocsUrlAction(copyToClipboard) {
|
|
225
223
|
return (row) => {
|
|
226
224
|
return {
|
|
227
|
-
icon: () => /* @__PURE__ */
|
|
225
|
+
icon: () => /* @__PURE__ */ React.createElement(ShareIcon, {
|
|
228
226
|
fontSize: "small"
|
|
229
227
|
}),
|
|
230
228
|
tooltip: "Click to copy documentation link to clipboard",
|
|
@@ -258,8 +256,8 @@ function createNameColumn() {
|
|
|
258
256
|
title: "Document",
|
|
259
257
|
field: "entity.metadata.name",
|
|
260
258
|
highlight: true,
|
|
261
|
-
render: (row) => /* @__PURE__ */
|
|
262
|
-
value: /* @__PURE__ */
|
|
259
|
+
render: (row) => /* @__PURE__ */ React.createElement(SubvalueCell, {
|
|
260
|
+
value: /* @__PURE__ */ React.createElement(Link, {
|
|
263
261
|
to: row.resolved.docsUrl
|
|
264
262
|
}, customTitle(row.entity)),
|
|
265
263
|
subvalue: row.entity.metadata.description
|
|
@@ -270,7 +268,7 @@ function createOwnerColumn() {
|
|
|
270
268
|
return {
|
|
271
269
|
title: "Owner",
|
|
272
270
|
field: "resolved.ownedByRelationsTitle",
|
|
273
|
-
render: ({resolved}) => /* @__PURE__ */
|
|
271
|
+
render: ({resolved}) => /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
274
272
|
entityRefs: resolved.ownedByRelations,
|
|
275
273
|
defaultKind: "group"
|
|
276
274
|
})
|
|
@@ -326,7 +324,7 @@ const DocsTable$1 = ({
|
|
|
326
324
|
const defaultActions = [
|
|
327
325
|
createCopyDocsUrlAction(copyToClipboard)
|
|
328
326
|
];
|
|
329
|
-
return /* @__PURE__ */
|
|
327
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, loading || documents && documents.length > 0 ? /* @__PURE__ */ React.createElement(Table, {
|
|
330
328
|
isLoading: loading,
|
|
331
329
|
options: {
|
|
332
330
|
paging: true,
|
|
@@ -338,11 +336,11 @@ const DocsTable$1 = ({
|
|
|
338
336
|
columns: columns || defaultColumns,
|
|
339
337
|
actions: actions || defaultActions,
|
|
340
338
|
title: title ? `${title} (${documents.length})` : `All (${documents.length})`
|
|
341
|
-
}) : /* @__PURE__ */
|
|
339
|
+
}) : /* @__PURE__ */ React.createElement(EmptyState, {
|
|
342
340
|
missing: "data",
|
|
343
341
|
title: "No documents to show",
|
|
344
342
|
description: "Create your own document. Check out our Getting Started Information",
|
|
345
|
-
action: /* @__PURE__ */
|
|
343
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
346
344
|
color: "primary",
|
|
347
345
|
to: "https://backstage.io/docs/features/techdocs/getting-started",
|
|
348
346
|
variant: "contained"
|
|
@@ -369,15 +367,15 @@ const EntityListDocsTable = ({
|
|
|
369
367
|
createStarEntityAction(isStarredEntity, toggleStarredEntity)
|
|
370
368
|
];
|
|
371
369
|
if (error) {
|
|
372
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
373
371
|
severity: "error",
|
|
374
372
|
title: "Could not load available documentation."
|
|
375
|
-
}, /* @__PURE__ */
|
|
373
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
376
374
|
language: "text",
|
|
377
375
|
text: error.toString()
|
|
378
376
|
}));
|
|
379
377
|
}
|
|
380
|
-
return /* @__PURE__ */
|
|
378
|
+
return /* @__PURE__ */ React.createElement(DocsTable$1, {
|
|
381
379
|
title,
|
|
382
380
|
entities,
|
|
383
381
|
loading,
|
|
@@ -392,7 +390,7 @@ const TechDocsPageWrapper = ({children}) => {
|
|
|
392
390
|
var _a;
|
|
393
391
|
const configApi = useApi(configApiRef);
|
|
394
392
|
const generatedSubtitle = `Documentation available in ${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"}`;
|
|
395
|
-
return /* @__PURE__ */
|
|
393
|
+
return /* @__PURE__ */ React.createElement(PageWithHeader, {
|
|
396
394
|
title: "Documentation",
|
|
397
395
|
subtitle: generatedSubtitle,
|
|
398
396
|
themeId: "documentation"
|
|
@@ -421,11 +419,11 @@ const DefaultTechDocsHome = ({
|
|
|
421
419
|
columns,
|
|
422
420
|
actions
|
|
423
421
|
}) => {
|
|
424
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
425
423
|
title: ""
|
|
426
|
-
}, /* @__PURE__ */
|
|
424
|
+
}, /* @__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
425
|
initialFilter
|
|
428
|
-
}), /* @__PURE__ */
|
|
426
|
+
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(EntityListContainer, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, {
|
|
429
427
|
actions,
|
|
430
428
|
columns
|
|
431
429
|
}))))));
|
|
@@ -438,15 +436,15 @@ const DocsCardGrid$1 = ({
|
|
|
438
436
|
const toLowerMaybe = useApi(configApiRef).getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? (str) => str : (str) => str.toLocaleLowerCase();
|
|
439
437
|
if (!entities)
|
|
440
438
|
return null;
|
|
441
|
-
return /* @__PURE__ */
|
|
439
|
+
return /* @__PURE__ */ React.createElement(ItemCardGrid, {
|
|
442
440
|
"data-testid": "docs-explore"
|
|
443
441
|
}, !(entities == null ? void 0 : entities.length) ? null : entities.map((entity, index) => {
|
|
444
442
|
var _a, _b;
|
|
445
|
-
return /* @__PURE__ */
|
|
443
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
446
444
|
key: index
|
|
447
|
-
}, /* @__PURE__ */
|
|
445
|
+
}, /* @__PURE__ */ React.createElement(CardMedia, null, /* @__PURE__ */ React.createElement(ItemCardHeader, {
|
|
448
446
|
title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
|
|
449
|
-
})), /* @__PURE__ */
|
|
447
|
+
})), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
450
448
|
to: getRouteToReaderPageFor({
|
|
451
449
|
namespace: toLowerMaybe((_b = entity.metadata.namespace) != null ? _b : "default"),
|
|
452
450
|
kind: toLowerMaybe(entity.kind),
|
|
@@ -466,22 +464,22 @@ var DocsCardGrid$2 = /*#__PURE__*/Object.freeze({
|
|
|
466
464
|
const EntityListDocsGrid = () => {
|
|
467
465
|
const {loading, error, entities} = useEntityListProvider();
|
|
468
466
|
if (error) {
|
|
469
|
-
return /* @__PURE__ */
|
|
467
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
470
468
|
severity: "error",
|
|
471
469
|
title: "Could not load available documentation."
|
|
472
|
-
}, /* @__PURE__ */
|
|
470
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
473
471
|
language: "text",
|
|
474
472
|
text: error.toString()
|
|
475
473
|
}));
|
|
476
474
|
}
|
|
477
475
|
if (loading || !entities) {
|
|
478
|
-
return /* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
479
477
|
}
|
|
480
478
|
entities.sort((a, b) => {
|
|
481
479
|
var _a, _b;
|
|
482
480
|
return ((_a = a.metadata.title) != null ? _a : a.metadata.name).localeCompare((_b = b.metadata.title) != null ? _b : b.metadata.name);
|
|
483
481
|
});
|
|
484
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ React.createElement(DocsCardGrid$1, {
|
|
485
483
|
entities
|
|
486
484
|
});
|
|
487
485
|
};
|
|
@@ -635,7 +633,7 @@ Feedback:`);
|
|
|
635
633
|
default:
|
|
636
634
|
return dom;
|
|
637
635
|
}
|
|
638
|
-
ReactDOM.render(
|
|
636
|
+
ReactDOM.render(React.createElement(FeedbackOutlinedIcon), feedbackLink);
|
|
639
637
|
feedbackLink.style.paddingLeft = "5px";
|
|
640
638
|
feedbackLink.title = "Leave feedback for this page";
|
|
641
639
|
feedbackLink.id = "git-feedback-link";
|
|
@@ -800,11 +798,6 @@ const transform = async (html, transformers) => {
|
|
|
800
798
|
return dom;
|
|
801
799
|
};
|
|
802
800
|
|
|
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
801
|
const TechDocsSearchBar = ({
|
|
809
802
|
entityId,
|
|
810
803
|
debounceTime = 150
|
|
@@ -841,10 +834,10 @@ const TechDocsSearchBar = ({
|
|
|
841
834
|
navigate(location);
|
|
842
835
|
}
|
|
843
836
|
};
|
|
844
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React.createElement(Grid, {
|
|
845
838
|
item: true,
|
|
846
839
|
xs: 12
|
|
847
|
-
}, /* @__PURE__ */
|
|
840
|
+
}, /* @__PURE__ */ React.createElement(Autocomplete, {
|
|
848
841
|
"data-testid": "techdocs-search-bar",
|
|
849
842
|
size: "small",
|
|
850
843
|
open,
|
|
@@ -863,7 +856,7 @@ const TechDocsSearchBar = ({
|
|
|
863
856
|
noOptionsText: "No results found",
|
|
864
857
|
value: null,
|
|
865
858
|
options,
|
|
866
|
-
renderOption: ({document}) => /* @__PURE__ */
|
|
859
|
+
renderOption: ({document}) => /* @__PURE__ */ React.createElement(DocsResultListItem, {
|
|
867
860
|
result: document,
|
|
868
861
|
lineClamp: 3,
|
|
869
862
|
asListItem: false,
|
|
@@ -871,7 +864,7 @@ const TechDocsSearchBar = ({
|
|
|
871
864
|
title: document.title
|
|
872
865
|
}),
|
|
873
866
|
loading,
|
|
874
|
-
renderInput: (params) => /* @__PURE__ */
|
|
867
|
+
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
|
|
875
868
|
...params,
|
|
876
869
|
"data-testid": "techdocs-search-bar-input",
|
|
877
870
|
variant: "outlined",
|
|
@@ -881,13 +874,13 @@ const TechDocsSearchBar = ({
|
|
|
881
874
|
onChange: handleQuery,
|
|
882
875
|
InputProps: {
|
|
883
876
|
...params.InputProps,
|
|
884
|
-
startAdornment: /* @__PURE__ */
|
|
877
|
+
startAdornment: /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
885
878
|
position: "start"
|
|
886
|
-
}, /* @__PURE__ */
|
|
879
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
887
880
|
"aria-label": "Query",
|
|
888
881
|
disabled: true
|
|
889
|
-
}, /* @__PURE__ */
|
|
890
|
-
endAdornment: /* @__PURE__ */
|
|
882
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null))),
|
|
883
|
+
endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
891
884
|
color: "inherit",
|
|
892
885
|
size: 20
|
|
893
886
|
}) : null, params.InputProps.endAdornment)
|
|
@@ -896,21 +889,20 @@ const TechDocsSearchBar = ({
|
|
|
896
889
|
}));
|
|
897
890
|
};
|
|
898
891
|
const TechDocsSearch = (props) => {
|
|
899
|
-
const configApi = useApi(configApiRef);
|
|
900
|
-
const legacyPaths = configApi.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths");
|
|
901
892
|
const initialState = {
|
|
902
893
|
term: "",
|
|
903
894
|
types: ["techdocs"],
|
|
904
895
|
pageCursor: "",
|
|
905
|
-
filters:
|
|
896
|
+
filters: props.entityId
|
|
906
897
|
};
|
|
907
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, {
|
|
908
899
|
initialState
|
|
909
|
-
}, /* @__PURE__ */
|
|
900
|
+
}, /* @__PURE__ */ React.createElement(TechDocsSearchBar, {
|
|
910
901
|
...props
|
|
911
902
|
}));
|
|
912
903
|
};
|
|
913
904
|
|
|
905
|
+
const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog'));
|
|
914
906
|
const useDrawerStyles = makeStyles((theme) => createStyles({
|
|
915
907
|
paper: {
|
|
916
908
|
width: "100%",
|
|
@@ -952,13 +944,15 @@ const TechDocsBuildLogsDrawerContent = ({
|
|
|
952
944
|
title: "Close the drawer",
|
|
953
945
|
onClick: onClose,
|
|
954
946
|
color: "inherit"
|
|
955
|
-
}, /* @__PURE__ */ React.createElement(Close, null))), /* @__PURE__ */ React.createElement(
|
|
947
|
+
}, /* @__PURE__ */ React.createElement(Close, null))), /* @__PURE__ */ React.createElement(Suspense, {
|
|
948
|
+
fallback: /* @__PURE__ */ React.createElement(Progress, null)
|
|
949
|
+
}, /* @__PURE__ */ React.createElement(LazyLog, {
|
|
956
950
|
text: buildLog.length === 0 ? "Waiting for logs..." : buildLog.join("\n"),
|
|
957
951
|
extraLines: 1,
|
|
958
952
|
follow: true,
|
|
959
953
|
selectableLines: true,
|
|
960
954
|
enableSearch: true
|
|
961
|
-
}));
|
|
955
|
+
})));
|
|
962
956
|
};
|
|
963
957
|
const TechDocsBuildLogs = ({buildLog}) => {
|
|
964
958
|
const classes = useDrawerStyles();
|
|
@@ -983,7 +977,7 @@ const TechDocsNotFound = ({errorMessage}) => {
|
|
|
983
977
|
if (techdocsBuilder !== "local") {
|
|
984
978
|
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
979
|
}
|
|
986
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ React.createElement(ErrorPage, {
|
|
987
981
|
status: "404",
|
|
988
982
|
statusMessage: errorMessage || "Documentation not found",
|
|
989
983
|
additionalInfo
|
|
@@ -1006,64 +1000,64 @@ const TechDocsStateIndicator = () => {
|
|
|
1006
1000
|
syncErrorMessage,
|
|
1007
1001
|
buildLog
|
|
1008
1002
|
} = useTechDocsReader();
|
|
1009
|
-
const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */
|
|
1003
|
+
const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */ React.createElement(Progress, null) : null;
|
|
1010
1004
|
if (state === "INITIAL_BUILD") {
|
|
1011
|
-
StateAlert = /* @__PURE__ */
|
|
1005
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1012
1006
|
variant: "outlined",
|
|
1013
1007
|
severity: "info",
|
|
1014
|
-
icon: /* @__PURE__ */
|
|
1008
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
1015
1009
|
size: "24px"
|
|
1016
1010
|
}),
|
|
1017
|
-
action: /* @__PURE__ */
|
|
1011
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1018
1012
|
buildLog
|
|
1019
1013
|
})
|
|
1020
1014
|
}, "Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster.");
|
|
1021
1015
|
}
|
|
1022
1016
|
if (state === "CONTENT_STALE_REFRESHING") {
|
|
1023
|
-
StateAlert = /* @__PURE__ */
|
|
1017
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1024
1018
|
variant: "outlined",
|
|
1025
1019
|
severity: "info",
|
|
1026
|
-
icon: /* @__PURE__ */
|
|
1020
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, {
|
|
1027
1021
|
size: "24px"
|
|
1028
1022
|
}),
|
|
1029
|
-
action: /* @__PURE__ */
|
|
1023
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1030
1024
|
buildLog
|
|
1031
1025
|
})
|
|
1032
1026
|
}, "A newer version of this documentation is being prepared and will be available shortly.");
|
|
1033
1027
|
}
|
|
1034
1028
|
if (state === "CONTENT_STALE_READY") {
|
|
1035
|
-
StateAlert = /* @__PURE__ */
|
|
1029
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1036
1030
|
variant: "outlined",
|
|
1037
1031
|
severity: "success",
|
|
1038
|
-
action: /* @__PURE__ */
|
|
1032
|
+
action: /* @__PURE__ */ React.createElement(Button$1, {
|
|
1039
1033
|
color: "inherit",
|
|
1040
1034
|
onClick: () => contentReload()
|
|
1041
1035
|
}, "Refresh")
|
|
1042
1036
|
}, "A newer version of this documentation is now available, please refresh to view.");
|
|
1043
1037
|
}
|
|
1044
1038
|
if (state === "CONTENT_STALE_ERROR") {
|
|
1045
|
-
StateAlert = /* @__PURE__ */
|
|
1039
|
+
StateAlert = /* @__PURE__ */ React.createElement(Alert, {
|
|
1046
1040
|
variant: "outlined",
|
|
1047
1041
|
severity: "error",
|
|
1048
|
-
action: /* @__PURE__ */
|
|
1042
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1049
1043
|
buildLog
|
|
1050
1044
|
}),
|
|
1051
1045
|
classes: {message: classes.message}
|
|
1052
1046
|
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage);
|
|
1053
1047
|
}
|
|
1054
1048
|
if (state === "CONTENT_NOT_FOUND") {
|
|
1055
|
-
StateAlert = /* @__PURE__ */
|
|
1049
|
+
StateAlert = /* @__PURE__ */ React.createElement(React.Fragment, null, syncErrorMessage && /* @__PURE__ */ React.createElement(Alert, {
|
|
1056
1050
|
variant: "outlined",
|
|
1057
1051
|
severity: "error",
|
|
1058
|
-
action: /* @__PURE__ */
|
|
1052
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, {
|
|
1059
1053
|
buildLog
|
|
1060
1054
|
}),
|
|
1061
1055
|
classes: {message: classes.message}
|
|
1062
|
-
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage), /* @__PURE__ */
|
|
1056
|
+
}, "Building a newer version of this documentation failed.", " ", syncErrorMessage), /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1063
1057
|
errorMessage: contentErrorMessage
|
|
1064
1058
|
}));
|
|
1065
1059
|
}
|
|
1066
|
-
return /* @__PURE__ */
|
|
1060
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, ReaderProgress, StateAlert);
|
|
1067
1061
|
};
|
|
1068
1062
|
|
|
1069
1063
|
function calculateDisplayState({
|
|
@@ -1227,11 +1221,11 @@ const TechDocsReaderContext = createContext({});
|
|
|
1227
1221
|
const TechDocsReaderProvider = ({children}) => {
|
|
1228
1222
|
const {namespace = "", kind = "", name = "", "*": path} = useParams();
|
|
1229
1223
|
const value = useReaderState(kind, namespace, name, path);
|
|
1230
|
-
return /* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
|
|
1231
1225
|
value
|
|
1232
1226
|
}, children);
|
|
1233
1227
|
};
|
|
1234
|
-
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */
|
|
1228
|
+
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
|
|
1235
1229
|
...props
|
|
1236
1230
|
}));
|
|
1237
1231
|
const useTechDocsReader = () => useContext(TechDocsReaderContext);
|
|
@@ -1295,6 +1289,7 @@ const useTechDocsReaderDom = () => {
|
|
|
1295
1289
|
.md-footer-nav__link { width: 20rem;}
|
|
1296
1290
|
.md-content { margin-left: 20rem; max-width: calc(100% - 20rem * 2 - 3rem); }
|
|
1297
1291
|
.md-typeset { font-size: 1rem; }
|
|
1292
|
+
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-weight: bold; }
|
|
1298
1293
|
.md-nav { font-size: 1rem; }
|
|
1299
1294
|
.md-grid { max-width: 90vw; margin: 0 }
|
|
1300
1295
|
.md-typeset table:not([class]) {
|
|
@@ -1467,12 +1462,12 @@ const TheReader = ({
|
|
|
1467
1462
|
shadowRoot.appendChild(dom);
|
|
1468
1463
|
onReadyRef.current();
|
|
1469
1464
|
}, [dom]);
|
|
1470
|
-
return /* @__PURE__ */
|
|
1465
|
+
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, {
|
|
1471
1466
|
container: true,
|
|
1472
1467
|
className: classes.searchBar
|
|
1473
|
-
}, /* @__PURE__ */
|
|
1468
|
+
}, /* @__PURE__ */ React.createElement(TechDocsSearch, {
|
|
1474
1469
|
entityId: entityRef
|
|
1475
|
-
})), /* @__PURE__ */
|
|
1470
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1476
1471
|
"data-testid": "techdocs-content-shadowroot",
|
|
1477
1472
|
ref: shadowDomRef
|
|
1478
1473
|
}));
|
|
@@ -1482,7 +1477,7 @@ const Reader = ({
|
|
|
1482
1477
|
onReady = () => {
|
|
1483
1478
|
},
|
|
1484
1479
|
withSearch = true
|
|
1485
|
-
}) => /* @__PURE__ */
|
|
1480
|
+
}) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(TheReader, {
|
|
1486
1481
|
entityRef,
|
|
1487
1482
|
onReady,
|
|
1488
1483
|
withSearch
|
|
@@ -1499,34 +1494,34 @@ const TechDocsPageHeader = ({
|
|
|
1499
1494
|
const lifecycle = spec == null ? void 0 : spec.lifecycle;
|
|
1500
1495
|
const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
|
|
1501
1496
|
const docsRootLink = useRouteRef(rootRouteRef)();
|
|
1502
|
-
const labels = /* @__PURE__ */
|
|
1497
|
+
const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1503
1498
|
label: "Component",
|
|
1504
|
-
value: /* @__PURE__ */
|
|
1499
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLink, {
|
|
1505
1500
|
color: "inherit",
|
|
1506
1501
|
entityRef,
|
|
1507
1502
|
defaultKind: "Component"
|
|
1508
1503
|
})
|
|
1509
|
-
}), ownedByRelations.length > 0 && /* @__PURE__ */
|
|
1504
|
+
}), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1510
1505
|
label: "Owner",
|
|
1511
|
-
value: /* @__PURE__ */
|
|
1506
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
1512
1507
|
color: "inherit",
|
|
1513
1508
|
entityRefs: ownedByRelations,
|
|
1514
1509
|
defaultKind: "group"
|
|
1515
1510
|
})
|
|
1516
|
-
}), lifecycle ? /* @__PURE__ */
|
|
1511
|
+
}), lifecycle ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1517
1512
|
label: "Lifecycle",
|
|
1518
1513
|
value: lifecycle
|
|
1519
|
-
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */
|
|
1514
|
+
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1520
1515
|
label: "",
|
|
1521
|
-
value: /* @__PURE__ */
|
|
1516
|
+
value: /* @__PURE__ */ React.createElement("a", {
|
|
1522
1517
|
href: locationMetadata.target,
|
|
1523
1518
|
target: "_blank",
|
|
1524
1519
|
rel: "noopener noreferrer"
|
|
1525
|
-
}, /* @__PURE__ */
|
|
1520
|
+
}, /* @__PURE__ */ React.createElement(CodeIcon, {
|
|
1526
1521
|
style: {marginTop: "-25px", fill: "#fff"}
|
|
1527
1522
|
}))
|
|
1528
1523
|
}) : null);
|
|
1529
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ React.createElement(Header, {
|
|
1530
1525
|
title: siteName ? siteName : ".",
|
|
1531
1526
|
pageTitleOverride: siteName || name,
|
|
1532
1527
|
subtitle: siteDescription && siteDescription !== "None" ? siteDescription : "",
|
|
@@ -1552,13 +1547,13 @@ const LegacyTechDocsPage = () => {
|
|
|
1552
1547
|
setDocumentReady(true);
|
|
1553
1548
|
}, [setDocumentReady]);
|
|
1554
1549
|
if (entityMetadataError) {
|
|
1555
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1556
1551
|
errorMessage: entityMetadataError.message
|
|
1557
1552
|
});
|
|
1558
1553
|
}
|
|
1559
|
-
return /* @__PURE__ */
|
|
1554
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1560
1555
|
themeId: "documentation"
|
|
1561
|
-
}, /* @__PURE__ */
|
|
1556
|
+
}, /* @__PURE__ */ React.createElement(TechDocsPageHeader, {
|
|
1562
1557
|
techDocsMetadata: techdocsMetadataValue,
|
|
1563
1558
|
entityMetadata: entityMetadataValue,
|
|
1564
1559
|
entityRef: {
|
|
@@ -1566,9 +1561,9 @@ const LegacyTechDocsPage = () => {
|
|
|
1566
1561
|
namespace,
|
|
1567
1562
|
name
|
|
1568
1563
|
}
|
|
1569
|
-
}), /* @__PURE__ */
|
|
1564
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1570
1565
|
"data-testid": "techdocs-content"
|
|
1571
|
-
}, /* @__PURE__ */
|
|
1566
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
1572
1567
|
onReady,
|
|
1573
1568
|
entityRef: {
|
|
1574
1569
|
kind,
|
|
@@ -1596,13 +1591,13 @@ const TechDocsPage = ({children}) => {
|
|
|
1596
1591
|
setDocumentReady(true);
|
|
1597
1592
|
}, [setDocumentReady]);
|
|
1598
1593
|
if (entityMetadataError) {
|
|
1599
|
-
return /* @__PURE__ */
|
|
1594
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1600
1595
|
errorMessage: entityMetadataError.message
|
|
1601
1596
|
});
|
|
1602
1597
|
}
|
|
1603
1598
|
if (!children)
|
|
1604
|
-
return outlet || /* @__PURE__ */
|
|
1605
|
-
return /* @__PURE__ */
|
|
1599
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsPage, null);
|
|
1600
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1606
1601
|
themeId: "documentation"
|
|
1607
1602
|
}, children instanceof Function ? children({
|
|
1608
1603
|
techdocsMetadataValue,
|
|
@@ -1644,12 +1639,12 @@ const CustomPanel = ({
|
|
|
1644
1639
|
}
|
|
1645
1640
|
return typeof config.filterPredicate === "function" && config.filterPredicate(entity);
|
|
1646
1641
|
});
|
|
1647
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
1648
1643
|
title: config.title,
|
|
1649
1644
|
description: config.description
|
|
1650
|
-
}, index === 0 ? /* @__PURE__ */
|
|
1645
|
+
}, index === 0 ? /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.") : null), /* @__PURE__ */ React.createElement("div", {
|
|
1651
1646
|
className: classes.panelContainer
|
|
1652
|
-
}, /* @__PURE__ */
|
|
1647
|
+
}, /* @__PURE__ */ React.createElement(Panel, {
|
|
1653
1648
|
"data-testid": "techdocs-custom-panel",
|
|
1654
1649
|
entities: shownEntities
|
|
1655
1650
|
})));
|
|
@@ -1684,27 +1679,27 @@ const TechDocsCustomHome = ({
|
|
|
1684
1679
|
});
|
|
1685
1680
|
const currentTabConfig = tabsConfig[selectedTab];
|
|
1686
1681
|
if (loading) {
|
|
1687
|
-
return /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Progress, null)));
|
|
1688
1683
|
}
|
|
1689
1684
|
if (error) {
|
|
1690
|
-
return /* @__PURE__ */
|
|
1685
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
1691
1686
|
severity: "error",
|
|
1692
1687
|
title: "Could not load available documentation."
|
|
1693
|
-
}, /* @__PURE__ */
|
|
1688
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
1694
1689
|
language: "text",
|
|
1695
1690
|
text: error.toString()
|
|
1696
1691
|
}))));
|
|
1697
1692
|
}
|
|
1698
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(HeaderTabs, {
|
|
1699
1694
|
selectedIndex: selectedTab,
|
|
1700
1695
|
onChange: (index) => setSelectedTab(index),
|
|
1701
1696
|
tabs: tabsConfig.map(({label}, index) => ({
|
|
1702
1697
|
id: index.toString(),
|
|
1703
1698
|
label
|
|
1704
1699
|
}))
|
|
1705
|
-
}), /* @__PURE__ */
|
|
1700
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1706
1701
|
"data-testid": "techdocs-content"
|
|
1707
|
-
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */
|
|
1702
|
+
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */ React.createElement(CustomPanel, {
|
|
1708
1703
|
key: index,
|
|
1709
1704
|
config,
|
|
1710
1705
|
entities: !!entities ? entities : [],
|
|
@@ -1742,14 +1737,14 @@ const LegacyTechDocsHome = () => {
|
|
|
1742
1737
|
]
|
|
1743
1738
|
}
|
|
1744
1739
|
];
|
|
1745
|
-
return /* @__PURE__ */
|
|
1740
|
+
return /* @__PURE__ */ React.createElement(TechDocsCustomHome, {
|
|
1746
1741
|
tabsConfig
|
|
1747
1742
|
});
|
|
1748
1743
|
};
|
|
1749
1744
|
|
|
1750
1745
|
const TechDocsIndexPage = () => {
|
|
1751
1746
|
const outlet = useOutlet();
|
|
1752
|
-
return outlet || /* @__PURE__ */
|
|
1747
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsHome, null);
|
|
1753
1748
|
};
|
|
1754
1749
|
|
|
1755
1750
|
var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1759,7 +1754,7 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
1759
1754
|
|
|
1760
1755
|
const EntityPageDocs = ({entity}) => {
|
|
1761
1756
|
var _a;
|
|
1762
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ React.createElement(Reader, {
|
|
1763
1758
|
withSearch: false,
|
|
1764
1759
|
entityRef: {
|
|
1765
1760
|
kind: entity.kind,
|
|
@@ -1775,12 +1770,12 @@ const isTechDocsAvailable = (entity) => {
|
|
|
1775
1770
|
return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[TECHDOCS_ANNOTATION]);
|
|
1776
1771
|
};
|
|
1777
1772
|
const Router = () => {
|
|
1778
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1779
1774
|
path: "/",
|
|
1780
|
-
element: /* @__PURE__ */
|
|
1781
|
-
}), /* @__PURE__ */
|
|
1775
|
+
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
1776
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
1782
1777
|
path: "/:namespace/:kind/:name/*",
|
|
1783
|
-
element: /* @__PURE__ */
|
|
1778
|
+
element: /* @__PURE__ */ React.createElement(TechDocsPage, null)
|
|
1784
1779
|
}));
|
|
1785
1780
|
};
|
|
1786
1781
|
const EmbeddedDocsRouter = (_props) => {
|
|
@@ -1788,13 +1783,13 @@ const EmbeddedDocsRouter = (_props) => {
|
|
|
1788
1783
|
const {entity} = useEntity();
|
|
1789
1784
|
const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
|
|
1790
1785
|
if (!projectId) {
|
|
1791
|
-
return /* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
|
|
1792
1787
|
annotation: TECHDOCS_ANNOTATION
|
|
1793
1788
|
});
|
|
1794
1789
|
}
|
|
1795
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1796
1791
|
path: "/*",
|
|
1797
|
-
element: /* @__PURE__ */
|
|
1792
|
+
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
1798
1793
|
entity
|
|
1799
1794
|
})
|
|
1800
1795
|
}));
|