@axis-backstage/plugin-readme 0.13.0 → 0.15.0
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 +12 -0
- package/dist/components/FetchComponent/FetchComponent.esm.js +20 -9
- package/dist/components/FetchComponent/FetchComponent.esm.js.map +1 -1
- package/dist/components/ReadmeCard/ReadmeCard.esm.js +31 -28
- package/dist/components/ReadmeCard/ReadmeCard.esm.js.map +1 -1
- package/dist/components/ReadmeDialog/ReadmeDialog.esm.js +18 -16
- package/dist/components/ReadmeDialog/ReadmeDialog.esm.js.map +1 -1
- package/dist/hooks/useFullViewParam.esm.js +24 -0
- package/dist/hooks/useFullViewParam.esm.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/package.json +20 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @axis-backstage/plugin-readme
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2a2afb8: Add URL state management and update fullscreen icon
|
|
8
|
+
|
|
9
|
+
## 0.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 86c01b7: Bumped to Backstage 1.40
|
|
14
|
+
|
|
3
15
|
## 0.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { useApi } from '@backstage/core-plugin-api';
|
|
4
4
|
import { Progress, Link, ResponseErrorPanel, ErrorPanel, MarkdownContent, CodeSnippet } from '@backstage/core-components';
|
|
@@ -28,26 +28,37 @@ const FetchComponent = () => {
|
|
|
28
28
|
[entity]
|
|
29
29
|
);
|
|
30
30
|
if (loading) {
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
32
32
|
}
|
|
33
33
|
if (error instanceof ResponseError) {
|
|
34
34
|
if (error.statusCode === 404) {
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(Typography, { pb: 2, variant: "body2", children: [
|
|
37
|
+
"No README.md file found at source location:",
|
|
38
|
+
" ",
|
|
39
|
+
location && /* @__PURE__ */ jsx("strong", { children: location })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
|
|
42
|
+
"Need help? Go to our",
|
|
43
|
+
" ",
|
|
44
|
+
/* @__PURE__ */ jsx(Link, { to: "https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md", children: "documentation" })
|
|
45
|
+
] })
|
|
46
|
+
] });
|
|
36
47
|
}
|
|
37
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
38
49
|
}
|
|
39
50
|
if (error) {
|
|
40
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ jsx(ErrorPanel, { error });
|
|
41
52
|
}
|
|
42
53
|
if (!content) {
|
|
43
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(ErrorPanel, { error: Error("Unknown error") });
|
|
44
55
|
}
|
|
45
56
|
if (!content[1] || content[1] === "error") {
|
|
46
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ jsx(ErrorPanel, { error: Error(content[1] ?? "Unknown error") });
|
|
47
58
|
} else if (content[1].startsWith("text/markdown")) {
|
|
48
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsx(MarkdownContent, { content: content[0] });
|
|
49
60
|
}
|
|
50
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": "readme-content", children: /* @__PURE__ */ jsx(CodeSnippet, { text: content[0], language: "plaintext" }) });
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
export { FetchComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchComponent.esm.js","sources":["../../../src/components/FetchComponent/FetchComponent.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"FetchComponent.esm.js","sources":["../../../src/components/FetchComponent/FetchComponent.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n CodeSnippet,\n ErrorPanel,\n Link,\n MarkdownContent,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { readmeApiRef } from '../../api/ReadmeApi';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { getEntitySourceLocation } from '@backstage/catalog-model';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { ResponseError } from '@backstage/errors';\n\nexport const FetchComponent = () => {\n const { entity } = useEntity();\n const readmeApi = useApi(readmeApiRef);\n let location;\n\n try {\n const { target } = getEntitySourceLocation(entity);\n location = target ?? target;\n } catch (err) {\n location = ': Unknown';\n }\n\n const {\n value: content,\n loading,\n error,\n } = useAsync(\n async (): Promise<string[]> =>\n await readmeApi.getReadmeContent(stringifyEntityRef(entity)),\n [entity],\n );\n\n if (loading) {\n return <Progress />;\n }\n\n if (error instanceof ResponseError) {\n if (error.statusCode === 404) {\n return (\n <Box>\n <Typography pb={2} variant=\"body2\">\n No README.md file found at source location:{' '}\n {location && <strong>{location}</strong>}\n </Typography>\n <Typography variant=\"body2\">\n Need help? Go to our{' '}\n <Link to=\"https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md\">\n documentation\n </Link>\n </Typography>\n </Box>\n );\n }\n return <ResponseErrorPanel error={error} />;\n }\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n if (!content) {\n return <ErrorPanel error={Error('Unknown error')} />;\n }\n if (!content[1] || content[1] === 'error') {\n return <ErrorPanel error={Error(content[1] ?? 'Unknown error')} />;\n } else if (content[1].startsWith('text/markdown')) {\n return <MarkdownContent content={content[0]} />;\n }\n // probably text/plain\n return (\n <div data-testid=\"readme-content\">\n <CodeSnippet text={content[0]} language=\"plaintext\" />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkBO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAI,IAAA,QAAA;AAEJ,EAAI,IAAA;AACF,IAAA,MAAM,EAAE,MAAA,EAAW,GAAA,uBAAA,CAAwB,MAAM,CAAA;AACjD,IAAA,QAAA,GAAW,MAAU,IAAA,MAAA;AAAA,WACd,GAAK,EAAA;AACZ,IAAW,QAAA,GAAA,WAAA;AAAA;AAGb,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,OAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACE,GAAA,QAAA;AAAA,IACF,YACE,MAAM,SAAA,CAAU,gBAAiB,CAAA,kBAAA,CAAmB,MAAM,CAAC,CAAA;AAAA,IAC7D,CAAC,MAAM;AAAA,GACT;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAGnB,EAAA,IAAI,iBAAiB,aAAe,EAAA;AAClC,IAAI,IAAA,KAAA,CAAM,eAAe,GAAK,EAAA;AAC5B,MAAA,4BACG,GACC,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAI,CAAG,EAAA,OAAA,EAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,UAAA,6CAAA;AAAA,UACW,GAAA;AAAA,UAC3C,QAAA,oBAAa,GAAA,CAAA,QAAA,EAAA,EAAQ,QAAS,EAAA,QAAA,EAAA;AAAA,SACjC,EAAA,CAAA;AAAA,wBACA,IAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,UAAA,sBAAA;AAAA,UACL,GAAA;AAAA,0BACpB,GAAA,CAAA,IAAA,EAAA,EAAK,EAAG,EAAA,4FAAA,EAA6F,QAEtG,EAAA,eAAA,EAAA;AAAA,SACF,EAAA;AAAA,OACF,EAAA,CAAA;AAAA;AAGJ,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,cAAW,KAAc,EAAA,CAAA;AAAA;AAEnC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,KAAO,EAAA,KAAA,CAAM,eAAe,CAAG,EAAA,CAAA;AAAA;AAEpD,EAAA,IAAI,CAAC,OAAQ,CAAA,CAAC,KAAK,OAAQ,CAAA,CAAC,MAAM,OAAS,EAAA;AACzC,IAAO,uBAAA,GAAA,CAAC,cAAW,KAAO,EAAA,KAAA,CAAM,QAAQ,CAAC,CAAA,IAAK,eAAe,CAAG,EAAA,CAAA;AAAA,aACvD,OAAQ,CAAA,CAAC,CAAE,CAAA,UAAA,CAAW,eAAe,CAAG,EAAA;AACjD,IAAA,uBAAQ,GAAA,CAAA,eAAA,EAAA,EAAgB,OAAS,EAAA,OAAA,CAAQ,CAAC,CAAG,EAAA,CAAA;AAAA;AAG/C,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA,EAAI,aAAY,EAAA,gBAAA,EACf,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA,EAAY,IAAM,EAAA,OAAA,CAAQ,CAAC,CAAA,EAAG,QAAS,EAAA,WAAA,EAAY,CACtD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
|
+
import FullscreenIcon from '@mui/icons-material/Fullscreen';
|
|
4
5
|
import { InfoCard } from '@backstage/core-components';
|
|
5
6
|
import { FetchComponent } from '../FetchComponent/FetchComponent.esm.js';
|
|
6
|
-
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
7
7
|
import { ReadmeDialog } from '../ReadmeDialog/ReadmeDialog.esm.js';
|
|
8
|
+
import { useFullViewParam } from '../../hooks/useFullViewParam.esm.js';
|
|
8
9
|
|
|
9
10
|
const ReadmeCard = (props) => {
|
|
10
11
|
const { variant = "gridItem", maxHeight: propMaxHeight } = props;
|
|
12
|
+
const [isFullViewOpen, setIsFullViewOpen] = useFullViewParam();
|
|
11
13
|
const maxHeight = variant === "fullHeight" ? "none" : propMaxHeight ?? "235px";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
InfoCard,
|
|
17
|
+
{
|
|
18
|
+
title: "README",
|
|
19
|
+
variant,
|
|
20
|
+
action: variant !== "fullHeight" ? /* @__PURE__ */ jsx(
|
|
21
|
+
IconButton,
|
|
22
|
+
{
|
|
23
|
+
onClick: () => setIsFullViewOpen(true),
|
|
24
|
+
"aria-label": "Open full view",
|
|
25
|
+
title: "Open full view",
|
|
26
|
+
size: "large",
|
|
27
|
+
children: /* @__PURE__ */ jsx(FullscreenIcon, {})
|
|
28
|
+
}
|
|
29
|
+
) : void 0,
|
|
30
|
+
children: /* @__PURE__ */ jsx("div", { style: { overflow: "auto" }, children: /* @__PURE__ */ jsx(Box, { maxHeight, children: /* @__PURE__ */ jsx(FetchComponent, {}) }) })
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
ReadmeDialog,
|
|
35
|
+
{
|
|
36
|
+
open: isFullViewOpen,
|
|
37
|
+
onClose: () => setIsFullViewOpen(false)
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] });
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
export { ReadmeCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["import IconButton from '@mui/material/IconButton';\nimport Box from '@mui/material/Box';\nimport FullscreenIcon from '@mui/icons-material/Fullscreen';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { FetchComponent } from '../FetchComponent';\nimport { ReadmeDialog } from '../ReadmeDialog/ReadmeDialog';\nimport { useFullViewParam } from '../../hooks/useFullViewParam';\n\n/**\n * ReadmeCardProps props.\n *\n * @public\n */\nexport type ReadmeCardProps = {\n variant?: InfoCardVariants;\n maxHeight?: string | number;\n};\n\nexport const ReadmeCard = (props: ReadmeCardProps) => {\n const { variant = 'gridItem', maxHeight: propMaxHeight } = props;\n const [isFullViewOpen, setIsFullViewOpen] = useFullViewParam();\n\n const maxHeight =\n variant === 'fullHeight' ? 'none' : propMaxHeight ?? '235px';\n\n return (\n <>\n <InfoCard\n title=\"README\"\n variant={variant}\n action={\n variant !== 'fullHeight' ? (\n <IconButton\n onClick={() => setIsFullViewOpen(true)}\n aria-label=\"Open full view\"\n title=\"Open full view\"\n size=\"large\"\n >\n <FullscreenIcon />\n </IconButton>\n ) : undefined\n }\n >\n <div style={{ overflow: 'auto' }}>\n <Box maxHeight={maxHeight}>\n <FetchComponent />\n </Box>\n </div>\n </InfoCard>\n\n <ReadmeDialog\n open={isFullViewOpen}\n onClose={() => setIsFullViewOpen(false)}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAkBa,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,SAAA,EAAW,eAAkB,GAAA,KAAA;AAC3D,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,gBAAiB,EAAA;AAE7D,EAAA,MAAM,SACJ,GAAA,OAAA,KAAY,YAAe,GAAA,MAAA,GAAS,aAAiB,IAAA,OAAA;AAEvD,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,QAAA;AAAA,QACN,OAAA;AAAA,QACA,MAAA,EACE,YAAY,YACV,mBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAS,MAAM,iBAAA,CAAkB,IAAI,CAAA;AAAA,YACrC,YAAW,EAAA,gBAAA;AAAA,YACX,KAAM,EAAA,gBAAA;AAAA,YACN,IAAK,EAAA,OAAA;AAAA,YAEL,8BAAC,cAAe,EAAA,EAAA;AAAA;AAAA,SAEhB,GAAA,MAAA;AAAA,QAGN,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,QAAU,EAAA,MAAA,EACtB,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EACH,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,GAClB,CACF,EAAA;AAAA;AAAA,KACF;AAAA,oBAEA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,cAAA;AAAA,QACN,OAAA,EAAS,MAAM,iBAAA,CAAkB,KAAK;AAAA;AAAA;AACxC,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Button from '@mui/material/Button';
|
|
3
3
|
import Dialog from '@mui/material/Dialog';
|
|
4
4
|
import DialogActions from '@mui/material/DialogActions';
|
|
@@ -8,26 +8,28 @@ import Box from '@mui/material/Box';
|
|
|
8
8
|
import { FetchComponent } from '../FetchComponent/FetchComponent.esm.js';
|
|
9
9
|
|
|
10
10
|
const ReadmeDialog = ({ open, onClose }) => {
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
12
|
Dialog,
|
|
13
13
|
{
|
|
14
14
|
maxWidth: "md",
|
|
15
15
|
open,
|
|
16
16
|
onClose,
|
|
17
|
-
"data-testid": "content-dialog"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
"data-testid": "content-dialog",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "README" }),
|
|
20
|
+
/* @__PURE__ */ jsx(DialogContent, { dividers: true, children: /* @__PURE__ */ jsx(Box, { minWidth: 650, children: /* @__PURE__ */ jsx(FetchComponent, {}) }) }),
|
|
21
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
|
|
22
|
+
Button,
|
|
23
|
+
{
|
|
24
|
+
variant: "contained",
|
|
25
|
+
color: "primary",
|
|
26
|
+
"aria-label": "close",
|
|
27
|
+
onClick: onClose,
|
|
28
|
+
children: "Close"
|
|
29
|
+
}
|
|
30
|
+
) })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
31
33
|
);
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadmeDialog.esm.js","sources":["../../../src/components/ReadmeDialog/ReadmeDialog.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ReadmeDialog.esm.js","sources":["../../../src/components/ReadmeDialog/ReadmeDialog.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport Box from '@mui/material/Box';\nimport { FetchComponent } from '../FetchComponent';\n\ntype Props = {\n open: boolean;\n onClose: () => void;\n};\n\nexport const ReadmeDialog = ({ open, onClose }: Props) => {\n return (\n <Dialog\n maxWidth=\"md\"\n open={open}\n onClose={onClose}\n data-testid=\"content-dialog\"\n >\n <DialogTitle>README</DialogTitle>\n <DialogContent dividers>\n <Box minWidth={650}>\n <FetchComponent />\n </Box>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n aria-label=\"close\"\n onClick={onClose}\n >\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAaO,MAAM,YAAe,GAAA,CAAC,EAAE,IAAA,EAAM,SAAqB,KAAA;AACxD,EACE,uBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAS,EAAA,IAAA;AAAA,MACT,IAAA;AAAA,MACA,OAAA;AAAA,MACA,aAAY,EAAA,gBAAA;AAAA,MAEZ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,eAAY,QAAM,EAAA,QAAA,EAAA,CAAA;AAAA,wBACnB,GAAA,CAAC,aAAc,EAAA,EAAA,QAAA,EAAQ,IACrB,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,QAAA,EAAU,GACb,EAAA,QAAA,kBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,CAAA,EAClB,CACF,EAAA,CAAA;AAAA,4BACC,aACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,WAAA;AAAA,YACR,KAAM,EAAA,SAAA;AAAA,YACN,YAAW,EAAA,OAAA;AAAA,YACX,OAAS,EAAA,OAAA;AAAA,YACV,QAAA,EAAA;AAAA;AAAA,SAGH,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
const useFullViewParam = () => {
|
|
5
|
+
const location = useLocation();
|
|
6
|
+
const navigate = useNavigate();
|
|
7
|
+
const isFullView = useMemo(() => {
|
|
8
|
+
const params = new URLSearchParams(location.search);
|
|
9
|
+
return params.get("fullView") === "true";
|
|
10
|
+
}, [location.search]);
|
|
11
|
+
const setFullView = (open) => {
|
|
12
|
+
const params = new URLSearchParams(location.search);
|
|
13
|
+
if (open) {
|
|
14
|
+
params.set("fullView", "true");
|
|
15
|
+
} else {
|
|
16
|
+
params.delete("fullView");
|
|
17
|
+
}
|
|
18
|
+
navigate({ search: params.toString() }, { replace: true });
|
|
19
|
+
};
|
|
20
|
+
return [isFullView, setFullView];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useFullViewParam };
|
|
24
|
+
//# sourceMappingURL=useFullViewParam.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFullViewParam.esm.js","sources":["../../src/hooks/useFullViewParam.ts"],"sourcesContent":["import { useLocation, useNavigate } from 'react-router-dom';\nimport { useMemo } from 'react';\n\nexport const useFullViewParam = (): [boolean, (open: boolean) => void] => {\n const location = useLocation();\n const navigate = useNavigate();\n\n const isFullView = useMemo(() => {\n const params = new URLSearchParams(location.search);\n return params.get('fullView') === 'true';\n }, [location.search]);\n\n const setFullView = (open: boolean) => {\n const params = new URLSearchParams(location.search);\n if (open) {\n params.set('fullView', 'true');\n } else {\n params.delete('fullView');\n }\n navigate({ search: params.toString() }, { replace: true });\n };\n\n return [isFullView, setFullView];\n};\n"],"names":[],"mappings":";;;AAGO,MAAM,mBAAmB,MAA0C;AACxE,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAA,MAAM,WAAW,WAAY,EAAA;AAE7B,EAAM,MAAA,UAAA,GAAa,QAAQ,MAAM;AAC/B,IAAA,MAAM,MAAS,GAAA,IAAI,eAAgB,CAAA,QAAA,CAAS,MAAM,CAAA;AAClD,IAAO,OAAA,MAAA,CAAO,GAAI,CAAA,UAAU,CAAM,KAAA,MAAA;AAAA,GACjC,EAAA,CAAC,QAAS,CAAA,MAAM,CAAC,CAAA;AAEpB,EAAM,MAAA,WAAA,GAAc,CAAC,IAAkB,KAAA;AACrC,IAAA,MAAM,MAAS,GAAA,IAAI,eAAgB,CAAA,QAAA,CAAS,MAAM,CAAA;AAClD,IAAA,IAAI,IAAM,EAAA;AACR,MAAO,MAAA,CAAA,GAAA,CAAI,YAAY,MAAM,CAAA;AAAA,KACxB,MAAA;AACL,MAAA,MAAA,CAAO,OAAO,UAAU,CAAA;AAAA;AAE1B,IAAS,QAAA,CAAA,EAAE,QAAQ,MAAO,CAAA,QAAA,IAAc,EAAA,EAAE,OAAS,EAAA,IAAA,EAAM,CAAA;AAAA,GAC3D;AAEA,EAAO,OAAA,CAAC,YAAY,WAAW,CAAA;AACjC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { InfoCardVariants } from '@backstage/core-components';
|
|
4
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
4
|
import { ApiHolder } from '@backstage/core-plugin-api';
|
|
@@ -24,7 +23,7 @@ declare const readmePlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
24
23
|
/**
|
|
25
24
|
* Readme card exported from the Readme plugin
|
|
26
25
|
* @public */
|
|
27
|
-
declare const ReadmeCard: (props: ReadmeCardProps) =>
|
|
26
|
+
declare const ReadmeCard: (props: ReadmeCardProps) => react_jsx_runtime.JSX.Element;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Checks if a README is available for the given entity by making a request to the backend.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axis-backstage/plugin-readme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,38 +29,40 @@
|
|
|
29
29
|
"postpack": "backstage-cli package postpack"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@backstage/catalog-model": "^1.7.
|
|
33
|
-
"@backstage/core-components": "^0.
|
|
34
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
32
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
33
|
+
"@backstage/core-components": "^0.17.3",
|
|
34
|
+
"@backstage/core-plugin-api": "^1.10.8",
|
|
35
35
|
"@backstage/errors": "^1.2.7",
|
|
36
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
37
|
-
"@backstage/theme": "^0.6.
|
|
36
|
+
"@backstage/plugin-catalog-react": "^1.19.0",
|
|
37
|
+
"@backstage/theme": "^0.6.6",
|
|
38
38
|
"@mui/icons-material": "^5.15.7",
|
|
39
39
|
"@mui/material": "^5.15.7",
|
|
40
40
|
"react-use": "^17.2.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
43
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
44
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
45
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
46
|
+
"react-router-dom": "^6.3.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@backstage/cli": "^0.
|
|
49
|
-
"@backstage/core-app-api": "^1.
|
|
50
|
-
"@backstage/dev-utils": "^1.1.
|
|
51
|
-
"@backstage/test-utils": "^1.7.
|
|
52
|
-
"@testing-library/
|
|
53
|
-
"@testing-library/
|
|
49
|
+
"@backstage/cli": "^0.33.0",
|
|
50
|
+
"@backstage/core-app-api": "^1.17.1",
|
|
51
|
+
"@backstage/dev-utils": "^1.1.11",
|
|
52
|
+
"@backstage/test-utils": "^1.7.9",
|
|
53
|
+
"@testing-library/dom": "^10.0.0",
|
|
54
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
55
|
+
"@testing-library/react": "^16.0.0",
|
|
54
56
|
"@testing-library/user-event": "^14.0.0",
|
|
55
|
-
"msw": "^1.
|
|
57
|
+
"msw": "^1.3.5"
|
|
56
58
|
},
|
|
57
59
|
"files": [
|
|
58
60
|
"dist"
|
|
59
61
|
],
|
|
60
62
|
"typesVersions": {
|
|
61
63
|
"*": {
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
+
"package.json": [
|
|
65
|
+
"package.json"
|
|
64
66
|
]
|
|
65
67
|
}
|
|
66
68
|
},
|