Skip to content

feat: Device notification mute/unmute (upstream #822) #113

Description

@Starosdev

Summary

Port feature from upstream AnalogJ/scrutiny PR AnalogJ#822 to allow muting notifications per device.

Problem

When a drive is degraded and waiting for replacement, users receive repeated failure notifications. There's no way to silence notifications for a specific device while still monitoring others.

Solution

Add a muted field to devices and UI controls to enable/disable notifications per device.

Changes Required

Backend

Database Migration - New migration m20251108044508:

  • Add Muted bool column to Device table

Files to modify:

  • webapp/backend/pkg/database/interface.go - Add UpdateDeviceMuted method
  • webapp/backend/pkg/database/scrutiny_repository_device.go - Implement UpdateDeviceMuted
  • webapp/backend/pkg/database/scrutiny_repository_migrations.go - Add migration
  • webapp/backend/pkg/models/device.go - Add Muted bool field
  • webapp/backend/pkg/notify/notify.go - Skip notification if device is muted
  • webapp/backend/pkg/web/server.go - Add /device/:wwn/mute and /device/:wwn/unmute routes

New files:

  • webapp/backend/pkg/web/handler/mute_device.go
  • webapp/backend/pkg/web/handler/unmute_device.go
  • webapp/backend/pkg/database/migrations/m20251108044508/device.go

Frontend

Files to modify:

  • webapp/frontend/src/app/core/models/device-model.ts - Add muted: boolean
  • webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.html - Show muted icon
  • webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.scss - Muted icon styles
  • webapp/frontend/src/app/layout/common/detail-settings/detail-settings.component.html - Enable notification toggle
  • webapp/frontend/src/app/layout/common/detail-settings/detail-settings.component.ts - Handle mute state
  • webapp/frontend/src/app/modules/detail/detail.component.html - Show muted icon, enable settings
  • webapp/frontend/src/app/modules/detail/detail.component.scss - Muted icon styles
  • webapp/frontend/src/app/modules/detail/detail.component.ts - Implement settings dialog
  • webapp/frontend/src/app/modules/detail/detail.service.ts - Add setMuted API call

API Endpoints

Endpoint Method Description
/api/device/:wwn/mute POST Mute device notifications
/api/device/:wwn/unmute POST Unmute device notifications

Upstream Reference

Screenshots (from upstream PR)

Dashboard with muted device indicator and detail page settings dialog.

Acceptance Criteria

  • Add database migration for muted column
  • Implement mute/unmute API endpoints
  • Skip notifications for muted devices
  • Show muted icon on dashboard and detail pages
  • Enable notification toggle in device settings dialog
  • Add tests for mute functionality

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions