@backstage/plugin-techdocs 1.4.0 → 1.4.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/esm/{TechDocsCustomHome-02667b22.esm.js → TechDocsCustomHome-c3774096.esm.js} +30 -33
- package/dist/esm/{TechDocsCustomHome-02667b22.esm.js.map → TechDocsCustomHome-c3774096.esm.js.map} +1 -1
- package/dist/esm/{index-847211c1.esm.js → index-1eb4d135.esm.js} +456 -454
- package/dist/esm/index-1eb4d135.esm.js.map +1 -0
- package/dist/esm/{index-5ce38e4c.esm.js → index-a106661c.esm.js} +2 -2
- package/dist/esm/index-a106661c.esm.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +17 -17
- package/dist/esm/index-5ce38e4c.esm.js.map +0 -1
- package/dist/esm/index-847211c1.esm.js.map +0 -1
|
@@ -317,13 +317,9 @@ const TechDocsReaderProvider = ({
|
|
|
317
317
|
const { entityRef } = useTechDocsReaderPage();
|
|
318
318
|
const { kind, namespace, name } = entityRef;
|
|
319
319
|
const value = useReaderState(kind, namespace, name, path);
|
|
320
|
-
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
|
|
321
|
-
value
|
|
322
|
-
}, children instanceof Function ? children(value) : children);
|
|
320
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, { value }, children instanceof Function ? children(value) : children);
|
|
323
321
|
};
|
|
324
|
-
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
|
|
325
|
-
...props
|
|
326
|
-
}));
|
|
322
|
+
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, { ...props }));
|
|
327
323
|
|
|
328
324
|
const useStyles$4 = makeStyles({
|
|
329
325
|
flexContainer: {
|
|
@@ -353,53 +349,62 @@ const TechDocsSearchResultListItem = (props) => {
|
|
|
353
349
|
value: rank
|
|
354
350
|
});
|
|
355
351
|
};
|
|
352
|
+
const LinkWrapper = ({ children }) => asLink ? /* @__PURE__ */ React.createElement(Link, { noTrack: true, to: result.location, onClick: handleClick }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
356
353
|
const TextItem = () => {
|
|
357
|
-
const resultTitle = (highlight == null ? void 0 : highlight.fields.title) ? /* @__PURE__ */ React.createElement(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}) : result.title;
|
|
362
|
-
const entityTitle = (highlight == null ? void 0 : highlight.fields.entityTitle) ? /* @__PURE__ */ React.createElement(HighlightedSearchResultText, {
|
|
363
|
-
text: highlight.fields.entityTitle,
|
|
364
|
-
preTag: highlight.preTag,
|
|
365
|
-
postTag: highlight.postTag
|
|
366
|
-
}) : result.entityTitle;
|
|
367
|
-
const resultName = (highlight == null ? void 0 : highlight.fields.name) ? /* @__PURE__ */ React.createElement(HighlightedSearchResultText, {
|
|
368
|
-
text: highlight.fields.name,
|
|
369
|
-
preTag: highlight.preTag,
|
|
370
|
-
postTag: highlight.postTag
|
|
371
|
-
}) : result.name;
|
|
372
|
-
return /* @__PURE__ */ React.createElement(ListItemText, {
|
|
373
|
-
className: classes.itemText,
|
|
374
|
-
primaryTypographyProps: { variant: "h6" },
|
|
375
|
-
primary: title ? title : /* @__PURE__ */ React.createElement(React.Fragment, null, resultTitle, " | ", entityTitle != null ? entityTitle : resultName, " docs"),
|
|
376
|
-
secondary: /* @__PURE__ */ React.createElement("span", {
|
|
377
|
-
style: {
|
|
378
|
-
display: "-webkit-box",
|
|
379
|
-
WebkitBoxOrient: "vertical",
|
|
380
|
-
WebkitLineClamp: lineClamp,
|
|
381
|
-
overflow: "hidden"
|
|
382
|
-
}
|
|
383
|
-
}, (highlight == null ? void 0 : highlight.fields.text) ? /* @__PURE__ */ React.createElement(HighlightedSearchResultText, {
|
|
384
|
-
text: highlight.fields.text,
|
|
354
|
+
const resultTitle = (highlight == null ? void 0 : highlight.fields.title) ? /* @__PURE__ */ React.createElement(
|
|
355
|
+
HighlightedSearchResultText,
|
|
356
|
+
{
|
|
357
|
+
text: highlight.fields.title,
|
|
385
358
|
preTag: highlight.preTag,
|
|
386
359
|
postTag: highlight.postTag
|
|
387
|
-
}
|
|
388
|
-
|
|
360
|
+
}
|
|
361
|
+
) : result.title;
|
|
362
|
+
const entityTitle = (highlight == null ? void 0 : highlight.fields.entityTitle) ? /* @__PURE__ */ React.createElement(
|
|
363
|
+
HighlightedSearchResultText,
|
|
364
|
+
{
|
|
365
|
+
text: highlight.fields.entityTitle,
|
|
366
|
+
preTag: highlight.preTag,
|
|
367
|
+
postTag: highlight.postTag
|
|
368
|
+
}
|
|
369
|
+
) : result.entityTitle;
|
|
370
|
+
const resultName = (highlight == null ? void 0 : highlight.fields.name) ? /* @__PURE__ */ React.createElement(
|
|
371
|
+
HighlightedSearchResultText,
|
|
372
|
+
{
|
|
373
|
+
text: highlight.fields.name,
|
|
374
|
+
preTag: highlight.preTag,
|
|
375
|
+
postTag: highlight.postTag
|
|
376
|
+
}
|
|
377
|
+
) : result.name;
|
|
378
|
+
return /* @__PURE__ */ React.createElement(
|
|
379
|
+
ListItemText,
|
|
380
|
+
{
|
|
381
|
+
className: classes.itemText,
|
|
382
|
+
primaryTypographyProps: { variant: "h6" },
|
|
383
|
+
primary: /* @__PURE__ */ React.createElement(LinkWrapper, null, title ? title : /* @__PURE__ */ React.createElement(React.Fragment, null, resultTitle, " | ", entityTitle != null ? entityTitle : resultName, " docs")),
|
|
384
|
+
secondary: /* @__PURE__ */ React.createElement(
|
|
385
|
+
"span",
|
|
386
|
+
{
|
|
387
|
+
style: {
|
|
388
|
+
display: "-webkit-box",
|
|
389
|
+
WebkitBoxOrient: "vertical",
|
|
390
|
+
WebkitLineClamp: lineClamp,
|
|
391
|
+
overflow: "hidden"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
(highlight == null ? void 0 : highlight.fields.text) ? /* @__PURE__ */ React.createElement(
|
|
395
|
+
HighlightedSearchResultText,
|
|
396
|
+
{
|
|
397
|
+
text: highlight.fields.text,
|
|
398
|
+
preTag: highlight.preTag,
|
|
399
|
+
postTag: highlight.postTag
|
|
400
|
+
}
|
|
401
|
+
) : result.text
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
);
|
|
389
405
|
};
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
to: result.location,
|
|
393
|
-
onClick: handleClick
|
|
394
|
-
}, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
395
|
-
const ListItemWrapper = ({ children }) => asListItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ListItem, {
|
|
396
|
-
alignItems: "flex-start"
|
|
397
|
-
}, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement("div", {
|
|
398
|
-
className: classes.flexContainer
|
|
399
|
-
}, children)), /* @__PURE__ */ React.createElement(Divider, {
|
|
400
|
-
component: "li"
|
|
401
|
-
})) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
402
|
-
return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
|
|
406
|
+
const ListItemWrapper = ({ children }) => asListItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ListItem, { alignItems: "flex-start" }, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement("div", { className: classes.flexContainer }, children)), /* @__PURE__ */ React.createElement(Divider, { component: "li" })) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
407
|
+
return /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null));
|
|
403
408
|
};
|
|
404
409
|
|
|
405
410
|
const useStyles$3 = makeStyles((theme) => ({
|
|
@@ -450,42 +455,45 @@ const TechDocsSearchBar = (props) => {
|
|
|
450
455
|
navigate(location);
|
|
451
456
|
}
|
|
452
457
|
};
|
|
453
|
-
return /* @__PURE__ */ React.createElement(Paper, {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
458
|
+
return /* @__PURE__ */ React.createElement(Paper, { className: classes.bar, variant: "outlined" }, /* @__PURE__ */ React.createElement(
|
|
459
|
+
SearchAutocomplete,
|
|
460
|
+
{
|
|
461
|
+
classes: { root: classes.root },
|
|
462
|
+
"data-testid": "techdocs-search-bar",
|
|
463
|
+
size: "small",
|
|
464
|
+
open,
|
|
465
|
+
getOptionLabel: () => "",
|
|
466
|
+
filterOptions: (x) => {
|
|
467
|
+
return x;
|
|
468
|
+
},
|
|
469
|
+
onClose: () => {
|
|
470
|
+
setOpen(false);
|
|
471
|
+
},
|
|
472
|
+
onFocus: () => {
|
|
473
|
+
setOpen(true);
|
|
474
|
+
},
|
|
475
|
+
onChange: handleSelection,
|
|
476
|
+
blurOnSelect: true,
|
|
477
|
+
noOptionsText: "No results found",
|
|
478
|
+
value: null,
|
|
479
|
+
options,
|
|
480
|
+
renderOption: ({ document, highlight }) => /* @__PURE__ */ React.createElement(
|
|
481
|
+
TechDocsSearchResultListItem,
|
|
482
|
+
{
|
|
483
|
+
result: document,
|
|
484
|
+
lineClamp: 3,
|
|
485
|
+
asListItem: false,
|
|
486
|
+
asLink: false,
|
|
487
|
+
title: document.title,
|
|
488
|
+
highlight
|
|
489
|
+
}
|
|
490
|
+
),
|
|
491
|
+
loading,
|
|
492
|
+
inputDebounceTime: debounceTime,
|
|
493
|
+
inputPlaceholder: `Search ${entityTitle || entityId.name} docs`,
|
|
494
|
+
freeSolo: false
|
|
495
|
+
}
|
|
496
|
+
));
|
|
489
497
|
};
|
|
490
498
|
const TechDocsSearch = (props) => {
|
|
491
499
|
const initialState = {
|
|
@@ -494,11 +502,7 @@ const TechDocsSearch = (props) => {
|
|
|
494
502
|
pageCursor: "",
|
|
495
503
|
filters: props.entityId
|
|
496
504
|
};
|
|
497
|
-
return /* @__PURE__ */ React.createElement(SearchContextProvider, {
|
|
498
|
-
initialState
|
|
499
|
-
}, /* @__PURE__ */ React.createElement(TechDocsSearchBar, {
|
|
500
|
-
...props
|
|
501
|
-
}));
|
|
505
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, { initialState }, /* @__PURE__ */ React.createElement(TechDocsSearchBar, { ...props }));
|
|
502
506
|
};
|
|
503
507
|
|
|
504
508
|
const useDrawerStyles = makeStyles(
|
|
@@ -528,46 +532,59 @@ const TechDocsBuildLogsDrawerContent = ({
|
|
|
528
532
|
}) => {
|
|
529
533
|
const classes = useDrawerStyles();
|
|
530
534
|
const logText = buildLog.length === 0 ? "Waiting for logs..." : buildLog.join("\n");
|
|
531
|
-
return /* @__PURE__ */ React.createElement(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
535
|
+
return /* @__PURE__ */ React.createElement(
|
|
536
|
+
Grid,
|
|
537
|
+
{
|
|
538
|
+
container: true,
|
|
539
|
+
direction: "column",
|
|
540
|
+
className: classes.root,
|
|
541
|
+
spacing: 0,
|
|
542
|
+
wrap: "nowrap"
|
|
543
|
+
},
|
|
544
|
+
/* @__PURE__ */ React.createElement(
|
|
545
|
+
Grid,
|
|
546
|
+
{
|
|
547
|
+
item: true,
|
|
548
|
+
container: true,
|
|
549
|
+
justifyContent: "space-between",
|
|
550
|
+
alignItems: "center",
|
|
551
|
+
spacing: 0,
|
|
552
|
+
wrap: "nowrap"
|
|
553
|
+
},
|
|
554
|
+
/* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Build Details"),
|
|
555
|
+
/* @__PURE__ */ React.createElement(
|
|
556
|
+
IconButton,
|
|
557
|
+
{
|
|
558
|
+
key: "dismiss",
|
|
559
|
+
title: "Close the drawer",
|
|
560
|
+
onClick: onClose,
|
|
561
|
+
color: "inherit"
|
|
562
|
+
},
|
|
563
|
+
/* @__PURE__ */ React.createElement(Close, null)
|
|
564
|
+
)
|
|
565
|
+
),
|
|
566
|
+
/* @__PURE__ */ React.createElement(LogViewer, { text: logText, classes: { root: classes.logs } })
|
|
567
|
+
);
|
|
555
568
|
};
|
|
556
569
|
const TechDocsBuildLogs = ({ buildLog }) => {
|
|
557
570
|
const classes = useDrawerStyles();
|
|
558
571
|
const [open, setOpen] = useState(false);
|
|
559
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
572
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, { color: "inherit", onClick: () => setOpen(true) }, "Show Build Logs"), /* @__PURE__ */ React.createElement(
|
|
573
|
+
Drawer,
|
|
574
|
+
{
|
|
575
|
+
classes: { paper: classes.paper },
|
|
576
|
+
anchor: "right",
|
|
577
|
+
open,
|
|
578
|
+
onClose: () => setOpen(false)
|
|
579
|
+
},
|
|
580
|
+
/* @__PURE__ */ React.createElement(
|
|
581
|
+
TechDocsBuildLogsDrawerContent,
|
|
582
|
+
{
|
|
583
|
+
buildLog,
|
|
584
|
+
onClose: () => setOpen(false)
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
));
|
|
571
588
|
};
|
|
572
589
|
|
|
573
590
|
const TechDocsNotFound = ({ errorMessage }) => {
|
|
@@ -576,11 +593,14 @@ const TechDocsNotFound = ({ errorMessage }) => {
|
|
|
576
593
|
if (techdocsBuilder !== "local") {
|
|
577
594
|
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.";
|
|
578
595
|
}
|
|
579
|
-
return /* @__PURE__ */ React.createElement(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
596
|
+
return /* @__PURE__ */ React.createElement(
|
|
597
|
+
ErrorPage,
|
|
598
|
+
{
|
|
599
|
+
status: "404",
|
|
600
|
+
statusMessage: errorMessage || "Documentation not found",
|
|
601
|
+
additionalInfo
|
|
602
|
+
}
|
|
603
|
+
);
|
|
584
604
|
};
|
|
585
605
|
|
|
586
606
|
const useStyles$2 = makeStyles((theme) => ({
|
|
@@ -603,63 +623,70 @@ const TechDocsStateIndicator = () => {
|
|
|
603
623
|
buildLog
|
|
604
624
|
} = useTechDocsReader();
|
|
605
625
|
if (state === "INITIAL_BUILD") {
|
|
606
|
-
StateAlert = /* @__PURE__ */ React.createElement(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
626
|
+
StateAlert = /* @__PURE__ */ React.createElement(
|
|
627
|
+
Alert,
|
|
628
|
+
{
|
|
629
|
+
classes: { root: classes.root },
|
|
630
|
+
variant: "outlined",
|
|
631
|
+
severity: "info",
|
|
632
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, { size: "24px" }),
|
|
633
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog })
|
|
634
|
+
},
|
|
635
|
+
"Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster."
|
|
636
|
+
);
|
|
617
637
|
}
|
|
618
638
|
if (state === "CONTENT_STALE_REFRESHING") {
|
|
619
|
-
StateAlert = /* @__PURE__ */ React.createElement(
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
639
|
+
StateAlert = /* @__PURE__ */ React.createElement(
|
|
640
|
+
Alert,
|
|
641
|
+
{
|
|
642
|
+
variant: "outlined",
|
|
643
|
+
severity: "info",
|
|
644
|
+
icon: /* @__PURE__ */ React.createElement(CircularProgress, { size: "24px" }),
|
|
645
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
|
|
646
|
+
classes: { root: classes.root }
|
|
647
|
+
},
|
|
648
|
+
"A newer version of this documentation is being prepared and will be available shortly."
|
|
649
|
+
);
|
|
630
650
|
}
|
|
631
651
|
if (state === "CONTENT_STALE_READY") {
|
|
632
|
-
StateAlert = /* @__PURE__ */ React.createElement(
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
onClick: () => contentReload()
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
652
|
+
StateAlert = /* @__PURE__ */ React.createElement(
|
|
653
|
+
Alert,
|
|
654
|
+
{
|
|
655
|
+
variant: "outlined",
|
|
656
|
+
severity: "success",
|
|
657
|
+
action: /* @__PURE__ */ React.createElement(Button, { color: "inherit", onClick: () => contentReload() }, "Refresh"),
|
|
658
|
+
classes: { root: classes.root }
|
|
659
|
+
},
|
|
660
|
+
"A newer version of this documentation is now available, please refresh to view."
|
|
661
|
+
);
|
|
641
662
|
}
|
|
642
663
|
if (state === "CONTENT_STALE_ERROR") {
|
|
643
|
-
StateAlert = /* @__PURE__ */ React.createElement(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
664
|
+
StateAlert = /* @__PURE__ */ React.createElement(
|
|
665
|
+
Alert,
|
|
666
|
+
{
|
|
667
|
+
variant: "outlined",
|
|
668
|
+
severity: "error",
|
|
669
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
|
|
670
|
+
classes: { root: classes.root, message: classes.message }
|
|
671
|
+
},
|
|
672
|
+
"Building a newer version of this documentation failed.",
|
|
673
|
+
" ",
|
|
674
|
+
syncErrorMessage
|
|
675
|
+
);
|
|
651
676
|
}
|
|
652
677
|
if (state === "CONTENT_NOT_FOUND") {
|
|
653
|
-
StateAlert = /* @__PURE__ */ React.createElement(React.Fragment, null, syncErrorMessage && /* @__PURE__ */ React.createElement(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
678
|
+
StateAlert = /* @__PURE__ */ React.createElement(React.Fragment, null, syncErrorMessage && /* @__PURE__ */ React.createElement(
|
|
679
|
+
Alert,
|
|
680
|
+
{
|
|
681
|
+
variant: "outlined",
|
|
682
|
+
severity: "error",
|
|
683
|
+
action: /* @__PURE__ */ React.createElement(TechDocsBuildLogs, { buildLog }),
|
|
684
|
+
classes: { root: classes.root, message: classes.message }
|
|
685
|
+
},
|
|
686
|
+
"Building a newer version of this documentation failed.",
|
|
687
|
+
" ",
|
|
688
|
+
syncErrorMessage
|
|
689
|
+
), /* @__PURE__ */ React.createElement(TechDocsNotFound, { errorMessage: contentErrorMessage }));
|
|
663
690
|
}
|
|
664
691
|
return StateAlert;
|
|
665
692
|
};
|
|
@@ -1439,28 +1466,27 @@ const CopyToClipboardTooltip = withStyles((theme) => ({
|
|
|
1439
1466
|
boxShadow: "none"
|
|
1440
1467
|
}
|
|
1441
1468
|
}))(Tooltip);
|
|
1442
|
-
const CopyToClipboardIcon = () => /* @__PURE__ */ React.createElement(SvgIcon, null, /* @__PURE__ */ React.createElement("path", {
|
|
1443
|
-
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
|
|
1444
|
-
}));
|
|
1469
|
+
const CopyToClipboardIcon = () => /* @__PURE__ */ React.createElement(SvgIcon, null, /* @__PURE__ */ React.createElement("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }));
|
|
1445
1470
|
const CopyToClipboardButton = ({ text }) => {
|
|
1446
1471
|
const [open, setOpen] = useState(false);
|
|
1447
1472
|
const handleClick = useCallback(() => {
|
|
1448
|
-
navigator.clipboard.writeText(text);
|
|
1473
|
+
window.navigator.clipboard.writeText(text);
|
|
1449
1474
|
setOpen(true);
|
|
1450
1475
|
}, [text]);
|
|
1451
1476
|
const handleClose = useCallback(() => {
|
|
1452
1477
|
setOpen(false);
|
|
1453
1478
|
}, [setOpen]);
|
|
1454
|
-
return /* @__PURE__ */ React.createElement(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1479
|
+
return /* @__PURE__ */ React.createElement(
|
|
1480
|
+
CopyToClipboardTooltip,
|
|
1481
|
+
{
|
|
1482
|
+
title: "Copied to clipboard",
|
|
1483
|
+
placement: "left",
|
|
1484
|
+
open,
|
|
1485
|
+
onClose: handleClose,
|
|
1486
|
+
leaveDelay: 1e3
|
|
1487
|
+
},
|
|
1488
|
+
/* @__PURE__ */ React.createElement("button", { className: "md-clipboard md-icon", onClick: handleClick }, /* @__PURE__ */ React.createElement(CopyToClipboardIcon, null))
|
|
1489
|
+
);
|
|
1464
1490
|
};
|
|
1465
1491
|
const copyToClipboard = (theme) => {
|
|
1466
1492
|
return (dom) => {
|
|
@@ -1471,11 +1497,7 @@ const copyToClipboard = (theme) => {
|
|
|
1471
1497
|
const container = document.createElement("div");
|
|
1472
1498
|
(_a = code == null ? void 0 : code.parentElement) == null ? void 0 : _a.prepend(container);
|
|
1473
1499
|
ReactDOM.render(
|
|
1474
|
-
/* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
1475
|
-
theme
|
|
1476
|
-
}, /* @__PURE__ */ React.createElement(CopyToClipboardButton, {
|
|
1477
|
-
text
|
|
1478
|
-
})),
|
|
1500
|
+
/* @__PURE__ */ React.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React.createElement(CopyToClipboardButton, { text })),
|
|
1479
1501
|
container
|
|
1480
1502
|
);
|
|
1481
1503
|
}
|
|
@@ -1766,13 +1788,7 @@ const TechDocsReaderPageContentAddons = () => {
|
|
|
1766
1788
|
);
|
|
1767
1789
|
secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
|
|
1768
1790
|
}
|
|
1769
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, {
|
|
1770
|
-
container: primarySidebarAddonLocation
|
|
1771
|
-
}, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, {
|
|
1772
|
-
container: contentElement
|
|
1773
|
-
}, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, {
|
|
1774
|
-
container: secondarySidebarAddonLocation
|
|
1775
|
-
}, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar)));
|
|
1791
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, { container: primarySidebarAddonLocation }, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, { container: contentElement }, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, { container: secondarySidebarAddonLocation }, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar)));
|
|
1776
1792
|
};
|
|
1777
1793
|
|
|
1778
1794
|
const useStyles$1 = makeStyles({
|
|
@@ -1805,37 +1821,17 @@ const TechDocsReaderPageContent = withTechDocsReaderProvider(
|
|
|
1805
1821
|
[setShadowRoot, onReady]
|
|
1806
1822
|
);
|
|
1807
1823
|
if (entityMetadataLoading === false && !entityMetadata)
|
|
1808
|
-
return /* @__PURE__ */ React.createElement(ErrorPage, {
|
|
1809
|
-
status: "404",
|
|
1810
|
-
statusMessage: "PAGE NOT FOUND"
|
|
1811
|
-
});
|
|
1824
|
+
return /* @__PURE__ */ React.createElement(ErrorPage, { status: "404", statusMessage: "PAGE NOT FOUND" });
|
|
1812
1825
|
if (!dom) {
|
|
1813
|
-
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
1814
|
-
container: true
|
|
1815
|
-
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
1816
|
-
xs: 12,
|
|
1817
|
-
item: true
|
|
1818
|
-
}, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
|
|
1826
|
+
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
|
|
1819
1827
|
}
|
|
1820
|
-
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
xs: "auto",
|
|
1828
|
-
item: true
|
|
1829
|
-
}, /* @__PURE__ */ React.createElement(TechDocsSearch, {
|
|
1830
|
-
entityId: entityRef,
|
|
1831
|
-
entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
|
|
1832
|
-
})), /* @__PURE__ */ React.createElement(Grid, {
|
|
1833
|
-
xs: 12,
|
|
1834
|
-
item: true
|
|
1835
|
-
}, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
|
|
1836
|
-
element: dom,
|
|
1837
|
-
onAppend: handleAppend
|
|
1838
|
-
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
|
|
1828
|
+
return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null)), withSearch && /* @__PURE__ */ React.createElement(Grid, { className: classes.search, xs: "auto", item: true }, /* @__PURE__ */ React.createElement(
|
|
1829
|
+
TechDocsSearch,
|
|
1830
|
+
{
|
|
1831
|
+
entityId: entityRef,
|
|
1832
|
+
entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
|
|
1833
|
+
}
|
|
1834
|
+
)), /* @__PURE__ */ React.createElement(Grid, { xs: 12, item: true }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, { element: dom, onAppend: handleAppend }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
|
|
1839
1835
|
}
|
|
1840
1836
|
);
|
|
1841
1837
|
const Reader = TechDocsReaderPageContent;
|
|
@@ -1851,11 +1847,7 @@ const rootCatalogDocsRouteRef = createRouteRef({
|
|
|
1851
1847
|
id: "techdocs:catalog-reader-view"
|
|
1852
1848
|
});
|
|
1853
1849
|
|
|
1854
|
-
const skeleton = /* @__PURE__ */ React.createElement(Skeleton, {
|
|
1855
|
-
animation: "wave",
|
|
1856
|
-
variant: "text",
|
|
1857
|
-
height: 40
|
|
1858
|
-
});
|
|
1850
|
+
const skeleton = /* @__PURE__ */ React.createElement(Skeleton, { animation: "wave", variant: "text", height: 40 });
|
|
1859
1851
|
const TechDocsReaderPageHeader = (props) => {
|
|
1860
1852
|
const { children } = props;
|
|
1861
1853
|
const addons = useTechDocsAddons();
|
|
@@ -1887,54 +1879,68 @@ const TechDocsReaderPageHeader = (props) => {
|
|
|
1887
1879
|
const lifecycle = spec == null ? void 0 : spec.lifecycle;
|
|
1888
1880
|
const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
|
|
1889
1881
|
const docsRootLink = useRouteRef(rootRouteRef)();
|
|
1890
|
-
const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1882
|
+
const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
1883
|
+
HeaderLabel,
|
|
1884
|
+
{
|
|
1885
|
+
label: capitalize((entityMetadata == null ? void 0 : entityMetadata.kind) || "entity"),
|
|
1886
|
+
value: /* @__PURE__ */ React.createElement(
|
|
1887
|
+
EntityRefLink,
|
|
1888
|
+
{
|
|
1889
|
+
color: "inherit",
|
|
1890
|
+
entityRef,
|
|
1891
|
+
title: entityMetadata == null ? void 0 : entityMetadata.metadata.title,
|
|
1892
|
+
defaultKind: "Component"
|
|
1893
|
+
}
|
|
1894
|
+
)
|
|
1895
|
+
}
|
|
1896
|
+
), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(
|
|
1897
|
+
HeaderLabel,
|
|
1898
|
+
{
|
|
1899
|
+
label: "Owner",
|
|
1900
|
+
value: /* @__PURE__ */ React.createElement(
|
|
1901
|
+
EntityRefLinks,
|
|
1902
|
+
{
|
|
1903
|
+
color: "inherit",
|
|
1904
|
+
entityRefs: ownedByRelations,
|
|
1905
|
+
defaultKind: "group"
|
|
1906
|
+
}
|
|
1907
|
+
)
|
|
1908
|
+
}
|
|
1909
|
+
), lifecycle ? /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Lifecycle", value: lifecycle }) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(
|
|
1910
|
+
HeaderLabel,
|
|
1911
|
+
{
|
|
1912
|
+
label: "",
|
|
1913
|
+
value: /* @__PURE__ */ React.createElement(
|
|
1914
|
+
Grid,
|
|
1915
|
+
{
|
|
1916
|
+
container: true,
|
|
1917
|
+
direction: "column",
|
|
1918
|
+
alignItems: "center",
|
|
1919
|
+
style: { color: "#fff" }
|
|
1920
|
+
},
|
|
1921
|
+
/* @__PURE__ */ React.createElement(Grid, { style: { padding: 0 }, item: true }, /* @__PURE__ */ React.createElement(CodeIcon, { style: { marginTop: "-25px" } })),
|
|
1922
|
+
/* @__PURE__ */ React.createElement(Grid, { style: { padding: 0 }, item: true }, "Source")
|
|
1923
|
+
),
|
|
1924
|
+
url: locationMetadata.target
|
|
1925
|
+
}
|
|
1926
|
+
) : null);
|
|
1926
1927
|
const noEntMetadata = !entityMetadataLoading && entityMetadata === void 0;
|
|
1927
1928
|
const noTdMetadata = !metadataLoading && metadata === void 0;
|
|
1928
1929
|
if (noEntMetadata || noTdMetadata)
|
|
1929
1930
|
return null;
|
|
1930
|
-
return /* @__PURE__ */ React.createElement(
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1931
|
+
return /* @__PURE__ */ React.createElement(
|
|
1932
|
+
Header,
|
|
1933
|
+
{
|
|
1934
|
+
type: "Documentation",
|
|
1935
|
+
typeLink: docsRootLink,
|
|
1936
|
+
title: title || skeleton,
|
|
1937
|
+
subtitle: subtitle === "" ? void 0 : subtitle || skeleton
|
|
1938
|
+
},
|
|
1939
|
+
/* @__PURE__ */ React.createElement(Helmet, { titleTemplate: "%s" }, /* @__PURE__ */ React.createElement("title", null, tabTitle)),
|
|
1940
|
+
labels,
|
|
1941
|
+
children,
|
|
1942
|
+
addons.renderComponentsByLocation(TechDocsAddonLocations.Header)
|
|
1943
|
+
);
|
|
1938
1944
|
};
|
|
1939
1945
|
|
|
1940
1946
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -1966,40 +1972,44 @@ const TechDocsReaderPageSubheader = (props) => {
|
|
|
1966
1972
|
return null;
|
|
1967
1973
|
if (entityMetadataLoading === false && !entityMetadata)
|
|
1968
1974
|
return null;
|
|
1969
|
-
return /* @__PURE__ */ React.createElement(Toolbar, {
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
title: "Settings"
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1975
|
+
return /* @__PURE__ */ React.createElement(Toolbar, { classes, ...props.toolbarProps }, /* @__PURE__ */ React.createElement(
|
|
1976
|
+
Box,
|
|
1977
|
+
{
|
|
1978
|
+
display: "flex",
|
|
1979
|
+
justifyContent: "flex-end",
|
|
1980
|
+
width: "100%",
|
|
1981
|
+
flexWrap: "wrap"
|
|
1982
|
+
},
|
|
1983
|
+
subheaderAddons,
|
|
1984
|
+
settingsAddons ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Settings" }, /* @__PURE__ */ React.createElement(
|
|
1985
|
+
IconButton,
|
|
1986
|
+
{
|
|
1987
|
+
"aria-controls": "tech-docs-reader-page-settings",
|
|
1988
|
+
"aria-haspopup": "true",
|
|
1989
|
+
onClick: handleClick
|
|
1990
|
+
},
|
|
1991
|
+
/* @__PURE__ */ React.createElement(SettingsIcon, null)
|
|
1992
|
+
)), /* @__PURE__ */ React.createElement(
|
|
1993
|
+
Menu,
|
|
1994
|
+
{
|
|
1995
|
+
id: "tech-docs-reader-page-settings",
|
|
1996
|
+
getContentAnchorEl: null,
|
|
1997
|
+
anchorEl,
|
|
1998
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1999
|
+
open: Boolean(anchorEl),
|
|
2000
|
+
onClose: handleClose,
|
|
2001
|
+
keepMounted: true
|
|
2002
|
+
},
|
|
2003
|
+
settingsAddons
|
|
2004
|
+
)) : null
|
|
2005
|
+
));
|
|
1992
2006
|
};
|
|
1993
2007
|
|
|
1994
2008
|
const TechDocsReaderLayout = ({
|
|
1995
2009
|
withSearch,
|
|
1996
2010
|
withHeader = true
|
|
1997
2011
|
}) => {
|
|
1998
|
-
return /* @__PURE__ */ React.createElement(Page, {
|
|
1999
|
-
themeId: "documentation"
|
|
2000
|
-
}, withHeader && /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, {
|
|
2001
|
-
withSearch
|
|
2002
|
-
}));
|
|
2012
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "documentation" }, withHeader && /* @__PURE__ */ React.createElement(TechDocsReaderPageHeader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, { withSearch }));
|
|
2003
2013
|
};
|
|
2004
2014
|
const TechDocsReaderPage$1 = (props) => {
|
|
2005
2015
|
const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);
|
|
@@ -2016,17 +2026,9 @@ const TechDocsReaderPage$1 = (props) => {
|
|
|
2016
2026
|
const page = grandChildren.find(
|
|
2017
2027
|
(grandChild) => !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY)
|
|
2018
2028
|
);
|
|
2019
|
-
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, {
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
}
|
|
2023
|
-
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, {
|
|
2024
|
-
entityRef
|
|
2025
|
-
}, ({ metadata, entityMetadata, onReady }) => /* @__PURE__ */ React.createElement("div", {
|
|
2026
|
-
className: "techdocs-reader-page"
|
|
2027
|
-
}, /* @__PURE__ */ React.createElement(Page, {
|
|
2028
|
-
themeId: "documentation"
|
|
2029
|
-
}, children instanceof Function ? children({
|
|
2029
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, { entityRef }, page || /* @__PURE__ */ React.createElement(TechDocsReaderLayout, null));
|
|
2030
|
+
}
|
|
2031
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderPageProvider, { entityRef }, ({ metadata, entityMetadata, onReady }) => /* @__PURE__ */ React.createElement("div", { className: "techdocs-reader-page" }, /* @__PURE__ */ React.createElement(Page, { themeId: "documentation" }, children instanceof Function ? children({
|
|
2030
2032
|
entityRef,
|
|
2031
2033
|
techdocsMetadataValue: metadata.value,
|
|
2032
2034
|
entityMetadataValue: entityMetadata.value,
|
|
@@ -2046,26 +2048,29 @@ const DocsCardGrid = (props) => {
|
|
|
2046
2048
|
const config = useApi(configApiRef);
|
|
2047
2049
|
if (!entities)
|
|
2048
2050
|
return null;
|
|
2049
|
-
return /* @__PURE__ */ React.createElement(ItemCardGrid, {
|
|
2050
|
-
"data-testid": "docs-explore"
|
|
2051
|
-
}, !(entities == null ? void 0 : entities.length) ? null : entities.map((entity, index) => {
|
|
2051
|
+
return /* @__PURE__ */ React.createElement(ItemCardGrid, { "data-testid": "docs-explore" }, !(entities == null ? void 0 : entities.length) ? null : entities.map((entity, index) => {
|
|
2052
2052
|
var _a, _b;
|
|
2053
|
-
return /* @__PURE__ */ React.createElement(Card, {
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2053
|
+
return /* @__PURE__ */ React.createElement(Card, { key: index }, /* @__PURE__ */ React.createElement(CardMedia, null, /* @__PURE__ */ React.createElement(
|
|
2054
|
+
ItemCardHeader,
|
|
2055
|
+
{
|
|
2056
|
+
title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
|
|
2057
|
+
}
|
|
2058
|
+
)), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(
|
|
2059
|
+
Button$1,
|
|
2060
|
+
{
|
|
2061
|
+
to: getRouteToReaderPageFor({
|
|
2062
|
+
namespace: toLowerMaybe(
|
|
2063
|
+
(_b = entity.metadata.namespace) != null ? _b : "default",
|
|
2064
|
+
config
|
|
2065
|
+
),
|
|
2066
|
+
kind: toLowerMaybe(entity.kind, config),
|
|
2067
|
+
name: toLowerMaybe(entity.metadata.name, config)
|
|
2068
|
+
}),
|
|
2069
|
+
color: "primary",
|
|
2070
|
+
"data-testid": "read_docs"
|
|
2071
|
+
},
|
|
2072
|
+
"Read Docs"
|
|
2073
|
+
)));
|
|
2069
2074
|
}));
|
|
2070
2075
|
};
|
|
2071
2076
|
|
|
@@ -2088,39 +2093,30 @@ const EntityListDocsGridGroup = ({
|
|
|
2088
2093
|
return typeof group.filterPredicate === "function" && group.filterPredicate(entity);
|
|
2089
2094
|
});
|
|
2090
2095
|
const titleComponent = (() => {
|
|
2091
|
-
return typeof group.title === "string" ? /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
2092
|
-
title: group.title
|
|
2093
|
-
}) : group.title;
|
|
2096
|
+
return typeof group.title === "string" ? /* @__PURE__ */ React.createElement(ContentHeader, { title: group.title }) : group.title;
|
|
2094
2097
|
})();
|
|
2095
2098
|
if (shownEntities.length === 0) {
|
|
2096
2099
|
return null;
|
|
2097
2100
|
}
|
|
2098
|
-
return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(DocsCardGrid, {
|
|
2099
|
-
entities: shownEntities
|
|
2100
|
-
}));
|
|
2101
|
+
return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(DocsCardGrid, { entities: shownEntities }));
|
|
2101
2102
|
};
|
|
2102
2103
|
const EntityListDocsGrid = ({ groups }) => {
|
|
2103
2104
|
const { loading, error, entities } = useEntityList();
|
|
2104
2105
|
if (error) {
|
|
2105
|
-
return /* @__PURE__ */ React.createElement(
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2106
|
+
return /* @__PURE__ */ React.createElement(
|
|
2107
|
+
WarningPanel,
|
|
2108
|
+
{
|
|
2109
|
+
severity: "error",
|
|
2110
|
+
title: "Could not load available documentation."
|
|
2111
|
+
},
|
|
2112
|
+
/* @__PURE__ */ React.createElement(CodeSnippet, { language: "text", text: error.toString() })
|
|
2113
|
+
);
|
|
2112
2114
|
}
|
|
2113
2115
|
if (loading) {
|
|
2114
2116
|
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
2115
2117
|
}
|
|
2116
2118
|
if (entities.length === 0) {
|
|
2117
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2118
|
-
"data-testid": "doc-not-found"
|
|
2119
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
2120
|
-
variant: "body2"
|
|
2121
|
-
}, "No documentation found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link, {
|
|
2122
|
-
to: "https://backstage.io/docs/features/techdocs/creating-and-publishing"
|
|
2123
|
-
}, "publishing documentation"), "."));
|
|
2119
|
+
return /* @__PURE__ */ React.createElement("div", { "data-testid": "doc-not-found" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "No documentation found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/techdocs/creating-and-publishing" }, "publishing documentation"), "."));
|
|
2124
2120
|
}
|
|
2125
2121
|
entities.sort(
|
|
2126
2122
|
(a, b) => {
|
|
@@ -2130,11 +2126,14 @@ const EntityListDocsGrid = ({ groups }) => {
|
|
|
2130
2126
|
);
|
|
2131
2127
|
}
|
|
2132
2128
|
);
|
|
2133
|
-
return /* @__PURE__ */ React.createElement(Content, null, (groups || [allEntitiesGroup]).map((group, index) => /* @__PURE__ */ React.createElement(
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2129
|
+
return /* @__PURE__ */ React.createElement(Content, null, (groups || [allEntitiesGroup]).map((group, index) => /* @__PURE__ */ React.createElement(
|
|
2130
|
+
EntityListDocsGridGroup,
|
|
2131
|
+
{
|
|
2132
|
+
entities,
|
|
2133
|
+
group,
|
|
2134
|
+
key: `${group.title}-${index}`
|
|
2135
|
+
}
|
|
2136
|
+
)));
|
|
2138
2137
|
};
|
|
2139
2138
|
|
|
2140
2139
|
const YellowStar = withStyles$1({
|
|
@@ -2146,9 +2145,7 @@ const actionFactories = {
|
|
|
2146
2145
|
createCopyDocsUrlAction(copyToClipboard) {
|
|
2147
2146
|
return (row) => {
|
|
2148
2147
|
return {
|
|
2149
|
-
icon: () => /* @__PURE__ */ React.createElement(ShareIcon, {
|
|
2150
|
-
fontSize: "small"
|
|
2151
|
-
}),
|
|
2148
|
+
icon: () => /* @__PURE__ */ React.createElement(ShareIcon, { fontSize: "small" }),
|
|
2152
2149
|
tooltip: "Click to copy documentation link to clipboard",
|
|
2153
2150
|
onClick: () => copyToClipboard(`${window.location.origin}${row.resolved.docsUrl}`)
|
|
2154
2151
|
};
|
|
@@ -2176,22 +2173,26 @@ const columnFactories = {
|
|
|
2176
2173
|
title: "Document",
|
|
2177
2174
|
field: "entity.metadata.name",
|
|
2178
2175
|
highlight: true,
|
|
2179
|
-
render: (row) => /* @__PURE__ */ React.createElement(
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2176
|
+
render: (row) => /* @__PURE__ */ React.createElement(
|
|
2177
|
+
SubvalueCell,
|
|
2178
|
+
{
|
|
2179
|
+
value: /* @__PURE__ */ React.createElement(Link, { to: row.resolved.docsUrl }, customTitle(row.entity)),
|
|
2180
|
+
subvalue: row.entity.metadata.description
|
|
2181
|
+
}
|
|
2182
|
+
)
|
|
2185
2183
|
};
|
|
2186
2184
|
},
|
|
2187
2185
|
createOwnerColumn() {
|
|
2188
2186
|
return {
|
|
2189
2187
|
title: "Owner",
|
|
2190
2188
|
field: "resolved.ownedByRelationsTitle",
|
|
2191
|
-
render: ({ resolved }) => /* @__PURE__ */ React.createElement(
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2189
|
+
render: ({ resolved }) => /* @__PURE__ */ React.createElement(
|
|
2190
|
+
EntityRefLinks,
|
|
2191
|
+
{
|
|
2192
|
+
entityRefs: resolved.ownedByRelations,
|
|
2193
|
+
defaultKind: "group"
|
|
2194
|
+
}
|
|
2195
|
+
)
|
|
2195
2196
|
};
|
|
2196
2197
|
},
|
|
2197
2198
|
createTypeColumn() {
|
|
@@ -2236,28 +2237,38 @@ const DocsTable = (props) => {
|
|
|
2236
2237
|
const defaultActions = [
|
|
2237
2238
|
actionFactories.createCopyDocsUrlAction(copyToClipboard)
|
|
2238
2239
|
];
|
|
2239
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, loading || documents && documents.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2240
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, loading || documents && documents.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
2241
|
+
Table,
|
|
2242
|
+
{
|
|
2243
|
+
isLoading: loading,
|
|
2244
|
+
options: {
|
|
2245
|
+
paging: true,
|
|
2246
|
+
pageSize: 20,
|
|
2247
|
+
search: true,
|
|
2248
|
+
actionsColumnIndex: -1
|
|
2249
|
+
},
|
|
2250
|
+
data: documents,
|
|
2251
|
+
columns: columns || defaultColumns,
|
|
2252
|
+
actions: actions || defaultActions,
|
|
2253
|
+
title: title ? `${title} (${documents.length})` : `All (${documents.length})`
|
|
2254
|
+
}
|
|
2255
|
+
) : /* @__PURE__ */ React.createElement(
|
|
2256
|
+
EmptyState,
|
|
2257
|
+
{
|
|
2258
|
+
missing: "data",
|
|
2259
|
+
title: "No documents to show",
|
|
2260
|
+
description: "Create your own document. Check out our Getting Started Information",
|
|
2261
|
+
action: /* @__PURE__ */ React.createElement(
|
|
2262
|
+
Button$1,
|
|
2263
|
+
{
|
|
2264
|
+
color: "primary",
|
|
2265
|
+
to: "https://backstage.io/docs/features/techdocs/getting-started",
|
|
2266
|
+
variant: "contained"
|
|
2267
|
+
},
|
|
2268
|
+
"DOCS"
|
|
2269
|
+
)
|
|
2270
|
+
}
|
|
2271
|
+
));
|
|
2261
2272
|
};
|
|
2262
2273
|
DocsTable.columns = columnFactories;
|
|
2263
2274
|
DocsTable.actions = actionFactories;
|
|
@@ -2277,21 +2288,25 @@ const EntityListDocsTable = (props) => {
|
|
|
2277
2288
|
)
|
|
2278
2289
|
];
|
|
2279
2290
|
if (error) {
|
|
2280
|
-
return /* @__PURE__ */ React.createElement(
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2291
|
+
return /* @__PURE__ */ React.createElement(
|
|
2292
|
+
WarningPanel,
|
|
2293
|
+
{
|
|
2294
|
+
severity: "error",
|
|
2295
|
+
title: "Could not load available documentation."
|
|
2296
|
+
},
|
|
2297
|
+
/* @__PURE__ */ React.createElement(CodeSnippet, { language: "text", text: error.toString() })
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2300
|
+
return /* @__PURE__ */ React.createElement(
|
|
2301
|
+
DocsTable,
|
|
2302
|
+
{
|
|
2303
|
+
title,
|
|
2304
|
+
entities,
|
|
2305
|
+
loading,
|
|
2306
|
+
actions: actions || defaultActions,
|
|
2307
|
+
columns
|
|
2308
|
+
}
|
|
2309
|
+
);
|
|
2295
2310
|
};
|
|
2296
2311
|
EntityListDocsTable.columns = columnFactories;
|
|
2297
2312
|
EntityListDocsTable.actions = actionFactories;
|
|
@@ -2301,11 +2316,15 @@ const TechDocsPageWrapper = (props) => {
|
|
|
2301
2316
|
const { children } = props;
|
|
2302
2317
|
const configApi = useApi(configApiRef);
|
|
2303
2318
|
const generatedSubtitle = `Documentation available in ${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"}`;
|
|
2304
|
-
return /* @__PURE__ */ React.createElement(
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2319
|
+
return /* @__PURE__ */ React.createElement(
|
|
2320
|
+
PageWithHeader,
|
|
2321
|
+
{
|
|
2322
|
+
title: "Documentation",
|
|
2323
|
+
subtitle: generatedSubtitle,
|
|
2324
|
+
themeId: "documentation"
|
|
2325
|
+
},
|
|
2326
|
+
children
|
|
2327
|
+
);
|
|
2309
2328
|
};
|
|
2310
2329
|
|
|
2311
2330
|
class TechDocsFilter {
|
|
@@ -2327,14 +2346,7 @@ const TechDocsPicker = () => {
|
|
|
2327
2346
|
|
|
2328
2347
|
const DefaultTechDocsHome = (props) => {
|
|
2329
2348
|
const { initialFilter = "owned", columns, actions } = props;
|
|
2330
|
-
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
2331
|
-
title: ""
|
|
2332
|
-
}, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(TechDocsPicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
|
|
2333
|
-
initialFilter
|
|
2334
|
-
}), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, {
|
|
2335
|
-
actions,
|
|
2336
|
-
columns
|
|
2337
|
-
}))))));
|
|
2349
|
+
return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "" }, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(TechDocsPicker, null), /* @__PURE__ */ React.createElement(UserListPicker, { initialFilter }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(EntityListDocsTable, { actions, columns }))))));
|
|
2338
2350
|
};
|
|
2339
2351
|
|
|
2340
2352
|
const techdocsPlugin = createPlugin({
|
|
@@ -2392,7 +2404,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(
|
|
|
2392
2404
|
const TechDocsCustomHome = techdocsPlugin.provide(
|
|
2393
2405
|
createRoutableExtension({
|
|
2394
2406
|
name: "TechDocsCustomHome",
|
|
2395
|
-
component: () => import('./TechDocsCustomHome-
|
|
2407
|
+
component: () => import('./TechDocsCustomHome-c3774096.esm.js').then(
|
|
2396
2408
|
(m) => m.TechDocsCustomHome
|
|
2397
2409
|
),
|
|
2398
2410
|
mountPoint: rootRouteRef
|
|
@@ -2410,7 +2422,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(
|
|
|
2410
2422
|
const TechDocsReaderPage = techdocsPlugin.provide(
|
|
2411
2423
|
createRoutableExtension({
|
|
2412
2424
|
name: "TechDocsReaderPage",
|
|
2413
|
-
component: () => import('./index-
|
|
2425
|
+
component: () => import('./index-a106661c.esm.js').then(
|
|
2414
2426
|
(m) => m.TechDocsReaderPage
|
|
2415
2427
|
),
|
|
2416
2428
|
mountPoint: rootDocsRouteRef
|
|
@@ -2419,18 +2431,12 @@ const TechDocsReaderPage = techdocsPlugin.provide(
|
|
|
2419
2431
|
|
|
2420
2432
|
const EntityPageDocs = ({ entity }) => {
|
|
2421
2433
|
const entityRef = getCompoundEntityRef(entity);
|
|
2422
|
-
return /* @__PURE__ */ React.createElement(TechDocsReaderPage, {
|
|
2423
|
-
entityRef
|
|
2424
|
-
}, /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, {
|
|
2425
|
-
withSearch: false
|
|
2426
|
-
}));
|
|
2434
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderPage, { entityRef }, /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, { withSearch: false }));
|
|
2427
2435
|
};
|
|
2428
2436
|
|
|
2429
2437
|
const TechDocsIndexPage = (props) => {
|
|
2430
2438
|
const outlet = useOutlet$1();
|
|
2431
|
-
return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, {
|
|
2432
|
-
...props
|
|
2433
|
-
});
|
|
2439
|
+
return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, { ...props });
|
|
2434
2440
|
};
|
|
2435
2441
|
|
|
2436
2442
|
var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -2444,13 +2450,13 @@ const isTechDocsAvailable = (entity) => {
|
|
|
2444
2450
|
return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[TECHDOCS_ANNOTATION]);
|
|
2445
2451
|
};
|
|
2446
2452
|
const Router = () => {
|
|
2447
|
-
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2453
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null) }), /* @__PURE__ */ React.createElement(
|
|
2454
|
+
Route,
|
|
2455
|
+
{
|
|
2456
|
+
path: "/:namespace/:kind/:name/*",
|
|
2457
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage$1, null)
|
|
2458
|
+
}
|
|
2459
|
+
));
|
|
2454
2460
|
};
|
|
2455
2461
|
const EmbeddedDocsRouter = (props) => {
|
|
2456
2462
|
var _a;
|
|
@@ -2459,9 +2465,7 @@ const EmbeddedDocsRouter = (props) => {
|
|
|
2459
2465
|
const element = useRoutes([
|
|
2460
2466
|
{
|
|
2461
2467
|
path: "/*",
|
|
2462
|
-
element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
|
|
2463
|
-
entity
|
|
2464
|
-
}),
|
|
2468
|
+
element: /* @__PURE__ */ React.createElement(EntityPageDocs, { entity }),
|
|
2465
2469
|
children: [
|
|
2466
2470
|
{
|
|
2467
2471
|
path: "*",
|
|
@@ -2472,9 +2476,7 @@ const EmbeddedDocsRouter = (props) => {
|
|
|
2472
2476
|
]);
|
|
2473
2477
|
const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
|
|
2474
2478
|
if (!projectId) {
|
|
2475
|
-
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
|
|
2476
|
-
annotation: TECHDOCS_ANNOTATION
|
|
2477
|
-
});
|
|
2479
|
+
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: TECHDOCS_ANNOTATION });
|
|
2478
2480
|
}
|
|
2479
2481
|
return element;
|
|
2480
2482
|
};
|
|
@@ -2487,4 +2489,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
|
|
|
2487
2489
|
});
|
|
2488
2490
|
|
|
2489
2491
|
export { DocsTable as D, EntityTechdocsContent as E, Reader as R, TechDocsPageWrapper as T, DocsCardGrid as a, TechDocsReaderPage$1 as b, TechDocsReaderLayout as c, TechDocsCustomHome as d, TechDocsIndexPage$2 as e, TechdocsPage as f, TechDocsReaderPage as g, techdocsStorageApiRef as h, techdocsApiRef as i, TechDocsClient as j, TechDocsStorageClient as k, TechDocsReaderProvider as l, TechDocsReaderPageHeader as m, TechDocsReaderPageContent as n, TechDocsReaderPageSubheader as o, TechDocsSearchResultListItem as p, TechDocsSearch as q, EntityListDocsGrid as r, EntityListDocsTable as s, techdocsPlugin as t, DefaultTechDocsHome as u, TechDocsPicker as v, isTechDocsAvailable as w, Router as x, EmbeddedDocsRouter as y };
|
|
2490
|
-
//# sourceMappingURL=index-
|
|
2492
|
+
//# sourceMappingURL=index-1eb4d135.esm.js.map
|