@backstage/plugin-home 0.4.14 → 0.4.17
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 +44 -0
- package/dist/esm/{index-e6d55b70.esm.js → index-75392e0a.esm.js} +25 -4
- package/dist/esm/index-75392e0a.esm.js.map +1 -0
- package/dist/esm/{index-bce831c1.esm.js → index-a82f6713.esm.js} +1 -1
- package/dist/esm/{index-bce831c1.esm.js.map → index-a82f6713.esm.js.map} +1 -1
- package/dist/esm/{index-f319937c.esm.js → index-ef0465b6.esm.js} +10 -4
- package/dist/esm/index-ef0465b6.esm.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +5 -5
- package/package.json +33 -20
- package/dist/esm/index-e6d55b70.esm.js.map +0 -1
- package/dist/esm/index-f319937c.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @backstage/plugin-home
|
|
2
2
|
|
|
3
|
+
## 0.4.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/catalog-model@0.12.0
|
|
9
|
+
- @backstage/core-components@0.9.0
|
|
10
|
+
- @backstage/plugin-search@0.7.2
|
|
11
|
+
- @backstage/plugin-catalog-react@0.8.0
|
|
12
|
+
- @backstage/core-plugin-api@0.8.0
|
|
13
|
+
|
|
14
|
+
## 0.4.16
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/core-components@0.8.10
|
|
20
|
+
- @backstage/plugin-catalog-react@0.7.0
|
|
21
|
+
- @backstage/catalog-model@0.11.0
|
|
22
|
+
- @backstage/core-plugin-api@0.7.0
|
|
23
|
+
- @backstage/plugin-search@0.7.1
|
|
24
|
+
|
|
25
|
+
## 0.4.15
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 1ed305728b: Bump `node-fetch` to version 2.6.7 and `cross-fetch` to version 3.1.5
|
|
30
|
+
- c77c5c7eb6: Added `backstage.role` to `package.json`
|
|
31
|
+
- 651b919dbb: Add Renderer support for the HomePageToolkit component.
|
|
32
|
+
|
|
33
|
+
Previously `<HomePageToolkit Renderer={ComponentAccordion} Tools={[]} />` would
|
|
34
|
+
result in the error `can't access property "map", props.tools is undefined`.
|
|
35
|
+
This change adds a context that can pass props down to the HomePageToolkit.
|
|
36
|
+
Also introduced is an `expanded` prop on the `ComponentAccordion` to setting
|
|
37
|
+
the default expanded state. See `In Accordian` story for details.
|
|
38
|
+
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
- @backstage/core-components@0.8.9
|
|
41
|
+
- @backstage/core-plugin-api@0.6.1
|
|
42
|
+
- @backstage/plugin-catalog-react@0.6.15
|
|
43
|
+
- @backstage/plugin-search@0.7.0
|
|
44
|
+
- @backstage/catalog-model@0.10.0
|
|
45
|
+
- @backstage/theme@0.2.15
|
|
46
|
+
|
|
3
47
|
## 0.4.14
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { Link } from '@backstage/core-components';
|
|
2
2
|
import { makeStyles, List, ListItemIcon, ListItemText } from '@material-ui/core';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
const Context = createContext(void 0);
|
|
6
|
+
const ContextProvider = ({
|
|
7
|
+
children,
|
|
8
|
+
tools
|
|
9
|
+
}) => {
|
|
10
|
+
const [toolsValue, _setTools] = React.useState(tools);
|
|
11
|
+
const value = {
|
|
12
|
+
tools: toolsValue
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, {
|
|
15
|
+
value
|
|
16
|
+
}, children);
|
|
17
|
+
};
|
|
18
|
+
const useToolkit = () => {
|
|
19
|
+
const value = React.useContext(Context);
|
|
20
|
+
return value;
|
|
21
|
+
};
|
|
4
22
|
|
|
5
23
|
const useStyles = makeStyles((theme) => ({
|
|
6
24
|
toolkit: {
|
|
@@ -28,10 +46,13 @@ const useStyles = makeStyles((theme) => ({
|
|
|
28
46
|
}
|
|
29
47
|
}));
|
|
30
48
|
const Content = (props) => {
|
|
49
|
+
var _a;
|
|
31
50
|
const classes = useStyles();
|
|
51
|
+
const toolkit = useToolkit();
|
|
52
|
+
const tools = (_a = toolkit == null ? void 0 : toolkit.tools) != null ? _a : props.tools;
|
|
32
53
|
return /* @__PURE__ */ React.createElement(List, {
|
|
33
54
|
className: classes.toolkit
|
|
34
|
-
},
|
|
55
|
+
}, tools.map((tool) => /* @__PURE__ */ React.createElement(Link, {
|
|
35
56
|
key: tool.url,
|
|
36
57
|
to: tool.url,
|
|
37
58
|
className: classes.tool
|
|
@@ -43,5 +64,5 @@ const Content = (props) => {
|
|
|
43
64
|
}))));
|
|
44
65
|
};
|
|
45
66
|
|
|
46
|
-
export { Content };
|
|
47
|
-
//# sourceMappingURL=index-
|
|
67
|
+
export { Content, ContextProvider };
|
|
68
|
+
//# sourceMappingURL=index-75392e0a.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-75392e0a.esm.js","sources":["../../src/homePageComponents/Toolkit/Context.tsx","../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { createContext } from 'react';\n\nexport type Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\ntype ToolkitContextValue = {\n tools: Tool[];\n};\n\nconst Context = createContext<ToolkitContextValue | undefined>(undefined);\n\nexport const ContextProvider = ({\n children,\n tools,\n}: {\n children: JSX.Element;\n tools: Tool[];\n}) => {\n const [toolsValue, _setTools] = React.useState(tools);\n\n const value: ToolkitContextValue = {\n tools: toolsValue,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useToolkit = () => {\n const value = React.useContext(Context);\n return value;\n};\n\nexport default Context;\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Link } from '@backstage/core-components';\nimport {\n makeStyles,\n List,\n ListItemIcon,\n ListItemText,\n} from '@material-ui/core';\nimport React from 'react';\nimport { useToolkit, Tool } from './Context';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n fontSize: '0.9em',\n lineHeight: '1.25',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\n/**\n * Props for Toolkit content component {@link Content}.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n const toolkit = useToolkit();\n const tools = toolkit?.tools ?? props.tools;\n\n return (\n <List className={classes.toolkit}>\n {tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;AA4BA,MAAM,UAAU,cAA+C;MAElD,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,YAAY,aAAa,MAAM,SAAS;AAE/C,QAAM,QAA6B;AAAA,IACjC,OAAO;AAAA;AAGT,6CAAQ,QAAQ,UAAT;AAAA,IAAkB;AAAA,KAAe;AAAA;MAG7B,aAAa,MAAM;AAC9B,QAAM,QAAQ,MAAM,WAAW;AAC/B,SAAO;AAAA;;ACtBT,MAAM,YAAY,WAAW;AAAU,EACrC,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,QAAQ,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE7B,OAAO;AAAA,IACL,WAAW,MAAM,QAAQ;AAAA,IACzB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE5B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW,MAAM,QAAQ;AAAA,IACzB,iBAAiB,MAAM,QAAQ,WAAW;AAAA;AAAA;MAkBjC,UAAU,CAAC,UAA+B;AAlEvD;AAmEE,QAAM,UAAU;AAChB,QAAM,UAAU;AAChB,QAAM,QAAQ,yCAAS,UAAT,YAAkB,MAAM;AAEtC,6CACG,MAAD;AAAA,IAAM,WAAW,QAAQ;AAAA,KACtB,MAAM,IAAI,CAAC,6CACT,MAAD;AAAA,IAAM,KAAK,KAAK;AAAA,IAAK,IAAI,KAAK;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACnD,cAAD;AAAA,IAAc,WAAW,QAAQ;AAAA,KAAO,KAAK,2CAC5C,cAAD;AAAA,IACE,0BAA0B,EAAE,WAAW,QAAQ;AAAA,IAC/C,WAAW,KAAK;AAAA;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-a82f6713.esm.js","sources":["../../src/components/HomepageCompositionRoot.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { useOutlet } from 'react-router';\n\nexport const HomepageCompositionRoot = (props: {\n title?: string;\n children?: ReactNode;\n}) => {\n const outlet = useOutlet();\n const children = props.children ?? outlet;\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;;MAmBa,0BAA0B,CAAC,UAGlC;AAtBN;AAuBE,QAAM,SAAS;AACf,QAAM,WAAW,YAAM,aAAN,YAAkB;AACnC,mEAAU;AAAA;;;;"}
|
|
@@ -11,10 +11,14 @@ import '@backstage/core-plugin-api';
|
|
|
11
11
|
const useStyles = makeStyles((theme) => ({
|
|
12
12
|
settingsIconButton: {
|
|
13
13
|
padding: theme.spacing(0, 1, 0, 0)
|
|
14
|
+
},
|
|
15
|
+
contentContainer: {
|
|
16
|
+
width: "100%"
|
|
14
17
|
}
|
|
15
18
|
}));
|
|
16
19
|
const ComponentAccordion = ({
|
|
17
20
|
title,
|
|
21
|
+
expanded = false,
|
|
18
22
|
Content,
|
|
19
23
|
Actions,
|
|
20
24
|
Settings,
|
|
@@ -23,7 +27,7 @@ const ComponentAccordion = ({
|
|
|
23
27
|
}) => {
|
|
24
28
|
const classes = useStyles();
|
|
25
29
|
const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);
|
|
26
|
-
const [isExpanded, setIsExpanded] = React.useState(
|
|
30
|
+
const [isExpanded, setIsExpanded] = React.useState(expanded);
|
|
27
31
|
const handleOpenSettings = (e) => {
|
|
28
32
|
e.stopPropagation();
|
|
29
33
|
setSettingsIsExpanded((prevState) => !prevState);
|
|
@@ -34,13 +38,15 @@ const ComponentAccordion = ({
|
|
|
34
38
|
componentName: title
|
|
35
39
|
}, /* @__PURE__ */ React.createElement(Settings, null)), /* @__PURE__ */ React.createElement(Accordion, {
|
|
36
40
|
expanded: isExpanded,
|
|
37
|
-
onChange: (_e,
|
|
41
|
+
onChange: (_e, expandedValue) => setIsExpanded(expandedValue)
|
|
38
42
|
}, /* @__PURE__ */ React.createElement(AccordionSummary, {
|
|
39
43
|
expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null)
|
|
40
44
|
}, Settings && /* @__PURE__ */ React.createElement(IconButton, {
|
|
41
45
|
onClick: handleOpenSettings,
|
|
42
46
|
className: classes.settingsIconButton
|
|
43
|
-
}, /* @__PURE__ */ React.createElement(SettingsIcon, null)), /* @__PURE__ */ React.createElement(Typography, null, title)), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement("div",
|
|
47
|
+
}, /* @__PURE__ */ React.createElement(SettingsIcon, null)), /* @__PURE__ */ React.createElement(Typography, null, title)), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement("div", {
|
|
48
|
+
className: classes.contentContainer
|
|
49
|
+
}, /* @__PURE__ */ React.createElement(Content, null), Actions && /* @__PURE__ */ React.createElement(Actions, null)))));
|
|
44
50
|
return ContextProvider ? /* @__PURE__ */ React.createElement(ContextProvider, {
|
|
45
51
|
...childProps
|
|
46
52
|
}, innerContent) : innerContent;
|
|
@@ -80,4 +86,4 @@ const ComponentTab = ({
|
|
|
80
86
|
};
|
|
81
87
|
|
|
82
88
|
export { ComponentAccordion, ComponentTab, ComponentTabs };
|
|
83
|
-
//# sourceMappingURL=index-
|
|
89
|
+
//# sourceMappingURL=index-ef0465b6.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ef0465b6.esm.js","sources":["../../src/componentRenderers/ComponentAccordion.tsx","../../src/componentRenderers/ComponentTabs/ComponentTabs.tsx","../../src/componentRenderers/ComponentTabs/ComponentTab.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Typography,\n IconButton,\n Theme,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport { SettingsModal } from '../components';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n settingsIconButton: {\n padding: theme.spacing(0, 1, 0, 0),\n },\n contentContainer: {\n width: '100%',\n },\n}));\n\nexport const ComponentAccordion = ({\n title,\n expanded = false,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n expanded?: boolean;\n Content: () => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const classes = useStyles();\n const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);\n const [isExpanded, setIsExpanded] = React.useState(expanded);\n\n const handleOpenSettings = (e: any) => {\n e.stopPropagation();\n setSettingsIsExpanded(prevState => !prevState);\n };\n\n const innerContent = (\n <>\n {Settings && (\n <SettingsModal\n open={settingsIsExpanded}\n close={() => setSettingsIsExpanded(false)}\n componentName={title}\n >\n <Settings />\n </SettingsModal>\n )}\n <Accordion\n expanded={isExpanded}\n onChange={(_e: any, expandedValue: boolean) =>\n setIsExpanded(expandedValue)\n }\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n {Settings && (\n <IconButton\n onClick={handleOpenSettings}\n className={classes.settingsIconButton}\n >\n <SettingsIcon />\n </IconButton>\n )}\n <Typography>{title}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <div className={classes.contentContainer}>\n <Content />\n {Actions && <Actions />}\n </div>\n </AccordionDetails>\n </Accordion>\n </>\n );\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { Tabs, Tab } from '@material-ui/core';\nimport { InfoCard } from '@backstage/core-components';\n\ntype TabType = {\n label: string;\n Component: () => JSX.Element;\n};\n\nexport const ComponentTabs = ({\n title,\n tabs,\n}: {\n title: string;\n tabs: TabType[];\n}) => {\n const [value, setValue] = React.useState(0);\n\n const handleChange = (_event: any, newValue: number) => {\n setValue(newValue);\n };\n\n return (\n <InfoCard title={title}>\n <Tabs value={value} onChange={handleChange}>\n {tabs.map(t => (\n <Tab key={t.label} label={t.label} />\n ))}\n </Tabs>\n {tabs.map(({ Component }, idx) => (\n <div\n key={idx}\n {...(idx !== value ? { style: { display: 'none' } } : {})}\n >\n <Component />\n </div>\n ))}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nexport const ComponentTab = ({\n title,\n Content,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,YAAY,WAAW,CAAC;AAAkB,EAC9C,oBAAoB;AAAA,IAClB,SAAS,MAAM,QAAQ,GAAG,GAAG,GAAG;AAAA;AAAA,EAElC,kBAAkB;AAAA,IAChB,OAAO;AAAA;AAAA;MAIE,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAQC;AACJ,QAAM,UAAU;AAChB,QAAM,CAAC,oBAAoB,yBAAyB,MAAM,SAAS;AACnE,QAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS;AAEnD,QAAM,qBAAqB,CAAC,MAAW;AACrC,MAAE;AACF,0BAAsB,eAAa,CAAC;AAAA;AAGtC,QAAM,yEAED,gDACE,eAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO,MAAM,sBAAsB;AAAA,IACnC,eAAe;AAAA,yCAEd,UAAD,4CAGH,WAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,IAAS,kBAClB,cAAc;AAAA,yCAGf,kBAAD;AAAA,IAAkB,gDAAa,gBAAD;AAAA,KAC3B,gDACE,YAAD;AAAA,IACE,SAAS;AAAA,IACT,WAAW,QAAQ;AAAA,yCAElB,cAAD,4CAGH,YAAD,MAAa,6CAEd,kBAAD,0CACG,OAAD;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACrB,SAAD,OACC,+CAAY,SAAD;AAOtB,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,KAAa,gBAElC;AAAA;;MCjFS,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,OAAO,YAAY,MAAM,SAAS;AAEzC,QAAM,eAAe,CAAC,QAAa,aAAqB;AACtD,aAAS;AAAA;AAGX,6CACG,UAAD;AAAA,IAAU;AAAA,yCACP,MAAD;AAAA,IAAM;AAAA,IAAc,UAAU;AAAA,KAC3B,KAAK,IAAI,2CACP,KAAD;AAAA,IAAK,KAAK,EAAE;AAAA,IAAO,OAAO,EAAE;AAAA,QAG/B,KAAK,IAAI,CAAC,EAAE,aAAa,4CACvB,OAAD;AAAA,IACE,KAAK;AAAA,OACA,QAAQ,QAAQ,EAAE,OAAO,EAAE,SAAS,aAAa;AAAA,yCAErD,WAAD;AAAA;;MChCG,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAKC;AACJ,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,yCAClB,SAAD,6CAGD,SAAD;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ declare type Tool = {
|
|
|
34
34
|
url: string;
|
|
35
35
|
icon: React__default.ReactNode;
|
|
36
36
|
};
|
|
37
|
+
|
|
37
38
|
/**
|
|
38
39
|
* Props for Toolkit content component {@link Content}.
|
|
39
40
|
*
|
|
@@ -50,8 +51,9 @@ declare const HomepageCompositionRoot: (props: {
|
|
|
50
51
|
title?: string | undefined;
|
|
51
52
|
children?: React.ReactNode;
|
|
52
53
|
}) => JSX.Element;
|
|
53
|
-
declare const ComponentAccordion: ({ title, Content, Actions, Settings, ContextProvider, ...childProps }: {
|
|
54
|
+
declare const ComponentAccordion: ({ title, expanded, Content, Actions, Settings, ContextProvider, ...childProps }: {
|
|
54
55
|
title: string;
|
|
56
|
+
expanded?: boolean | undefined;
|
|
55
57
|
Content: () => JSX.Element;
|
|
56
58
|
Actions?: (() => JSX.Element) | undefined;
|
|
57
59
|
Settings?: (() => JSX.Element) | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -146,25 +146,25 @@ const homePlugin = createPlugin({
|
|
|
146
146
|
});
|
|
147
147
|
const HomepageCompositionRoot = homePlugin.provide(createRoutableExtension({
|
|
148
148
|
name: "HomepageCompositionRoot",
|
|
149
|
-
component: () => import('./esm/index-
|
|
149
|
+
component: () => import('./esm/index-a82f6713.esm.js').then((m) => m.HomepageCompositionRoot),
|
|
150
150
|
mountPoint: rootRouteRef
|
|
151
151
|
}));
|
|
152
152
|
const ComponentAccordion = homePlugin.provide(createComponentExtension({
|
|
153
153
|
name: "ComponentAccordion",
|
|
154
154
|
component: {
|
|
155
|
-
lazy: () => import('./esm/index-
|
|
155
|
+
lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentAccordion)
|
|
156
156
|
}
|
|
157
157
|
}));
|
|
158
158
|
const ComponentTabs = homePlugin.provide(createComponentExtension({
|
|
159
159
|
name: "ComponentTabs",
|
|
160
160
|
component: {
|
|
161
|
-
lazy: () => import('./esm/index-
|
|
161
|
+
lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentTabs)
|
|
162
162
|
}
|
|
163
163
|
}));
|
|
164
164
|
const ComponentTab = homePlugin.provide(createComponentExtension({
|
|
165
165
|
name: "ComponentTab",
|
|
166
166
|
component: {
|
|
167
|
-
lazy: () => import('./esm/index-
|
|
167
|
+
lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentTab)
|
|
168
168
|
}
|
|
169
169
|
}));
|
|
170
170
|
const WelcomeTitle = homePlugin.provide(createComponentExtension({
|
|
@@ -187,7 +187,7 @@ const HomePageRandomJoke = homePlugin.provide(createCardExtension({
|
|
|
187
187
|
const HomePageToolkit = homePlugin.provide(createCardExtension({
|
|
188
188
|
name: "HomePageToolkit",
|
|
189
189
|
title: "Toolkit",
|
|
190
|
-
components: () => import('./esm/index-
|
|
190
|
+
components: () => import('./esm/index-75392e0a.esm.js')
|
|
191
191
|
}));
|
|
192
192
|
const HomePageStarredEntities = homePlugin.provide(createCardExtension({
|
|
193
193
|
name: "HomePageStarredEntities",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-home",
|
|
3
3
|
"description": "A Backstage plugin that helps you build a home page",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.17",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -10,23 +10,36 @@
|
|
|
10
10
|
"main": "dist/index.esm.js",
|
|
11
11
|
"types": "dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "frontend-plugin"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/backstage/backstage/tree/master/plugins/home#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/backstage/backstage",
|
|
20
|
+
"directory": "plugins/home"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"backstage",
|
|
24
|
+
"homepage"
|
|
25
|
+
],
|
|
13
26
|
"scripts": {
|
|
14
|
-
"build": "backstage-cli
|
|
15
|
-
"start": "backstage-cli
|
|
16
|
-
"lint": "backstage-cli lint",
|
|
17
|
-
"test": "backstage-cli test",
|
|
27
|
+
"build": "backstage-cli package build",
|
|
28
|
+
"start": "backstage-cli package start",
|
|
29
|
+
"lint": "backstage-cli package lint",
|
|
30
|
+
"test": "backstage-cli package test",
|
|
18
31
|
"diff": "backstage-cli plugin:diff",
|
|
19
|
-
"prepack": "backstage-cli prepack",
|
|
20
|
-
"postpack": "backstage-cli postpack",
|
|
21
|
-
"clean": "backstage-cli clean"
|
|
32
|
+
"prepack": "backstage-cli package prepack",
|
|
33
|
+
"postpack": "backstage-cli package postpack",
|
|
34
|
+
"clean": "backstage-cli package clean"
|
|
22
35
|
},
|
|
23
36
|
"dependencies": {
|
|
24
|
-
"@backstage/catalog-model": "^0.
|
|
25
|
-
"@backstage/core-components": "^0.
|
|
26
|
-
"@backstage/core-plugin-api": "^0.
|
|
27
|
-
"@backstage/plugin-catalog-react": "^0.
|
|
28
|
-
"@backstage/plugin-search": "^0.
|
|
29
|
-
"@backstage/theme": "^0.2.
|
|
37
|
+
"@backstage/catalog-model": "^0.12.0",
|
|
38
|
+
"@backstage/core-components": "^0.9.0",
|
|
39
|
+
"@backstage/core-plugin-api": "^0.8.0",
|
|
40
|
+
"@backstage/plugin-catalog-react": "^0.8.0",
|
|
41
|
+
"@backstage/plugin-search": "^0.7.2",
|
|
42
|
+
"@backstage/theme": "^0.2.15",
|
|
30
43
|
"@material-ui/core": "^4.12.2",
|
|
31
44
|
"@material-ui/icons": "^4.9.1",
|
|
32
45
|
"@material-ui/lab": "4.0.0-alpha.57",
|
|
@@ -39,20 +52,20 @@
|
|
|
39
52
|
"react": "^16.13.1 || ^17.0.0"
|
|
40
53
|
},
|
|
41
54
|
"devDependencies": {
|
|
42
|
-
"@backstage/cli": "^0.
|
|
43
|
-
"@backstage/core-app-api": "^0.
|
|
44
|
-
"@backstage/dev-utils": "^0.2.
|
|
45
|
-
"@backstage/test-utils": "^0.
|
|
55
|
+
"@backstage/cli": "^0.15.0",
|
|
56
|
+
"@backstage/core-app-api": "^0.6.0",
|
|
57
|
+
"@backstage/dev-utils": "^0.2.24",
|
|
58
|
+
"@backstage/test-utils": "^0.3.0",
|
|
46
59
|
"@testing-library/jest-dom": "^5.10.1",
|
|
47
60
|
"@testing-library/react": "^11.2.5",
|
|
48
61
|
"@testing-library/user-event": "^13.1.8",
|
|
49
62
|
"@types/jest": "^26.0.7",
|
|
50
63
|
"@types/node": "^14.14.32",
|
|
51
|
-
"cross-fetch": "^3.
|
|
64
|
+
"cross-fetch": "^3.1.5",
|
|
52
65
|
"msw": "^0.35.0"
|
|
53
66
|
},
|
|
54
67
|
"files": [
|
|
55
68
|
"dist"
|
|
56
69
|
],
|
|
57
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "04bb0dd824b78f6b57dac62c3015e681f094045c"
|
|
58
71
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-e6d55b70.esm.js","sources":["../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Link } from '@backstage/core-components';\nimport {\n makeStyles,\n List,\n ListItemIcon,\n ListItemText,\n} from '@material-ui/core';\nimport React from 'react';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n fontSize: '0.9em',\n lineHeight: '1.25',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\ntype Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\n/**\n * Props for Toolkit content component {@link Content}.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n\n return (\n <List className={classes.toolkit}>\n {props.tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,YAAY,WAAW;AAAU,EACrC,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,QAAQ,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE7B,OAAO;AAAA,IACL,WAAW,MAAM,QAAQ;AAAA,IACzB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE5B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW,MAAM,QAAQ;AAAA,IACzB,iBAAiB,MAAM,QAAQ,WAAW;AAAA;AAAA;MAwBjC,UAAU,CAAC,UAA+B;AACrD,QAAM,UAAU;AAEhB,6CACG,MAAD;AAAA,IAAM,WAAW,QAAQ;AAAA,KACtB,MAAM,MAAM,IAAI,CAAC,6CACf,MAAD;AAAA,IAAM,KAAK,KAAK;AAAA,IAAK,IAAI,KAAK;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACnD,cAAD;AAAA,IAAc,WAAW,QAAQ;AAAA,KAAO,KAAK,2CAC5C,cAAD;AAAA,IACE,0BAA0B,EAAE,WAAW,QAAQ;AAAA,IAC/C,WAAW,KAAK;AAAA;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-f319937c.esm.js","sources":["../../src/componentRenderers/ComponentAccordion.tsx","../../src/componentRenderers/ComponentTabs/ComponentTabs.tsx","../../src/componentRenderers/ComponentTabs/ComponentTab.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Typography,\n IconButton,\n Theme,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport { SettingsModal } from '../components';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n settingsIconButton: {\n padding: theme.spacing(0, 1, 0, 0),\n },\n}));\n\nexport const ComponentAccordion = ({\n title,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const classes = useStyles();\n const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const handleOpenSettings = (e: any) => {\n e.stopPropagation();\n setSettingsIsExpanded(prevState => !prevState);\n };\n\n const innerContent = (\n <>\n {Settings && (\n <SettingsModal\n open={settingsIsExpanded}\n close={() => setSettingsIsExpanded(false)}\n componentName={title}\n >\n <Settings />\n </SettingsModal>\n )}\n <Accordion\n expanded={isExpanded}\n onChange={(_e: any, expanded: boolean) => setIsExpanded(expanded)}\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n {Settings && (\n <IconButton\n onClick={handleOpenSettings}\n className={classes.settingsIconButton}\n >\n <SettingsIcon />\n </IconButton>\n )}\n <Typography>{title}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <div>\n <Content />\n {Actions && <Actions />}\n </div>\n </AccordionDetails>\n </Accordion>\n </>\n );\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { Tabs, Tab } from '@material-ui/core';\nimport { InfoCard } from '@backstage/core-components';\n\ntype TabType = {\n label: string;\n Component: () => JSX.Element;\n};\n\nexport const ComponentTabs = ({\n title,\n tabs,\n}: {\n title: string;\n tabs: TabType[];\n}) => {\n const [value, setValue] = React.useState(0);\n\n const handleChange = (_event: any, newValue: number) => {\n setValue(newValue);\n };\n\n return (\n <InfoCard title={title}>\n <Tabs value={value} onChange={handleChange}>\n {tabs.map(t => (\n <Tab key={t.label} label={t.label} />\n ))}\n </Tabs>\n {tabs.map(({ Component }, idx) => (\n <div\n key={idx}\n {...(idx !== value ? { style: { display: 'none' } } : {})}\n >\n <Component />\n </div>\n ))}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nexport const ComponentTab = ({\n title,\n Content,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,YAAY,WAAW,CAAC;AAAkB,EAC9C,oBAAoB;AAAA,IAClB,SAAS,MAAM,QAAQ,GAAG,GAAG,GAAG;AAAA;AAAA;MAIvB,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAOC;AACJ,QAAM,UAAU;AAChB,QAAM,CAAC,oBAAoB,yBAAyB,MAAM,SAAS;AACnE,QAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS;AAEnD,QAAM,qBAAqB,CAAC,MAAW;AACrC,MAAE;AACF,0BAAsB,eAAa,CAAC;AAAA;AAGtC,QAAM,yEAED,gDACE,eAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO,MAAM,sBAAsB;AAAA,IACnC,eAAe;AAAA,yCAEd,UAAD,4CAGH,WAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,IAAS,aAAsB,cAAc;AAAA,yCAEvD,kBAAD;AAAA,IAAkB,gDAAa,gBAAD;AAAA,KAC3B,gDACE,YAAD;AAAA,IACE,SAAS;AAAA,IACT,WAAW,QAAQ;AAAA,yCAElB,cAAD,4CAGH,YAAD,MAAa,6CAEd,kBAAD,0CACG,OAAD,0CACG,SAAD,OACC,+CAAY,SAAD;AAOtB,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,KAAa,gBAElC;AAAA;;MC1ES,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,OAAO,YAAY,MAAM,SAAS;AAEzC,QAAM,eAAe,CAAC,QAAa,aAAqB;AACtD,aAAS;AAAA;AAGX,6CACG,UAAD;AAAA,IAAU;AAAA,yCACP,MAAD;AAAA,IAAM;AAAA,IAAc,UAAU;AAAA,KAC3B,KAAK,IAAI,2CACP,KAAD;AAAA,IAAK,KAAK,EAAE;AAAA,IAAO,OAAO,EAAE;AAAA,QAG/B,KAAK,IAAI,CAAC,EAAE,aAAa,4CACvB,OAAD;AAAA,IACE,KAAK;AAAA,OACA,QAAQ,QAAQ,EAAE,OAAO,EAAE,SAAS,aAAa;AAAA,yCAErD,WAAD;AAAA;;MChCG,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAKC;AACJ,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,yCAClB,SAAD,6CAGD,SAAD;AAAA;;;;"}
|