Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/develop/rest-api/notifications_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ The remaining properties indicate the actions that **HAVE been taken**:

- `silenced` - `true` when the silence action has been taken
- `acknowledged` - `true` when the acknowledge action has been taken
- `acknowledgedAt` - timestamp indicating when the acknowledge action was taken
Comment thread
panaaj marked this conversation as resolved.

## Taking Action

Expand Down Expand Up @@ -328,6 +329,7 @@ The result of a successful clear request is that the:
- `state` value is set to `normal`
- `status.silenced` is set to `false`
- `status.acknowledged` is set to `false`
- `status.acknowledgedAt` is not present

If the clear action is requested when the `status.canClear` property is `false`, the alarm will not be cleared and an ERROR response is returned to the requestor.

Expand Down Expand Up @@ -480,6 +482,7 @@ _Notification: after successful `acknowledge` request_
"status": {
"silenced": true,
"acknowledged": true,
"acknowledgedAt": "2026-04-06T03:34:48.203Z",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"canSilence": true,
"canAcknow;edge": true,
"canClear": true
Expand Down
1 change: 1 addition & 0 deletions packages/server-api/src/deltas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export enum ALARM_METHOD {
export interface AlarmStatus {
silenced: boolean
acknowledged: boolean
acknowledgedAt?: Timestamp
canSilence: boolean
canAcknowledge: boolean
canClear: boolean
Expand Down
6 changes: 6 additions & 0 deletions packages/server-api/src/typebox/protocol-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export const AlarmStatusSchema = Type.Object(
acknowledged: Type.Boolean({
description: 'Whether the alarm has been acknowledged'
}),
acknowledgedAt: Type.Optional(
Type.String({
pattern: IsoTimePattern,
description: 'ISO 8601 timestamp when the alarm was acknowledged'
})
),
Comment thread
panaaj marked this conversation as resolved.
canSilence: Type.Boolean({
description: 'Whether the alarm can be silenced'
}),
Expand Down
12 changes: 10 additions & 2 deletions src/api/notifications/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class Alarm {
this.value.state !== ALARM_STATE.normal
) {
this.status.acknowledged = false
delete this.status.acknowledgedAt
this.status.silenced = false
}

Expand All @@ -113,8 +114,13 @@ export class Alarm {
this.value &&
'acknowledgeStatus' in this.value
) {
this.status.acknowledged =
this.value.acknowledgeStatus === 'Yes' ? true : false
if (this.value.acknowledgeStatus === 'Yes') {
this.status.acknowledgedAt = new Date().toISOString() as Timestamp
this.status.acknowledged = true
} else {
this.status.acknowledged = false
delete this.status.acknowledgedAt
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
if (
!this.status.silenced &&
Expand Down Expand Up @@ -228,6 +234,7 @@ export class Alarm {
throw new Error('Alarm already acknowledged!')
}
this.status.acknowledged = true
this.status.acknowledgedAt = new Date().toISOString() as Timestamp
this.alignAlarmMethod()
this.timeStamp()
}
Expand All @@ -239,6 +246,7 @@ export class Alarm {
this.value.state = ALARM_STATE.normal
this.status.silenced = false
this.status.acknowledged = false
delete this.status.acknowledgedAt
this.timeStamp()
}
}
Loading