Browse Source

Merge pull request #9533 from Dmitriymush/bug-fix/tables-setting-columns-error

Fixed alarm table basic settings columns error appearense and anomaly with changeDetection
pull/9583/head
Igor Kulikov 3 years ago
committed by GitHub
parent
commit
87b5b2074f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html
  2. 36
      ui-ngx/src/app/shared/components/tb-error.component.ts
  3. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

1
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

36
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: `
<div [@animation]="state" [ngStyle]="{marginTop: noMargin ? '0' : '0.5rem', fontSize: '.75rem'}">
<mat-error >
{{message}}
</mat-error>
<div [@animation]="state" [ngStyle]="{marginTop: noMargin ? '0' : '0.5rem', fontSize: '.75rem'}">
<mat-error>
{{message}}
</mat-error>
</div>
`,
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();
}
}
}

1
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"
},

Loading…
Cancel
Save