diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html index f07010854c..65f4bed2ae 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html @@ -224,7 +224,8 @@ matTooltip="{{ actionDescriptor.nameFunction ? actionDescriptor.nameFunction(entity) : actionDescriptor.name }}" matTooltipPosition="above" (click)="actionDescriptor.onAction($event, entity)"> - + {{actionDescriptor.icon}} @@ -239,7 +240,8 @@ [disabled]="isLoading$ | async" [fxShow]="actionDescriptor.isEnabled(entity)" (click)="actionDescriptor.onAction($event, entity)"> - + {{actionDescriptor.icon}} {{ actionDescriptor.nameFunction ? actionDescriptor.nameFunction(entity) : actionDescriptor.name }} diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts index e7caba0e3c..e9fb01c54a 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts @@ -58,6 +58,7 @@ export interface CellActionDescriptor> { nameFunction?: (entity: T) => string; icon?: string; mdiIcon?: string; + mdiIconFunction?: (entity: T) => string; style?: any; isEnabled: (entity: T) => boolean; onAction: ($event: MouseEvent, entity: T) => any; diff --git a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html index dd7c6c906c..fc48392e8c 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html @@ -44,6 +44,9 @@ {{ 'notification.rule-name-required' | translate }} + + {{ 'notification.rule-enable' | translate }} + notification.trigger.trigger @@ -55,11 +58,6 @@ {{ 'notification.trigger.trigger-required' | translate }} -
- - {{ 'notification.rule-enable' | translate }} - -
> { return [{ + name: '', + nameFunction: (entity) => + this.translate.instant(entity.enabled ? 'notification.rule-disable' : 'notification.rule-enable'), + mdiIcon: 'mdi:toggle-switch', + isEnabled: () => true, + mdiIconFunction: (entity) => entity.enabled ? 'mdi:toggle-switch' : 'mdi:toggle-switch-off-outline', + onAction: ($event, entity) => this.toggleEnableMode($event, entity) + }, + { name: this.translate.instant('notification.copy-rule'), icon: 'content_copy', isEnabled: () => true, @@ -128,4 +137,21 @@ export class RuleTableConfigResolver implements Resolve { + rule.enabled = notificationRule.enabled; + this.config.getTable().detectChanges(); + }); + } } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 11835f7e20..67732324b5 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2954,6 +2954,7 @@ "rule-engine-filter": "Rule engine filter", "rule-name": "Rule name", "rule-name-required": "Name is required", + "rule-disable": "Disable notification rule", "rule-enable": "Enable notification rule", "rule-node-filter": "Rule node filter", "rules": "Rules",