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 }}" keySettingsTitle="{{ 'widgets.table.column-settings' | translate }}"
removeKeyTitle="{{ 'widgets.table.remove-column' | translate }}" removeKeyTitle="{{ 'widgets.table.remove-column' | translate }}"
noKeysText="{{ 'widgets.table.no-columns' | translate }}" noKeysText="{{ 'widgets.table.no-columns' | translate }}"
requiredKeysText="{{ 'widgets.table.alarm-column-error' | translate }}"
hideDataKeyColor hideDataKeyColor
hideUnits hideUnits
hideDecimals hideDecimals

36
ui-ngx/src/app/shared/components/tb-error.component.ts

@ -14,17 +14,17 @@
/// limitations under the License. /// 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 { animate, state, style, transition, trigger } from '@angular/animations';
import { coerceBoolean } from '@shared/decorators/coercion'; import { coerceBoolean } from '@shared/decorators/coercion';
@Component({ @Component({
selector: 'tb-error', selector: 'tb-error',
template: ` template: `
<div [@animation]="state" [ngStyle]="{marginTop: noMargin ? '0' : '0.5rem', fontSize: '.75rem'}"> <div [@animation]="state" [ngStyle]="{marginTop: noMargin ? '0' : '0.5rem', fontSize: '.75rem'}">
<mat-error > <mat-error>
{{message}} {{message}}
</mat-error> </mat-error>
</div> </div>
`, `,
styles: [` styles: [`
@ -36,21 +36,23 @@ import { coerceBoolean } from '@shared/decorators/coercion';
trigger('animation', [ trigger('animation', [
state('show', style({ state('show', style({
opacity: 1, opacity: 1,
transform: 'translateY(0)'
})), })),
state('hide', style({ state('hide', style({
opacity: 0, opacity: 0,
transform: 'translateY(-1rem)' transform: 'translateY(-1rem)'
})), })),
transition('show => hide', animate('200ms ease-out')), transition('* <=> *', animate('200ms ease-out'))
transition('* => show', animate('200ms ease-in'))
]), ]),
] ]
}) })
export class TbErrorComponent { export class TbErrorComponent {
errorValue: any; errorValue: string;
state: any; state = 'hide';
message; message: string;
constructor(private cd: ChangeDetectorRef) {
}
@Input() @Input()
@coerceBoolean() @coerceBoolean()
@ -58,15 +60,13 @@ export class TbErrorComponent {
@Input() @Input()
set error(value) { set error(value) {
if (value && !this.message) { if (this.errorValue !== value) {
this.message = value;
this.state = 'hide';
setTimeout(() => {
this.state = 'show';
});
} else {
this.errorValue = value; this.errorValue = value;
if (value) {
this.message = value;
}
this.state = value ? 'show' : 'hide'; 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", "pagination": "Pagination",
"rows": "Rows", "rows": "Rows",
"timeseries-column-error": "At least one timeseries column should be specified", "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", "table-tabs": "Table tabs",
"show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode" "show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode"
}, },

Loading…
Cancel
Save