diff --git a/ui/projects/streampipes/platform-services/src/lib/model/datalake/DateRange.ts b/ui/projects/streampipes/platform-services/src/lib/model/datalake/DateRange.ts
index f061e5daff..c6e6a589c7 100644
--- a/ui/projects/streampipes/platform-services/src/lib/model/datalake/DateRange.ts
+++ b/ui/projects/streampipes/platform-services/src/lib/model/datalake/DateRange.ts
@@ -24,6 +24,11 @@ export interface TimeSettings {
timeSelectionId?: string;
}
+export interface ExtendedTimeSettings {
+ timeSettings: TimeSettings;
+ supportsLiveRefresh: boolean;
+}
+
export class TimeSelectionConstants {
static CUSTOM = 'custom';
static LAST_15_MINUTES = 'last-15-minutes';
@@ -101,6 +106,7 @@ export interface QuickTimeSelection {
startTime: (now: Date) => Date;
endTime: (now: Date) => Date;
addDividerAfter?: boolean;
+ supportsLiveRefresh?: boolean;
}
export class DateRange {
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.html
index 36b2b76cfe..84f316bcda 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.html
@@ -23,6 +23,7 @@
[matMenuTriggerFor]="menu"
aria-label="Refresh interval"
matTooltip="Refresh interval"
+ [disabled]="!liveRefreshEnabled"
>
autorenew
{{ liveSettings.label }}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.ts
index 520dddbaa3..b60e4e1c78 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/refresh-interval-settings/refresh-interval-settings.component.ts
@@ -33,6 +33,8 @@ export class DataExplorerRefreshIntervalSettingsComponent implements OnInit {
@Input()
availableOptions: DashboardLiveSettings[];
+ liveRefreshEnabled: boolean;
+
ngOnInit() {
if (!this.liveSettings?.label) {
this.liveSettings = this.availableOptions[0];
@@ -43,4 +45,11 @@ export class DataExplorerRefreshIntervalSettingsComponent implements OnInit {
this.liveSettings = option;
this.intervalSettingsChangedEmitter.emit(option);
}
+
+ handleEnableLiveRefresh(liveRefreshEnabled: boolean) {
+ if (this.liveRefreshEnabled === true && liveRefreshEnabled === false) {
+ this.intervalSettingsChangedEmitter.emit(this.availableOptions[0]);
+ }
+ this.liveRefreshEnabled = liveRefreshEnabled;
+ }
}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.html
index 58c976fd71..97aa766d30 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.html
@@ -88,7 +88,8 @@
();
@@ -68,6 +75,9 @@ export class TimeRangeSelectorComponent implements OnInit, OnChanges {
@Input()
enableTimeChange = true;
+ @Input()
+ showIntervalSettings = true;
+
@Input()
maxDayRange = 0;
@@ -107,12 +117,44 @@ export class TimeRangeSelectorComponent implements OnInit, OnChanges {
}
}
+ ngAfterViewInit(): void {
+ this.changeLiveRefreshEnabled();
+ }
+
+ changeLiveRefreshEnabled(): void {
+ if (
+ this.timeSettings.timeSelectionId ===
+ TimeSelectionConstants.CUSTOM ||
+ this.hasLiveRefreshEnabled(this.timeSettings.timeSelectionId) ===
+ false
+ ) {
+ this.refreshIntervalSettingsComponent?.handleEnableLiveRefresh(
+ false,
+ );
+ } else {
+ this.refreshIntervalSettingsComponent?.handleEnableLiveRefresh(
+ true,
+ );
+ }
+ }
+
+ hasLiveRefreshEnabled(timeSelectionId: string) {
+ const selectedQuickTimeSelection = this.quickSelections.find(
+ qs => timeSelectionId === qs.timeSelectionId,
+ );
+ return selectedQuickTimeSelection.supportsLiveRefresh;
+ }
+
applyPreviousInterval(): void {
+ this.timeSettings.timeSelectionId = TimeSelectionConstants.CUSTOM;
this.changeTimeByInterval((a, b) => a - b);
+ this.changeLiveRefreshEnabled();
}
applyNextInterval(): void {
+ this.timeSettings.timeSelectionId = TimeSelectionConstants.CUSTOM;
this.changeTimeByInterval((a, b) => a + b);
+ this.changeLiveRefreshEnabled();
}
compare(newDateRange: TimeSettings, oldDateRange: TimeSettings): boolean {
@@ -160,8 +202,11 @@ export class TimeRangeSelectorComponent implements OnInit, OnChanges {
this.reloadData();
}
- applyCurrentDateRange(timeSettings: TimeSettings) {
- this.timeSettings = timeSettings;
+ applyCurrentDateRange(extendedTimeSettings: ExtendedTimeSettings) {
+ this.timeSettings = extendedTimeSettings.timeSettings;
+ this.refreshIntervalSettingsComponent?.handleEnableLiveRefresh(
+ extendedTimeSettings.supportsLiveRefresh,
+ );
this.createDateString();
this.menu.closeMenu();
this.reloadData();
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.html
index 2bfda05f10..1dfc7f7119 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.html
@@ -46,7 +46,12 @@
#timeRangeSelection
[timeSettings]="timeSettings"
[labels]="labels"
- (timeSettingsEmitter)="timeSettingsEmitter.emit($event)"
+ (timeSettingsEmitter)="
+ timeSettingsEmitter.emit({
+ supportsLiveRefresh: false,
+ timeSettings: $event
+ })
+ "
[enableTimeChange]="enableTimeChange"
[maxDayRange]="maxDayRange"
class="w-100"
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
index a2748d9a47..318ce9ff79 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
@@ -27,6 +27,7 @@ import {
import {
QuickTimeSelection,
TimeSettings,
+ ExtendedTimeSettings,
} from '@streampipes/platform-services';
import { TimeSelectionService } from '../../../services/time-selection.service';
import { CustomTimeRangeSelectionComponent } from './custom-time-range-selection/custom-time-range-selection.component';
@@ -51,8 +52,8 @@ export class TimeRangeSelectorMenuComponent implements OnInit {
maxDayRange: number;
@Output()
- timeSettingsEmitter: EventEmitter =
- new EventEmitter();
+ timeSettingsEmitter: EventEmitter =
+ new EventEmitter();
@Input()
quickSelections: QuickTimeSelection[];
@@ -72,7 +73,10 @@ export class TimeRangeSelectorMenuComponent implements OnInit {
this.timeSettings.endTime = selectedDateRange.endDate.getTime();
this.timeRangeSelection.initializeDateRange();
this.triggerDisplayUpdate();
- this.timeSettingsEmitter.emit(this.timeSettings);
+ this.timeSettingsEmitter.emit({
+ supportsLiveRefresh: quickSelection.supportsLiveRefresh,
+ timeSettings: this.timeSettings,
+ });
}
triggerDisplayUpdate(): void {
diff --git a/ui/projects/streampipes/shared-ui/src/lib/services/time-selection.service.ts b/ui/projects/streampipes/shared-ui/src/lib/services/time-selection.service.ts
index be9d657fd4..cca6465323 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/services/time-selection.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/services/time-selection.service.ts
@@ -66,66 +66,77 @@ export class TimeSelectionService {
timeSelectionId: TimeSelectionConstants.LAST_15_MINUTES,
startTime: now => subMinutes(now, 15),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Last 1 hour',
timeSelectionId: TimeSelectionConstants.LAST_HOUR,
startTime: now => subHours(now, 1),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Last 1 day',
timeSelectionId: TimeSelectionConstants.LAST_DAY,
startTime: now => subDays(now, 1),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Last 1 week',
timeSelectionId: TimeSelectionConstants.LAST_WEEK,
startTime: now => subWeeks(now, 1),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Last 1 month',
timeSelectionId: TimeSelectionConstants.LAST_MONTH,
startTime: now => subMonths(now, 1),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Last 1 year',
timeSelectionId: TimeSelectionConstants.LAST_YEAR,
startTime: now => subYears(now, 1),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Current day',
timeSelectionId: TimeSelectionConstants.CURRENT_DAY,
startTime: now => startOfDay(now),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Current hour',
timeSelectionId: TimeSelectionConstants.CURRENT_HOUR,
startTime: now => startOfHour(now),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Current week',
timeSelectionId: TimeSelectionConstants.CURRENT_WEEK,
startTime: now => startOfWeek(now),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Current month',
timeSelectionId: TimeSelectionConstants.CURRENT_MONTH,
startTime: now => startOfMonth(now),
endTime: now => now,
+ supportsLiveRefresh: true,
},
{
label: 'Current year',
timeSelectionId: TimeSelectionConstants.CURRENT_YEAR,
startTime: now => startOfYear(now),
endTime: now => now,
+ supportsLiveRefresh: true,
},
];
diff --git a/ui/projects/streampipes/shared-ui/src/public-api.ts b/ui/projects/streampipes/shared-ui/src/public-api.ts
index 40fe20fa0a..ab70e0b106 100644
--- a/ui/projects/streampipes/shared-ui/src/public-api.ts
+++ b/ui/projects/streampipes/shared-ui/src/public-api.ts
@@ -39,6 +39,7 @@ export * from './lib/components/sp-exception-message/exception-details/exception
export * from './lib/components/sp-label/sp-label.component';
export * from './lib/components/sp-table/sp-table.component';
export * from './lib/components/warning-box/warning-box.component';
+export * from './lib/components/time-selector/time-selector.model';
export * from './lib/components/time-selector/time-range-selector.component';
export * from './lib/components/time-selector/time-selector-menu/time-selector-menu.component';
export * from './lib/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component';
diff --git a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.html b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.html
index 54e23fe4f9..5bdfed7df1 100644
--- a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.html
+++ b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.html
@@ -65,7 +65,7 @@
[matMenuTriggerFor]="menu"
aria-label="More options"
matTooltip="More options"
- *ngIf="!editMode && !dataViewMode"
+ *ngIf="!dataViewMode"
[attr.data-cy]="
'more-options-' +
configuredWidget.baseAppearanceConfig.widgetTitle.replaceAll(
@@ -97,20 +97,6 @@
Edit Widget
-