From 78b7ef676935cca94d14751ae35a04b1e9e6ae78 Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Mon, 2 Sep 2024 16:36:06 +0300 Subject: [PATCH] Clear styles and delete unused --- .../timewindow-config-dialog.component.html | 2 +- .../time/timewindow-panel.component.html | 5 +- .../time/timewindow-panel.component.scss | 2 +- .../time/timezone-panel.component.html | 23 ++++++-- .../time/timezone-panel.component.scss | 18 ------- .../components/time/timezone.component.html | 10 +--- .../components/time/timezone.component.ts | 54 +------------------ .../shared/models/widget-settings.models.ts | 13 ----- 8 files changed, 26 insertions(+), 101 deletions(-) diff --git a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html index 74a0204c26..d7cedd3b71 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html +++ b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html @@ -25,7 +25,7 @@ close -
+
diff --git a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html index 45a735187c..adc1b9b8cd 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html +++ b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html @@ -15,7 +15,7 @@ limitations under the License. --> - + @@ -121,8 +121,7 @@
- - +
- {{ computedTimezoneStyle.icon }}
- {{timezoneInfo}} + {{displayValue()}}
- {{ computedTimezoneStyle.icon }}
diff --git a/ui-ngx/src/app/shared/components/time/timezone.component.ts b/ui-ngx/src/app/shared/components/time/timezone.component.ts index 8f0f2eee40..f662b4c452 100644 --- a/ui-ngx/src/app/shared/components/time/timezone.component.ts +++ b/ui-ngx/src/app/shared/components/time/timezone.component.ts @@ -20,10 +20,8 @@ import { forwardRef, HostBinding, Input, - OnChanges, OnInit, Renderer2, - SimpleChanges, ViewContainerRef } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; @@ -31,13 +29,6 @@ import { TranslateService } from '@ngx-translate/core'; import { TooltipPosition } from '@angular/material/tooltip'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { coerceBoolean } from '@shared/decorators/coercion'; -import { - ComponentStyle, - defaultTimezoneStyle, - iconStyle, - textStyle, - TimezoneStyle -} from '@shared/models/widget-settings.models'; import { TimezonePanelComponent, TimezoneSelectionResult } from '@shared/components/time/timezone-panel.component'; import { TbPopoverService } from '@shared/components/popover.service'; import { getTimezoneInfo, TimezoneInfo } from '@shared/models/time/time.models'; @@ -56,7 +47,7 @@ import { TimeService } from '@core/services/time.service'; } ] }) -export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChanges { +export class TimezoneComponent implements ControlValueAccessor, OnInit { @HostBinding('class.no-margin') @Input() @@ -91,24 +82,9 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange @coerceBoolean() hideLabel = false; - isEditValue = false; - - @Input() - set isEdit(val) { - this.isEditValue = coerceBooleanProperty(val); - this.timezoneDisabled = this.isTimezoneDisabled(); - } - - get isEdit() { - return this.isEditValue; - } - @Input() tooltipPosition: TooltipPosition = 'above'; - @Input() - timezoneStyle: TimezoneStyle; - @Input() @coerceBoolean() disabled: boolean; @@ -155,10 +131,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange timezoneDisabled: boolean; - computedTimezoneStyle: TimezoneStyle; - timezoneComponentStyle: ComponentStyle; - timezoneIconStyle: ComponentStyle; - private propagateChange = (_: any) => {}; constructor(private translate: TranslateService, @@ -170,19 +142,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange } ngOnInit() { - this.updateTimezoneStyle(); - } - - ngOnChanges(changes: SimpleChanges): void { - for (const propName of Object.keys(changes)) { - const change = changes[propName]; - if (!change.firstChange && change.currentValue !== change.previousValue) { - if (propName === 'timezoneStyle') { - this.updateTimezoneStyle(); - this.updateDisplayValue(); - } - } - } } toggleTimezone($event: Event) { @@ -221,17 +180,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange this.cd.detectChanges(); } - private updateTimezoneStyle() { - if (!this.asButton) { - this.computedTimezoneStyle = {...defaultTimezoneStyle, ...(this.timezoneStyle || {})}; - this.timezoneComponentStyle = textStyle(this.computedTimezoneStyle.font); - if (this.computedTimezoneStyle.color) { - this.timezoneComponentStyle.color = this.computedTimezoneStyle.color; - } - this.timezoneIconStyle = this.computedTimezoneStyle.iconSize ? iconStyle(this.computedTimezoneStyle.iconSize) : {}; - } - } - registerOnChange(fn: any): void { this.propagateChange = fn; } diff --git a/ui-ngx/src/app/shared/models/widget-settings.models.ts b/ui-ngx/src/app/shared/models/widget-settings.models.ts index dbe75a5b36..5124458ff0 100644 --- a/ui-ngx/src/app/shared/models/widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/widget-settings.models.ts @@ -262,19 +262,6 @@ export const defaultTimewindowStyle: TimewindowStyle = { displayTypePrefix: true }; -export interface TimezoneStyle { - showIcon: boolean; - icon?: string; - iconSize?: string; - iconPosition?: 'left' | 'right'; - font?: Font; - color?: string; -} - -export const defaultTimezoneStyle: TimezoneStyle = { - showIcon: false -}; - export const constantColor = (color: string): ColorSettings => ({ type: ColorType.constant, color,