feat(#5504): customizable browser notifications - #5584
Open
abhiramaab wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds configurability and richer UX to Spring Boot Admin UI browser notifications by exposing a server-side timeout setting to the frontend and using it when creating Notification instances, plus enabling click-through navigation to instance details when a status change can be attributed to a single instance.
Changes:
- Introduces
spring.boot.admin.ui.browser-notification-timeout(default 5000ms;0disables auto-dismiss) and wires it intoUiController.Settings. - Frontend: uses the configured timeout (instead of a hardcoded 5s) and adds logic to derive a single affected instance for click navigation.
- Adds Vitest coverage for URL/id selection helpers and a Spring MVC test asserting settings exposure.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spring-boot-admin-server-ui/src/test/java/de/codecentric/boot/admin/server/ui/web/UiControllerTest.java | Adds a test to ensure the browser notification timeout is present in uiSettings model. |
| spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/web/UiController.java | Extends UiController.Settings with browserNotificationTimeout. |
| spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/config/AdminServerUiProperties.java | Adds the new configuration property with default (5000ms) and Javadoc. |
| spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/config/AdminServerUiAutoConfiguration.java | Maps the new property into UiController.Settings. |
| spring-boot-admin-server-ui/src/main/frontend/sba-config.ts | Adds browserNotificationTimeout to the default UI settings config. |
| spring-boot-admin-server-ui/src/main/frontend/notifications.ts | Uses configured timeout and adds click-to-open-instance-details behavior. |
| spring-boot-admin-server-ui/src/main/frontend/notifications.spec.ts | Adds unit tests for helper functions introduced in notifications.ts. |
| spring-boot-admin-server-ui/src/main/frontend/global.d.ts | Extends the UISettings type with browserNotificationTimeout. |
Comment on lines
19
to
+31
| import { HealthStatus } from './HealthStatus'; | ||
| import Application from './services/application'; | ||
| import sbaConfig from './sba-config'; | ||
|
|
||
| let granted = false; | ||
|
|
||
| type BrowserNotificationOptions = NotificationOptions & { | ||
| timeout?: number; | ||
| url?: string; | ||
| }; | ||
|
|
||
| export const buildInstanceDetailsUrl = (instanceId: string) => | ||
| `/instances/${instanceId}/details`; |
Comment on lines
+32
to
+34
| it('builds instance details path', () => { | ||
| expect(buildInstanceDetailsUrl('abc123')).toBe('/instances/abc123/details'); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spring.boot.admin.ui.browser-notification-timeout(default 5000ms;0disables auto-dismiss)Test plan
browser-notification-timeout: 0— notification stays until dismissedbrowser-notification-timeout: 10000— notification auto-dismisses after 10s/instances/{id}/detailsnpm test -- --run notifications.spec.tspasses