@backstage/plugin-notifications 0.5.16-next.0 → 0.5.16-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.
- package/CHANGELOG.md +25 -0
- package/dist/alpha.d.ts +2 -1
- package/dist/alpha.esm.js +4 -1
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/NotificationsFilters/NotificationsFilters.esm.js +88 -103
- package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
- package/dist/components/NotificationsPage/NotificationsPage.esm.js +7 -8
- package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
- package/dist/components/NotificationsPage/index.esm.js +5 -1
- package/dist/components/NotificationsPage/index.esm.js.map +1 -1
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js +65 -58
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js +8 -0
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js.map +1 -0
- package/dist/components/NotificationsTable/BulkActions.esm.js +48 -32
- package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationDescription.esm.js +8 -11
- package/dist/components/NotificationsTable/NotificationDescription.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationIcon.esm.js +4 -3
- package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationsTable.esm.js +90 -114
- package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js +8 -0
- package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js.map +1 -0
- package/dist/components/NotificationsTable/SelectAll.esm.js +18 -33
- package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SelectAll.module.css.esm.js +8 -0
- package/dist/components/NotificationsTable/SelectAll.module.css.esm.js.map +1 -0
- package/dist/components/NotificationsTable/SeverityIcon.esm.js +37 -25
- package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js +8 -0
- package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js.map +1 -0
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js +6 -7
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js +8 -0
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map +1 -0
- package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js +35 -43
- package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js +22 -33
- package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js +20 -20
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js +8 -0
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
- package/dist/{package.json.esm.js → plugins/notifications/package.json.esm.js} +2 -4
- package/dist/{package.json.esm.js.map → plugins/notifications/package.json.esm.js.map} +1 -1
- package/dist/translation.esm.js +3 -2
- package/dist/translation.esm.js.map +1 -1
- package/package.json +13 -15
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { jsxs, Fragment
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useCallback, useMemo, useEffect } from 'react';
|
|
3
3
|
import throttle from 'lodash/throttle';
|
|
4
4
|
import RelativeTime from 'react-relative-time';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
10
|
-
import { useConfirm } from 'material-ui-confirm';
|
|
11
|
-
import BroadcastIcon from '@material-ui/icons/RssFeed';
|
|
12
|
-
import { useApi, alertApiRef } from '@backstage/core-plugin-api';
|
|
5
|
+
import { Checkbox, Flex, Text, Dialog, DialogHeader, DialogBody, DialogFooter, Button } from '@backstage/ui';
|
|
6
|
+
import { RiRssFill } from '@remixicon/react';
|
|
7
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
8
|
+
import { toastApiRef } from '@backstage/frontend-plugin-api';
|
|
13
9
|
import { Link, Table } from '@backstage/core-components';
|
|
14
10
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
15
11
|
import { notificationsTranslationRef } from '../../translation.esm.js';
|
|
@@ -19,23 +15,9 @@ import { SelectAll } from './SelectAll.esm.js';
|
|
|
19
15
|
import { BulkActions } from './BulkActions.esm.js';
|
|
20
16
|
import { NotificationIcon } from './NotificationIcon.esm.js';
|
|
21
17
|
import { NotificationDescription } from './NotificationDescription.esm.js';
|
|
18
|
+
import styles from './NotificationsTable.module.css.esm.js';
|
|
22
19
|
|
|
23
20
|
const ThrottleDelayMs = 1e3;
|
|
24
|
-
const useStyles = makeStyles((theme) => ({
|
|
25
|
-
severityItem: {
|
|
26
|
-
alignContent: "center"
|
|
27
|
-
},
|
|
28
|
-
broadcastIcon: {
|
|
29
|
-
fontSize: "1rem",
|
|
30
|
-
verticalAlign: "text-bottom"
|
|
31
|
-
},
|
|
32
|
-
notificationInfoRow: {
|
|
33
|
-
marginRight: theme.spacing(0.5),
|
|
34
|
-
"&:not(:first-child)": {
|
|
35
|
-
marginLeft: theme.spacing(0.5)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
21
|
const NotificationsTable = ({
|
|
40
22
|
title,
|
|
41
23
|
markAsReadOnLinkOpen,
|
|
@@ -51,10 +33,9 @@ const NotificationsTable = ({
|
|
|
51
33
|
totalCount
|
|
52
34
|
}) => {
|
|
53
35
|
const { t } = useTranslationRef(notificationsTranslationRef);
|
|
54
|
-
const classes = useStyles();
|
|
55
36
|
const notificationsApi = useApi(notificationsApiRef);
|
|
56
|
-
const
|
|
57
|
-
const
|
|
37
|
+
const toastApi = useApi(toastApiRef);
|
|
38
|
+
const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);
|
|
58
39
|
const [selectedNotifications, setSelectedNotifications] = useState(
|
|
59
40
|
/* @__PURE__ */ new Set()
|
|
60
41
|
);
|
|
@@ -89,32 +70,24 @@ const NotificationsTable = ({
|
|
|
89
70
|
},
|
|
90
71
|
[notificationsApi, onUpdate]
|
|
91
72
|
);
|
|
73
|
+
const doMarkAllRead = useCallback(async () => {
|
|
74
|
+
setConfirmDialogOpen(false);
|
|
75
|
+
try {
|
|
76
|
+
const result = await notificationsApi.getNotifications({ read: false });
|
|
77
|
+
const ids = result.notifications?.map((notification) => notification.id) ?? [];
|
|
78
|
+
if (ids.length === 0) return;
|
|
79
|
+
await notificationsApi.updateNotifications({ ids, read: true });
|
|
80
|
+
onUpdate();
|
|
81
|
+
} catch {
|
|
82
|
+
toastApi.post({
|
|
83
|
+
title: t("table.errors.markAllReadFailed"),
|
|
84
|
+
status: "danger"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [notificationsApi, onUpdate, toastApi, t]);
|
|
92
88
|
const onMarkAllRead = useCallback(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
96
|
-
"Mark ",
|
|
97
|
-
/* @__PURE__ */ jsx("b", { children: "all" }),
|
|
98
|
-
" notifications as ",
|
|
99
|
-
/* @__PURE__ */ jsx("b", { children: "read" }),
|
|
100
|
-
"."
|
|
101
|
-
] }),
|
|
102
|
-
confirmationText: "Mark All"
|
|
103
|
-
}).then(async () => {
|
|
104
|
-
const ids = (await notificationsApi.getNotifications({ read: false })).notifications?.map((notification) => notification.id);
|
|
105
|
-
return notificationsApi.updateNotifications({
|
|
106
|
-
ids,
|
|
107
|
-
read: true
|
|
108
|
-
}).then(onUpdate);
|
|
109
|
-
}).catch((e) => {
|
|
110
|
-
if (e) {
|
|
111
|
-
alertApi.post({
|
|
112
|
-
message: "Failed to mark all notifications as read",
|
|
113
|
-
severity: "error"
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}, [alertApi, confirm, notificationsApi, onUpdate]);
|
|
89
|
+
setConfirmDialogOpen(true);
|
|
90
|
+
}, []);
|
|
118
91
|
const throttledContainsTextHandler = useMemo(
|
|
119
92
|
() => throttle(setContainsText, ThrottleDelayMs),
|
|
120
93
|
[setContainsText]
|
|
@@ -134,6 +107,7 @@ const NotificationsTable = ({
|
|
|
134
107
|
{
|
|
135
108
|
/* selection column */
|
|
136
109
|
width: "1rem",
|
|
110
|
+
cellStyle: { paddingRight: "2.5rem" },
|
|
137
111
|
title: showToolbar ? /* @__PURE__ */ jsx(
|
|
138
112
|
SelectAll,
|
|
139
113
|
{
|
|
@@ -148,20 +122,21 @@ const NotificationsTable = ({
|
|
|
148
122
|
render: (notification) => /* @__PURE__ */ jsx(
|
|
149
123
|
Checkbox,
|
|
150
124
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
onChange: (
|
|
125
|
+
"aria-label": "Select notification",
|
|
126
|
+
isSelected: selectedNotifications.has(notification.id),
|
|
127
|
+
onChange: (checked) => onNotificationsSelectChange([notification.id], checked)
|
|
154
128
|
}
|
|
155
129
|
)
|
|
156
130
|
},
|
|
157
131
|
{
|
|
158
132
|
/* compact-data column */
|
|
159
133
|
customFilterAndSearch: () => true,
|
|
134
|
+
cellStyle: { paddingLeft: 0 },
|
|
160
135
|
render: (notification) => {
|
|
161
|
-
return /* @__PURE__ */ jsxs(
|
|
162
|
-
/* @__PURE__ */ jsx(
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */ jsx(
|
|
136
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
|
|
137
|
+
/* @__PURE__ */ jsx("div", { className: styles.severityItem, children: /* @__PURE__ */ jsx(NotificationIcon, { notification }) }),
|
|
138
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
139
|
+
/* @__PURE__ */ jsx(Text, { variant: "body-medium", children: notification.payload.link ? /* @__PURE__ */ jsx(
|
|
165
140
|
Link,
|
|
166
141
|
{
|
|
167
142
|
to: notification.payload.link,
|
|
@@ -179,39 +154,25 @@ const NotificationsTable = ({
|
|
|
179
154
|
description: notification.payload.description
|
|
180
155
|
}
|
|
181
156
|
) : null,
|
|
182
|
-
/* @__PURE__ */ jsxs(
|
|
183
|
-
!notification.user && /* @__PURE__ */ jsx(
|
|
157
|
+
/* @__PURE__ */ jsxs(Text, { variant: "body-small", color: "secondary", children: [
|
|
158
|
+
!notification.user && /* @__PURE__ */ jsx(RiRssFill, { size: 14, className: styles.broadcastIcon }),
|
|
184
159
|
notification.origin && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
185
|
-
/* @__PURE__ */ jsx(
|
|
186
|
-
Typography,
|
|
187
|
-
{
|
|
188
|
-
variant: "inherit",
|
|
189
|
-
className: classes.notificationInfoRow,
|
|
190
|
-
children: notification.origin
|
|
191
|
-
}
|
|
192
|
-
),
|
|
160
|
+
/* @__PURE__ */ jsx("span", { className: styles.notificationInfoRow, children: notification.origin }),
|
|
193
161
|
"\u2022"
|
|
194
162
|
] }),
|
|
195
163
|
notification.payload.topic && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
196
|
-
/* @__PURE__ */ jsx(
|
|
197
|
-
Typography,
|
|
198
|
-
{
|
|
199
|
-
variant: "inherit",
|
|
200
|
-
className: classes.notificationInfoRow,
|
|
201
|
-
children: notification.payload.topic
|
|
202
|
-
}
|
|
203
|
-
),
|
|
164
|
+
/* @__PURE__ */ jsx("span", { className: styles.notificationInfoRow, children: notification.payload.topic }),
|
|
204
165
|
"\u2022"
|
|
205
166
|
] }),
|
|
206
167
|
notification.created && /* @__PURE__ */ jsx(
|
|
207
168
|
RelativeTime,
|
|
208
169
|
{
|
|
209
170
|
value: notification.created,
|
|
210
|
-
className:
|
|
171
|
+
className: styles.notificationInfoRow
|
|
211
172
|
}
|
|
212
173
|
)
|
|
213
174
|
] })
|
|
214
|
-
] })
|
|
175
|
+
] })
|
|
215
176
|
] });
|
|
216
177
|
}
|
|
217
178
|
},
|
|
@@ -248,46 +209,61 @@ const NotificationsTable = ({
|
|
|
248
209
|
onSwitchSavedStatus,
|
|
249
210
|
onMarkAllRead,
|
|
250
211
|
onNotificationsSelectChange,
|
|
251
|
-
classes.severityItem,
|
|
252
|
-
classes.broadcastIcon,
|
|
253
|
-
classes.notificationInfoRow,
|
|
254
212
|
markAsReadOnLinkOpen
|
|
255
213
|
]);
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
title,
|
|
269
|
-
onPageChange,
|
|
270
|
-
onRowsPerPageChange,
|
|
271
|
-
page,
|
|
272
|
-
totalCount,
|
|
273
|
-
onSearchChange: throttledContainsTextHandler,
|
|
274
|
-
data: notifications,
|
|
275
|
-
columns: compactColumns,
|
|
276
|
-
localization: {
|
|
277
|
-
body: {
|
|
278
|
-
emptyDataSourceMessage: t("table.emptyMessage")
|
|
214
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
215
|
+
/* @__PURE__ */ jsx(
|
|
216
|
+
Table,
|
|
217
|
+
{
|
|
218
|
+
isLoading,
|
|
219
|
+
options: {
|
|
220
|
+
padding: "dense",
|
|
221
|
+
search: true,
|
|
222
|
+
paging: true,
|
|
223
|
+
pageSize,
|
|
224
|
+
header: true,
|
|
225
|
+
sorting: false
|
|
279
226
|
},
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
227
|
+
title,
|
|
228
|
+
onPageChange,
|
|
229
|
+
onRowsPerPageChange,
|
|
230
|
+
page,
|
|
231
|
+
totalCount,
|
|
232
|
+
onSearchChange: throttledContainsTextHandler,
|
|
233
|
+
data: notifications,
|
|
234
|
+
columns: compactColumns,
|
|
235
|
+
localization: {
|
|
236
|
+
body: {
|
|
237
|
+
emptyDataSourceMessage: t("table.emptyMessage")
|
|
238
|
+
},
|
|
239
|
+
pagination: {
|
|
240
|
+
firstTooltip: t("table.pagination.firstTooltip"),
|
|
241
|
+
labelDisplayedRows: t("table.pagination.labelDisplayedRows"),
|
|
242
|
+
labelRowsSelect: t("table.pagination.labelRowsSelect"),
|
|
243
|
+
lastTooltip: t("table.pagination.lastTooltip"),
|
|
244
|
+
nextTooltip: t("table.pagination.nextTooltip"),
|
|
245
|
+
previousTooltip: t("table.pagination.previousTooltip")
|
|
246
|
+
}
|
|
287
247
|
}
|
|
288
248
|
}
|
|
289
|
-
|
|
290
|
-
|
|
249
|
+
),
|
|
250
|
+
/* @__PURE__ */ jsxs(
|
|
251
|
+
Dialog,
|
|
252
|
+
{
|
|
253
|
+
isOpen: confirmDialogOpen,
|
|
254
|
+
onOpenChange: setConfirmDialogOpen,
|
|
255
|
+
isDismissable: true,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: t("table.confirmDialog.title") }),
|
|
258
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx(Text, { variant: "body-medium", children: t("table.confirmDialog.markAllReadDescription") }) }),
|
|
259
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
260
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onPress: doMarkAllRead, children: t("table.confirmDialog.markAllReadConfirmation") }),
|
|
261
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", slot: "close", children: t("table.confirmDialog.cancel") })
|
|
262
|
+
] })
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
] });
|
|
291
267
|
};
|
|
292
268
|
|
|
293
269
|
export { NotificationsTable };
|
|
@@ -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 { useCallback, useEffect, useMemo, useState } 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';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\nimport { NotificationDescription } from './NotificationDescription';\n\nconst ThrottleDelayMs = 1000;\n\nconst useStyles = makeStyles(theme => ({\n severityItem: {\n alignContent: 'center',\n },\n broadcastIcon: {\n fontSize: '1rem',\n verticalAlign: 'text-bottom',\n },\n notificationInfoRow: {\n marginRight: theme.spacing(0.5),\n '&:not(:first-child)': {\n marginLeft: theme.spacing(0.5),\n },\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 { t } = useTranslationRef(notificationsTranslationRef);\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 <NotificationDescription\n description={notification.payload.description}\n />\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 •\n </>\n )}\n {notification.payload.topic && (\n <>\n <Typography\n variant=\"inherit\"\n className={classes.notificationInfoRow}\n >\n {notification.payload.topic}\n </Typography>\n •\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.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 localization={{\n body: {\n emptyDataSourceMessage: t('table.emptyMessage'),\n },\n pagination: {\n firstTooltip: t('table.pagination.firstTooltip'),\n labelDisplayedRows: t('table.pagination.labelDisplayedRows'),\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n lastTooltip: t('table.pagination.lastTooltip'),\n nextTooltip: t('table.pagination.nextTooltip'),\n previousTooltip: t('table.pagination.previousTooltip'),\n },\n }}\n />\n );\n};\n"],"names":["CheckBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,eAAA,GAAkB,GAAA;AAExB,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,YAAA,EAAc;AAAA,IACZ,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,aAAA,EAAe;AAAA,IACb,QAAA,EAAU,MAAA;AAAA,IACV,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,mBAAA,EAAqB;AAAA,IACnB,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC9B,qBAAA,EAAuB;AAAA,MACrB,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA;AAC/B;AAEJ,CAAA,CAAE,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,CAAA,KAA+B;AAC7B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,UA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;AAAA,UACrD,WAAA,EAAa,EAAE,8BAA8B,CAAA;AAAA,UAC7C,WAAA,EAAa,EAAE,8BAA8B,CAAA;AAAA,UAC7C,eAAA,EAAiB,EAAE,kCAAkC;AAAA;AACvD;AACF;AAAA,GACF;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 { useCallback, useEffect, useMemo, useState } from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogBody,\n DialogFooter,\n DialogHeader,\n Flex,\n Text,\n} from '@backstage/ui';\nimport { RiRssFill } from '@remixicon/react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\nimport {\n Link,\n Table,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\nimport { NotificationDescription } from './NotificationDescription';\n\nimport styles from './NotificationsTable.module.css';\n\nconst ThrottleDelayMs = 1000;\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 { t } = useTranslationRef(notificationsTranslationRef);\n const notificationsApi = useApi(notificationsApiRef);\n const toastApi = useApi(toastApiRef);\n const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);\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 doMarkAllRead = useCallback(async () => {\n setConfirmDialogOpen(false);\n try {\n const result = await notificationsApi.getNotifications({ read: false });\n const ids =\n result.notifications?.map(notification => notification.id) ?? [];\n if (ids.length === 0) return;\n await notificationsApi.updateNotifications({ ids, read: true });\n onUpdate();\n } catch {\n toastApi.post({\n title: t('table.errors.markAllReadFailed'),\n status: 'danger',\n });\n }\n }, [notificationsApi, onUpdate, toastApi, t]);\n\n const onMarkAllRead = useCallback(() => {\n setConfirmDialogOpen(true);\n }, []);\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 cellStyle: { paddingRight: '2.5rem' },\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 aria-label=\"Select notification\"\n isSelected={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 cellStyle: { paddingLeft: 0 },\n render: (notification: Notification) => {\n // Compact content\n return (\n <Flex gap=\"4\" align=\"center\">\n <div className={styles.severityItem}>\n <NotificationIcon notification={notification} />\n </div>\n <Flex direction=\"column\" gap=\"1\">\n <Text variant=\"body-medium\">\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 </Text>\n {notification.payload.description ? (\n <NotificationDescription\n description={notification.payload.description}\n />\n ) : null}\n\n <Text variant=\"body-small\" color=\"secondary\">\n {!notification.user && (\n <RiRssFill size={14} className={styles.broadcastIcon} />\n )}\n {notification.origin && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.origin}\n </span>\n •\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n •\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={styles.notificationInfoRow}\n />\n )}\n </Text>\n </Flex>\n </Flex>\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 markAsReadOnLinkOpen,\n ]);\n\n return (\n <>\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 localization={{\n body: {\n emptyDataSourceMessage: t('table.emptyMessage'),\n },\n pagination: {\n firstTooltip: t('table.pagination.firstTooltip'),\n labelDisplayedRows: t('table.pagination.labelDisplayedRows'),\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n lastTooltip: t('table.pagination.lastTooltip'),\n nextTooltip: t('table.pagination.nextTooltip'),\n previousTooltip: t('table.pagination.previousTooltip'),\n },\n }}\n />\n <Dialog\n isOpen={confirmDialogOpen}\n onOpenChange={setConfirmDialogOpen}\n isDismissable\n >\n <DialogHeader>{t('table.confirmDialog.title')}</DialogHeader>\n <DialogBody>\n <Text variant=\"body-medium\">\n {t('table.confirmDialog.markAllReadDescription')}\n </Text>\n </DialogBody>\n <DialogFooter>\n <Button variant=\"primary\" onPress={doMarkAllRead}>\n {t('table.confirmDialog.markAllReadConfirmation')}\n </Button>\n <Button variant=\"secondary\" slot=\"close\">\n {t('table.confirmDialog.cancel')}\n </Button>\n </DialogFooter>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,MAAM,eAAA,GAAkB,GAAA;AAiBjB,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,CAAA,KAA+B;AAC7B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhE,EAAA,MAAM,CAAC,qBAAA,EAAuB,wBAAwB,CAAA,GAAI,QAAA;AAAA,wBACpD,GAAA;AAAwB,GAC9B;AAEA,EAAA,MAAM,2BAAA,GAA8B,WAAA;AAAA,IAClC,CAAC,KAA2B,OAAA,KAAqB;AAC/C,MAAA,IAAI,SAAA;AACJ,MAAA,IAAI,OAAA,EAAS;AACX,QAAA,SAAA,uBAAgB,GAAA,CAAI,CAAC,GAAG,qBAAA,EAAuB,GAAG,GAAG,CAAC,CAAA;AAAA,MACxD,CAAA,MAAO;A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AAAA,WAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "/*\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 */\n\n@layer components {\n .NotificationsTable_severityItem__f46e23ec09 {\n align-content: center;\n display: flex;\n align-items: center;\n }\n\n .NotificationsTable_broadcastIcon__f46e23ec09 {\n font-size: 1rem;\n vertical-align: text-bottom;\n }\n\n .NotificationsTable_notificationInfoRow__f46e23ec09 {\n margin-right: var(--bui-space-1);\n }\n\n .NotificationsTable_notificationInfoRow__f46e23ec09:not(:first-child) {\n margin-left: var(--bui-space-1);\n }\n}\n";
|
|
4
|
+
var styles = {"severityItem":"NotificationsTable_severityItem__f46e23ec09","broadcastIcon":"NotificationsTable_broadcastIcon__f46e23ec09","notificationInfoRow":"NotificationsTable_notificationInfoRow__f46e23ec09"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { styles as default };
|
|
8
|
+
//# sourceMappingURL=NotificationsTable.module.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationsTable.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import Checkbox from '@
|
|
3
|
-
import
|
|
4
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
import Tooltip from '@material-ui/core/Tooltip';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { TooltipTrigger, Checkbox, Tooltip } from '@backstage/ui';
|
|
3
|
+
import styles from './SelectAll.module.css.esm.js';
|
|
6
4
|
|
|
7
|
-
const useStyles = makeStyles({
|
|
8
|
-
label: {
|
|
9
|
-
marginLeft: "0px",
|
|
10
|
-
maxWidth: "2rem",
|
|
11
|
-
"& span": {
|
|
12
|
-
paddingRight: "0px",
|
|
13
|
-
marginRight: "2px"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
5
|
const SelectAll = ({
|
|
18
6
|
count,
|
|
19
7
|
totalCount,
|
|
20
8
|
onSelectAll
|
|
21
9
|
}) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
) })
|
|
38
|
-
}
|
|
39
|
-
);
|
|
10
|
+
return /* @__PURE__ */ jsxs(TooltipTrigger, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
Checkbox,
|
|
13
|
+
{
|
|
14
|
+
className: styles.label,
|
|
15
|
+
"aria-label": "Select all",
|
|
16
|
+
isDisabled: !totalCount,
|
|
17
|
+
isSelected: count > 0,
|
|
18
|
+
isIndeterminate: count > 0 && totalCount !== count,
|
|
19
|
+
onChange: () => onSelectAll(),
|
|
20
|
+
children: count > 0 ? `(${count})` : void 0
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsx(Tooltip, { children: "Select all" })
|
|
24
|
+
] });
|
|
40
25
|
};
|
|
41
26
|
|
|
42
27
|
export { SelectAll };
|
|
@@ -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
|
|
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, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport styles from './SelectAll.module.css';\n\nexport const SelectAll = ({\n count,\n totalCount,\n onSelectAll,\n}: {\n count: number;\n totalCount: number;\n onSelectAll: () => void;\n}) => {\n return (\n <TooltipTrigger>\n <Checkbox\n className={styles.label}\n aria-label=\"Select all\"\n isDisabled={!totalCount}\n isSelected={count > 0}\n isIndeterminate={count > 0 && totalCount !== count}\n onChange={() => onSelectAll()}\n >\n {count > 0 ? `(${count})` : undefined}\n </Checkbox>\n <Tooltip>Select all</Tooltip>\n </TooltipTrigger>\n );\n};\n"],"names":[],"mappings":";;;;AAkBO,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,4BACG,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAA,CAAO,KAAA;AAAA,QAClB,YAAA,EAAW,YAAA;AAAA,QACX,YAAY,CAAC,UAAA;AAAA,QACb,YAAY,KAAA,GAAQ,CAAA;AAAA,QACpB,eAAA,EAAiB,KAAA,GAAQ,CAAA,IAAK,UAAA,KAAe,KAAA;AAAA,QAC7C,QAAA,EAAU,MAAM,WAAA,EAAY;AAAA,QAE3B,QAAA,EAAA,KAAA,GAAQ,CAAA,GAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,CAAA,GAAM;AAAA;AAAA,KAC9B;AAAA,oBACA,GAAA,CAAC,WAAQ,QAAA,EAAA,YAAA,EAAU;AAAA,GAAA,EACrB,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "/*\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\n@layer components {\n .SelectAll_label__545122f5af {\n display: flex;\n align-items: center;\n margin-left: 0;\n max-width: 4rem;\n gap: var(--bui-space-1);\n cursor: pointer;\n font-size: var(--bui-font-size-1);\n color: var(--bui-fg-primary);\n }\n}\n";
|
|
4
|
+
var styles = {"label":"SelectAll_label__545122f5af"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { styles as default };
|
|
8
|
+
//# sourceMappingURL=SelectAll.module.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAll.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import HighIcon from '@material-ui/icons/WarningOutlined';
|
|
5
|
-
import LowIcon from '@material-ui/icons/InfoOutlined';
|
|
6
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
+
import { RiCheckLine, RiInformationLine, RiAlertLine, RiErrorWarningLine } from '@remixicon/react';
|
|
3
|
+
import styles from './SeverityIcon.module.css.esm.js';
|
|
7
4
|
|
|
8
|
-
const useStyles = makeStyles((theme) => ({
|
|
9
|
-
critical: {
|
|
10
|
-
color: theme.palette.status.error
|
|
11
|
-
},
|
|
12
|
-
high: {
|
|
13
|
-
color: theme.palette.status.warning
|
|
14
|
-
},
|
|
15
|
-
normal: {
|
|
16
|
-
color: theme.palette.status.ok
|
|
17
|
-
},
|
|
18
|
-
low: {
|
|
19
|
-
color: theme.palette.status.running
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
5
|
const SeverityIcon = ({
|
|
23
|
-
severity
|
|
6
|
+
severity,
|
|
7
|
+
className,
|
|
8
|
+
style
|
|
24
9
|
}) => {
|
|
25
|
-
const classes = useStyles();
|
|
26
10
|
switch (severity) {
|
|
27
11
|
case "critical":
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
RiErrorWarningLine,
|
|
14
|
+
{
|
|
15
|
+
size: 20,
|
|
16
|
+
className: [styles.critical, className].filter(Boolean).join(" "),
|
|
17
|
+
style
|
|
18
|
+
}
|
|
19
|
+
);
|
|
29
20
|
case "high":
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
RiAlertLine,
|
|
23
|
+
{
|
|
24
|
+
size: 20,
|
|
25
|
+
className: [styles.high, className].filter(Boolean).join(" "),
|
|
26
|
+
style
|
|
27
|
+
}
|
|
28
|
+
);
|
|
31
29
|
case "low":
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
RiInformationLine,
|
|
32
|
+
{
|
|
33
|
+
size: 20,
|
|
34
|
+
className: [styles.low, className].filter(Boolean).join(" "),
|
|
35
|
+
style
|
|
36
|
+
}
|
|
37
|
+
);
|
|
33
38
|
case "normal":
|
|
34
39
|
default:
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
RiCheckLine,
|
|
42
|
+
{
|
|
43
|
+
size: 20,
|
|
44
|
+
className: [styles.normal, className].filter(Boolean).join(" "),
|
|
45
|
+
style
|
|
46
|
+
}
|
|
47
|
+
);
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
|
|
@@ -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 { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport
|
|
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 { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport {\n RiCheckLine,\n RiErrorWarningLine,\n RiAlertLine,\n RiInformationLine,\n} from '@remixicon/react';\nimport styles from './SeverityIcon.module.css';\n\nexport const SeverityIcon = ({\n severity,\n className,\n style,\n}: {\n severity?: NotificationSeverity;\n className?: string;\n style?: React.CSSProperties;\n}) => {\n switch (severity) {\n case 'critical':\n return (\n <RiErrorWarningLine\n size={20}\n className={[styles.critical, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'high':\n return (\n <RiAlertLine\n size={20}\n className={[styles.high, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'low':\n return (\n <RiInformationLine\n size={20}\n className={[styles.low, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'normal':\n default:\n return (\n <RiCheckLine\n size={20}\n className={[styles.normal, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n }\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,UAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,QAAA,EAAU,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAChE;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,MAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,IAAA,EAAM,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC5D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,KAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,GAAA,EAAK,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC3D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,QAAA;AAAA,IACL;AACE,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,MAAA,EAAQ,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC9D;AAAA;AAAA,OACF;AAAA;AAGR;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "/*\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\n@layer components {\n .SeverityIcon_critical__39872d16da {\n color: var(--bui-fg-danger);\n }\n\n .SeverityIcon_high__39872d16da {\n color: var(--bui-fg-warning);\n }\n\n .SeverityIcon_normal__39872d16da {\n color: var(--bui-fg-success);\n }\n\n .SeverityIcon_low__39872d16da {\n color: var(--bui-fg-info);\n }\n}\n";
|
|
4
|
+
var styles = {"critical":"SeverityIcon_critical__39872d16da","high":"SeverityIcon_high__39872d16da","normal":"SeverityIcon_normal__39872d16da","low":"SeverityIcon_low__39872d16da"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { styles as default };
|
|
8
|
+
//# sourceMappingURL=SeverityIcon.module.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeverityIcon.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styles from './NoBorderTableCell.module.css.esm.js';
|
|
3
3
|
|
|
4
|
-
const NoBorderTableCell =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})(MuiTableCell);
|
|
4
|
+
const NoBorderTableCell = ({
|
|
5
|
+
children,
|
|
6
|
+
align
|
|
7
|
+
}) => /* @__PURE__ */ jsx("td", { className: styles.cell, style: align ? { textAlign: align } : void 0, children });
|
|
9
8
|
|
|
10
9
|
export { NoBorderTableCell };
|
|
11
10
|
//# sourceMappingURL=NoBorderTableCell.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoBorderTableCell.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NoBorderTableCell.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 {
|
|
1
|
+
{"version":3,"file":"NoBorderTableCell.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NoBorderTableCell.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 { ReactNode } from 'react';\nimport styles from './NoBorderTableCell.module.css';\n\nexport const NoBorderTableCell = ({\n children,\n align,\n}: {\n children?: ReactNode;\n align?: 'left' | 'center' | 'right';\n}) => (\n <td className={styles.cell} style={align ? { textAlign: align } : undefined}>\n {children}\n </td>\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,qBAIE,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAW,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,KAAA,GAAQ,EAAE,SAAA,EAAW,KAAA,EAAM,GAAI,MAAA,EAC/D,QAAA,EACH;;;;"}
|