diff --git a/ui-ngx/src/app/modules/home/components/notification/notification-bell.component.ts b/ui-ngx/src/app/modules/home/components/notification/notification-bell.component.ts index 2283e14c31..3f94892260 100644 --- a/ui-ngx/src/app/modules/home/components/notification/notification-bell.component.ts +++ b/ui-ngx/src/app/modules/home/components/notification/notification-bell.component.ts @@ -66,7 +66,7 @@ export class NotificationBellComponent implements OnDestroy { if (value) { this.initSubscription(); } - }) + }); } ngOnDestroy() { diff --git a/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts b/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts index 517b4761d2..ed6f1a025b 100644 --- a/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts +++ b/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts @@ -95,7 +95,7 @@ export class ShowNotificationPopoverComponent extends PageComponent implements O this.router.navigateByUrl(this.router.createUrlTree(['notification-center'])).then(() => {}); } - trackById (index: number, item: NotificationRequest): string { + trackById(index: number, item: NotificationRequest): string { return item.id.id; } } diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts index cadfed0991..275caa6647 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts @@ -45,6 +45,6 @@ export class InboxNotificationDialogComponent extends DialogComponent { this.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC}; this.handleRowClick = ($event, notification) => { - this.showNotification($event, notification) + this.showNotification($event, notification); return true; - } + }; this.componentsData = { unreadOnly: true diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts index 8c55d0e47f..929dd32fab 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts @@ -72,7 +72,6 @@ export class RequestTableConfig extends EntityTableConfig this.onRequestAction(action); this.handleRowClick = (event, entity) => { - const path = (event as any).path || (event.composedPath && event.composedPath()); if ((event.target as HTMLElement).getElementsByClassName('stats').length || (event.target as HTMLElement).className === 'stats') { this.openStatsErrorDialog(event, entity); } @@ -145,7 +144,8 @@ export class RequestTableConfig extends EntityTableConfig + return `
${this.translate.instant(translateKey)}
`; } @@ -154,10 +154,10 @@ export class RequestTableConfig extends EntityTableConfig countError += Object.keys(stats.errors[method]).length); if (countError === 0) { - return '' + return ''; } - return `
+ return `
${countError} ${this.translate.instant('notification.fails')} >
`; } diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts index 346843d6aa..a659946a73 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts @@ -60,9 +60,9 @@ export class RuleTableConfig extends EntityTableConfig { this.defaultSortOrder = {property: 'name', direction: Direction.ASC}; this.handleRowClick = ($event, rule) => { - this.editRule($event, rule) + this.editRule($event, rule); return true; - } + }; this.columns.push( new EntityTableColumn('name', 'notification.rule-name', '30%'), diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts index d9a6271b80..2f4093813d 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts @@ -65,7 +65,7 @@ export class TargetsTableConfig extends EntityTableConfig { this.handleRowClick = ($event, target) => { this.editTarget($event, target); return true; - } + }; this.columns.push( new EntityTableColumn('name', 'notification.notification-target', '20%'), diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts index c14db49877..382b4614ea 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts @@ -63,9 +63,9 @@ export class TemplateTableConfig extends EntityTableConfig this.defaultSortOrder = {property: 'notificationType', direction: Direction.ASC}; this.handleRowClick = ($event, template) => { - this.editTemplate($event, template) + this.editTemplate($event, template); return true; - } + }; this.columns.push( new EntityTableColumn('notificationType', 'notification.type', '15%', diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts index 807fa5c4a9..114e082623 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts @@ -33,7 +33,7 @@ export interface NotificationRequestErrorDialogData { }) export class NotificationRequestErrorDialogComponent extends DialogComponent { - errorStats: { [key in NotificationDeliveryMethod]: {[key in string]: string}}; + errorStats: { [key in NotificationDeliveryMethod]: {[errorKey in string]: string}}; notificationDeliveryMethodErrorTranslateMap = new Map([ [NotificationDeliveryMethod.WEB, 'notification.delivery-method-type.web-failed-sent'], diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts index 909d4acd6b..8d0fa8b7fa 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts @@ -99,7 +99,7 @@ export class RequestNotificationDialogComponent extends }) }); - this.notificationRequestForm.get('template.name').setValue(guid()) + this.notificationRequestForm.get('template.name').setValue(guid()); this.notificationRequestForm.get('useTemplate').valueChanges.pipe( takeUntil(this.destroy$) diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts index 4413ca2941..8ecfba1c24 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, forwardRef, Input, OnDestroy } from '@angular/core'; +import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core'; import { AbstractControl, ControlValueAccessor, @@ -51,7 +51,7 @@ import { coerceBoolean } from '@shared/decorators/coerce-boolean'; } ] }) -export class EscalationsComponent implements ControlValueAccessor, Validator, OnDestroy { +export class EscalationsComponent implements ControlValueAccessor, Validator, OnInit, OnDestroy { escalationsFormGroup: FormGroup; @@ -107,6 +107,7 @@ export class EscalationsComponent implements ControlValueAccessor, Validator, On writeValue(escalations: {[key: string]: Array} | null): void { const escalationParse: Array = []; + // eslint-disable-next-line guard-for-in for (const escalation in escalations) { escalationParse.push({delayInSec: Number(escalation) * 1000, targets: escalations[escalation]}); } diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts index 439eaed964..9dc829a53b 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts @@ -165,13 +165,13 @@ export class RuleNotificationDialogComponent extends this.ruleNotificationForm.get('recipientsConfig.escalationTable').valueChanges.pipe( takeUntil(this.destroy$) - ).subscribe(value => { + ).subscribe(() => { if (this.countRecipientsChainConfig() > 1) { this.alarmTemplateForm.get('triggerConfig.clearRule').enable({emitEvent: false}); } else { this.alarmTemplateForm.get('triggerConfig.clearRule').disable({emitEvent: false}); } - }) + }); this.alarmTemplateForm = this.fb.group({ triggerConfig: this.fb.group({ diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts index 5155c53b36..aea112f924 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts @@ -64,7 +64,7 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn @Input() @coerceBoolean() - allowCreate: boolean = false; + allowCreate = false; @Input() @@ -155,19 +155,22 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn writeValue(value: EntityId | null): void { this.searchText = ''; if (value != null) { - this.notificationService.getNotificationTemplateById(value.id, {ignoreLoading: true, ignoreErrors: true}).subscribe( - (entity) => { + this.notificationService.getNotificationTemplateById(value.id, { + ignoreLoading: true, + ignoreErrors: true + }).subscribe({ + next: (entity) => { this.modelValue = entity.id; this.selectTemplateFormGroup.get('templateName').patchValue(entity, {emitEvent: false}); }, - () => { + error: () => { this.modelValue = null; this.selectTemplateFormGroup.get('templateName').patchValue('', {emitEvent: false}); if (value !== null) { this.propagateChange(this.modelValue); } } - ); + }); } else { this.modelValue = null; this.selectTemplateFormGroup.get('templateName').patchValue('', {emitEvent: false}); @@ -229,9 +232,7 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn }); return this.notificationService.getNotificationTemplates(pageLink, this.notificationTypes, {ignoreLoading: true}).pipe( catchError(() => of(emptyPageData())), - map(pageData => { - return pageData.data; - }) + map(pageData => pageData.data) ); } diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts index 328374e474..18908dab65 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts @@ -99,6 +99,7 @@ export class TemplateNotificationDialogComponent } this.templateNotificationForm.reset({}, {emitEvent: false}); this.templateNotificationForm.patchValue(this.templateNotification, {emitEvent: false}); + // eslint-disable-next-line guard-for-in for (const method in this.templateNotification.configuration.deliveryMethodsTemplates) { this.deliveryMethodFormsMap.get(NotificationDeliveryMethod[method]) .patchValue(this.templateNotification.configuration.deliveryMethodsTemplates[method]); diff --git a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts index bca00951c4..125d4d77d8 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts @@ -90,10 +90,10 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV disabled: boolean; @Input() - subscriptSizing: SubscriptSizing = 'fixed' + subscriptSizing: SubscriptSizing = 'fixed'; @Input() - hint: string + hint: string; @ViewChild('entityInput') entityInput: ElementRef; @ViewChild('entityAutocomplete') matAutocomplete: MatAutocomplete; diff --git a/ui-ngx/src/app/shared/components/string-items-list.component.ts b/ui-ngx/src/app/shared/components/string-items-list.component.ts index 454b6cd51a..161c8169e3 100644 --- a/ui-ngx/src/app/shared/components/string-items-list.component.ts +++ b/ui-ngx/src/app/shared/components/string-items-list.component.ts @@ -77,7 +77,7 @@ export class StringItemsListComponent implements ControlValueAccessor{ @Input() @coerceBoolean() - editable: boolean = false + editable = false; private propagateChange = (v: any) => { }; diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts index b3375cc53d..9d7605c59d 100644 --- a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts +++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts @@ -72,7 +72,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor { @Input() @coerceBoolean() - disabledAdvanced = false + disabledAdvanced = false; @Output() hideFlagChange = new EventEmitter(); diff --git a/ui-ngx/src/app/shared/decorators/coerce-boolean.ts b/ui-ngx/src/app/shared/decorators/coerce-boolean.ts index 5f459ea817..63da1eff17 100644 --- a/ui-ngx/src/app/shared/decorators/coerce-boolean.ts +++ b/ui-ngx/src/app/shared/decorators/coerce-boolean.ts @@ -16,21 +16,19 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion'; -export function coerceBoolean() { - return function (target: any, key: string): void { - const getter = function () { - return this['__' + key]; - }; - - const setter = function (next: any) { - this['__' + key] = coerceBooleanProperty(next); - }; +export const coerceBoolean = () => (target: any, key: string): void => { + const getter = function() { + return this['__' + key]; + }; - Object.defineProperty(target, key, { - get: getter, - set: setter, - enumerable: true, - configurable: true, - }); + const setter = function(next: any) { + this['__' + key] = coerceBooleanProperty(next); }; -} + + Object.defineProperty(target, key, { + get: getter, + set: setter, + enumerable: true, + configurable: true, + }); +}; diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts index f54d1f6793..7753eef59c 100644 --- a/ui-ngx/src/app/shared/models/notification.models.ts +++ b/ui-ngx/src/app/shared/models/notification.models.ts @@ -74,7 +74,7 @@ export interface NotificationRequestPreview { export interface NotificationRequestStats { sent: Map; - errors: { [key in NotificationDeliveryMethod]: {[key in string]: string}}; + errors: { [key in NotificationDeliveryMethod]: {[errorKey in string]: string}}; processedRecipients: Map>; } @@ -109,8 +109,9 @@ export interface NotificationRule extends Omit, 'la additionalConfig: {description: string}; } -export type NotificationRuleTriggerConfig = Partial +export type NotificationRuleTriggerConfig = Partial; export interface AlarmNotificationRuleTriggerConfig { alarmTypes?: Array; @@ -120,7 +121,7 @@ export interface AlarmNotificationRuleTriggerConfig { } interface ClearRule { - alarmStatuses: Array + alarmStatuses: Array; } export interface DeviceInactivityNotificationRuleTriggerConfig { @@ -169,7 +170,7 @@ export const ComponentLifecycleEventTranslationMap = new Map([ [AlarmAction.SEVERITY_CHANGED, 'notification.notify-alarm-action.severity-changed'], [AlarmAction.ACKNOWLEDGED, 'notification.notify-alarm-action.acknowledged'], [AlarmAction.CLEARED, 'notification.notify-alarm-action.cleared'] -]) +]); export enum AlarmAssignmentAction { ASSIGNED = 'ASSIGNED', @@ -193,7 +194,7 @@ export enum AlarmAssignmentAction { export const AlarmAssignmentActionTranslationMap = new Map([ [AlarmAssignmentAction.ASSIGNED, 'notification.notify-alarm-action.assigned'], [AlarmAssignmentAction.UNASSIGNED, 'notification.notify-alarm-action.unassigned'] -]) +]); export interface NotificationRuleRecipientConfig { targets?: Array; diff --git a/ui-ngx/src/app/shared/models/websocket/notification-ws.models.ts b/ui-ngx/src/app/shared/models/websocket/notification-ws.models.ts index effd4fd334..da876d0d3f 100644 --- a/ui-ngx/src/app/shared/models/websocket/notification-ws.models.ts +++ b/ui-ngx/src/app/shared/models/websocket/notification-ws.models.ts @@ -186,15 +186,15 @@ export interface NotificationsUpdateMsg extends CmdUpdateMsg { export type WebsocketNotificationMsg = NotificationCountUpdateMsg | NotificationsUpdateMsg; -export function isNotificationCountUpdateMsg(message: WebsocketNotificationMsg): message is NotificationCountUpdateMsg { +export const isNotificationCountUpdateMsg = (message: WebsocketNotificationMsg): message is NotificationCountUpdateMsg => { const updateMsg = (message as CmdUpdateMsg); return updateMsg.cmdId !== undefined && updateMsg.cmdUpdateType === CmdUpdateType.NOTIFICATIONS_COUNT; -} +}; -export function isNotificationsUpdateMsg(message: WebsocketNotificationMsg): message is NotificationsUpdateMsg { +export const isNotificationsUpdateMsg = (message: WebsocketNotificationMsg): message is NotificationsUpdateMsg => { const updateMsg = (message as CmdUpdateMsg); return updateMsg.cmdId !== undefined && updateMsg.cmdUpdateType === CmdUpdateType.NOTIFICATIONS; -} +}; export class NotificationPluginCmdWrapper implements CmdWrapper {