From 472569d5e1fbf2b5b768f043e4d6d0e4e97dc95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fr=C3=BCholz?= <78954450+Marcelfrueh@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:21:47 +0200 Subject: [PATCH] feat: Add time selection menu for single widgets in dashboard (#3240) --- .../model/dashboard/DashboardItem.java | 10 +++ .../lib/model/dashboard/dashboard.model.ts | 1 + .../src/lib/model/datalake/DateRange.ts | 5 ++ .../src/lib/model/gen/streampipes-model.ts | 6 +- ...custom-time-range-selection.component.html | 1 + .../time-selector-menu.component.html | 1 + ...a-explorer-dashboard-widget.component.html | 28 +++++++++ ...ata-explorer-dashboard-widget.component.ts | 61 +++++++++++++++++-- .../base-data-explorer-widget.directive.ts | 26 +++++--- ...lorer-edit-dashboard-dialog.component.html | 3 +- .../models/dataview-dashboard.model.ts | 1 + .../services/time-selection.service.ts | 10 +-- 12 files changed, 134 insertions(+), 19 deletions(-) diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardItem.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardItem.java index c7962b0411..81759642cb 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardItem.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardItem.java @@ -18,6 +18,7 @@ package org.apache.streampipes.model.dashboard; import java.util.List; +import java.util.Map; public class DashboardItem { @@ -31,6 +32,7 @@ public class DashboardItem { private Integer rows; private Integer x; private Integer y; + private Map timeSettings; public DashboardItem() { @@ -99,4 +101,12 @@ public Integer getY() { public void setY(Integer y) { this.y = y; } + + public Map getTimeSettings() { + return timeSettings; + } + + public void setTimeSettings(Map timeSettings) { + this.timeSettings = timeSettings; + } } diff --git a/ui/projects/streampipes/platform-services/src/lib/model/dashboard/dashboard.model.ts b/ui/projects/streampipes/platform-services/src/lib/model/dashboard/dashboard.model.ts index 8a65f934ed..532a19b2d4 100644 --- a/ui/projects/streampipes/platform-services/src/lib/model/dashboard/dashboard.model.ts +++ b/ui/projects/streampipes/platform-services/src/lib/model/dashboard/dashboard.model.ts @@ -25,6 +25,7 @@ export interface DashboardConfig extends GridsterConfig {} export interface ClientDashboardItem extends GridsterItem { widgetId: string; widgetType: string; + timeSettings?: TimeSettings; id: string; } 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 6c305f6dd4..9f3cff7d29 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?: TimeSelectionId; } +export interface WidgetTimeSettings { + timeSettings: TimeSettings; + widgetIndex?: number; +} + export interface TimeString { startDate: string; startTime: string; diff --git a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts index 7c9650ec20..398a67c5f7 100644 --- a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts +++ b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts @@ -20,7 +20,7 @@ /* tslint:disable */ /* eslint-disable */ // @ts-nocheck -// Generated using typescript-generator version 3.2.1263 on 2024-09-10 17:11:03. +// Generated using typescript-generator version 3.2.1263 on 2024-09-18 15:50:05. export class NamedStreamPipesEntity implements Storable { '@class': @@ -970,6 +970,7 @@ export class DashboardItem { name: string; rows: number; settings: string[]; + timeSettings: { [index: string]: any }; x: number; y: number; @@ -989,6 +990,9 @@ export class DashboardItem { instance.settings = __getCopyArrayFn(__identity())( data.settings, ); + instance.timeSettings = __getCopyObjectFn(__identity())( + data.timeSettings, + ); instance.x = data.x; instance.y = data.y; return instance; diff --git a/ui/src/app/data-explorer/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.html b/ui/src/app/data-explorer/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.html index 9e277f0ca6..1564d9b5dc 100644 --- a/ui/src/app/data-explorer/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.html +++ b/ui/src/app/data-explorer/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.html @@ -74,6 +74,7 @@
+
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 fa9617a0ed..ea476a9846 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 @@ -111,6 +111,34 @@ > get_app + + + + + +