diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.html b/ui-ngx/src/app/shared/components/time/timeinterval.component.html
index 3cf001e426..a67cbdd9be 100644
--- a/ui-ngx/src/app/shared/components/time/timeinterval.component.html
+++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.html
@@ -20,8 +20,18 @@
-
-
+
+
+
+ {{ predefinedName }}
+
+
+ {{ interval.name | translate:interval.translateParams }}
+
+
+
+
+
-
-
- {{ predefinedName }}
-
-
- {{ interval.name | translate:interval.translateParams }}
-
-
-
-
diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts
index 906d938d0b..4ffb18d624 100644
--- a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts
+++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts
@@ -22,6 +22,7 @@ import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-
import { coerceBoolean } from '@shared/decorators/coercion';
import { Interval, IntervalMath, TimeInterval } from '@shared/models/time/time.models';
import { isDefined } from '@core/utils';
+import { IntervalType } from '@shared/models/telemetry/telemetry.models';
@Component({
selector: 'tb-timeinterval',
@@ -98,6 +99,12 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
advanced = false;
+ customTimeInterval: TimeInterval = {
+ name: 'timeinterval.custom',
+ translateParams: {},
+ value: IntervalType.CUSTOM
+ };
+
private modelValue: Interval;
private rendered = false;
private propagateChangeValue: any;
@@ -134,8 +141,14 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
const min = this.timeService.boundMinInterval(this.minValue);
const max = this.timeService.boundMaxInterval(this.maxValue);
if (IntervalMath.numberValue(this.modelValue) >= min && IntervalMath.numberValue(this.modelValue) <= max) {
- this.advanced = !this.timeService.matchesExistingInterval(this.minValue, this.maxValue, this.modelValue, this.useCalendarIntervals);
- this.setInterval(this.modelValue);
+ const advanced = !this.timeService.matchesExistingInterval(this.minValue, this.maxValue, this.modelValue,
+ this.useCalendarIntervals);
+ if (advanced && this.disabledAdvanced) {
+ this.boundInterval();
+ } else {
+ this.advanced = advanced;
+ this.setInterval(this.modelValue);
+ }
} else {
this.boundInterval();
}
@@ -143,9 +156,9 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
}
private setInterval(interval: Interval) {
- if (!this.advanced) {
+ // if (!this.advanced) {
this.interval = interval;
- }
+ // }
const intervalSeconds = Math.floor(IntervalMath.numberValue(interval) / 1000);
this.days = Math.floor(intervalSeconds / 86400);
this.hours = Math.floor((intervalSeconds % 86400) / 3600);
diff --git a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
index e1c6af620b..54ebbf3f14 100644
--- a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
+++ b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
@@ -186,7 +186,8 @@ export enum IntervalType {
WEEK = 'WEEK',
WEEK_ISO = 'WEEK_ISO',
MONTH = 'MONTH',
- QUARTER = 'QUARTER'
+ QUARTER = 'QUARTER',
+ CUSTOM = 'CUSTOM'
}
export class TimeseriesSubscriptionCmd extends SubscriptionCmd {
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 cbd9be152b..1509a434c7 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -4609,6 +4609,7 @@
"minutes": "Minutes",
"seconds": "Seconds",
"advanced": "Advanced",
+ "custom": "Custom",
"predefined": {
"yesterday": "Yesterday",
"day-before-yesterday": "Day before yesterday",