@backstage/plugin-notifications 0.5.4-next.1 → 0.5.4-next.2

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/alpha.d.ts +2 -2
  3. package/dist/alpha.esm.js +2 -2
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/components/NotificationsFilters/NotificationsFilters.esm.js +82 -53
  6. package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
  7. package/dist/components/NotificationsPage/NotificationsPage.esm.js +54 -52
  8. package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
  9. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js +68 -61
  10. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
  11. package/dist/components/NotificationsTable/BulkActions.esm.js +22 -18
  12. package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
  13. package/dist/components/NotificationsTable/NotificationIcon.esm.js +3 -3
  14. package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
  15. package/dist/components/NotificationsTable/NotificationsTable.esm.js +71 -46
  16. package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
  17. package/dist/components/NotificationsTable/SelectAll.esm.js +3 -3
  18. package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
  19. package/dist/components/NotificationsTable/SeverityIcon.esm.js +5 -5
  20. package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
  21. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js +15 -10
  22. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map +1 -1
  23. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js +33 -24
  24. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
  25. package/dist/index.d.ts +5 -6
  26. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsTable.esm.js","sources":["../../../src/components/NotificationsTable/NotificationsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 React from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport CheckBox from '@material-ui/core/Checkbox';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport { useConfirm } from 'material-ui-confirm';\nimport BroadcastIcon from '@material-ui/icons/RssFeed';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n Link,\n Table,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\n\nconst ThrottleDelayMs = 1000;\n\nconst useStyles = makeStyles(theme => ({\n description: {\n maxHeight: '5rem',\n overflow: 'auto',\n },\n severityItem: {\n alignContent: 'center',\n },\n broadcastIcon: {\n fontSize: '1rem',\n verticalAlign: 'text-bottom',\n },\n notificationInfoRow: {\n marginLeft: theme.spacing(0.5),\n marginRight: theme.spacing(0.5),\n },\n}));\n\n/** @public */\nexport type NotificationsTableProps = Pick<\n TableProps,\n 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'\n> & {\n markAsReadOnLinkOpen?: boolean;\n isLoading?: boolean;\n isUnread: boolean;\n notifications?: Notification[];\n onUpdate: () => void;\n setContainsText: (search: string) => void;\n pageSize: number;\n};\n\n/** @public */\nexport const NotificationsTable = ({\n title,\n markAsReadOnLinkOpen,\n isLoading,\n notifications = [],\n isUnread,\n onUpdate,\n setContainsText,\n onPageChange,\n onRowsPerPageChange,\n page,\n pageSize,\n totalCount,\n}: NotificationsTableProps) => {\n const classes = useStyles();\n const notificationsApi = useApi(notificationsApiRef);\n const alertApi = useApi(alertApiRef);\n const confirm = useConfirm();\n\n const [selectedNotifications, setSelectedNotifications] = React.useState(\n new Set<Notification['id']>(),\n );\n\n const onNotificationsSelectChange = React.useCallback(\n (ids: Notification['id'][], checked: boolean) => {\n let newSelect: Set<Notification['id']>;\n if (checked) {\n newSelect = new Set([...selectedNotifications, ...ids]);\n } else {\n newSelect = new Set(selectedNotifications);\n ids.forEach(id => newSelect.delete(id));\n }\n setSelectedNotifications(newSelect);\n },\n [selectedNotifications, setSelectedNotifications],\n );\n\n const onSwitchReadStatus = React.useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n read: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n const onSwitchSavedStatus = React.useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n saved: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n const onMarkAllRead = React.useCallback(() => {\n confirm({\n title: 'Are you sure?',\n description: (\n <>\n Mark <b>all</b> notifications as <b>read</b>.\n </>\n ),\n confirmationText: 'Mark All',\n })\n .then(async () => {\n const ids = (\n await notificationsApi.getNotifications({ read: false })\n ).notifications?.map(notification => notification.id);\n\n return notificationsApi\n .updateNotifications({\n ids,\n read: true,\n })\n .then(onUpdate);\n })\n .catch(e => {\n if (e) {\n // if e === undefined, the Cancel button has been hit\n alertApi.post({\n message: 'Failed to mark all notifications as read',\n severity: 'error',\n });\n }\n });\n }, [alertApi, confirm, notificationsApi, onUpdate]);\n\n const throttledContainsTextHandler = React.useMemo(\n () => throttle(setContainsText, ThrottleDelayMs),\n [setContainsText],\n );\n\n React.useEffect(() => {\n const allShownIds = new Set(notifications.map(n => n.id));\n const intersect = [...selectedNotifications].filter(id =>\n allShownIds.has(id),\n );\n if (selectedNotifications.size !== intersect.length) {\n setSelectedNotifications(new Set(intersect));\n }\n }, [notifications, selectedNotifications]);\n\n const compactColumns = React.useMemo((): TableColumn<Notification>[] => {\n const showToolbar = notifications.length > 0;\n return [\n {\n /* selection column */\n width: '1rem',\n title: showToolbar ? (\n <SelectAll\n count={selectedNotifications.size}\n totalCount={notifications.length}\n onSelectAll={() =>\n onNotificationsSelectChange(\n notifications.map(notification => notification.id),\n selectedNotifications.size !== notifications.length,\n )\n }\n />\n ) : undefined,\n render: (notification: Notification) => (\n <CheckBox\n color=\"primary\"\n checked={selectedNotifications.has(notification.id)}\n onChange={(_, checked) =>\n onNotificationsSelectChange([notification.id], checked)\n }\n />\n ),\n },\n {\n /* compact-data column */\n customFilterAndSearch: () =>\n true /* Keep sorting&filtering on backend due to pagination. */,\n render: (notification: Notification) => {\n // Compact content\n return (\n <Grid container>\n <Grid item className={classes.severityItem}>\n <NotificationIcon notification={notification} />\n </Grid>\n <Grid item xs={11}>\n <Box>\n <Typography variant=\"subtitle1\">\n {notification.payload.link ? (\n <Link\n to={notification.payload.link}\n onClick={() => {\n if (markAsReadOnLinkOpen && !notification.read) {\n onSwitchReadStatus([notification.id], true);\n }\n }}\n >\n {notification.payload.title}\n </Link>\n ) : (\n notification.payload.title\n )}\n </Typography>\n {notification.payload.description ? (\n <Typography variant=\"body2\" className={classes.description}>\n {notification.payload.description}\n </Typography>\n ) : null}\n\n <Typography variant=\"caption\">\n {!notification.user && (\n <>\n <BroadcastIcon className={classes.broadcastIcon} />\n </>\n )}\n {notification.origin && (\n <>\n <Typography\n variant=\"inherit\"\n className={classes.notificationInfoRow}\n >\n {notification.origin}\n </Typography>\n &bull;\n </>\n )}\n {notification.payload.topic && (\n <>\n <Typography\n variant=\"inherit\"\n className={classes.notificationInfoRow}\n >\n {notification.payload.topic}\n </Typography>\n &bull;\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={classes.notificationInfoRow}\n />\n )}\n </Typography>\n </Box>\n </Grid>\n </Grid>\n );\n },\n },\n {\n /* actions column */\n width: '1rem',\n title: showToolbar ? (\n <BulkActions\n notifications={notifications}\n selectedNotifications={selectedNotifications}\n isUnread={isUnread}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n onMarkAllRead={onMarkAllRead}\n />\n ) : undefined,\n render: (notification: Notification) => (\n <BulkActions\n notifications={[notification]}\n selectedNotifications={new Set([notification.id])}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n ),\n },\n ];\n }, [\n notifications,\n selectedNotifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n onNotificationsSelectChange,\n classes.severityItem,\n classes.description,\n classes.broadcastIcon,\n classes.notificationInfoRow,\n markAsReadOnLinkOpen,\n ]);\n\n return (\n <Table<Notification>\n isLoading={isLoading}\n options={{\n padding: 'dense',\n search: true,\n paging: true,\n pageSize,\n header: true,\n sorting: false,\n }}\n title={title}\n onPageChange={onPageChange}\n onRowsPerPageChange={onRowsPerPageChange}\n page={page}\n totalCount={totalCount}\n onSearchChange={throttledContainsTextHandler}\n data={notifications}\n columns={compactColumns}\n />\n );\n};\n"],"names":["CheckBox"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,MAAM,eAAkB,GAAA,GAAA;AAExB,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,SAAW,EAAA,MAAA;AAAA,IACX,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,YAAc,EAAA;AAA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AA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,OAAA;AAAA,QACT,MAAQ,EAAA,IAAA;AAAA,QACR,MAAQ,EAAA,IAAA;AAAA,QACR,QAAA;AAAA,QACA,MAAQ,EAAA,IAAA;AAAA,QACR,OAAS,EAAA;AAAA,OACX;AAAA,MACA,KAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAgB,EAAA,4BAAA;AAAA,MAChB,IAAM,EAAA,aAAA;AAAA,MACN,OAAS,EAAA;AAAA;AAAA,GACX;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationsTable.esm.js","sources":["../../../src/components/NotificationsTable/NotificationsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { useState, useCallback, useMemo, useEffect } from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport CheckBox from '@material-ui/core/Checkbox';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport { useConfirm } from 'material-ui-confirm';\nimport BroadcastIcon from '@material-ui/icons/RssFeed';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n Link,\n Table,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\n\nconst ThrottleDelayMs = 1000;\n\nconst useStyles = makeStyles(theme => ({\n description: {\n maxHeight: '5rem',\n overflow: 'auto',\n },\n severityItem: {\n alignContent: 'center',\n },\n broadcastIcon: {\n fontSize: '1rem',\n verticalAlign: 'text-bottom',\n },\n notificationInfoRow: {\n marginLeft: theme.spacing(0.5),\n marginRight: theme.spacing(0.5),\n },\n}));\n\n/** @public */\nexport type NotificationsTableProps = Pick<\n TableProps,\n 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'\n> & {\n markAsReadOnLinkOpen?: boolean;\n isLoading?: boolean;\n isUnread: boolean;\n notifications?: Notification[];\n onUpdate: () => void;\n setContainsText: (search: string) => void;\n pageSize: number;\n};\n\n/** @public */\nexport const NotificationsTable = ({\n title,\n markAsReadOnLinkOpen,\n isLoading,\n notifications = [],\n isUnread,\n onUpdate,\n setContainsText,\n onPageChange,\n onRowsPerPageChange,\n page,\n pageSize,\n totalCount,\n}: NotificationsTableProps) => {\n const classes = useStyles();\n const notificationsApi = useApi(notificationsApiRef);\n const alertApi = useApi(alertApiRef);\n const confirm = useConfirm();\n\n const [selectedNotifications, setSelectedNotifications] = useState(\n new Set<Notification['id']>(),\n );\n\n const onNotificationsSelectChange = useCallback(\n (ids: Notification['id'][], checked: boolean) => {\n let newSelect: Set<Notification['id']>;\n if (checked) {\n newSelect = new Set([...selectedNotifications, ...ids]);\n } else {\n newSelect = new Set(selectedNotifications);\n ids.forEach(id => newSelect.delete(id));\n }\n setSelectedNotifications(newSelect);\n },\n [selectedNotifications, setSelectedNotifications],\n );\n\n const onSwitchReadStatus = useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n read: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n const onSwitchSavedStatus = useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n saved: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n const onMarkAllRead = useCallback(() => {\n confirm({\n title: 'Are you sure?',\n description: (\n <>\n Mark <b>all</b> notifications as <b>read</b>.\n </>\n ),\n confirmationText: 'Mark All',\n })\n .then(async () => {\n const ids = (\n await notificationsApi.getNotifications({ read: false })\n ).notifications?.map(notification => notification.id);\n\n return notificationsApi\n .updateNotifications({\n ids,\n read: true,\n })\n .then(onUpdate);\n })\n .catch(e => {\n if (e) {\n // if e === undefined, the Cancel button has been hit\n alertApi.post({\n message: 'Failed to mark all notifications as read',\n severity: 'error',\n });\n }\n });\n }, [alertApi, confirm, notificationsApi, onUpdate]);\n\n const throttledContainsTextHandler = useMemo(\n () => throttle(setContainsText, ThrottleDelayMs),\n [setContainsText],\n );\n\n useEffect(() => {\n const allShownIds = new Set(notifications.map(n => n.id));\n const intersect = [...selectedNotifications].filter(id =>\n allShownIds.has(id),\n );\n if (selectedNotifications.size !== intersect.length) {\n setSelectedNotifications(new Set(intersect));\n }\n }, [notifications, selectedNotifications]);\n\n const compactColumns = useMemo((): TableColumn<Notification>[] => {\n const showToolbar = notifications.length > 0;\n return [\n {\n /* selection column */\n width: '1rem',\n title: showToolbar ? (\n <SelectAll\n count={selectedNotifications.size}\n totalCount={notifications.length}\n onSelectAll={() =>\n onNotificationsSelectChange(\n notifications.map(notification => notification.id),\n selectedNotifications.size !== notifications.length,\n )\n }\n />\n ) : undefined,\n render: (notification: Notification) => (\n <CheckBox\n color=\"primary\"\n checked={selectedNotifications.has(notification.id)}\n onChange={(_, checked) =>\n onNotificationsSelectChange([notification.id], checked)\n }\n />\n ),\n },\n {\n /* compact-data column */\n customFilterAndSearch: () =>\n true /* Keep sorting&filtering on backend due to pagination. */,\n render: (notification: Notification) => {\n // Compact content\n return (\n <Grid container>\n <Grid item className={classes.severityItem}>\n <NotificationIcon notification={notification} />\n </Grid>\n <Grid item xs={11}>\n <Box>\n <Typography variant=\"subtitle1\">\n {notification.payload.link ? (\n <Link\n to={notification.payload.link}\n onClick={() => {\n if (markAsReadOnLinkOpen && !notification.read) {\n onSwitchReadStatus([notification.id], true);\n }\n }}\n >\n {notification.payload.title}\n </Link>\n ) : (\n notification.payload.title\n )}\n </Typography>\n {notification.payload.description ? (\n <Typography variant=\"body2\" className={classes.description}>\n {notification.payload.description}\n </Typography>\n ) : null}\n\n <Typography variant=\"caption\">\n {!notification.user && (\n <>\n <BroadcastIcon className={classes.broadcastIcon} />\n </>\n )}\n {notification.origin && (\n <>\n <Typography\n variant=\"inherit\"\n className={classes.notificationInfoRow}\n >\n {notification.origin}\n </Typography>\n &bull;\n </>\n )}\n {notification.payload.topic && (\n <>\n <Typography\n variant=\"inherit\"\n className={classes.notificationInfoRow}\n >\n {notification.payload.topic}\n </Typography>\n &bull;\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={classes.notificationInfoRow}\n />\n )}\n </Typography>\n </Box>\n </Grid>\n </Grid>\n );\n },\n },\n {\n /* actions column */\n width: '1rem',\n title: showToolbar ? (\n <BulkActions\n notifications={notifications}\n selectedNotifications={selectedNotifications}\n isUnread={isUnread}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n onMarkAllRead={onMarkAllRead}\n />\n ) : undefined,\n render: (notification: Notification) => (\n <BulkActions\n notifications={[notification]}\n selectedNotifications={new Set([notification.id])}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n ),\n },\n ];\n }, [\n notifications,\n selectedNotifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n onNotificationsSelectChange,\n classes.severityItem,\n classes.description,\n classes.broadcastIcon,\n classes.notificationInfoRow,\n markAsReadOnLinkOpen,\n ]);\n\n return (\n <Table<Notification>\n isLoading={isLoading}\n options={{\n padding: 'dense',\n search: true,\n paging: true,\n pageSize,\n header: true,\n sorting: false,\n }}\n title={title}\n onPageChange={onPageChange}\n onRowsPerPageChange={onRowsPerPageChange}\n page={page}\n totalCount={totalCount}\n onSearchChange={throttledContainsTextHandler}\n data={notifications}\n columns={compactColumns}\n />\n );\n};\n"],"names":["CheckBox"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,MAAM,eAAkB,GAAA,GAAA;AAExB,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,SAAW,EAAA,MAAA;AAAA,IACX,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,aAAe,EAAA;AAAA,IACb,QAAU,EAAA,MAAA;AAAA,IACV,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,mBAAqB,EAAA;AAAA,IACnB,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC7B,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAElC,CAAE,CAAA,CAAA;AAiBK,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAA;AAAA,EACA,oBAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAgB,EAAC;AAAA,EACjB,QAAA;AAAA,EACA,QAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AACnD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAU,UAAW,EAAA;AAE3B,EAAM,MAAA,CAAC,qBAAuB,EAAA,wBAAwB,CAAI,GAAA,QAAA;AAAA,wBACpD,GAAwB;AAAA,GAC9B;AAEA,EAAA,MAAM,2BAA8B,GAA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AA;AAAA,IACA,qBAAA;AAAA,IACA,QAAA;AAAA,IACA,kBAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,2BAAA;AAAA,IACA,OAAQ,CAAA,YAAA;AAAA,IACR,OAAQ,CAAA,WAAA;AAAA,IACR,OAAQ,CAAA,aAAA;AAAA,IACR,OAAQ,CAAA,mBAAA;AAAA,IACR;AAAA,GACD,CAAA;AAED,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,OAAA;AAAA,QACT,MAAQ,EAAA,IAAA;AAAA,QACR,MAAQ,EAAA,IAAA;AAAA,QACR,QAAA;AAAA,QACA,MAAQ,EAAA,IAAA;AAAA,QACR,OAAS,EAAA;AAAA,OACX;AAAA,MACA,KAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAgB,EAAA,4BAAA;AAAA,MAChB,IAAM,EAAA,aAAA;AAAA,MACN,OAAS,EAAA;AAAA;AAAA,GACX;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import Checkbox from '@material-ui/core/Checkbox';
3
3
  import FormControlLabel from '@material-ui/core/FormControlLabel';
4
4
  import { makeStyles } from '@material-ui/core/styles';
@@ -18,12 +18,12 @@ const SelectAll = ({
18
18
  onSelectAll
19
19
  }) => {
20
20
  const classes = useStyles();
21
- return /* @__PURE__ */ React.createElement(
21
+ return /* @__PURE__ */ jsx(
22
22
  FormControlLabel,
23
23
  {
24
24
  label: count > 0 ? `(${count})` : void 0,
25
25
  className: classes.label,
26
- control: /* @__PURE__ */ React.createElement(
26
+ control: /* @__PURE__ */ jsx(
27
27
  Checkbox,
28
28
  {
29
29
  color: "primary",
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAll.esm.js","sources":["../../../src/components/NotificationsTable/SelectAll.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React from 'react';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles({\n label: {\n marginLeft: '0px',\n maxWidth: '2rem',\n '& span': {\n paddingRight: '0px',\n },\n },\n});\n\nexport const SelectAll = ({\n count,\n totalCount,\n onSelectAll,\n}: {\n count: number;\n totalCount: number;\n onSelectAll: () => void;\n}) => {\n const classes = useStyles();\n\n return (\n <FormControlLabel\n label={count > 0 ? `(${count})` : undefined}\n className={classes.label}\n control={\n <Checkbox\n color=\"primary\"\n disabled={!totalCount}\n checked={count > 0}\n indeterminate={count > 0 && totalCount !== count}\n onChange={onSelectAll}\n />\n }\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAoBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,KAAO,EAAA;AAAA,IACL,UAAY,EAAA,KAAA;AAAA,IACZ,QAAU,EAAA,MAAA;AAAA,IACV,QAAU,EAAA;AAAA,MACR,YAAc,EAAA;AAAA;AAChB;AAEJ,CAAC,CAAA;AAEM,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,KAAA,GAAQ,CAAI,GAAA,CAAA,CAAA,EAAI,KAAK,CAAM,CAAA,CAAA,GAAA,KAAA,CAAA;AAAA,MAClC,WAAW,OAAQ,CAAA,KAAA;AAAA,MACnB,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,SAAA;AAAA,UACN,UAAU,CAAC,UAAA;AAAA,UACX,SAAS,KAAQ,GAAA,CAAA;AAAA,UACjB,aAAA,EAAe,KAAQ,GAAA,CAAA,IAAK,UAAe,KAAA,KAAA;AAAA,UAC3C,QAAU,EAAA;AAAA;AAAA;AACZ;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"SelectAll.esm.js","sources":["../../../src/components/NotificationsTable/SelectAll.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles({\n label: {\n marginLeft: '0px',\n maxWidth: '2rem',\n '& span': {\n paddingRight: '0px',\n },\n },\n});\n\nexport const SelectAll = ({\n count,\n totalCount,\n onSelectAll,\n}: {\n count: number;\n totalCount: number;\n onSelectAll: () => void;\n}) => {\n const classes = useStyles();\n\n return (\n <FormControlLabel\n label={count > 0 ? `(${count})` : undefined}\n className={classes.label}\n control={\n <Checkbox\n color=\"primary\"\n disabled={!totalCount}\n checked={count > 0}\n indeterminate={count > 0 && totalCount !== count}\n onChange={onSelectAll}\n />\n }\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,KAAO,EAAA;AAAA,IACL,UAAY,EAAA,KAAA;AAAA,IACZ,QAAU,EAAA,MAAA;AAAA,IACV,QAAU,EAAA;AAAA,MACR,YAAc,EAAA;AAAA;AAChB;AAEJ,CAAC,CAAA;AAEM,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,KAAA,GAAQ,CAAI,GAAA,CAAA,CAAA,EAAI,KAAK,CAAM,CAAA,CAAA,GAAA,KAAA,CAAA;AAAA,MAClC,WAAW,OAAQ,CAAA,KAAA;AAAA,MACnB,OACE,kBAAA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,SAAA;AAAA,UACN,UAAU,CAAC,UAAA;AAAA,UACX,SAAS,KAAQ,GAAA,CAAA;AAAA,UACjB,aAAA,EAAe,KAAQ,GAAA,CAAA,IAAK,UAAe,KAAA,KAAA;AAAA,UAC3C,QAAU,EAAA;AAAA;AAAA;AACZ;AAAA,GAEJ;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import NormalIcon from '@material-ui/icons/CheckOutlined';
3
3
  import CriticalIcon from '@material-ui/icons/ErrorOutline';
4
4
  import HighIcon from '@material-ui/icons/WarningOutlined';
@@ -25,14 +25,14 @@ const SeverityIcon = ({
25
25
  const classes = useStyles();
26
26
  switch (severity) {
27
27
  case "critical":
28
- return /* @__PURE__ */ React.createElement(CriticalIcon, { className: classes.critical });
28
+ return /* @__PURE__ */ jsx(CriticalIcon, { className: classes.critical });
29
29
  case "high":
30
- return /* @__PURE__ */ React.createElement(HighIcon, { className: classes.high });
30
+ return /* @__PURE__ */ jsx(HighIcon, { className: classes.high });
31
31
  case "low":
32
- return /* @__PURE__ */ React.createElement(LowIcon, { className: classes.low });
32
+ return /* @__PURE__ */ jsx(LowIcon, { className: classes.low });
33
33
  case "normal":
34
34
  default:
35
- return /* @__PURE__ */ React.createElement(NormalIcon, { className: classes.normal });
35
+ return /* @__PURE__ */ jsx(NormalIcon, { className: classes.normal });
36
36
  }
37
37
  };
38
38
 
@@ -1 +1 @@
1
- {"version":3,"file":"SeverityIcon.esm.js","sources":["../../../src/components/NotificationsTable/SeverityIcon.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React from 'react';\nimport { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport NormalIcon from '@material-ui/icons/CheckOutlined';\nimport CriticalIcon from '@material-ui/icons/ErrorOutline';\nimport HighIcon from '@material-ui/icons/WarningOutlined';\nimport LowIcon from '@material-ui/icons/InfoOutlined';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n critical: {\n color: theme.palette.status.error,\n },\n high: {\n color: theme.palette.status.warning,\n },\n normal: {\n color: theme.palette.status.ok,\n },\n low: {\n color: theme.palette.status.running,\n },\n}));\n\nexport const SeverityIcon = ({\n severity,\n}: {\n severity?: NotificationSeverity;\n}) => {\n const classes = useStyles();\n\n switch (severity) {\n case 'critical':\n return <CriticalIcon className={classes.critical} />;\n case 'high':\n return <HighIcon className={classes.high} />;\n case 'low':\n return <LowIcon className={classes.low} />;\n case 'normal':\n default:\n return <NormalIcon className={classes.norm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"sourcesContent":["/*\n * Copyright 2024 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 { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport NormalIcon from '@material-ui/icons/CheckOutlined';\nimport CriticalIcon from '@material-ui/icons/ErrorOutline';\nimport HighIcon from '@material-ui/icons/WarningOutlined';\nimport LowIcon from '@material-ui/icons/InfoOutlined';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n critical: {\n color: theme.palette.status.error,\n },\n high: {\n color: theme.palette.status.warning,\n },\n normal: {\n color: theme.palette.status.ok,\n },\n low: {\n color: theme.palette.status.running,\n },\n}));\n\nexport const SeverityIcon = ({\n severity,\n}: {\n severity?: NotificationSeverity;\n}) => {\n const classes = useStyles();\n\n switch (severity) {\n case 'critical':\n return <CriticalIcon className={classes.critical} />;\n case 'high':\n return <HighIcon className={classes.high} />;\n case 'low':\n return <LowIcon className={classes.low} />;\n case 'normal':\n default:\n return <NormalIcon className={classes.normal} />;\n }\n};\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,QAAU,EAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,GAAK,EAAA;AAAA,IACH,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA;AAEhC,CAAE,CAAA,CAAA;AAEK,MAAM,eAAe,CAAC;AAAA,EAC3B;AACF,CAEM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,QAAQ,QAAU;AAAA,IAChB,KAAK,UAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,SAAW,EAAA,OAAA,CAAQ,QAAU,EAAA,CAAA;AAAA,IACpD,KAAK,MAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,IAAM,EAAA,CAAA;AAAA,IAC5C,KAAK,KAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,OAAA,EAAA,EAAQ,SAAW,EAAA,OAAA,CAAQ,GAAK,EAAA,CAAA;AAAA,IAC1C,KAAK,QAAA;AAAA,IACL;AACE,MAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,OAAA,CAAQ,MAAQ,EAAA,CAAA;AAAA;AAEpD;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import { InfoCard, Progress, ErrorPanel } from '@backstage/core-components';
3
4
  import { useNotificationsApi } from '../../hooks/useNotificationsApi.esm.js';
4
5
  import { useApi } from '@backstage/core-plugin-api';
@@ -9,7 +10,7 @@ import '../../hooks/useTitleCounter.esm.js';
9
10
  import { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel.esm.js';
10
11
 
11
12
  const UserNotificationSettingsCard = (props) => {
12
- const [settings, setNotificationSettings] = React.useState(void 0);
13
+ const [settings, setNotificationSettings] = useState(void 0);
13
14
  const client = useApi(notificationsApiRef);
14
15
  const { error, value, loading } = useNotificationsApi((api) => {
15
16
  return api.getNotificationSettings();
@@ -22,14 +23,18 @@ const UserNotificationSettingsCard = (props) => {
22
23
  const onUpdate = (newSettings) => {
23
24
  client.updateNotificationSettings(newSettings).then((updatedSettings) => setNotificationSettings(updatedSettings));
24
25
  };
25
- return /* @__PURE__ */ React.createElement(InfoCard, { title: "Notification settings", variant: "gridItem" }, loading && /* @__PURE__ */ React.createElement(Progress, null), error && /* @__PURE__ */ React.createElement(ErrorPanel, { title: "Failed to load settings", error }), settings && /* @__PURE__ */ React.createElement(
26
- UserNotificationSettingsPanel,
27
- {
28
- settings,
29
- onChange: onUpdate,
30
- originNames: props.originNames
31
- }
32
- ));
26
+ return /* @__PURE__ */ jsxs(InfoCard, { title: "Notification settings", variant: "gridItem", children: [
27
+ loading && /* @__PURE__ */ jsx(Progress, {}),
28
+ error && /* @__PURE__ */ jsx(ErrorPanel, { title: "Failed to load settings", error }),
29
+ settings && /* @__PURE__ */ jsx(
30
+ UserNotificationSettingsPanel,
31
+ {
32
+ settings,
33
+ onChange: onUpdate,
34
+ originNames: props.originNames
35
+ }
36
+ )
37
+ ] });
33
38
  };
34
39
 
35
40
  export { UserNotificationSettingsCard };
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotificationSettingsCard.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, { useEffect } from 'react';\nimport { ErrorPanel, InfoCard, Progress } from '@backstage/core-components';\nimport { useNotificationsApi } from '../../hooks';\nimport { NotificationSettings } from '@backstage/plugin-notifications-common';\nimport { notificationsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel';\n\n/** @public */\nexport const UserNotificationSettingsCard = (props: {\n originNames?: Record<string, string>;\n}) => {\n const [settings, setNotificationSettings] = React.useState<\n NotificationSettings | undefined\n >(undefined);\n\n const client = useApi(notificationsApiRef);\n const { error, value, loading } = useNotificationsApi(api => {\n return api.getNotificationSettings();\n });\n\n useEffect(() => {\n if (!loading && !error) {\n setNotificationSettings(value);\n }\n }, [loading, value, error]);\n\n const onUpdate = (newSettings: NotificationSettings) => {\n client\n .updateNotificationSettings(newSettings)\n .then(updatedSettings => setNotificationSettings(updatedSettings));\n };\n\n return (\n <InfoCard title=\"Notification settings\" variant=\"gridItem\">\n {loading && <Progress />}\n {error && <ErrorPanel title=\"Failed to load settings\" error={error} />}\n {settings && (\n <UserNotificationSettingsPanel\n settings={settings}\n onChange={onUpdate}\n originNames={props.originNames}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBa,MAAA,4BAAA,GAA+B,CAAC,KAEvC,KAAA;AACJ,EAAA,MAAM,CAAC,QAAU,EAAA,uBAAuB,CAAI,GAAA,KAAA,CAAM,SAEhD,KAAS,CAAA,CAAA;AAEX,EAAM,MAAA,MAAA,GAAS,OAAO,mBAAmB,CAAA;AACzC,EAAA,MAAM,EAAE,KAAO,EAAA,KAAA,EAAO,OAAQ,EAAA,GAAI,oBAAoB,CAAO,GAAA,KAAA;AAC3D,IAAA,OAAO,IAAI,uBAAwB,EAAA;AAAA,GACpC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,CAAC,OAAW,IAAA,CAAC,KAAO,EAAA;AACtB,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA;AAC/B,GACC,EAAA,CAAC,OAAS,EAAA,KAAA,EAAO,KAAK,CAAC,CAAA;AAE1B,EAAM,MAAA,QAAA,GAAW,CAAC,WAAsC,KAAA;AACtD,IAAA,MAAA,CACG,2BAA2B,WAAW,CAAA,CACtC,KAAK,CAAmB,eAAA,KAAA,uBAAA,CAAwB,eAAe,CAAC,CAAA;AAAA,GACrE;AAEA,EAAA,2CACG,QAAS,EAAA,EAAA,KAAA,EAAM,uBAAwB,EAAA,OAAA,EAAQ,cAC7C,OAAW,oBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EACrB,yBAAU,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAM,yBAA0B,EAAA,KAAA,EAAc,GACnE,QACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,6BAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MACA,QAAU,EAAA,QAAA;AAAA,MACV,aAAa,KAAM,CAAA;AAAA;AAAA,GAGzB,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"UserNotificationSettingsCard.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useState, useEffect } from 'react';\nimport { ErrorPanel, InfoCard, Progress } from '@backstage/core-components';\nimport { useNotificationsApi } from '../../hooks';\nimport { NotificationSettings } from '@backstage/plugin-notifications-common';\nimport { notificationsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel';\n\n/** @public */\nexport const UserNotificationSettingsCard = (props: {\n originNames?: Record<string, string>;\n}) => {\n const [settings, setNotificationSettings] = useState<\n NotificationSettings | undefined\n >(undefined);\n\n const client = useApi(notificationsApiRef);\n const { error, value, loading } = useNotificationsApi(api => {\n return api.getNotificationSettings();\n });\n\n useEffect(() => {\n if (!loading && !error) {\n setNotificationSettings(value);\n }\n }, [loading, value, error]);\n\n const onUpdate = (newSettings: NotificationSettings) => {\n client\n .updateNotificationSettings(newSettings)\n .then(updatedSettings => setNotificationSettings(updatedSettings));\n };\n\n return (\n <InfoCard title=\"Notification settings\" variant=\"gridItem\">\n {loading && <Progress />}\n {error && <ErrorPanel title=\"Failed to load settings\" error={error} />}\n {settings && (\n <UserNotificationSettingsPanel\n settings={settings}\n onChange={onUpdate}\n originNames={props.originNames}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAyBa,MAAA,4BAAA,GAA+B,CAAC,KAEvC,KAAA;AACJ,EAAA,MAAM,CAAC,QAAA,EAAU,uBAAuB,CAAA,GAAI,SAE1C,KAAS,CAAA,CAAA;AAEX,EAAM,MAAA,MAAA,GAAS,OAAO,mBAAmB,CAAA;AACzC,EAAA,MAAM,EAAE,KAAO,EAAA,KAAA,EAAO,OAAQ,EAAA,GAAI,oBAAoB,CAAO,GAAA,KAAA;AAC3D,IAAA,OAAO,IAAI,uBAAwB,EAAA;AAAA,GACpC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,CAAC,OAAW,IAAA,CAAC,KAAO,EAAA;AACtB,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA;AAC/B,GACC,EAAA,CAAC,OAAS,EAAA,KAAA,EAAO,KAAK,CAAC,CAAA;AAE1B,EAAM,MAAA,QAAA,GAAW,CAAC,WAAsC,KAAA;AACtD,IAAA,MAAA,CACG,2BAA2B,WAAW,CAAA,CACtC,KAAK,CAAmB,eAAA,KAAA,uBAAA,CAAwB,eAAe,CAAC,CAAA;AAAA,GACrE;AAEA,EAAA,uBACG,IAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,uBAAA,EAAwB,SAAQ,UAC7C,EAAA,QAAA,EAAA;AAAA,IAAA,OAAA,wBAAY,QAAS,EAAA,EAAA,CAAA;AAAA,IACrB,KAAS,oBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,2BAA0B,KAAc,EAAA,CAAA;AAAA,IACnE,QACC,oBAAA,GAAA;AAAA,MAAC,6BAAA;AAAA,MAAA;AAAA,QACC,QAAA;AAAA,QACA,QAAU,EAAA,QAAA;AAAA,QACV,aAAa,KAAM,CAAA;AAAA;AAAA;AACrB,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { isNotificationsEnabledFor } from '@backstage/plugin-notifications-common';
3
3
  import Table from '@material-ui/core/Table';
4
4
  import MuiTableCell from '@material-ui/core/TableCell';
@@ -54,31 +54,40 @@ const UserNotificationSettingsPanel = (props) => {
54
54
  return capitalize(originId.replaceAll(/[_:]/g, " "));
55
55
  };
56
56
  if (settings.channels.length === 0 || allOrigins.length === 0) {
57
- return /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No notification settings available, check back later");
57
+ return /* @__PURE__ */ jsx(Typography, { variant: "body1", children: "No notification settings available, check back later" });
58
58
  }
59
- return /* @__PURE__ */ React.createElement(Table, null, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1" }, "Origin")), settings.channels.map((channel) => /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1" }, channel.id))))), /* @__PURE__ */ React.createElement(TableBody, null, allOrigins.map((origin) => /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, null, formatOriginName(origin)), settings.channels.map((channel) => /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(
60
- Tooltip,
61
- {
62
- title: `Enable or disable ${channel.id.toLocaleLowerCase(
63
- "en-US"
64
- )} notifications from ${formatOriginName(
65
- origin
66
- ).toLocaleLowerCase("en-US")}`
67
- },
68
- /* @__PURE__ */ React.createElement(
69
- Switch,
70
- {
71
- checked: isNotificationsEnabledFor(
72
- settings,
73
- channel.id,
74
- origin
75
- ),
76
- onChange: (event) => {
77
- handleChange(channel.id, origin, event.target.checked);
59
+ return /* @__PURE__ */ jsxs(Table, { children: [
60
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
61
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: "Origin" }) }),
62
+ settings.channels.map((channel) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: channel.id }) }))
63
+ ] }) }),
64
+ /* @__PURE__ */ jsx(TableBody, { children: allOrigins.map((origin) => /* @__PURE__ */ jsxs(TableRow, { children: [
65
+ /* @__PURE__ */ jsx(TableCell, { children: formatOriginName(origin) }),
66
+ settings.channels.map((channel) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
67
+ Tooltip,
68
+ {
69
+ title: `Enable or disable ${channel.id.toLocaleLowerCase(
70
+ "en-US"
71
+ )} notifications from ${formatOriginName(
72
+ origin
73
+ ).toLocaleLowerCase("en-US")}`,
74
+ children: /* @__PURE__ */ jsx(
75
+ Switch,
76
+ {
77
+ checked: isNotificationsEnabledFor(
78
+ settings,
79
+ channel.id,
80
+ origin
81
+ ),
82
+ onChange: (event) => {
83
+ handleChange(channel.id, origin, event.target.checked);
84
+ }
85
+ }
86
+ )
78
87
  }
79
- }
80
- )
81
- )))))));
88
+ ) }))
89
+ ] })) })
90
+ ] });
82
91
  };
83
92
 
84
93
  export { UserNotificationSettingsPanel };
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotificationSettingsPanel.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 isNotificationsEnabledFor,\n NotificationSettings,\n} from '@backstage/plugin-notifications-common';\nimport Table from '@material-ui/core/Table';\nimport MuiTableCell from '@material-ui/core/TableCell';\nimport { withStyles } from '@material-ui/core/styles';\nimport TableHead from '@material-ui/core/TableHead';\nimport Typography from '@material-ui/core/Typography';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableRow from '@material-ui/core/TableRow';\nimport Switch from '@material-ui/core/Switch';\nimport { capitalize } from 'lodash';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst TableCell = withStyles({\n root: {\n borderBottom: 'none',\n },\n})(MuiTableCell);\n\nexport const UserNotificationSettingsPanel = (props: {\n settings: NotificationSettings;\n onChange: (settings: NotificationSettings) => void;\n originNames?: Record<string, string>;\n}) => {\n const { settings, onChange } = props;\n const allOrigins = [\n ...new Set(\n settings.channels.flatMap(channel =>\n channel.origins.map(origin => origin.id),\n ),\n ),\n ];\n\n const handleChange = (\n channelId: string,\n originId: string,\n enabled: boolean,\n ) => {\n const updatedSettings = {\n channels: settings.channels.map(channel => {\n if (channel.id !== channelId) {\n return channel;\n }\n return {\n ...channel,\n origins: channel.origins.map(origin => {\n if (origin.id !== originId) {\n return origin;\n }\n return {\n ...origin,\n enabled,\n };\n }),\n };\n }),\n };\n onChange(updatedSettings);\n };\n\n const formatOriginName = (originId: string) => {\n if (props.originNames && originId in props.originNames) {\n return props.originNames[originId];\n }\n return capitalize(originId.replaceAll(/[_:]/g, ' '));\n };\n\n if (settings.channels.length === 0 || allOrigins.length === 0) {\n return (\n <Typography variant=\"body1\">\n No notification settings available, check back later\n </Typography>\n );\n }\n\n return (\n <Table>\n <TableHead>\n <TableRow>\n <TableCell>\n <Typography variant=\"subtitle1\">Origin</Typography>\n </TableCell>\n {settings.channels.map(channel => (\n <TableCell>\n <Typography variant=\"subtitle1\">{channel.id}</Typography>\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n <TableBody>\n {allOrigins.map(origin => (\n <TableRow>\n <TableCell>{formatOriginName(origin)}</TableCell>\n {settings.channels.map(channel => (\n <TableCell>\n <Tooltip\n title={`Enable or disable ${channel.id.toLocaleLowerCase(\n 'en-US',\n )} notifications from ${formatOriginName(\n origin,\n ).toLocaleLowerCase('en-US')}`}\n >\n <Switch\n checked={isNotificationsEnabledFor(\n settings,\n channel.id,\n origin,\n )}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n handleChange(channel.id, origin, event.target.checked);\n }}\n />\n </Tooltip>\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </Table>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,YAAc,EAAA;AAAA;AAElB,CAAC,EAAE,YAAY,CAAA;AAEF,MAAA,6BAAA,GAAgC,CAAC,KAIxC,KAAA;AACJ,EAAM,MAAA,EAAE,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAC/B,EAAA,MAAM,UAAa,GAAA;AAAA,IACjB,GAAG,IAAI,GAAA;AAAA,MACL,SAAS,QAAS,CAAA,OAAA;AAAA,QAAQ,aACxB,OAAQ,CAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE;AAAA;AACzC;AACF,GACF;AAEA,EAAA,MAAM,YAAe,GAAA,CACnB,SACA,EAAA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el.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ChangeEvent } from 'react';\nimport {\n isNotificationsEnabledFor,\n NotificationSettings,\n} from '@backstage/plugin-notifications-common';\nimport Table from '@material-ui/core/Table';\nimport MuiTableCell from '@material-ui/core/TableCell';\nimport { withStyles } from '@material-ui/core/styles';\nimport TableHead from '@material-ui/core/TableHead';\nimport Typography from '@material-ui/core/Typography';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableRow from '@material-ui/core/TableRow';\nimport Switch from '@material-ui/core/Switch';\nimport { capitalize } from 'lodash';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst TableCell = withStyles({\n root: {\n borderBottom: 'none',\n },\n})(MuiTableCell);\n\nexport const UserNotificationSettingsPanel = (props: {\n settings: NotificationSettings;\n onChange: (settings: NotificationSettings) => void;\n originNames?: Record<string, string>;\n}) => {\n const { settings, onChange } = props;\n const allOrigins = [\n ...new Set(\n settings.channels.flatMap(channel =>\n channel.origins.map(origin => origin.id),\n ),\n ),\n ];\n\n const handleChange = (\n channelId: string,\n originId: string,\n enabled: boolean,\n ) => {\n const updatedSettings = {\n channels: settings.channels.map(channel => {\n if (channel.id !== channelId) {\n return channel;\n }\n return {\n ...channel,\n origins: channel.origins.map(origin => {\n if (origin.id !== originId) {\n return origin;\n }\n return {\n ...origin,\n enabled,\n };\n }),\n };\n }),\n };\n onChange(updatedSettings);\n };\n\n const formatOriginName = (originId: string) => {\n if (props.originNames && originId in props.originNames) {\n return props.originNames[originId];\n }\n return capitalize(originId.replaceAll(/[_:]/g, ' '));\n };\n\n if (settings.channels.length === 0 || allOrigins.length === 0) {\n return (\n <Typography variant=\"body1\">\n No notification settings available, check back later\n </Typography>\n );\n }\n\n return (\n <Table>\n <TableHead>\n <TableRow>\n <TableCell>\n <Typography variant=\"subtitle1\">Origin</Typography>\n </TableCell>\n {settings.channels.map(channel => (\n <TableCell>\n <Typography variant=\"subtitle1\">{channel.id}</Typography>\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n <TableBody>\n {allOrigins.map(origin => (\n <TableRow>\n <TableCell>{formatOriginName(origin)}</TableCell>\n {settings.channels.map(channel => (\n <TableCell>\n <Tooltip\n title={`Enable or disable ${channel.id.toLocaleLowerCase(\n 'en-US',\n )} notifications from ${formatOriginName(\n origin,\n ).toLocaleLowerCase('en-US')}`}\n >\n <Switch\n checked={isNotificationsEnabledFor(\n settings,\n channel.id,\n origin,\n )}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n handleChange(channel.id, origin, event.target.checked);\n }}\n />\n </Tooltip>\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </Table>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,YAAc,EAAA;AAAA;AAElB,CAAC,EAAE,YAAY,CAAA;AAEF,MAAA,6BAAA,GAAgC,CAAC,KAIxC,KAAA;AACJ,EAAM,MAAA,EAAE,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAC/B,EAAA,MAAM,UAAa,GAAA;AAAA,IACjB,GAAG,IAAI,GAAA;AAAA,MACL,SAAS,QAAS,CAAA,OAAA;AAAA,QAAQ,aACxB,OAAQ,CAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE;AAAA;AACzC;AACF,GACF;AAEA,EAAA,MAAM,YAAe,GAAA,CACnB,SACA,E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,GACF,EAAA,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
3
  import { DiscoveryApi, FetchApi, IconComponent } from '@backstage/core-plugin-api';
5
4
  import { NotificationSeverity, Notification, NotificationStatus, NotificationSettings } from '@backstage/plugin-notifications-common';
@@ -22,7 +21,7 @@ declare const notificationsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
22
21
  root: _backstage_core_plugin_api.RouteRef<undefined>;
23
22
  }, {}>;
24
23
  /** @public */
25
- declare const NotificationsPage: (props?: NotificationsPageProps) => React.JSX.Element;
24
+ declare const NotificationsPage: (props?: NotificationsPageProps) => react_jsx_runtime.JSX.Element;
26
25
 
27
26
  /** @public */
28
27
  declare const notificationsApiRef: _backstage_core_plugin_api.ApiRef<NotificationsApi>;
@@ -131,7 +130,7 @@ declare const NotificationsSidebarItem: (props?: {
131
130
  text?: string;
132
131
  disableHighlight?: boolean;
133
132
  noTrack?: boolean;
134
- }) => React__default.JSX.Element;
133
+ }) => react_jsx_runtime.JSX.Element;
135
134
 
136
135
  /** @public */
137
136
  type NotificationsTableProps = Pick<TableProps, 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'> & {
@@ -144,11 +143,11 @@ type NotificationsTableProps = Pick<TableProps, 'onPageChange' | 'onRowsPerPageC
144
143
  pageSize: number;
145
144
  };
146
145
  /** @public */
147
- declare const NotificationsTable: ({ title, markAsReadOnLinkOpen, isLoading, notifications, isUnread, onUpdate, setContainsText, onPageChange, onRowsPerPageChange, page, pageSize, totalCount, }: NotificationsTableProps) => React__default.JSX.Element;
146
+ declare const NotificationsTable: ({ title, markAsReadOnLinkOpen, isLoading, notifications, isUnread, onUpdate, setContainsText, onPageChange, onRowsPerPageChange, page, pageSize, totalCount, }: NotificationsTableProps) => react_jsx_runtime.JSX.Element;
148
147
 
149
148
  /** @public */
150
149
  declare const UserNotificationSettingsCard: (props: {
151
150
  originNames?: Record<string, string>;
152
- }) => React__default.JSX.Element;
151
+ }) => react_jsx_runtime.JSX.Element;
153
152
 
154
153
  export { type GetNotificationsCommonOptions, type GetNotificationsOptions, type GetNotificationsResponse, type GetTopicsOptions, type GetTopicsResponse, type NotificationsApi, NotificationsClient, NotificationsPage, type NotificationsPageProps, NotificationsSidebarItem, NotificationsTable, type NotificationsTableProps, type UpdateNotificationsOptions, UserNotificationSettingsCard, notificationsApiRef, notificationsPlugin, useNotificationsApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications",
3
- "version": "0.5.4-next.1",
3
+ "version": "0.5.4-next.2",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "notifications",
@@ -42,11 +42,11 @@
42
42
  "types": "./dist/index.d.ts",
43
43
  "typesVersions": {
44
44
  "*": {
45
- "*": [
46
- "dist/index.d.ts"
47
- ],
48
45
  "alpha": [
49
46
  "dist/alpha.d.ts"
47
+ ],
48
+ "package.json": [
49
+ "package.json"
50
50
  ]
51
51
  }
52
52
  },
@@ -63,14 +63,14 @@
63
63
  "test": "backstage-cli package test"
64
64
  },
65
65
  "dependencies": {
66
- "@backstage/core-compat-api": "0.4.1-next.1",
67
- "@backstage/core-components": "0.17.1-next.0",
68
- "@backstage/core-plugin-api": "1.10.5",
66
+ "@backstage/core-compat-api": "0.4.1-next.2",
67
+ "@backstage/core-components": "0.17.1-next.1",
68
+ "@backstage/core-plugin-api": "1.10.6-next.0",
69
69
  "@backstage/errors": "1.2.7",
70
- "@backstage/frontend-plugin-api": "0.10.1-next.0",
70
+ "@backstage/frontend-plugin-api": "0.10.1-next.1",
71
71
  "@backstage/plugin-notifications-common": "0.0.8",
72
- "@backstage/plugin-signals-react": "0.0.11",
73
- "@backstage/theme": "0.6.4",
72
+ "@backstage/plugin-signals-react": "0.0.12-next.0",
73
+ "@backstage/theme": "0.6.5-next.0",
74
74
  "@backstage/types": "1.2.1",
75
75
  "@material-ui/core": "^4.9.13",
76
76
  "@material-ui/icons": "^4.9.1",
@@ -82,11 +82,11 @@
82
82
  "react-use": "^17.2.4"
83
83
  },
84
84
  "devDependencies": {
85
- "@backstage/cli": "0.32.0-next.1",
86
- "@backstage/core-app-api": "1.16.0",
87
- "@backstage/dev-utils": "1.1.9-next.1",
88
- "@backstage/plugin-signals": "0.0.18-next.0",
89
- "@backstage/test-utils": "1.7.6",
85
+ "@backstage/cli": "0.32.0-next.2",
86
+ "@backstage/core-app-api": "1.16.1-next.0",
87
+ "@backstage/dev-utils": "1.1.9-next.2",
88
+ "@backstage/plugin-signals": "0.0.18-next.1",
89
+ "@backstage/test-utils": "1.7.7-next.0",
90
90
  "@testing-library/jest-dom": "^6.0.0",
91
91
  "@testing-library/react": "^16.0.0",
92
92
  "@testing-library/user-event": "^14.0.0",