You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/06/13 08:15:37 UTC
(streampipes) 01/03: feat: Ease chart selection in dashboard
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a commit to branch load-summary-charts-in-dashboard
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 4ff4e9ffd0966fd904ebc158cfaeb36ec942ee71
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sat Jun 13 09:30:33 2026 +0200
feat: Ease chart selection in dashboard
---
.../model/datalake/ChartSummaryDto.java | 1 +
.../DataExplorerWidgetResourceManager.java | 22 +++++++++++++++++++
.../lib/model/resource/resource-summary.model.ts | 1 +
.../chart-preview/chart-preview.component.html | 25 +++++++++++-----------
.../chart-preview/chart-preview.component.ts | 6 +++---
.../chart-selection/chart-selection.component.ts | 17 ++++++---------
6 files changed, 45 insertions(+), 27 deletions(-)
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ChartSummaryDto.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ChartSummaryDto.java
index eb6f6035a5..a4c0e98537 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ChartSummaryDto.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/ChartSummaryDto.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.model.datalake;
public record ChartSummaryDto(String elementId,
String name,
+ String datasetName,
Long createdAtEpochMs,
Long lastModifiedEpochMs,
String widgetType,
diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerWidgetResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerWidgetResourceManager.java
index 7d6b841d1e..09fe152f01 100644
--- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerWidgetResourceManager.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerWidgetResourceManager.java
@@ -26,6 +26,8 @@ import org.apache.streampipes.storage.api.explorer.IDataExplorerWidgetStorage;
import org.springframework.security.core.Authentication;
import java.util.Collection;
+import java.util.List;
+import java.util.Map;
public class DataExplorerWidgetResourceManager extends CrudResourceManager<DataExplorerWidgetModel> {
@@ -44,6 +46,7 @@ public class DataExplorerWidgetResourceManager extends CrudResourceManager<DataE
.map(chart -> new ChartSummaryDto(
chart.getElementId(),
getChartName(chart),
+ getDatasetName(chart),
getCreatedAt(chart),
getLastModified(chart),
chart.getWidgetType(),
@@ -81,6 +84,25 @@ public class DataExplorerWidgetResourceManager extends CrudResourceManager<DataE
return false;
}
+ private String getDatasetName(DataExplorerWidgetModel chart) {
+ if (chart == null || chart.getDataConfig() == null) {
+ return null;
+ }
+
+ Object sourceConfigs = chart.getDataConfig().get("sourceConfigs");
+ if (!(sourceConfigs instanceof List<?> configs) || configs.isEmpty()) {
+ return null;
+ }
+
+ Object firstConfig = configs.get(0);
+ if (!(firstConfig instanceof Map<?, ?> config)) {
+ return null;
+ }
+
+ Object measureName = config.get("measureName");
+ return measureName instanceof String ? (String) measureName : null;
+ }
+
private String getChartName(DataExplorerWidgetModel chart) {
if (chart == null || chart.getBaseAppearanceConfig() == null) {
return chart != null ? chart.getElementId() : null;
diff --git a/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts b/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
index b4348b7d19..b3ca4026a8 100644
--- a/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
+++ b/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
@@ -74,6 +74,7 @@ export interface PipelineSummaryDto {
export interface ChartSummaryDto {
elementId: string;
name: string;
+ datasetName: string | null;
createdAtEpochMs: number | null;
lastModifiedEpochMs: number | null;
multiSourceChart: boolean;
diff --git a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.html b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.html
index dd3be00b33..52d80b569e 100644
--- a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.html
+++ b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.html
@@ -19,14 +19,11 @@
<div
fxLayout="row"
class="data-view-preview-outer"
- [attr.data-cy]="
- 'add-data-view-btn-' +
- chart.baseAppearanceConfig.widgetTitle.replaceAll(' ', '')
- "
+ [attr.data-cy]="'add-data-view-btn-' + chart.name.replaceAll(' ', '')"
(click)="addChartEmitter.emit(chart.elementId)"
>
<div fxFlex fxLayout="column">
- <h5>{{ chart.baseAppearanceConfig.widgetTitle }}</h5>
+ <h5>{{ chart.name }}</h5>
<div fxLayout="row" fxLayoutGap="15px" class="text-sm">
<span fxLayoutAlign="start center"
><mat-icon color="primary">insert_chart</mat-icon></span
@@ -35,14 +32,16 @@
widgetTypeLabel
}}</span>
</div>
- <div fxLayout="row" fxLayoutGap="15px" class="text-sm">
- <span fxLayoutAlign="start center"
- ><mat-icon color="primary">folder</mat-icon></span
- >
- <span fxFlex fxLayoutAlign="start center">{{
- chart.dataConfig.sourceConfigs[0].measureName
- }}</span>
- </div>
+ @if (chart.datasetName) {
+ <div fxLayout="row" fxLayoutGap="15px" class="text-sm">
+ <span fxLayoutAlign="start center"
+ ><mat-icon color="primary">folder</mat-icon></span
+ >
+ <span fxFlex fxLayoutAlign="start center">{{
+ chart.datasetName
+ }}</span>
+ </div>
+ }
</div>
<div fxLayoutAlign="end center">
<i class="material-icons">add</i>
diff --git a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
index f1e5d677ec..15fefe9e9d 100644
--- a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
+++ b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
@@ -24,7 +24,7 @@ import {
Output,
inject,
} from '@angular/core';
-import { DataExplorerWidgetModel } from '@streampipes/platform-services';
+import { ChartSummaryDto } from '@streampipes/platform-services';
import { ChartRegistry } from '../../../../../../chart-shared/registry/chart-registry.service';
import {
FlexDirective,
@@ -50,14 +50,14 @@ export class ChartPreviewComponent implements OnInit {
private widgetRegistryService = inject(ChartRegistry);
@Input()
- chart: DataExplorerWidgetModel;
+ chart: ChartSummaryDto;
widgetTypeLabel: string;
@Output()
addChartEmitter: EventEmitter<string> = new EventEmitter<string>();
- ngOnInit() {
+ ngOnInit(): void {
this.widgetTypeLabel = this.widgetRegistryService.getChartTemplate(
this.chart.widgetType,
).label;
diff --git a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
index 07b3f7eec3..8d362f4c31 100644
--- a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
+++ b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
@@ -17,10 +17,7 @@
*/
import { Component, EventEmitter, inject, OnInit, Output } from '@angular/core';
-import {
- ChartService,
- DataExplorerWidgetModel,
-} from '@streampipes/platform-services';
+import { ChartSummaryDto, ChartService } from '@streampipes/platform-services';
import { Router } from '@angular/router';
import { AuthService } from '../../../../../services/auth.service';
import { UserPrivilege } from '../../../../../core/auth/user-privilege.enum';
@@ -59,16 +56,14 @@ export class ChartSelectionComponent implements OnInit {
@Output()
addChartEmitter: EventEmitter<string> = new EventEmitter();
- charts: DataExplorerWidgetModel[] = [];
+ charts: ChartSummaryDto[] = [];
hasChartWritePrivileges: boolean = false;
- ngOnInit() {
- this.dataViewService.getAllCharts().subscribe(charts => {
- this.charts = charts.sort((a, b) =>
- a.baseAppearanceConfig.widgetTitle.localeCompare(
- b.baseAppearanceConfig.widgetTitle,
- ),
+ ngOnInit(): void {
+ this.dataViewService.getChartSummary().subscribe(chartSummary => {
+ this.charts = chartSummary.resources.sort((a, b) =>
+ a.name.localeCompare(b.name),
);
});