@red-hat-developer-hub/backstage-plugin-global-header 1.15.1 → 1.16.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 +10 -0
- package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js +7 -3
- package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js +6 -1
- package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js +34 -25
- package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/HelpDropdown.esm.js +7 -3
- package/dist/components/HeaderDropdownComponent/HelpDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/MenuSection.esm.js +4 -1
- package/dist/components/HeaderDropdownComponent/MenuSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js +8 -4
- package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js +4 -2
- package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js +6 -4
- package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js +10 -5
- package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js.map +1 -1
- package/dist/components/LogoutButton/LogoutButton.esm.js +3 -1
- package/dist/components/LogoutButton/LogoutButton.esm.js.map +1 -1
- package/dist/components/MenuItemLink/MenuItemLink.esm.js +5 -2
- package/dist/components/MenuItemLink/MenuItemLink.esm.js.map +1 -1
- package/dist/components/NotificationBanner.esm.js +6 -2
- package/dist/components/NotificationBanner.esm.js.map +1 -1
- package/dist/components/NotificationButton/NotificationButton.esm.js +6 -3
- package/dist/components/NotificationButton/NotificationButton.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchBar.esm.js +4 -2
- package/dist/components/SearchComponent/SearchBar.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchInput.esm.js +23 -19
- package/dist/components/SearchComponent/SearchInput.esm.js.map +1 -1
- package/dist/components/SupportButton/SupportButton.esm.js +5 -2
- package/dist/components/SupportButton/SupportButton.esm.js.map +1 -1
- package/dist/defaultMountPoints/defaultMountPoints.esm.js +7 -7
- package/dist/defaultMountPoints/defaultMountPoints.esm.js.map +1 -1
- package/dist/hooks/useTranslation.esm.js +8 -0
- package/dist/hooks/useTranslation.esm.js.map +1 -0
- package/dist/index.d.ts +49 -1
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +2 -0
- package/dist/plugin.esm.js.map +1 -1
- package/dist/translations/de.esm.js +43 -0
- package/dist/translations/de.esm.js.map +1 -0
- package/dist/translations/es.esm.js +43 -0
- package/dist/translations/es.esm.js.map +1 -0
- package/dist/translations/fr.esm.js +43 -0
- package/dist/translations/fr.esm.js.map +1 -0
- package/dist/translations/index.esm.js +15 -0
- package/dist/translations/index.esm.js.map +1 -0
- package/dist/translations/it.esm.js +43 -0
- package/dist/translations/it.esm.js.map +1 -0
- package/dist/translations/ref.esm.js +63 -0
- package/dist/translations/ref.esm.js.map +1 -0
- package/package.json +1 -1
|
@@ -13,6 +13,9 @@ import Typography from '@mui/material/Typography';
|
|
|
13
13
|
import IconButton from '@mui/material/IconButton';
|
|
14
14
|
import Tooltip from '@mui/material/Tooltip';
|
|
15
15
|
import { useDropdownManager } from '../../hooks/useDropdownManager.esm.js';
|
|
16
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
17
|
+
import '@backstage/core-plugin-api';
|
|
18
|
+
import '@backstage/core-plugin-api/alpha';
|
|
16
19
|
import { HeaderDropdownComponent } from './HeaderDropdownComponent.esm.js';
|
|
17
20
|
import { DropdownEmptyState } from './DropdownEmptyState.esm.js';
|
|
18
21
|
|
|
@@ -24,6 +27,7 @@ const StarredItem = ({
|
|
|
24
27
|
const { Icon, primaryTitle, secondaryTitle } = useEntityPresentation(entityRef);
|
|
25
28
|
const { name, kind, namespace } = parseEntityRef(entityRef);
|
|
26
29
|
const theme = useTheme();
|
|
30
|
+
const { t } = useTranslation();
|
|
27
31
|
return /* @__PURE__ */ jsxs(
|
|
28
32
|
MenuItem,
|
|
29
33
|
{
|
|
@@ -42,7 +46,7 @@ const StarredItem = ({
|
|
|
42
46
|
sx: { ml: 1, mr: 1 }
|
|
43
47
|
}
|
|
44
48
|
),
|
|
45
|
-
/* @__PURE__ */ jsx(Tooltip, { title: "
|
|
49
|
+
/* @__PURE__ */ jsx(Tooltip, { title: t("starred.removeTooltip"), children: /* @__PURE__ */ jsx(
|
|
46
50
|
IconButton,
|
|
47
51
|
{
|
|
48
52
|
onClick: (e) => {
|
|
@@ -60,6 +64,7 @@ const StarredItem = ({
|
|
|
60
64
|
const StarredDropdown = () => {
|
|
61
65
|
const { anchorEl, handleOpen, handleClose } = useDropdownManager();
|
|
62
66
|
const { starredEntities, toggleStarredEntity } = useStarredEntities();
|
|
67
|
+
const { t } = useTranslation();
|
|
63
68
|
const entitiesArray = Array.from(starredEntities);
|
|
64
69
|
return /* @__PURE__ */ jsx(
|
|
65
70
|
HeaderDropdownComponent,
|
|
@@ -68,13 +73,13 @@ const StarredDropdown = () => {
|
|
|
68
73
|
onOpen: handleOpen,
|
|
69
74
|
onClose: handleClose,
|
|
70
75
|
anchorEl,
|
|
71
|
-
tooltip: "
|
|
76
|
+
tooltip: t("starred.title"),
|
|
72
77
|
isIconButton: true,
|
|
73
78
|
children: entitiesArray.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
79
|
/* @__PURE__ */ jsx(
|
|
75
80
|
ListItemText,
|
|
76
81
|
{
|
|
77
|
-
primary: "
|
|
82
|
+
primary: t("starred.title"),
|
|
78
83
|
sx: { pl: 2, mt: 1, fontWeight: "bold", color: "text.secondary" }
|
|
79
84
|
}
|
|
80
85
|
),
|
|
@@ -90,8 +95,8 @@ const StarredDropdown = () => {
|
|
|
90
95
|
] }) : /* @__PURE__ */ jsx(
|
|
91
96
|
DropdownEmptyState,
|
|
92
97
|
{
|
|
93
|
-
title: "
|
|
94
|
-
subTitle: "
|
|
98
|
+
title: t("starred.noItemsTitle"),
|
|
99
|
+
subTitle: t("starred.noItemsSubtitle"),
|
|
95
100
|
icon: /* @__PURE__ */ jsx(AutoAwesomeIcon, { sx: { fontSize: 64 }, color: "disabled" })
|
|
96
101
|
}
|
|
97
102
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StarredDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/StarredDropdown.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type { FC } from 'react';\nimport {\n useEntityPresentation,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { Link } from '@backstage/core-components';\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport StarBorderIcon from '@mui/icons-material/StarBorder';\nimport Star from '@mui/icons-material/Star';\nimport AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';\nimport ListItemIcon from '@mui/material/ListItemIcon';\nimport ListItemText from '@mui/material/ListItemText';\n\nimport { useTheme } from '@mui/material/styles';\nimport MenuItem from '@mui/material/MenuItem';\nimport Typography from '@mui/material/Typography';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport { DropdownEmptyState } from './DropdownEmptyState';\n\n/**\n * @public\n * Props for each starred entitify item\n */\ninterface SectionComponentProps {\n entityRef: string | CompoundEntityRef | Entity;\n toggleStarredEntity: (\n entityOrRef: Entity | CompoundEntityRef | string,\n ) => void;\n handleClose: () => void;\n}\n\nconst StarredItem: FC<SectionComponentProps> = ({\n entityRef,\n toggleStarredEntity,\n handleClose,\n}) => {\n const { Icon, primaryTitle, secondaryTitle } =\n useEntityPresentation(entityRef);\n const { name, kind, namespace } = parseEntityRef(entityRef as string);\n const theme = useTheme();\n\n return (\n <MenuItem\n component={Link}\n to={`/catalog/${namespace || 'default'}/${kind}/${name}`}\n onClick={handleClose}\n disableRipple\n disableTouchRipple\n >\n {Icon && (\n <ListItemIcon sx={{ minWidth: 36 }}>\n <Icon />\n </ListItemIcon>\n )}\n <ListItemText\n primary={\n <Typography sx={{ color: theme.palette.text.primary }}>\n {primaryTitle || secondaryTitle}\n </Typography>\n }\n secondary={kind.toLocaleUpperCase()}\n // inset={!Icon}\n sx={{ ml: 1, mr: 1 }}\n />\n <Tooltip title
|
|
1
|
+
{"version":3,"file":"StarredDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/StarredDropdown.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type { FC } from 'react';\nimport {\n useEntityPresentation,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { Link } from '@backstage/core-components';\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport StarBorderIcon from '@mui/icons-material/StarBorder';\nimport Star from '@mui/icons-material/Star';\nimport AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';\nimport ListItemIcon from '@mui/material/ListItemIcon';\nimport ListItemText from '@mui/material/ListItemText';\n\nimport { useTheme } from '@mui/material/styles';\nimport MenuItem from '@mui/material/MenuItem';\nimport Typography from '@mui/material/Typography';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport { DropdownEmptyState } from './DropdownEmptyState';\nimport { useTranslation } from '../../hooks/useTranslation';\n\n/**\n * @public\n * Props for each starred entitify item\n */\ninterface SectionComponentProps {\n entityRef: string | CompoundEntityRef | Entity;\n toggleStarredEntity: (\n entityOrRef: Entity | CompoundEntityRef | string,\n ) => void;\n handleClose: () => void;\n}\n\nconst StarredItem: FC<SectionComponentProps> = ({\n entityRef,\n toggleStarredEntity,\n handleClose,\n}) => {\n const { Icon, primaryTitle, secondaryTitle } =\n useEntityPresentation(entityRef);\n const { name, kind, namespace } = parseEntityRef(entityRef as string);\n const theme = useTheme();\n const { t } = useTranslation();\n\n return (\n <MenuItem\n component={Link}\n to={`/catalog/${namespace || 'default'}/${kind}/${name}`}\n onClick={handleClose}\n disableRipple\n disableTouchRipple\n >\n {Icon && (\n <ListItemIcon sx={{ minWidth: 36 }}>\n <Icon />\n </ListItemIcon>\n )}\n <ListItemText\n primary={\n <Typography sx={{ color: theme.palette.text.primary }}>\n {primaryTitle || secondaryTitle}\n </Typography>\n }\n secondary={kind.toLocaleUpperCase()}\n // inset={!Icon}\n sx={{ ml: 1, mr: 1 }}\n />\n <Tooltip title={t('starred.removeTooltip')}>\n <IconButton\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n toggleStarredEntity(entityRef);\n }}\n >\n <Star color=\"warning\" />\n </IconButton>\n </Tooltip>\n </MenuItem>\n );\n};\n\nexport const StarredDropdown = () => {\n const { anchorEl, handleOpen, handleClose } = useDropdownManager();\n const { starredEntities, toggleStarredEntity } = useStarredEntities();\n const { t } = useTranslation();\n\n const entitiesArray = Array.from(starredEntities);\n\n return (\n <HeaderDropdownComponent\n buttonContent={<StarBorderIcon />}\n onOpen={handleOpen}\n onClose={handleClose}\n anchorEl={anchorEl}\n tooltip={t('starred.title')}\n isIconButton\n >\n {entitiesArray.length > 0 ? (\n <>\n <ListItemText\n primary={t('starred.title')}\n sx={{ pl: 2, mt: 1, fontWeight: 'bold', color: 'text.secondary' }}\n />\n {entitiesArray.map(enitityRef => (\n <StarredItem\n key={enitityRef}\n entityRef={enitityRef}\n toggleStarredEntity={toggleStarredEntity}\n handleClose={handleClose}\n />\n ))}\n </>\n ) : (\n <DropdownEmptyState\n title={t('starred.noItemsTitle')}\n subTitle={t('starred.noItemsSubtitle')}\n icon={<AutoAwesomeIcon sx={{ fontSize: 64 }} color=\"disabled\" />}\n />\n )}\n </HeaderDropdownComponent>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwDA,MAAM,cAAyC,CAAC;AAAA,EAC9C,SAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAA,MAAM,EAAE,IAAM,EAAA,YAAA,EAAc,cAAe,EAAA,GACzC,sBAAsB,SAAS,CAAA;AACjC,EAAA,MAAM,EAAE,IAAM,EAAA,IAAA,EAAM,SAAU,EAAA,GAAI,eAAe,SAAmB,CAAA;AACpE,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EACE,uBAAA,IAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,M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AA,KAAA,EAAM,UAAW,EAAA;AAAA;AAAA;AAChE;AAAA,GAEJ;AAEJ;;;;"}
|
|
@@ -3,10 +3,12 @@ import { useApi, errorApiRef, identityApiRef } from '@backstage/core-plugin-api'
|
|
|
3
3
|
import MenuItem from '@mui/material/MenuItem';
|
|
4
4
|
import Divider from '@mui/material/Divider';
|
|
5
5
|
import { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent.esm.js';
|
|
6
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
6
7
|
|
|
7
8
|
const LogoutButton = () => {
|
|
8
9
|
const errorApi = useApi(errorApiRef);
|
|
9
10
|
const identityApi = useApi(identityApiRef);
|
|
11
|
+
const { t } = useTranslation();
|
|
10
12
|
const handleLogout = () => {
|
|
11
13
|
identityApi.signOut().catch((error) => errorApi.post(error));
|
|
12
14
|
};
|
|
@@ -21,7 +23,7 @@ const LogoutButton = () => {
|
|
|
21
23
|
width: "100%",
|
|
22
24
|
color: "inherit"
|
|
23
25
|
},
|
|
24
|
-
children: /* @__PURE__ */ jsx(MenuItemLinkContent, { icon: "logout", label: "
|
|
26
|
+
children: /* @__PURE__ */ jsx(MenuItemLinkContent, { icon: "logout", label: t("profile.signOut") })
|
|
25
27
|
}
|
|
26
28
|
)
|
|
27
29
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutButton.esm.js","sources":["../../../src/components/LogoutButton/LogoutButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport MenuItem from '@mui/material/MenuItem';\nimport Divider from '@mui/material/Divider';\n\nimport { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent';\n\nexport const LogoutButton = () => {\n const errorApi = useApi(errorApiRef);\n const identityApi = useApi(identityApiRef);\n\n const handleLogout = () => {\n identityApi.signOut().catch(error => errorApi.post(error));\n };\n\n return (\n <>\n <Divider />\n <MenuItem\n onClick={handleLogout}\n sx={{\n cursor: 'pointer',\n width: '100%',\n color: 'inherit',\n }}\n >\n <MenuItemLinkContent icon=\"logout\" label
|
|
1
|
+
{"version":3,"file":"LogoutButton.esm.js","sources":["../../../src/components/LogoutButton/LogoutButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport MenuItem from '@mui/material/MenuItem';\nimport Divider from '@mui/material/Divider';\n\nimport { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent';\nimport { useTranslation } from '../../hooks/useTranslation';\n\nexport const LogoutButton = () => {\n const errorApi = useApi(errorApiRef);\n const identityApi = useApi(identityApiRef);\n const { t } = useTranslation();\n\n const handleLogout = () => {\n identityApi.signOut().catch(error => errorApi.post(error));\n };\n\n return (\n <>\n <Divider />\n <MenuItem\n onClick={handleLogout}\n sx={{\n cursor: 'pointer',\n width: '100%',\n color: 'inherit',\n }}\n >\n <MenuItemLinkContent icon=\"logout\" label={t('profile.signOut')} />\n </MenuItem>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4BO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,WAAA,CAAY,SAAU,CAAA,KAAA,CAAM,WAAS,QAAS,CAAA,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,GAC3D;AAEA,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,CAAA;AAAA,oBACT,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,YAAA;AAAA,QACT,EAAI,EAAA;AAAA,UACF,MAAQ,EAAA,SAAA;AAAA,UACR,KAAO,EAAA,MAAA;AAAA,UACP,KAAO,EAAA;AAAA,SACT;AAAA,QAEA,8BAAC,mBAAoB,EAAA,EAAA,IAAA,EAAK,UAAS,KAAO,EAAA,CAAA,CAAE,iBAAiB,CAAG,EAAA;AAAA;AAAA;AAClE,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
|
3
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
3
4
|
import { MenuItemLinkContent } from './MenuItemLinkContent.esm.js';
|
|
4
5
|
|
|
5
6
|
const MenuItemLink = ({
|
|
@@ -9,12 +10,14 @@ const MenuItemLink = ({
|
|
|
9
10
|
icon,
|
|
10
11
|
tooltip
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const isExternalLink = to?.startsWith("http://") || to?.startsWith("https://");
|
|
15
|
+
const translatedTitle = title && title.includes(".") ? t(title, {}) || title : title;
|
|
13
16
|
const headerLinkContent = () => /* @__PURE__ */ jsx(
|
|
14
17
|
MenuItemLinkContent,
|
|
15
18
|
{
|
|
16
19
|
icon,
|
|
17
|
-
label:
|
|
20
|
+
label: translatedTitle,
|
|
18
21
|
subLabel: subTitle,
|
|
19
22
|
isExternalLink
|
|
20
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemLink.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLink.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 Tooltip from '@mui/material/Tooltip';\nimport { MenuItemLinkContent } from './MenuItemLinkContent';\n\n/**\n * Header Icon Button properties\n * @public\n */\nexport interface MenuItemLinkProps {\n to: string;\n title?: string;\n subTitle?: string;\n icon?: string;\n tooltip?: string;\n}\n\nexport const MenuItemLink = ({\n to,\n title,\n subTitle,\n icon,\n tooltip,\n}: MenuItemLinkProps) => {\n const
|
|
1
|
+
{"version":3,"file":"MenuItemLink.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLink.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 Tooltip from '@mui/material/Tooltip';\nimport { useTranslation } from '../../hooks/useTranslation';\nimport { MenuItemLinkContent } from './MenuItemLinkContent';\n\n/**\n * Header Icon Button properties\n * @public\n */\nexport interface MenuItemLinkProps {\n to: string;\n title?: string;\n subTitle?: string;\n icon?: string;\n tooltip?: string;\n}\n\nexport const MenuItemLink = ({\n to,\n title,\n subTitle,\n icon,\n tooltip,\n}: MenuItemLinkProps) => {\n const { t } = useTranslation();\n const isExternalLink =\n to?.startsWith('http://') || to?.startsWith('https://');\n\n // Check if title looks like a translation key (contains dots)\n const translatedTitle =\n title && title.includes('.')\n ? t(title as any, {}) || title // Fallback to original title if translation fails\n : title;\n\n const headerLinkContent = () => (\n <MenuItemLinkContent\n icon={icon}\n label={translatedTitle}\n subLabel={subTitle}\n isExternalLink={isExternalLink}\n />\n );\n\n return (\n <>\n {tooltip && (\n <Tooltip title={tooltip}>\n <div>{headerLinkContent()}</div>\n </Tooltip>\n )}\n {!tooltip && headerLinkContent()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAgCO,MAAM,eAAe,CAAC;AAAA,EAC3B,EAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAyB,KAAA;AACvB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,iBACJ,EAAI,EAAA,UAAA,CAAW,SAAS,CAAK,IAAA,EAAA,EAAI,WAAW,UAAU,CAAA;AAGxD,EAAM,MAAA,eAAA,GACJ,KAAS,IAAA,KAAA,CAAM,QAAS,CAAA,GAAG,CACvB,GAAA,CAAA,CAAE,KAAc,EAAA,EAAE,CAAA,IAAK,KACvB,GAAA,KAAA;AAEN,EAAA,MAAM,oBAAoB,sBACxB,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,KAAO,EAAA,eAAA;AAAA,MACP,QAAU,EAAA,QAAA;AAAA,MACV;AAAA;AAAA,GACF;AAGF,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IACC,OAAA,oBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,EACd,8BAAC,KAAK,EAAA,EAAA,QAAA,EAAA,iBAAA,IAAoB,CAC5B,EAAA,CAAA;AAAA,IAED,CAAC,WAAW,iBAAkB;AAAA,GACjC,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -3,8 +3,10 @@ import { useState, useMemo } from 'react';
|
|
|
3
3
|
import { MarkdownContent } from '@backstage/core-components';
|
|
4
4
|
import Alert from '@mui/material/Alert';
|
|
5
5
|
import { HeaderIcon } from './HeaderIcon/HeaderIcon.esm.js';
|
|
6
|
+
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
6
7
|
|
|
7
8
|
const NotificationBanner = (props) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
8
10
|
const [dismissed, setDismissed] = useState(() => {
|
|
9
11
|
if (props.dismiss === "localstorage") {
|
|
10
12
|
try {
|
|
@@ -39,10 +41,12 @@ const NotificationBanner = (props) => {
|
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
console.warn(
|
|
42
|
-
|
|
44
|
+
t("notifications.unsupportedDismissOption", {
|
|
45
|
+
option: props.dismiss
|
|
46
|
+
})
|
|
43
47
|
);
|
|
44
48
|
return void 0;
|
|
45
|
-
}, [props.id, props.title, props.dismiss]);
|
|
49
|
+
}, [props.id, props.title, props.dismiss, t]);
|
|
46
50
|
if (dismissed || !props.title) {
|
|
47
51
|
return null;
|
|
48
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationBanner.esm.js","sources":["../../src/components/NotificationBanner.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useState, useMemo } from 'react';\nimport type { CSSProperties } from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\n\nimport Alert from '@mui/material/Alert';\n\nimport { HeaderIcon } from './HeaderIcon/HeaderIcon';\n\n/**\n * @public\n */\nexport type NotificationBannerDismiss = 'none' | 'session' | 'localstorage';\n\n/**\n * @public\n */\nexport interface NotificationBannerProps {\n id?: string;\n title: string;\n markdown?: boolean;\n icon?: string;\n\n textColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n layout?: CSSProperties;\n\n dismiss?: NotificationBannerDismiss;\n}\n\nexport const NotificationBanner = (props: NotificationBannerProps) => {\n const [dismissed, setDismissed] = useState<boolean>(() => {\n if (props.dismiss === 'localstorage') {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n return dismissedObject[props.id ?? props.title] === 'dismissed';\n } catch (error) {\n // nothing\n return false;\n }\n } else {\n return false;\n }\n });\n\n const onClose = useMemo<(() => void) | undefined>(() => {\n if (!props.dismiss || props.dismiss === 'none') {\n return undefined;\n } else if (props.dismiss === 'session') {\n return () => setDismissed(true);\n } else if (props.dismiss === 'localstorage') {\n return () => {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n dismissedObject[props.id ?? props.title] = 'dismissed';\n localStorage.setItem(\n 'global-header/NotificationBanner',\n JSON.stringify(dismissedObject),\n );\n } catch (error) {\n // nothing\n }\n setDismissed(true);\n };\n }\n // eslint-disable-next-line no-console\n console.warn(\n
|
|
1
|
+
{"version":3,"file":"NotificationBanner.esm.js","sources":["../../src/components/NotificationBanner.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useState, useMemo } from 'react';\nimport type { CSSProperties } from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\n\nimport Alert from '@mui/material/Alert';\n\nimport { HeaderIcon } from './HeaderIcon/HeaderIcon';\nimport { useTranslation } from '../hooks/useTranslation';\n\n/**\n * @public\n */\nexport type NotificationBannerDismiss = 'none' | 'session' | 'localstorage';\n\n/**\n * @public\n */\nexport interface NotificationBannerProps {\n id?: string;\n title: string;\n markdown?: boolean;\n icon?: string;\n\n textColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n layout?: CSSProperties;\n\n dismiss?: NotificationBannerDismiss;\n}\n\nexport const NotificationBanner = (props: NotificationBannerProps) => {\n const { t } = useTranslation();\n const [dismissed, setDismissed] = useState<boolean>(() => {\n if (props.dismiss === 'localstorage') {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n return dismissedObject[props.id ?? props.title] === 'dismissed';\n } catch (error) {\n // nothing\n return false;\n }\n } else {\n return false;\n }\n });\n\n const onClose = useMemo<(() => void) | undefined>(() => {\n if (!props.dismiss || props.dismiss === 'none') {\n return undefined;\n } else if (props.dismiss === 'session') {\n return () => setDismissed(true);\n } else if (props.dismiss === 'localstorage') {\n return () => {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n dismissedObject[props.id ?? props.title] = 'dismissed';\n localStorage.setItem(\n 'global-header/NotificationBanner',\n JSON.stringify(dismissedObject),\n );\n } catch (error) {\n // nothing\n }\n setDismissed(true);\n };\n }\n // eslint-disable-next-line no-console\n console.warn(\n t('notifications.unsupportedDismissOption' as any, {\n option: props.dismiss,\n }),\n );\n return undefined;\n }, [props.id, props.title, props.dismiss, t]);\n\n if (dismissed || !props.title) {\n return null;\n }\n\n return (\n <Alert\n color=\"warning\"\n icon={props.icon ? <HeaderIcon icon={props.icon} /> : false}\n onClose={onClose}\n sx={{\n color: props.textColor,\n backgroundColor: props.backgroundColor,\n borderColor: props.borderColor,\n borderStyle: 'solid',\n borderWidth: 2,\n borderRadius: 0,\n justifyContent: 'center',\n textAlign: 'center',\n ...props.layout,\n }}\n >\n {props.markdown ? (\n <MarkdownContent content={props.title} dialect=\"gfm\" />\n ) : (\n props.title\n )}\n </Alert>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAgDa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAkB,MAAM;AACxD,IAAI,IAAA,KAAA,CAAM,YAAY,cAAgB,EAAA;AACpC,MAAI,IAAA;AACF,QAAA,MAAM,eACJ,GAAA,YAAA,CAAa,OAAQ,CAAA,kCAAkC,CAAK,IAAA,IAAA;AAC9D,QAAM,MAAA,eAAA,GAAkB,IAAK,CAAA,KAAA,CAAM,eAAe,CAAA;AAClD,QAAA,OAAO,eAAgB,CAAA,KAAA,CAAM,EAAM,IAAA,KAAA,CAAM,KAAK,CAAM,KAAA,WAAA;AAAA,eAC7C,KAAO,EAAA;AAEd,QAAO,OAAA,KAAA;AAAA;AACT,KACK,MAAA;AACL,MAAO,OAAA,KAAA;AAAA;AACT,GACD,CAAA;AAED,EAAM,MAAA,OAAA,GAAU,QAAkC,MAAM;AACtD,IAAA,IAAI,CAAC,KAAA,CAAM,OAAW,IAAA,KAAA,CAAM,YAAY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AAI,EAAA;AAAA,QACF,OAAO,KAAM,CAAA,SAAA;AAAA,QACb,iBAAiB,KAAM,CAAA,eAAA;AAAA,QACvB,aAAa,KAAM,CAAA,WAAA;AAAA,QACnB,WAAa,EAAA,OAAA;AAAA,QACb,WAAa,EAAA,CAAA;AAAA,QACb,YAAc,EAAA,CAAA;AAAA,QACd,cAAgB,EAAA,QAAA;AAAA,QAChB,SAAW,EAAA,QAAA;AAAA,QACX,GAAG,KAAM,CAAA;AAAA,OACX;AAAA,MAEC,QAAA,EAAA,KAAA,CAAM,QACL,mBAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAM,KAAO,EAAA,OAAA,EAAQ,KAAM,EAAA,CAAA,GAErD,KAAM,CAAA;AAAA;AAAA,GAEV;AAEJ;;;;"}
|
|
@@ -6,10 +6,11 @@ import IconButton from '@mui/material/IconButton';
|
|
|
6
6
|
import Tooltip from '@mui/material/Tooltip';
|
|
7
7
|
import NotificationIcon from '@mui/icons-material/NotificationsOutlined';
|
|
8
8
|
import { useNotificationCount } from '../../hooks/useNotificationCount.esm.js';
|
|
9
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
9
10
|
|
|
10
11
|
const Link = (props) => /* @__PURE__ */ jsx(Link$1, { ...props, color: "inherit", externalLinkIcon: false });
|
|
11
12
|
const NotificationButton = ({
|
|
12
|
-
title
|
|
13
|
+
title,
|
|
13
14
|
tooltip,
|
|
14
15
|
color = "inherit",
|
|
15
16
|
size = "small",
|
|
@@ -17,18 +18,20 @@ const NotificationButton = ({
|
|
|
17
18
|
to = "/notifications",
|
|
18
19
|
layout
|
|
19
20
|
}) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
20
22
|
const { available, unreadCount } = useNotificationCount();
|
|
23
|
+
const displayTitle = title || t("notifications.title");
|
|
21
24
|
if (!available) {
|
|
22
25
|
return null;
|
|
23
26
|
}
|
|
24
|
-
return /* @__PURE__ */ jsx(Box, { sx: layout, children: /* @__PURE__ */ jsx(Tooltip, { title: tooltip ??
|
|
27
|
+
return /* @__PURE__ */ jsx(Box, { sx: layout, children: /* @__PURE__ */ jsx(Tooltip, { title: tooltip ?? displayTitle, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
25
28
|
IconButton,
|
|
26
29
|
{
|
|
27
30
|
component: Link,
|
|
28
31
|
color,
|
|
29
32
|
size,
|
|
30
33
|
to,
|
|
31
|
-
"aria-label":
|
|
34
|
+
"aria-label": displayTitle,
|
|
32
35
|
children: unreadCount > 0 ? /* @__PURE__ */ jsx(Badge, { badgeContent: unreadCount, color: badgeColor, max: 999, children: /* @__PURE__ */ jsx(NotificationIcon, { fontSize: size }) }) : /* @__PURE__ */ jsx(NotificationIcon, { fontSize: size })
|
|
33
36
|
}
|
|
34
37
|
) }) }) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationButton.esm.js","sources":["../../../src/components/NotificationButton/NotificationButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type { CSSProperties } from 'react';\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Badge from '@mui/material/Badge';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport NotificationIcon from '@mui/icons-material/NotificationsOutlined';\n\nimport { useNotificationCount } from '../../hooks/useNotificationCount';\n\n/**\n * @public\n */\nexport interface NotificationButtonProps {\n title?: string;\n tooltip?: string;\n color?:\n | 'inherit'\n | 'default'\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n size?: 'small' | 'medium' | 'large';\n badgeColor?:\n | 'primary'\n | 'secondary'\n | 'default'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n to?: string;\n layout?: CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\n/**\n * @public\n */\nexport const NotificationButton = ({\n title
|
|
1
|
+
{"version":3,"file":"NotificationButton.esm.js","sources":["../../../src/components/NotificationButton/NotificationButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type { CSSProperties } from 'react';\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Badge from '@mui/material/Badge';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport NotificationIcon from '@mui/icons-material/NotificationsOutlined';\n\nimport { useNotificationCount } from '../../hooks/useNotificationCount';\nimport { useTranslation } from '../../hooks/useTranslation';\n\n/**\n * @public\n */\nexport interface NotificationButtonProps {\n title?: string;\n tooltip?: string;\n color?:\n | 'inherit'\n | 'default'\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n size?: 'small' | 'medium' | 'large';\n badgeColor?:\n | 'primary'\n | 'secondary'\n | 'default'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n to?: string;\n layout?: CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\n/**\n * @public\n */\nexport const NotificationButton = ({\n title,\n tooltip,\n color = 'inherit',\n size = 'small',\n badgeColor = 'error',\n to = '/notifications',\n layout,\n}: NotificationButtonProps) => {\n const { t } = useTranslation();\n const { available, unreadCount } = useNotificationCount();\n\n const displayTitle = title || t('notifications.title');\n\n if (!available) {\n return null;\n }\n\n return (\n <Box sx={layout}>\n <Tooltip title={tooltip ?? displayTitle}>\n <div>\n <IconButton\n component={Link}\n color={color}\n size={size}\n to={to}\n aria-label={displayTitle}\n >\n {unreadCount > 0 ? (\n <Badge badgeContent={unreadCount} color={badgeColor} max={999}>\n <NotificationIcon fontSize={size} />\n </Badge>\n ) : (\n <NotificationIcon fontSize={size} />\n )}\n </IconButton>\n </div>\n </Tooltip>\n </Box>\n );\n};\n"],"names":["BackstageLink"],"mappings":";;;;;;;;;;AAyDA,MAAM,IAAA,GAAO,CAAC,KAAA,qBACX,GAAA,CAAAA,MAAA,EAAA,EAAe,GAAG,KAAO,EAAA,KAAA,EAAM,SAAU,EAAA,gBAAA,EAAkB,KAAO,EAAA,CAAA;AAM9D,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAQ,GAAA,SAAA;AAAA,EACR,IAAO,GAAA,OAAA;AAAA,EACP,UAAa,GAAA,OAAA;AAAA,EACb,EAAK,GAAA,gBAAA;AAAA,EACL;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,EAAE,SAAA,EAAW,WAAY,EAAA,GAAI,oBAAqB,EAAA;AAExD,EAAM,MAAA,YAAA,GAAe,KAAS,IAAA,CAAA,CAAE,qBAAqB,CAAA;AAErD,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,MACP,EAAA,QAAA,kBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,IAAW,YACzB,EAAA,QAAA,kBAAA,GAAA,CAAC,KACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,YAAY,EAAA,YAAA;AAAA,MAEX,wBAAc,CACb,mBAAA,GAAA,CAAC,SAAM,YAAc,EAAA,WAAA,EAAa,OAAO,UAAY,EAAA,GAAA,EAAK,KACxD,QAAC,kBAAA,GAAA,CAAA,gBAAA,EAAA,EAAiB,UAAU,IAAM,EAAA,CAAA,EACpC,oBAEC,GAAA,CAAA,gBAAA,EAAA,EAAiB,UAAU,IAAM,EAAA;AAAA;AAAA,GAEtC,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -8,6 +8,7 @@ import { SearchInput } from './SearchInput.esm.js';
|
|
|
8
8
|
import { SearchOption } from './SearchOption.esm.js';
|
|
9
9
|
import { useTheme } from '@mui/material/styles';
|
|
10
10
|
import { useDebouncedCallback } from '../../hooks/useDebouncedCallback.esm.js';
|
|
11
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
11
12
|
|
|
12
13
|
const SearchBar = (props) => {
|
|
13
14
|
const { query, setSearchTerm } = props;
|
|
@@ -16,6 +17,7 @@ const SearchBar = (props) => {
|
|
|
16
17
|
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
17
18
|
const highlightedIndexRef = useRef(highlightedIndex);
|
|
18
19
|
const { setTerm } = useSearch();
|
|
20
|
+
const { t } = useTranslation();
|
|
19
21
|
const onInputChange = useDebouncedCallback((_, inputValue) => {
|
|
20
22
|
setSearchTerm(inputValue);
|
|
21
23
|
setTerm(inputValue);
|
|
@@ -27,7 +29,7 @@ const SearchBar = (props) => {
|
|
|
27
29
|
const results = query?.term ? value?.results ?? [] : [];
|
|
28
30
|
let options = [];
|
|
29
31
|
if (query?.term && results.length === 0) {
|
|
30
|
-
options = ["
|
|
32
|
+
options = [t("search.noResults")];
|
|
31
33
|
}
|
|
32
34
|
if (results.length > 0) {
|
|
33
35
|
options = [
|
|
@@ -83,7 +85,7 @@ const SearchBar = (props) => {
|
|
|
83
85
|
{
|
|
84
86
|
params,
|
|
85
87
|
error: !!error,
|
|
86
|
-
helperText: error ? "
|
|
88
|
+
helperText: error ? t("search.errorFetching") : ""
|
|
87
89
|
}
|
|
88
90
|
),
|
|
89
91
|
renderOption: (renderProps, option, { index }) => /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchComponent/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useEffect, useRef, useState } from 'react';\nimport {\n SearchResultState,\n SearchResultProps,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport { createSearchLink } from '../../utils/stringUtils';\nimport { useNavigate } from 'react-router-dom';\nimport { SearchInput } from './SearchInput';\nimport { SearchOption } from './SearchOption';\nimport { useTheme } from '@mui/material/styles';\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback';\n\ninterface SearchBarProps {\n query: SearchResultProps['query'];\n setSearchTerm: (term: string) => void;\n}\nexport const SearchBar = (props: SearchBarProps) => {\n const { query, setSearchTerm } = props;\n const navigate = useNavigate();\n const theme = useTheme();\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const highlightedIndexRef = useRef(highlightedIndex);\n const { setTerm } = useSearch();\n\n const onInputChange = useDebouncedCallback((_, inputValue) => {\n setSearchTerm(inputValue);\n setTerm(inputValue);\n }, 300);\n\n useEffect(() => {\n highlightedIndexRef.current = highlightedIndex;\n }, [highlightedIndex]);\n\n return (\n <SearchResultState {...props}>\n {({ loading, error, value }) => {\n const results = query?.term ? value?.results ?? [] : [];\n let options: string[] = [];\n if (query?.term && results.length === 0) {\n options = ['
|
|
1
|
+
{"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchComponent/SearchBar.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useEffect, useRef, useState } from 'react';\nimport {\n SearchResultState,\n SearchResultProps,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport { createSearchLink } from '../../utils/stringUtils';\nimport { useNavigate } from 'react-router-dom';\nimport { SearchInput } from './SearchInput';\nimport { SearchOption } from './SearchOption';\nimport { useTheme } from '@mui/material/styles';\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback';\nimport { useTranslation } from '../../hooks/useTranslation';\n\ninterface SearchBarProps {\n query: SearchResultProps['query'];\n setSearchTerm: (term: string) => void;\n}\nexport const SearchBar = (props: SearchBarProps) => {\n const { query, setSearchTerm } = props;\n const navigate = useNavigate();\n const theme = useTheme();\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const highlightedIndexRef = useRef(highlightedIndex);\n const { setTerm } = useSearch();\n const { t } = useTranslation();\n\n const onInputChange = useDebouncedCallback((_, inputValue) => {\n setSearchTerm(inputValue);\n setTerm(inputValue);\n }, 300);\n\n useEffect(() => {\n highlightedIndexRef.current = highlightedIndex;\n }, [highlightedIndex]);\n\n return (\n <SearchResultState {...props}>\n {({ loading, error, value }) => {\n const results = query?.term ? value?.results ?? [] : [];\n let options: string[] = [];\n if (query?.term && results.length === 0) {\n options = [t('search.noResults')];\n }\n if (results.length > 0) {\n options = [\n ...results.map(result => result.document.title),\n `${query?.term}`,\n ];\n }\n const searchLink = createSearchLink(query?.term ?? '');\n\n return (\n <Autocomplete\n freeSolo\n options={options}\n loading={loading}\n value={query?.term ?? ''}\n getOptionLabel={option => option ?? ''}\n onInputChange={onInputChange}\n onHighlightChange={(_, option) =>\n setHighlightedIndex(options.indexOf(option ?? ''))\n }\n componentsProps={{\n paper: {\n sx: {\n '&:empty': { visibility: 'hidden' }, // Removes underline-like effect\n borderRadius: '4px',\n outline: 'unset',\n boxShadow:\n theme.palette.mode === 'dark'\n ? `0 2px 6px 2px rgba(0, 0, 0, 0.50), 0 1px 2px 0 rgba(0, 0, 0, 0.50)`\n : '0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.30)',\n },\n },\n }}\n sx={{\n width: '100%',\n '& [class*=\"MuiAutocomplete-clearIndicator\"]': {\n visibility: query?.term ? 'visible' : 'hidden',\n },\n }}\n filterOptions={x => x}\n onKeyDown={event => {\n const currentHighlight = highlightedIndexRef.current;\n if (event.key === 'Enter') {\n event.preventDefault();\n if (currentHighlight === -1 && query?.term) {\n navigate(searchLink);\n } else if (currentHighlight !== -1) {\n navigate(\n results[highlightedIndex]?.document?.location ?? searchLink,\n );\n }\n setHighlightedIndex(-1);\n }\n }}\n renderInput={params => (\n <SearchInput\n params={params}\n error={!!error}\n helperText={error ? t('search.errorFetching') : ''}\n />\n )}\n renderOption={(renderProps, option, { index }) => (\n <SearchOption\n option={option}\n index={index}\n options={options}\n query={query}\n results={results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A,OAAA;AAC7C,UAAI,IAAA,KAAA,CAAM,QAAQ,OAAS,EAAA;AACzB,YAAA,KAAA,CAAM,cAAe,EAAA;AACrB,YAAI,IAAA,gBAAA,KAAqB,CAAM,CAAA,IAAA,KAAA,EAAO,IAAM,EAAA;AAC1C,cAAA,QAAA,CAAS,UAAU,CAAA;AAAA,aACrB,MAAA,IAAW,qBAAqB,CAAI,CAAA,EAAA;AAClC,cAAA,QAAA;AAAA,gBACE,OAAQ,CAAA,gBAAgB,CAAG,EAAA,QAAA,EAAU,QAAY,IAAA;AAAA,eACnD;AAAA;AAEF,YAAA,mBAAA,CAAoB,CAAE,CAAA,CAAA;AAAA;AACxB,SACF;AAAA,QACA,aAAa,CACX,MAAA,qBAAA,GAAA;AAAA,UAAC,WAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,KAAA,EAAO,CAAC,CAAC,KAAA;AAAA,YACT,UAAY,EAAA,KAAA,GAAQ,CAAE,CAAA,sBAAsB,CAAI,GAAA;AAAA;AAAA,SAClD;AAAA,QAEF,cAAc,CAAC,WAAA,EAAa,MAAQ,EAAA,EAAE,OACpC,qBAAA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,KAAA;AAAA,YACA,OAAA;AAAA,YACA,KAAA;AAAA,YACA,OAAA;AAAA,YACA,WAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,QAEF,YAAc,EAAA;AAAA,UACZ,EAAA,EAAI,EAAE,SAAA,EAAW,MAAO;AAAA;AAC1B;AAAA,KACF;AAAA,GAGN,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,31 +2,35 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import TextField from '@mui/material/TextField';
|
|
3
3
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
4
4
|
import SearchIcon from '@mui/icons-material/Search';
|
|
5
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
5
6
|
|
|
6
7
|
const SearchInput = ({
|
|
7
8
|
params,
|
|
8
9
|
error,
|
|
9
10
|
helperText
|
|
10
|
-
}) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
}) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
TextField,
|
|
15
|
+
{
|
|
16
|
+
...params,
|
|
17
|
+
placeholder: t("search.placeholder"),
|
|
18
|
+
variant: "standard",
|
|
19
|
+
error,
|
|
20
|
+
helperText,
|
|
21
|
+
InputProps: {
|
|
22
|
+
...params.InputProps,
|
|
23
|
+
disableUnderline: true,
|
|
24
|
+
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(SearchIcon, { style: { color: "inherit" } }) })
|
|
25
|
+
},
|
|
26
|
+
sx: {
|
|
27
|
+
input: { color: "inherit" },
|
|
28
|
+
button: { color: "inherit" },
|
|
29
|
+
"& fieldset": { border: "none" }
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
);
|
|
33
|
+
};
|
|
30
34
|
|
|
31
35
|
export { SearchInput };
|
|
32
36
|
//# sourceMappingURL=SearchInput.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.esm.js","sources":["../../../src/components/SearchComponent/SearchInput.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 TextField from '@mui/material/TextField';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport SearchIcon from '@mui/icons-material/Search';\n\ninterface SearchInputProps {\n params: any;\n error: boolean;\n helperText: string;\n}\n\nexport const SearchInput = ({\n params,\n error,\n helperText,\n}: SearchInputProps) => (\n <TextField\n
|
|
1
|
+
{"version":3,"file":"SearchInput.esm.js","sources":["../../../src/components/SearchComponent/SearchInput.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 TextField from '@mui/material/TextField';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport SearchIcon from '@mui/icons-material/Search';\nimport { useTranslation } from '../../hooks/useTranslation';\n\ninterface SearchInputProps {\n params: any;\n error: boolean;\n helperText: string;\n}\n\nexport const SearchInput = ({\n params,\n error,\n helperText,\n}: SearchInputProps) => {\n const { t } = useTranslation();\n\n return (\n <TextField\n {...params}\n placeholder={t('search.placeholder')}\n variant=\"standard\"\n error={error}\n helperText={helperText}\n InputProps={{\n ...params.InputProps,\n disableUnderline: true,\n startAdornment: (\n <InputAdornment position=\"start\">\n <SearchIcon style={{ color: 'inherit' }} />\n </InputAdornment>\n ),\n }}\n sx={{\n input: { color: 'inherit' },\n button: { color: 'inherit' },\n '& fieldset': { border: 'none' },\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BO,MAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAwB,KAAA;AACtB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACE,GAAG,MAAA;AAAA,MACJ,WAAA,EAAa,EAAE,oBAAoB,CAAA;AAAA,MACnC,OAAQ,EAAA,UAAA;AAAA,MACR,KAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,GAAG,MAAO,CAAA,UAAA;AAAA,QACV,gBAAkB,EAAA,IAAA;AAAA,QAClB,cACE,kBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,QAAA,EAAS,OACvB,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAO,EAAE,KAAA,EAAO,SAAU,EAAA,EAAG,CAC3C,EAAA;AAAA,OAEJ;AAAA,MACA,EAAI,EAAA;AAAA,QACF,KAAA,EAAO,EAAE,KAAA,EAAO,SAAU,EAAA;AAAA,QAC1B,MAAA,EAAQ,EAAE,KAAA,EAAO,SAAU,EAAA;AAAA,QAC3B,YAAA,EAAc,EAAE,MAAA,EAAQ,MAAO;AAAA;AACjC;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -3,9 +3,10 @@ import { useApiHolder, configApiRef } from '@backstage/core-plugin-api';
|
|
|
3
3
|
import { Link } from '@backstage/core-components';
|
|
4
4
|
import MenuItem from '@mui/material/MenuItem';
|
|
5
5
|
import { MenuItemLink } from '../MenuItemLink/MenuItemLink.esm.js';
|
|
6
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
6
7
|
|
|
7
8
|
const SupportButton = ({
|
|
8
|
-
title
|
|
9
|
+
title,
|
|
9
10
|
to,
|
|
10
11
|
icon = "support",
|
|
11
12
|
tooltip,
|
|
@@ -15,6 +16,8 @@ const SupportButton = ({
|
|
|
15
16
|
}) => {
|
|
16
17
|
const apiHolder = useApiHolder();
|
|
17
18
|
const config = apiHolder.get(configApiRef);
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const displayTitle = title || t("help.supportTitle");
|
|
18
21
|
const supportUrl = to ?? config?.getOptionalString("app.support.url");
|
|
19
22
|
if (!supportUrl) {
|
|
20
23
|
return null;
|
|
@@ -31,7 +34,7 @@ const SupportButton = ({
|
|
|
31
34
|
MenuItemLink,
|
|
32
35
|
{
|
|
33
36
|
to: supportUrl,
|
|
34
|
-
title,
|
|
37
|
+
title: displayTitle,
|
|
35
38
|
icon,
|
|
36
39
|
tooltip
|
|
37
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportButton.esm.js","sources":["../../../src/components/SupportButton/SupportButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { configApiRef, useApiHolder } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport MenuItem from '@mui/material/MenuItem';\nimport { MenuItemLink } from '../MenuItemLink/MenuItemLink';\nimport { CSSProperties } from 'react';\n\n/**\n * @public\n */\nexport interface SupportButtonProps {\n icon?: string;\n title?: string;\n to?: string;\n tooltip?: string;\n style?: CSSProperties;\n onClick?: () => void;\n}\n/**\n * @public\n */\nexport const SupportButton = ({\n title
|
|
1
|
+
{"version":3,"file":"SupportButton.esm.js","sources":["../../../src/components/SupportButton/SupportButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { configApiRef, useApiHolder } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport MenuItem from '@mui/material/MenuItem';\nimport { MenuItemLink } from '../MenuItemLink/MenuItemLink';\nimport { CSSProperties } from 'react';\nimport { useTranslation } from '../../hooks/useTranslation';\n\n/**\n * @public\n */\nexport interface SupportButtonProps {\n icon?: string;\n title?: string;\n to?: string;\n tooltip?: string;\n style?: CSSProperties;\n onClick?: () => void;\n}\n/**\n * @public\n */\nexport const SupportButton = ({\n title,\n to,\n icon = 'support',\n tooltip,\n style,\n onClick = () => {},\n}: SupportButtonProps) => {\n const apiHolder = useApiHolder();\n const config = apiHolder.get(configApiRef);\n const { t } = useTranslation();\n\n const displayTitle = title || t('help.supportTitle');\n const supportUrl = to ?? config?.getOptionalString('app.support.url');\n\n if (!supportUrl) {\n return null;\n }\n\n return (\n <MenuItem\n to={supportUrl}\n component={Link}\n sx={{ width: '100%', color: 'inherit', ...style }}\n onClick={onClick}\n data-testid=\"support-button\"\n >\n <MenuItemLink\n to={supportUrl}\n title={displayTitle}\n icon={icon}\n tooltip={tooltip}\n />\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqCO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,KAAA;AAAA,EACA,EAAA;AAAA,EACA,IAAO,GAAA,SAAA;AAAA,EACP,OAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAU,MAAM;AAAA;AAClB,CAA0B,KAAA;AACxB,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAM,MAAA,MAAA,GAAS,SAAU,CAAA,GAAA,CAAI,YAAY,CAAA;AACzC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAM,MAAA,YAAA,GAAe,KAAS,IAAA,CAAA,CAAE,mBAAmB,CAAA;AACnD,EAAA,MAAM,UAAa,GAAA,EAAA,IAAM,MAAQ,EAAA,iBAAA,CAAkB,iBAAiB,CAAA;AAEpE,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,UAAA;AAAA,MACJ,SAAW,EAAA,IAAA;AAAA,MACX,IAAI,EAAE,KAAA,EAAO,QAAQ,KAAO,EAAA,SAAA,EAAW,GAAG,KAAM,EAAA;AAAA,MAChD,OAAA;AAAA,MACA,aAAY,EAAA,gBAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA,UAAA;AAAA,UACJ,KAAO,EAAA,YAAA;AAAA,UACP,IAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -118,7 +118,7 @@ const defaultProfileDropdownMountPoints = [
|
|
|
118
118
|
config: {
|
|
119
119
|
priority: 200,
|
|
120
120
|
props: {
|
|
121
|
-
title: "
|
|
121
|
+
title: "profile.settings",
|
|
122
122
|
icon: "manageAccounts",
|
|
123
123
|
link: "/settings"
|
|
124
124
|
}
|
|
@@ -129,7 +129,7 @@ const defaultProfileDropdownMountPoints = [
|
|
|
129
129
|
config: {
|
|
130
130
|
priority: 150,
|
|
131
131
|
props: {
|
|
132
|
-
title: "
|
|
132
|
+
title: "profile.myProfile",
|
|
133
133
|
icon: "account"
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -147,7 +147,7 @@ const defaultHelpDropdownMountPoints = [
|
|
|
147
147
|
config: {
|
|
148
148
|
priority: 100,
|
|
149
149
|
props: {
|
|
150
|
-
title: "
|
|
150
|
+
title: "help.quickStart",
|
|
151
151
|
icon: "quickstart",
|
|
152
152
|
link: "https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/"
|
|
153
153
|
}
|
|
@@ -164,10 +164,10 @@ const defaultApplicationLauncherDropdownMountPoints = [
|
|
|
164
164
|
{
|
|
165
165
|
Component: MenuItemLink,
|
|
166
166
|
config: {
|
|
167
|
-
section: "
|
|
167
|
+
section: "applicationLauncher.sections.documentation",
|
|
168
168
|
priority: 150,
|
|
169
169
|
props: {
|
|
170
|
-
title: "
|
|
170
|
+
title: "applicationLauncher.developerHub",
|
|
171
171
|
icon: "developerHub",
|
|
172
172
|
link: "https://docs.redhat.com/en/documentation/red_hat_developer_hub"
|
|
173
173
|
}
|
|
@@ -176,10 +176,10 @@ const defaultApplicationLauncherDropdownMountPoints = [
|
|
|
176
176
|
{
|
|
177
177
|
Component: MenuItemLink,
|
|
178
178
|
config: {
|
|
179
|
-
section: "
|
|
179
|
+
section: "applicationLauncher.sections.developerTools",
|
|
180
180
|
priority: 130,
|
|
181
181
|
props: {
|
|
182
|
-
title: "
|
|
182
|
+
title: "applicationLauncher.rhdhLocal",
|
|
183
183
|
icon: "developerHub",
|
|
184
184
|
link: "https://github.com/redhat-developer/rhdh-local"
|
|
185
185
|
}
|