diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html index 860072fbbd..c2e8de37c4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html @@ -40,6 +40,7 @@ keySettingsTitle="{{ 'widgets.table.column-settings' | translate }}" removeKeyTitle="{{ 'widgets.table.remove-column' | translate }}" noKeysText="{{ 'widgets.table.no-columns' | translate }}" + requiredKeysText="{{ 'widgets.table.alarm-column-error' | translate }}" hideDataKeyColor hideUnits hideDecimals diff --git a/ui-ngx/src/app/shared/components/tb-error.component.ts b/ui-ngx/src/app/shared/components/tb-error.component.ts index 5ddd2d7896..c0055df1f1 100644 --- a/ui-ngx/src/app/shared/components/tb-error.component.ts +++ b/ui-ngx/src/app/shared/components/tb-error.component.ts @@ -14,17 +14,17 @@ /// limitations under the License. /// -import { Component, Input } from '@angular/core'; +import { ChangeDetectorRef, Component, Input } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-error', template: ` -
- - {{message}} - +
+ + {{message}} +
`, styles: [` @@ -36,21 +36,23 @@ import { coerceBoolean } from '@shared/decorators/coercion'; trigger('animation', [ state('show', style({ opacity: 1, + transform: 'translateY(0)' })), state('hide', style({ opacity: 0, transform: 'translateY(-1rem)' })), - transition('show => hide', animate('200ms ease-out')), - transition('* => show', animate('200ms ease-in')) - + transition('* <=> *', animate('200ms ease-out')) ]), ] }) export class TbErrorComponent { - errorValue: any; - state: any; - message; + errorValue: string; + state = 'hide'; + message: string; + + constructor(private cd: ChangeDetectorRef) { + } @Input() @coerceBoolean() @@ -58,15 +60,13 @@ export class TbErrorComponent { @Input() set error(value) { - if (value && !this.message) { - this.message = value; - this.state = 'hide'; - setTimeout(() => { - this.state = 'show'; - }); - } else { + if (this.errorValue !== value) { this.errorValue = value; + if (value) { + this.message = value; + } this.state = value ? 'show' : 'hide'; + this.cd.markForCheck(); } } } 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 a15108e1b4..dde8b8a056 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -6314,6 +6314,7 @@ "pagination": "Pagination", "rows": "Rows", "timeseries-column-error": "At least one timeseries column should be specified", + "alarm-column-error": "At least one alarm column should be specified", "table-tabs": "Table tabs", "show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode" },