UI: Fixed some time new time windows intervals not apply

This commit is contained in:
Vladyslav_Prykhodko 2024-03-20 12:50:50 +02:00 committed by Chantsova Ekaterina
parent eceed0c4b1
commit 03c3079100
3 changed files with 20 additions and 16 deletions

View File

@ -51,7 +51,8 @@
"import/order": "off",
"@typescript-eslint/member-ordering": "off",
"no-underscore-dangle": "off",
"@typescript-eslint/naming-convention": "off"
"@typescript-eslint/naming-convention": "off",
"jsdoc/newline-after-description": 0
}
},
{

View File

@ -21,6 +21,7 @@ import { coerceNumberProperty } from '@angular/cdk/coercion';
import { SubscriptSizing } from '@angular/material/form-field';
import { coerceBoolean } from '@shared/decorators/coercion';
import { Interval, IntervalMath, TimeInterval } from '@shared/models/time/time.models';
import { isDefined } from '@core/utils';
@Component({
selector: 'tb-timeinterval',
@ -90,14 +91,14 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
secs = 0;
interval: Interval = 0;
modelValue: Interval;
advanced = false;
rendered = false;
intervals: Array<TimeInterval>;
private propagateChange = (_: any) => {};
advanced = false;
private modelValue: Interval;
private rendered = false;
private propagateChange: (value: any) => void = () => {};
constructor(private timeService: TimeService) {
}
@ -108,6 +109,9 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
registerOnChange(fn: any): void {
this.propagateChange = fn;
if (isDefined(this.modelValue) && this.rendered) {
this.propagateChange(this.modelValue);
}
}
registerOnTouched(fn: any): void {
@ -132,7 +136,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
}
}
setInterval(interval: Interval) {
private setInterval(interval: Interval) {
if (!this.advanced) {
this.interval = interval;
}
@ -143,7 +147,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
this.secs = intervalSeconds % 60;
}
boundInterval(updateToPreferred = false) {
private boundInterval(updateToPreferred = false) {
const min = this.timeService.boundMinInterval(this.minValue);
const max = this.timeService.boundMaxInterval(this.maxValue);
this.intervals = this.timeService.getIntervals(this.minValue, this.maxValue, this.useCalendarIntervals);
@ -165,7 +169,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
}
}
updateView(updateToPreferred = false) {
private updateView(updateToPreferred = false) {
if (!this.rendered) {
return;
}
@ -187,7 +191,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
this.boundInterval(updateToPreferred);
}
calculateIntervalMs(): number {
private calculateIntervalMs(): number {
return (this.days * 86400 +
this.hours * 3600 +
this.mins * 60 +
@ -232,7 +236,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
}
}
onSecsChange() {
private onSecsChange() {
if (typeof this.secs === 'undefined') {
return;
}
@ -252,7 +256,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
this.updateView();
}
onMinsChange() {
private onMinsChange() {
if (typeof this.mins === 'undefined') {
return;
}
@ -272,7 +276,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
this.updateView();
}
onHoursChange() {
private onHoursChange() {
if (typeof this.hours === 'undefined') {
return;
}
@ -292,7 +296,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
this.updateView();
}
onDaysChange() {
private onDaysChange() {
if (typeof this.days === 'undefined') {
return;
}

View File

@ -20,7 +20,6 @@ import {
AggregationType,
DAY,
HistoryWindowType,
QuickTimeInterval,
quickTimeIntervalPeriod,
RealtimeWindowType,
Timewindow,