From 376d5ef797c262605f230badb9a3473b5f7e6421 Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Thu, 14 Mar 2024 12:51:12 +0100 Subject: [PATCH 1/2] chore: use colors from theme for notification's severity Signed-off-by: Marek Libra --- .../src/service/router.ts | 4 +-- .../src/api/NotificationsClient.ts | 2 +- .../NotificationsTable/SeverityIcon.tsx | 26 ++++++++++++++++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/plugins/notifications-backend/src/service/router.ts b/plugins/notifications-backend/src/service/router.ts index f9e87335ed..a1b7bb3eaf 100644 --- a/plugins/notifications-backend/src/service/router.ts +++ b/plugins/notifications-backend/src/service/router.ts @@ -213,9 +213,9 @@ export async function createRouter( } opts.createdAfter = new Date(sinceEpoch); } - if (req.query.minimal_severity) { + if (req.query.minimumSeverity) { opts.minimumSeverity = normalizeSeverity( - req.query.minimal_severity.toString(), + req.query.minimumSeverity.toString(), ); } diff --git a/plugins/notifications/src/api/NotificationsClient.ts b/plugins/notifications/src/api/NotificationsClient.ts index c4fffded9e..10ad58bd92 100644 --- a/plugins/notifications/src/api/NotificationsClient.ts +++ b/plugins/notifications/src/api/NotificationsClient.ts @@ -68,7 +68,7 @@ export class NotificationsClient implements NotificationsApi { queryString.append('createdAfter', options.createdAfter.toISOString()); } if (options?.minimumSeverity !== undefined) { - queryString.append('minimal_severity', options.minimumSeverity); + queryString.append('minimumSeverity', options.minimumSeverity); } const urlSegment = `?${queryString}`; diff --git a/plugins/notifications/src/components/NotificationsTable/SeverityIcon.tsx b/plugins/notifications/src/components/NotificationsTable/SeverityIcon.tsx index 37680db3c2..062c2ae5b7 100644 --- a/plugins/notifications/src/components/NotificationsTable/SeverityIcon.tsx +++ b/plugins/notifications/src/components/NotificationsTable/SeverityIcon.tsx @@ -19,21 +19,39 @@ import NormalIcon from '@material-ui/icons/CheckOutlined'; import CriticalIcon from '@material-ui/icons/ErrorOutline'; import HighIcon from '@material-ui/icons/WarningOutlined'; import LowIcon from '@material-ui/icons/InfoOutlined'; +import { makeStyles } from '@material-ui/core/styles'; + +const useStyles = makeStyles(theme => ({ + critical: { + color: theme.palette.status.error, + }, + high: { + color: theme.palette.status.warning, + }, + normal: { + color: theme.palette.status.ok, + }, + low: { + color: theme.palette.status.running, + }, +})); export const SeverityIcon = ({ severity, }: { severity?: NotificationSeverity; }) => { + const classes = useStyles(); + switch (severity) { case 'critical': - return ; + return ; case 'high': - return ; + return ; case 'low': - return ; + return ; case 'normal': default: - return ; + return ; } }; From 939b4ecead509718473c057f28dd6b2ffbfeaf03 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 1 Apr 2024 12:19:30 +0200 Subject: [PATCH 2/2] .changesets: added changesets for notifications changes Signed-off-by: Patrik Oldsberg --- .changeset/clean-drinks-poke.md | 6 ++++++ .changeset/wet-plants-help.md | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/clean-drinks-poke.md create mode 100644 .changeset/wet-plants-help.md diff --git a/.changeset/clean-drinks-poke.md b/.changeset/clean-drinks-poke.md new file mode 100644 index 0000000000..9c57c3ac56 --- /dev/null +++ b/.changeset/clean-drinks-poke.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-notifications-backend': minor +'@backstage/plugin-notifications': minor +--- + +Notifications-backend URL query parameter changed from `minimal_severity` to `minimumSeverity`. diff --git a/.changeset/wet-plants-help.md b/.changeset/wet-plants-help.md new file mode 100644 index 0000000000..c497c68421 --- /dev/null +++ b/.changeset/wet-plants-help.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-notifications': patch +--- + +The severity icons now get their colors from the theme.