Browse Source
Merge pull request #8832 from vvlladd28/feature/notification/clear-alarm/style
Remove specify alarm notification style for cleared alarm notification
pull/8849/head
Igor Kulikov
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
8 additions and
3 deletions
-
application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/AlarmTriggerProcessor.java
-
common/data/src/main/java/org/thingsboard/server/common/data/alarm/Alarm.java
-
common/data/src/main/java/org/thingsboard/server/common/data/notification/info/AlarmNotificationInfo.java
-
ui-ngx/src/app/shared/components/notification/notification.component.html
-
ui-ngx/src/app/shared/components/notification/notification.component.ts
-
ui-ngx/src/app/shared/models/notification.models.ts
|
|
|
@ -108,6 +108,8 @@ public class AlarmTriggerProcessor implements NotificationRuleTriggerProcessor<A |
|
|
|
.alarmOriginatorName(alarmInfo.getOriginatorName()) |
|
|
|
.alarmSeverity(alarmInfo.getSeverity()) |
|
|
|
.alarmStatus(alarmInfo.getStatus()) |
|
|
|
.acknowledged(alarmInfo.isAcknowledged()) |
|
|
|
.cleared(alarmInfo.isCleared()) |
|
|
|
.alarmCustomerId(alarmInfo.getCustomerId()) |
|
|
|
.build(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -153,7 +153,6 @@ public class Alarm extends BaseData<AlarmId> implements HasName, HasTenantId, Ha |
|
|
|
} |
|
|
|
|
|
|
|
public static AlarmStatus toStatus(boolean cleared, boolean acknowledged) { |
|
|
|
|
|
|
|
if (cleared) { |
|
|
|
return acknowledged ? AlarmStatus.CLEARED_ACK : AlarmStatus.CLEARED_UNACK; |
|
|
|
} else { |
|
|
|
|
|
|
|
@ -42,6 +42,8 @@ public class AlarmNotificationInfo implements RuleOriginatedNotificationInfo { |
|
|
|
private String alarmOriginatorName; |
|
|
|
private AlarmSeverity alarmSeverity; |
|
|
|
private AlarmStatus alarmStatus; |
|
|
|
private boolean acknowledged; |
|
|
|
private boolean cleared; |
|
|
|
private CustomerId alarmCustomerId; |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@ -41,7 +41,7 @@ |
|
|
|
matTooltip="{{ 'notification.mark-as-read' | translate }}" matTooltipPosition="above"> |
|
|
|
<mat-icon>check_circle_outline</mat-icon> |
|
|
|
</button> |
|
|
|
<div class="alarm-severity" *ngIf="notification.type === notificationType.ALARM" |
|
|
|
<div class="alarm-severity" *ngIf="notification.type === notificationType.ALARM && !notification.info.cleared" |
|
|
|
[ngStyle]="{backgroundColor: alarmColorSeverity(0.06)}"> |
|
|
|
<span [ngStyle]="notificationIconColor()" class="severity"> |
|
|
|
{{alarmSeverityTranslations.get(notification.info.alarmSeverity) | translate}} |
|
|
|
|
|
|
|
@ -139,7 +139,7 @@ export class NotificationComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
notificationColor(): string { |
|
|
|
if (this.notification.type === NotificationType.ALARM) { |
|
|
|
if (this.notification.type === NotificationType.ALARM && !this.notification.info.cleared) { |
|
|
|
return AlarmSeverityNotificationColors.get(this.notification.info.alarmSeverity); |
|
|
|
} |
|
|
|
return 'transparent'; |
|
|
|
|
|
|
|
@ -48,6 +48,8 @@ export interface NotificationInfo { |
|
|
|
alarmStatus?: AlarmStatus; |
|
|
|
alarmType?: string; |
|
|
|
stateEntityId?: EntityId; |
|
|
|
acknowledged?: boolean; |
|
|
|
cleared?: boolean; |
|
|
|
} |
|
|
|
|
|
|
|
export interface NotificationRequest extends Omit<BaseData<NotificationRequestId>, 'label'> { |
|
|
|
|