@backstage/plugin-home 0.4.31-next.0 → 0.4.31-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 +14 -0
- package/dist/esm/{index-e9c329fa.esm.js → index-236adacf.esm.js} +1 -1
- package/dist/esm/{index-e9c329fa.esm.js.map → index-236adacf.esm.js.map} +1 -1
- package/dist/esm/{index-c04bccf7.esm.js → index-6bbcec36.esm.js} +1 -1
- package/dist/esm/{index-c04bccf7.esm.js.map → index-6bbcec36.esm.js.map} +1 -1
- package/dist/esm/{index-640dfb11.esm.js → index-810d077a.esm.js} +3 -3
- package/dist/esm/{index-640dfb11.esm.js.map → index-810d077a.esm.js.map} +1 -1
- package/dist/esm/{index-830d4f5f.esm.js → index-87a51b51.esm.js} +3 -4
- package/dist/esm/{index-830d4f5f.esm.js.map → index-87a51b51.esm.js.map} +1 -1
- package/dist/index.esm.js +6 -6
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/plugin-home
|
|
2
2
|
|
|
3
|
+
## 0.4.31-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3d1d867d42: Fixed regression that caused the `WelcomeTitle` to not be the right size when passed to the `title` property of the `<Header>` component. A Storybook entry was also added for the `WelcomeTitle`
|
|
8
|
+
- c553a625d2: remove unused plugin-stack-overflow dependency
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/core-components@0.12.4-next.0
|
|
11
|
+
- @backstage/plugin-catalog-react@1.3.0-next.1
|
|
12
|
+
- @backstage/catalog-model@1.1.6-next.0
|
|
13
|
+
- @backstage/config@1.0.6
|
|
14
|
+
- @backstage/core-plugin-api@1.3.0
|
|
15
|
+
- @backstage/theme@0.2.16
|
|
16
|
+
|
|
3
17
|
## 0.4.31-next.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-236adacf.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-dom';\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":";;;;;;;;AAmBa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AAtBN,EAAA,IAAA,EAAA,CAAA;AAuBE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAA,CAAW,EAAM,GAAA,KAAA,CAAA,QAAA,KAAN,IAAkB,GAAA,EAAA,GAAA,MAAA,CAAA;AACnC,EAAA,iEAAU,QAAS,CAAA,CAAA;AACrB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-6bbcec36.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 = (props: {\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 {\n title,\n expanded = false,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n } = props;\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 = (props: { title: string; tabs: TabType[] }) => {\n const { title, tabs } = props;\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 = (props: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const { title, Content, ContextProvider, ...childProps } = props;\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EAC9C,kBAAoB,EAAA;AAAA,IAClB,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,GACnC;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,kBAAA,GAAqB,CAAC,KAO7B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,OAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,GAAG,UAAA;AAAA,GACD,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,CAAC,kBAAoB,EAAA,qBAAqB,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AACxE,EAAA,MAAM,CAAC,UAAY,EAAA,aAAa,CAAI,GAAA,KAAA,CAAM,SAAS,QAAQ,CAAA,CAAA;AAE3D,EAAM,MAAA,kBAAA,GAAqB,CAAC,CAAW,KAAA;AACrC,IAAA,CAAA,CAAE,eAAgB,EAAA,CAAA;AAClB,IAAsB,qBAAA,CAAA,CAAA,SAAA,KAAa,CAAC,SAAS,CAAA,CAAA;AAAA,GAC/C,CAAA;AAEA,EAAM,MAAA,YAAA,6DAED,QACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,kBAAA;AAAA,MACN,KAAA,EAAO,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,MACxC,aA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
|
|
8
8
|
function getTimes(clockConfigs, customTimeFormat) {
|
|
9
|
-
const d = new Date();
|
|
9
|
+
const d = /* @__PURE__ */ new Date();
|
|
10
10
|
const lang = window.navigator.language;
|
|
11
11
|
const clocks = [];
|
|
12
12
|
if (!clockConfigs) {
|
|
@@ -19,7 +19,7 @@ function getTimes(clockConfigs, customTimeFormat) {
|
|
|
19
19
|
...customTimeFormat != null ? customTimeFormat : timeFormat
|
|
20
20
|
};
|
|
21
21
|
try {
|
|
22
|
-
new Date().toLocaleString(lang, options);
|
|
22
|
+
(/* @__PURE__ */ new Date()).toLocaleString(lang, options);
|
|
23
23
|
} catch (e) {
|
|
24
24
|
console.warn(
|
|
25
25
|
`The timezone ${options.timeZone} is invalid. Defaulting to GMT`
|
|
@@ -59,4 +59,4 @@ const HeaderWorldClock = (props) => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
export { HeaderWorldClock };
|
|
62
|
-
//# sourceMappingURL=index-
|
|
62
|
+
//# sourceMappingURL=index-810d077a.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-810d077a.esm.js","sources":["../../src/homePageComponents/HeaderWorldClock/HeaderWorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { HeaderLabel } from '@backstage/core-components';\n\nconst timeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\ntype TimeObj = {\n time: string;\n label: string;\n};\n\n/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nfunction getTimes(\n clockConfigs: ClockConfig[],\n customTimeFormat?: Intl.DateTimeFormatOptions,\n) {\n const d = new Date();\n const lang = window.navigator.language;\n\n const clocks: TimeObj[] = [];\n\n if (!clockConfigs) {\n return clocks;\n }\n\n for (const clockConfig of clockConfigs) {\n let label = clockConfig.label;\n\n const options: Intl.DateTimeFormatOptions = {\n timeZone: clockConfig.timeZone,\n ...(customTimeFormat ?? timeFormat),\n };\n\n try {\n new Date().toLocaleString(lang, options);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\n `The timezone ${options.timeZone} is invalid. Defaulting to GMT`,\n );\n options.timeZone = 'GMT';\n label = 'GMT';\n }\n\n const time = d.toLocaleTimeString(lang, options);\n clocks.push({ time, label });\n }\n\n return clocks;\n}\n\n/**\n * A component to display a configurable list of clocks for various time zones.\n *\n * @example\n * Here's a simple example:\n * ```\n * // This will give you a clock for the time zone that Stockholm is in\n * // you can add more than one but keep in mind space may be limited\n * const clockConfigs: ClockConfig[] = [\n * {\n * label: 'STO',\n * timeZone: 'Europe/Stockholm',\n * },\n * ];\n *\n * // Setting hour12 to false will make all the clocks show in the 24hr format\n * const timeFormat: Intl.DateTimeFormatOptions = {\n * hour: '2-digit',\n * minute: '2-digit',\n * hour12: false,\n * };\n *\n * // Here is the component in use:\n * <HeaderWorldClock\n * clockConfigs={clockConfigs}\n * customTimeFormat={timeFormat}\n * />\n * ```\n *\n * @public\n */\nexport const HeaderWorldClock = (props: {\n clockConfigs: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n\n const defaultTimes: TimeObj[] = [];\n const [clocks, setTimes] = React.useState(defaultTimes);\n\n React.useEffect(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n\n const intervalId = setInterval(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [clockConfigs, customTimeFormat]);\n\n if (clocks.length !== 0) {\n return (\n <>\n {clocks.map(clock => (\n <HeaderLabel\n label={clock.label}\n value={clock.time}\n key={clock.label}\n />\n ))}\n </>\n );\n }\n return null;\n};\n"],"names":[],"mappings":";;;AAmBA,MAAM,UAAyC,GAAA;AAAA,EAC7C,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA,SAAA;AACV,CAAA,CAAA;AAaA,SAAS,QAAA,CACP,cACA,gBACA,EAAA;AACA,EAAM,MAAA,CAAA,uBAAQ,IAAK,EAAA,CAAA;AACnB,EAAM,MAAA,IAAA,GAAO,OAAO,SAAU,CAAA,QAAA,CAAA;AAE9B,EAAA,MAAM,SAAoB,EAAC,CAAA;AAE3B,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AAEA,EAAA,KAAA,MAAW,eAAe,YAAc,EAAA;AACtC,IAAA,IAAI,QAAQ,WAAY,CAAA,KAAA,CAAA;AAExB,IAAA,MAAM,OAAsC,GAAA;AAAA,MAC1C,UAAU,WAAY,CAAA,QAAA;AAAA,MACtB,GAAI,gBAAoB,IAAA,IAAA,GAAA,gBAAA,GAAA,UAAA;AAAA,KAC1B,CAAA;AAEA,IAAI,IAAA;AACF,MAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,cAAe,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAAA,aAChC,CAAP,EAAA;AAEA,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,gBAAgB,OAAQ,CAAA,QAAA,CAAA,8BAAA,CAAA;AAAA,OAC1B,CAAA;AACA,MAAA,OAAA,CAAQ,QAAW,GAAA,KAAA,CAAA;AACnB,MAAQ,KAAA,GAAA,KAAA,CAAA;AAAA,KACV;AAEA,IAAA,MAAM,IAAO,GAAA,CAAA,CAAE,kBAAmB,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAC/C,IAAA,MAAA,CAAO,IAAK,CAAA,EA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/core-plugin-api';
|
|
2
|
-
import { Tooltip } from '@material-ui/core';
|
|
3
|
-
import Typography from '@material-ui/core/Typography';
|
|
2
|
+
import { Tooltip, Typography } from '@material-ui/core';
|
|
4
3
|
import React, { useMemo, useEffect } from 'react';
|
|
5
4
|
import useAsync from 'react-use/lib/useAsync';
|
|
6
5
|
|
|
@@ -621,8 +620,8 @@ const WelcomeTitle = () => {
|
|
|
621
620
|
});
|
|
622
621
|
}
|
|
623
622
|
}, [error, alertApi]);
|
|
624
|
-
return /* @__PURE__ */ React.createElement(Tooltip, { title: greeting.language }, /* @__PURE__ */ React.createElement(Typography, { component: "span" }, `${greeting.greeting}${(profile == null ? void 0 : profile.displayName) ? `, ${profile == null ? void 0 : profile.displayName}` : ""}!`));
|
|
623
|
+
return /* @__PURE__ */ React.createElement(Tooltip, { title: greeting.language }, /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "inherit" }, `${greeting.greeting}${(profile == null ? void 0 : profile.displayName) ? `, ${profile == null ? void 0 : profile.displayName}` : ""}!`));
|
|
625
624
|
};
|
|
626
625
|
|
|
627
626
|
export { WelcomeTitle };
|
|
628
|
-
//# sourceMappingURL=index-
|
|
627
|
+
//# sourceMappingURL=index-87a51b51.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-87a51b51.esm.js","sources":["../../src/homePageComponents/WelcomeTitle/timeUtil.ts","../../src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 goodMorning from './locales/goodMorning.locales.json';\nimport goodAfternoon from './locales/goodAfternoon.locales.json';\nimport goodEvening from './locales/goodEvening.locales.json';\n\n// Select a large random integer at startup, to prevent the greetings to change\n// every time the user navigates.\nconst greetingRandomSeed = Math.floor(Math.random() * 1000000);\n\nexport function getTimeBasedGreeting(): { language: string; greeting: string } {\n const random = (array: string[]) => array[greetingRandomSeed % array.length];\n\n const currentHour = new Date(Date.now()).getHours();\n if (currentHour >= 23) {\n return {\n language: 'Seriously',\n greeting: 'Get some rest',\n };\n }\n const timeOfDay = (hour: number): { [language: string]: string } => {\n if (hour < 12) return goodMorning;\n if (hour < 17) return goodAfternoon;\n return goodEvening;\n };\n const greetings = timeOfDay(currentHour);\n const greetingsKey = random(Object.keys(greetings));\n return {\n language: greetingsKey,\n greeting: greetings[greetingsKey],\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 */\nimport {\n alertApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { Tooltip, Typography } from '@material-ui/core';\nimport React, { useEffect, useMemo } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { getTimeBasedGreeting } from './timeUtil';\n\nexport const WelcomeTitle = () => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n const greeting = useMemo(() => getTimeBasedGreeting(), []);\n\n const { value: profile, error } = useAsync(() =>\n identityApi.getProfileInfo(),\n );\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load user identity: ${error}`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n return (\n <Tooltip title={greeting.language}>\n <Typography component=\"span\" variant=\"inherit\">{`${greeting.greeting}${\n profile?.displayName ? `, ${profile?.displayName}` : ''\n }!`}</Typography>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,qBAAqB,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,MAAA,KAAW,GAAO,CAAA,CAAA;AAEtD,SAAS,oBAA+D,GAAA;AAC7E,EAAA,MAAM,SAAS,CAAC,KAAA,KAAoB,KAAM,CAAA,kBAAA,GAAqB,MAAM,MAAM,CAAA,CAAA;AAE3E,EAAA,MAAM,cAAc,IAAI,IAAA,CAAK,KAAK,GAAI,EAAC,EAAE,QAAS,EAAA,CAAA;AAClD,EAAA,IAAI,eAAe,EAAI,EAAA;AACrB,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,WAAA;AAAA,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tB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAU,MAAO,EAAA,OAAA,EAAQ,aAAW,CAAG,EAAA,QAAA,CAAS,YAC1D,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,WAAA,IAAc,KAAK,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,WAAA,CAAA,CAAA,GAAgB,KACnD,CACN,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.esm.js
CHANGED
|
@@ -75,7 +75,7 @@ const homePlugin = createPlugin({
|
|
|
75
75
|
const HomepageCompositionRoot = homePlugin.provide(
|
|
76
76
|
createRoutableExtension({
|
|
77
77
|
name: "HomepageCompositionRoot",
|
|
78
|
-
component: () => import('./esm/index-
|
|
78
|
+
component: () => import('./esm/index-236adacf.esm.js').then((m) => m.HomepageCompositionRoot),
|
|
79
79
|
mountPoint: rootRouteRef
|
|
80
80
|
})
|
|
81
81
|
);
|
|
@@ -83,7 +83,7 @@ const ComponentAccordion = homePlugin.provide(
|
|
|
83
83
|
createComponentExtension({
|
|
84
84
|
name: "ComponentAccordion",
|
|
85
85
|
component: {
|
|
86
|
-
lazy: () => import('./esm/index-
|
|
86
|
+
lazy: () => import('./esm/index-6bbcec36.esm.js').then((m) => m.ComponentAccordion)
|
|
87
87
|
}
|
|
88
88
|
})
|
|
89
89
|
);
|
|
@@ -91,7 +91,7 @@ const ComponentTabs = homePlugin.provide(
|
|
|
91
91
|
createComponentExtension({
|
|
92
92
|
name: "ComponentTabs",
|
|
93
93
|
component: {
|
|
94
|
-
lazy: () => import('./esm/index-
|
|
94
|
+
lazy: () => import('./esm/index-6bbcec36.esm.js').then((m) => m.ComponentTabs)
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
97
|
);
|
|
@@ -99,7 +99,7 @@ const ComponentTab = homePlugin.provide(
|
|
|
99
99
|
createComponentExtension({
|
|
100
100
|
name: "ComponentTab",
|
|
101
101
|
component: {
|
|
102
|
-
lazy: () => import('./esm/index-
|
|
102
|
+
lazy: () => import('./esm/index-6bbcec36.esm.js').then((m) => m.ComponentTab)
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
105
|
);
|
|
@@ -107,7 +107,7 @@ const WelcomeTitle = homePlugin.provide(
|
|
|
107
107
|
createComponentExtension({
|
|
108
108
|
name: "WelcomeTitle",
|
|
109
109
|
component: {
|
|
110
|
-
lazy: () => import('./esm/index-
|
|
110
|
+
lazy: () => import('./esm/index-87a51b51.esm.js').then((m) => m.WelcomeTitle)
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
);
|
|
@@ -144,7 +144,7 @@ const HeaderWorldClock = homePlugin.provide(
|
|
|
144
144
|
createComponentExtension({
|
|
145
145
|
name: "HeaderWorldClock",
|
|
146
146
|
component: {
|
|
147
|
-
lazy: () => import('./esm/index-
|
|
147
|
+
lazy: () => import('./esm/index-810d077a.esm.js').then(
|
|
148
148
|
(m) => m.HeaderWorldClock
|
|
149
149
|
)
|
|
150
150
|
}
|
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.31-next.
|
|
4
|
+
"version": "0.4.31-next.1",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -35,10 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@backstage/catalog-model": "^1.1.6-next.0",
|
|
37
37
|
"@backstage/config": "^1.0.6",
|
|
38
|
-
"@backstage/core-components": "^0.12.
|
|
38
|
+
"@backstage/core-components": "^0.12.4-next.0",
|
|
39
39
|
"@backstage/core-plugin-api": "^1.3.0",
|
|
40
|
-
"@backstage/plugin-catalog-react": "^1.3.0-next.
|
|
41
|
-
"@backstage/plugin-stack-overflow": "^0.1.11-next.0",
|
|
40
|
+
"@backstage/plugin-catalog-react": "^1.3.0-next.1",
|
|
42
41
|
"@backstage/theme": "^0.2.16",
|
|
43
42
|
"@material-ui/core": "^4.12.2",
|
|
44
43
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -52,10 +51,10 @@
|
|
|
52
51
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@backstage/cli": "^0.22.
|
|
56
|
-
"@backstage/core-app-api": "^1.4.0",
|
|
57
|
-
"@backstage/dev-utils": "^1.0.12-next.
|
|
58
|
-
"@backstage/test-utils": "^1.2.
|
|
54
|
+
"@backstage/cli": "^0.22.2-next.0",
|
|
55
|
+
"@backstage/core-app-api": "^1.4.1-next.0",
|
|
56
|
+
"@backstage/dev-utils": "^1.0.12-next.1",
|
|
57
|
+
"@backstage/test-utils": "^1.2.5-next.0",
|
|
59
58
|
"@testing-library/jest-dom": "^5.10.1",
|
|
60
59
|
"@testing-library/react": "^12.1.3",
|
|
61
60
|
"@testing-library/user-event": "^14.0.0",
|