@backstage/plugin-techdocs 0.0.0-nightly-202192122645 → 0.0.0-nightly-2021101222132
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 +54 -11
- package/dist/index.esm.js +110 -114
- 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]) {
|
|
@@ -1398,13 +1393,14 @@ const useTechDocsReaderDom = () => {
|
|
|
1398
1393
|
addLinkClickListener({
|
|
1399
1394
|
baseUrl: window.location.origin,
|
|
1400
1395
|
onClick: (_, url) => {
|
|
1401
|
-
var _a;
|
|
1396
|
+
var _a, _b;
|
|
1402
1397
|
const parsedUrl = new URL(url);
|
|
1403
1398
|
if (parsedUrl.hash) {
|
|
1404
1399
|
navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
|
|
1405
1400
|
(_a = transformedElement == null ? void 0 : transformedElement.querySelector(`#${parsedUrl.hash.slice(1)}`)) == null ? void 0 : _a.scrollIntoView();
|
|
1406
1401
|
} else {
|
|
1407
1402
|
navigate(parsedUrl.pathname);
|
|
1403
|
+
(_b = transformedElement == null ? void 0 : transformedElement.querySelector(".md-content__inner")) == null ? void 0 : _b.scrollIntoView();
|
|
1408
1404
|
}
|
|
1409
1405
|
}
|
|
1410
1406
|
}),
|
|
@@ -1466,12 +1462,12 @@ const TheReader = ({
|
|
|
1466
1462
|
shadowRoot.appendChild(dom);
|
|
1467
1463
|
onReadyRef.current();
|
|
1468
1464
|
}, [dom]);
|
|
1469
|
-
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, {
|
|
1470
1466
|
container: true,
|
|
1471
1467
|
className: classes.searchBar
|
|
1472
|
-
}, /* @__PURE__ */
|
|
1468
|
+
}, /* @__PURE__ */ React.createElement(TechDocsSearch, {
|
|
1473
1469
|
entityId: entityRef
|
|
1474
|
-
})), /* @__PURE__ */
|
|
1470
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1475
1471
|
"data-testid": "techdocs-content-shadowroot",
|
|
1476
1472
|
ref: shadowDomRef
|
|
1477
1473
|
}));
|
|
@@ -1481,7 +1477,7 @@ const Reader = ({
|
|
|
1481
1477
|
onReady = () => {
|
|
1482
1478
|
},
|
|
1483
1479
|
withSearch = true
|
|
1484
|
-
}) => /* @__PURE__ */
|
|
1480
|
+
}) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(TheReader, {
|
|
1485
1481
|
entityRef,
|
|
1486
1482
|
onReady,
|
|
1487
1483
|
withSearch
|
|
@@ -1498,34 +1494,34 @@ const TechDocsPageHeader = ({
|
|
|
1498
1494
|
const lifecycle = spec == null ? void 0 : spec.lifecycle;
|
|
1499
1495
|
const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
|
|
1500
1496
|
const docsRootLink = useRouteRef(rootRouteRef)();
|
|
1501
|
-
const labels = /* @__PURE__ */
|
|
1497
|
+
const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1502
1498
|
label: "Component",
|
|
1503
|
-
value: /* @__PURE__ */
|
|
1499
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLink, {
|
|
1504
1500
|
color: "inherit",
|
|
1505
1501
|
entityRef,
|
|
1506
1502
|
defaultKind: "Component"
|
|
1507
1503
|
})
|
|
1508
|
-
}), ownedByRelations.length > 0 && /* @__PURE__ */
|
|
1504
|
+
}), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1509
1505
|
label: "Owner",
|
|
1510
|
-
value: /* @__PURE__ */
|
|
1506
|
+
value: /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
1511
1507
|
color: "inherit",
|
|
1512
1508
|
entityRefs: ownedByRelations,
|
|
1513
1509
|
defaultKind: "group"
|
|
1514
1510
|
})
|
|
1515
|
-
}), lifecycle ? /* @__PURE__ */
|
|
1511
|
+
}), lifecycle ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1516
1512
|
label: "Lifecycle",
|
|
1517
1513
|
value: lifecycle
|
|
1518
|
-
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */
|
|
1514
|
+
}) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(HeaderLabel, {
|
|
1519
1515
|
label: "",
|
|
1520
|
-
value: /* @__PURE__ */
|
|
1516
|
+
value: /* @__PURE__ */ React.createElement("a", {
|
|
1521
1517
|
href: locationMetadata.target,
|
|
1522
1518
|
target: "_blank",
|
|
1523
1519
|
rel: "noopener noreferrer"
|
|
1524
|
-
}, /* @__PURE__ */
|
|
1520
|
+
}, /* @__PURE__ */ React.createElement(CodeIcon, {
|
|
1525
1521
|
style: {marginTop: "-25px", fill: "#fff"}
|
|
1526
1522
|
}))
|
|
1527
1523
|
}) : null);
|
|
1528
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ React.createElement(Header, {
|
|
1529
1525
|
title: siteName ? siteName : ".",
|
|
1530
1526
|
pageTitleOverride: siteName || name,
|
|
1531
1527
|
subtitle: siteDescription && siteDescription !== "None" ? siteDescription : "",
|
|
@@ -1551,13 +1547,13 @@ const LegacyTechDocsPage = () => {
|
|
|
1551
1547
|
setDocumentReady(true);
|
|
1552
1548
|
}, [setDocumentReady]);
|
|
1553
1549
|
if (entityMetadataError) {
|
|
1554
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1555
1551
|
errorMessage: entityMetadataError.message
|
|
1556
1552
|
});
|
|
1557
1553
|
}
|
|
1558
|
-
return /* @__PURE__ */
|
|
1554
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1559
1555
|
themeId: "documentation"
|
|
1560
|
-
}, /* @__PURE__ */
|
|
1556
|
+
}, /* @__PURE__ */ React.createElement(TechDocsPageHeader, {
|
|
1561
1557
|
techDocsMetadata: techdocsMetadataValue,
|
|
1562
1558
|
entityMetadata: entityMetadataValue,
|
|
1563
1559
|
entityRef: {
|
|
@@ -1565,9 +1561,9 @@ const LegacyTechDocsPage = () => {
|
|
|
1565
1561
|
namespace,
|
|
1566
1562
|
name
|
|
1567
1563
|
}
|
|
1568
|
-
}), /* @__PURE__ */
|
|
1564
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1569
1565
|
"data-testid": "techdocs-content"
|
|
1570
|
-
}, /* @__PURE__ */
|
|
1566
|
+
}, /* @__PURE__ */ React.createElement(Reader, {
|
|
1571
1567
|
onReady,
|
|
1572
1568
|
entityRef: {
|
|
1573
1569
|
kind,
|
|
@@ -1595,13 +1591,13 @@ const TechDocsPage = ({children}) => {
|
|
|
1595
1591
|
setDocumentReady(true);
|
|
1596
1592
|
}, [setDocumentReady]);
|
|
1597
1593
|
if (entityMetadataError) {
|
|
1598
|
-
return /* @__PURE__ */
|
|
1594
|
+
return /* @__PURE__ */ React.createElement(TechDocsNotFound, {
|
|
1599
1595
|
errorMessage: entityMetadataError.message
|
|
1600
1596
|
});
|
|
1601
1597
|
}
|
|
1602
1598
|
if (!children)
|
|
1603
|
-
return outlet || /* @__PURE__ */
|
|
1604
|
-
return /* @__PURE__ */
|
|
1599
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsPage, null);
|
|
1600
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
1605
1601
|
themeId: "documentation"
|
|
1606
1602
|
}, children instanceof Function ? children({
|
|
1607
1603
|
techdocsMetadataValue,
|
|
@@ -1643,12 +1639,12 @@ const CustomPanel = ({
|
|
|
1643
1639
|
}
|
|
1644
1640
|
return typeof config.filterPredicate === "function" && config.filterPredicate(entity);
|
|
1645
1641
|
});
|
|
1646
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
1647
1643
|
title: config.title,
|
|
1648
1644
|
description: config.description
|
|
1649
|
-
}, index === 0 ? /* @__PURE__ */
|
|
1645
|
+
}, index === 0 ? /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.") : null), /* @__PURE__ */ React.createElement("div", {
|
|
1650
1646
|
className: classes.panelContainer
|
|
1651
|
-
}, /* @__PURE__ */
|
|
1647
|
+
}, /* @__PURE__ */ React.createElement(Panel, {
|
|
1652
1648
|
"data-testid": "techdocs-custom-panel",
|
|
1653
1649
|
entities: shownEntities
|
|
1654
1650
|
})));
|
|
@@ -1683,27 +1679,27 @@ const TechDocsCustomHome = ({
|
|
|
1683
1679
|
});
|
|
1684
1680
|
const currentTabConfig = tabsConfig[selectedTab];
|
|
1685
1681
|
if (loading) {
|
|
1686
|
-
return /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Progress, null)));
|
|
1687
1683
|
}
|
|
1688
1684
|
if (error) {
|
|
1689
|
-
return /* @__PURE__ */
|
|
1685
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
1690
1686
|
severity: "error",
|
|
1691
1687
|
title: "Could not load available documentation."
|
|
1692
|
-
}, /* @__PURE__ */
|
|
1688
|
+
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
1693
1689
|
language: "text",
|
|
1694
1690
|
text: error.toString()
|
|
1695
1691
|
}))));
|
|
1696
1692
|
}
|
|
1697
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(HeaderTabs, {
|
|
1698
1694
|
selectedIndex: selectedTab,
|
|
1699
1695
|
onChange: (index) => setSelectedTab(index),
|
|
1700
1696
|
tabs: tabsConfig.map(({label}, index) => ({
|
|
1701
1697
|
id: index.toString(),
|
|
1702
1698
|
label
|
|
1703
1699
|
}))
|
|
1704
|
-
}), /* @__PURE__ */
|
|
1700
|
+
}), /* @__PURE__ */ React.createElement(Content, {
|
|
1705
1701
|
"data-testid": "techdocs-content"
|
|
1706
|
-
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */
|
|
1702
|
+
}, currentTabConfig.panels.map((config, index) => /* @__PURE__ */ React.createElement(CustomPanel, {
|
|
1707
1703
|
key: index,
|
|
1708
1704
|
config,
|
|
1709
1705
|
entities: !!entities ? entities : [],
|
|
@@ -1741,14 +1737,14 @@ const LegacyTechDocsHome = () => {
|
|
|
1741
1737
|
]
|
|
1742
1738
|
}
|
|
1743
1739
|
];
|
|
1744
|
-
return /* @__PURE__ */
|
|
1740
|
+
return /* @__PURE__ */ React.createElement(TechDocsCustomHome, {
|
|
1745
1741
|
tabsConfig
|
|
1746
1742
|
});
|
|
1747
1743
|
};
|
|
1748
1744
|
|
|
1749
1745
|
const TechDocsIndexPage = () => {
|
|
1750
1746
|
const outlet = useOutlet();
|
|
1751
|
-
return outlet || /* @__PURE__ */
|
|
1747
|
+
return outlet || /* @__PURE__ */ React.createElement(LegacyTechDocsHome, null);
|
|
1752
1748
|
};
|
|
1753
1749
|
|
|
1754
1750
|
var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1758,7 +1754,7 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
1758
1754
|
|
|
1759
1755
|
const EntityPageDocs = ({entity}) => {
|
|
1760
1756
|
var _a;
|
|
1761
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ React.createElement(Reader, {
|
|
1762
1758
|
withSearch: false,
|
|
1763
1759
|
entityRef: {
|
|
1764
1760
|
kind: entity.kind,
|
|
@@ -1774,12 +1770,12 @@ const isTechDocsAvailable = (entity) => {
|
|
|
1774
1770
|
return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[TECHDOCS_ANNOTATION]);
|
|
1775
1771
|
};
|
|
1776
1772
|
const Router = () => {
|
|
1777
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1778
1774
|
path: "/",
|
|
1779
|
-
element: /* @__PURE__ */
|
|
1780
|
-
}), /* @__PURE__ */
|
|
1775
|
+
element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null)
|
|
1776
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
1781
1777
|
path: "/:namespace/:kind/:name/*",
|
|
1782
|
-
element: /* @__PURE__ */
|
|
1778
|
+
element: /* @__PURE__ */ React.createElement(TechDocsPage, null)
|
|
1783
1779
|
}));
|
|
1784
1780
|
};
|
|
1785
1781
|
const EmbeddedDocsRouter = (_props) => {
|
|
@@ -1787,13 +1783,13 @@ const EmbeddedDocsRouter = (_props) => {
|
|
|
1787
1783
|
const {entity} = useEntity();
|
|
1788
1784
|
const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
|
|
1789
1785
|
if (!projectId) {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
|
|
1791
1787
|
annotation: TECHDOCS_ANNOTATION
|
|
1792
1788
|
});
|
|
1793
1789
|
}
|
|
1794
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
1795
1791
|
path: "/*",
|
|
1796
|
-
element: /* @__PURE__ */
|
|
1792
|
+
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
1797
1793
|
entity
|
|
1798
1794
|
})
|
|
1799
1795
|
}));
|