You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2026/03/30 15:06:16 UTC
(streampipes) branch dev updated: fix(#4300): deprecate multi-source chart editing in UI (#4327)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 8c7e1f3e1e fix(#4300): deprecate multi-source chart editing in UI (#4327)
8c7e1f3e1e is described below
commit 8c7e1f3e1ee6e5a9842fe6780b8fb5f09f415977
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Mon Mar 30 17:06:09 2026 +0200
fix(#4300): deprecate multi-source chart editing in UI (#4327)
---
ui/deployment/i18n/en.json | 3 +
.../chart-overview-table.component.html | 7 +++
.../chart-overview-table.component.ts | 6 ++
.../chart-view/chart-view.component.html | 13 ++++
.../components/chart-view/chart-view.component.ts | 36 +++++++++--
.../chart-data-settings.component.html | 43 +-------------
.../data-settings/chart-data-settings.component.ts | 69 ++++------------------
7 files changed, 72 insertions(+), 105 deletions(-)
diff --git a/ui/deployment/i18n/en.json b/ui/deployment/i18n/en.json
index 4d33544b20..22f9ab102e 100644
--- a/ui/deployment/i18n/en.json
+++ b/ui/deployment/i18n/en.json
@@ -732,6 +732,9 @@
"Value": null,
"Remove Mapping": null,
"The desired chart was not found!": null,
+ "Legacy multi-source chart": null,
+ "This chart uses multiple data sources and cannot be edited in this release. Please migrate it manually before making changes.": null,
+ "This chart is outdated and must be migrated.": null,
"Add To Asset": null,
"Data": null,
"Visualization": null,
diff --git a/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.html b/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.html
index d1834177a6..2c5a32e112 100644
--- a/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.html
+++ b/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.html
@@ -46,6 +46,13 @@
fxLayoutAlign="start center"
fxLayoutGap="5px"
>
+ @if (isLegacyMultiSourceChart(element)) {
+ <mat-icon
+ [matTooltip]="outdatedChartTooltip | translate"
+ style="color: var(--color-warn)"
+ >warning</mat-icon
+ >
+ }
<div fxLayout="column" fxLayoutAlign="start start">
<span class="text-sm">{{
element.baseAppearanceConfig.widgetTitle
diff --git a/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.ts b/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.ts
index e87c91a1e2..1650594a9d 100644
--- a/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.ts
+++ b/ui/src/app/chart/components/chart-overview/chart-overview-table/chart-overview-table.component.ts
@@ -100,6 +100,8 @@ export class ChartOverviewTableComponent implements OnInit {
};
charts: DataExplorerWidgetModel[] = [];
filteredCharts: DataExplorerWidgetModel[] = [];
+ readonly outdatedChartTooltip =
+ 'This chart is outdated and must be migrated.';
private dataViewService = inject(ChartService);
private dataExplorerDashboardService = inject(ChartSharedService);
@@ -215,4 +217,8 @@ export class ChartOverviewTableComponent implements OnInit {
formatDate(timestamp?: number): string {
return this.dateFormatService.formatDate(timestamp);
}
+
+ isLegacyMultiSourceChart(chart: DataExplorerWidgetModel): boolean {
+ return (chart?.dataConfig?.sourceConfigs?.length ?? 0) > 1;
+ }
}
diff --git a/ui/src/app/chart/components/chart-view/chart-view.component.html b/ui/src/app/chart/components/chart-view/chart-view.component.html
index cfcde07378..18885ba522 100644
--- a/ui/src/app/chart/components/chart-view/chart-view.component.html
+++ b/ui/src/app/chart/components/chart-view/chart-view.component.html
@@ -44,6 +44,19 @@
{{ 'The desired chart was not found!' | translate }}
</div>
} @else {
+ @if (legacyMultiSourceChart) {
+ <div class="p-10">
+ <sp-alert-banner
+ type="warning"
+ icon="warning"
+ [title]="legacyMultiSourceWarningTitle | translate"
+ [description]="
+ legacyMultiSourceWarningDescription | translate
+ "
+ >
+ </sp-alert-banner>
+ </div>
+ }
<mat-drawer-container
fxFlex="100"
fxLayout="column"
diff --git a/ui/src/app/chart/components/chart-view/chart-view.component.ts b/ui/src/app/chart/components/chart-view/chart-view.component.ts
index f9f7575022..7941a5686b 100644
--- a/ui/src/app/chart/components/chart-view/chart-view.component.ts
+++ b/ui/src/app/chart/components/chart-view/chart-view.component.ts
@@ -49,6 +49,7 @@ import {
DialogService,
PanelType,
SidebarResizeComponent,
+ SpAlertBannerComponent,
SpBasicViewComponent,
TimeSelectionService,
} from '@streampipes/shared-ui';
@@ -88,6 +89,7 @@ import { ChartDataPreviewComponent } from './query-result-preview/chart-data-pre
styleUrls: ['./chart-view.component.scss'],
imports: [
SpBasicViewComponent,
+ SpAlertBannerComponent,
FlexDirective,
LayoutAlignDirective,
LayoutDirective,
@@ -107,6 +109,9 @@ export class ChartViewComponent
{
dataViewLoaded = false;
timeSettings: TimeSettings;
+ readonly legacyMultiSourceWarningTitle = 'Legacy multi-source chart';
+ readonly legacyMultiSourceWarningDescription =
+ 'This chart uses multiple data sources and cannot be edited in this release. Please migrate it manually before making changes.';
editMode = true;
dataView: DataExplorerWidgetModel;
@@ -140,6 +145,7 @@ export class ChartViewComponent
queryParams$: Subscription;
chartNotFound = false;
+ legacyMultiSourceChart = false;
latestQueryResults: SpQueryResult[] = [];
observableGenerator =
@@ -150,12 +156,8 @@ export class ChartViewComponent
ngOnInit() {
const dataViewId = this.route.snapshot.params.id;
- this.currentUser$ = this.currentUserService.user$.subscribe(user => {
- if (!this.authService.hasRole(UserRole.ROLE_DATA_EXPLORER_ADMIN)) {
- this.editMode = false;
- } else {
- this.editMode = this.route.snapshot.queryParams.editMode;
- }
+ this.currentUser$ = this.currentUserService.user$.subscribe(() => {
+ this.editMode = this.shouldEnableEditMode();
});
if (dataViewId) {
@@ -237,6 +239,10 @@ export class ChartViewComponent
this.originalDataView = JSON.parse(
JSON.stringify(this.dataView),
);
+ this.legacyMultiSourceChart = this.hasMultipleSourceConfigs(
+ this.dataView,
+ );
+ this.editMode = this.shouldEnableEditMode();
this.timeSettings =
this.dataExplorerSharedService.makeChartTimeSettings(
this.dataView,
@@ -367,6 +373,9 @@ export class ChartViewComponent
}
saveDataView(): void {
+ if (this.legacyMultiSourceChart) {
+ return;
+ }
this.dataView.timeSettings = this.timeSettings;
this.dataView.metadata ??= {
lastModifiedEpochMs: undefined,
@@ -441,6 +450,9 @@ export class ChartViewComponent
return dialogRef.afterClosed().pipe(
switchMap((dialogResult: ConfirmDialogAction | undefined) => {
if (dialogResult === 'confirm') {
+ if (this.legacyMultiSourceChart) {
+ return of(true);
+ }
this.dataView.timeSettings = this.timeSettings;
return (
this.dataView.elementId !== undefined
@@ -564,4 +576,16 @@ export class ChartViewComponent
this.currentUser$?.unsubscribe();
this.queryParams$?.unsubscribe();
}
+
+ private hasMultipleSourceConfigs(widget: DataExplorerWidgetModel): boolean {
+ return (widget?.dataConfig?.sourceConfigs?.length ?? 0) > 1;
+ }
+
+ private shouldEnableEditMode(): boolean {
+ return (
+ this.authService.hasRole(UserRole.ROLE_DATA_EXPLORER_ADMIN) &&
+ !!this.route.snapshot.queryParams.editMode &&
+ !this.legacyMultiSourceChart
+ );
+ }
}
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.html b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.html
index 115e1f8656..b4a7dcd331 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.html
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.html
@@ -18,11 +18,7 @@
<div fxFlex="100" fxLayout="column" class="form-field-small">
<mat-accordion fxFlex="100" class="data-source-selection-panel">
- @for (
- sourceConfig of dataConfig.sourceConfigs;
- track sourceConfig;
- let i = $index
- ) {
+ @if (sourceConfig) {
<mat-expansion-panel
[expanded]="step === 0"
hideToggle
@@ -36,31 +32,10 @@
class="text-sm"
>
{{
- sourceConfig?.measureName ||
- ('New Data Source' | translate)
+ sourceConfig.measureName ||
+ ('Dataset' | translate)
}}
</span>
- <div fxLayoutAlign="end center">
- <button
- mat-icon-button
- color="accent"
- [matTooltip]="'Clone Data Source' | translate"
- >
- <i
- class="material-icons plus-icon align-btn"
- (click)="cloneSourceConfig(i)"
- >flip_to_front</i
- >
- </button>
- <button
- mat-icon-button
- color="accent"
- [matTooltip]="'Delete Data Source' | translate"
- (click)="removeSourceConfig(i)"
- >
- <i class="material-icons align-btn">delete</i>
- </button>
- </div>
</div>
</mat-expansion-panel-header>
<div fxFlex="100" fxLayout="column" class="mt-10 p-sm">
@@ -399,18 +374,6 @@
</mat-expansion-panel>
}
</mat-accordion>
- <div class="p-10">
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="addDataSource()"
- style="margin-right: 10px; margin-bottom: 15px"
- >
- {{ 'Add Data Source' | translate }}
- </button>
- </div>
<div class="p-10">
<div data-cy="data-explorer-ignore-too-much-data-warning-checkbox">
<mat-checkbox [(ngModel)]="dataConfig.ignoreTooMuchDataWarning">
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
index 0715e65e18..3dbe619bef 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
@@ -144,6 +144,10 @@ export class ChartDataSettingsComponent implements OnInit {
expandFieldsDataSource = true;
expandFieldsQuery = true;
+ get sourceConfig(): SourceConfig | undefined {
+ return this.dataConfig?.sourceConfigs?.[0];
+ }
+
ngOnInit(): void {
this.loadPipelinesAndMeasurements();
}
@@ -157,12 +161,12 @@ export class ChartDataSettingsComponent implements OnInit {
a.measureName.localeCompare(b.measureName),
);
- if (!this.dataConfig.sourceConfigs) {
+ if (!this.sourceConfig) {
const defaultConfigs = this.findDefaultConfig();
- this.addDataSource(defaultConfigs.measureName);
+ this.initializeSourceConfig(defaultConfigs.measureName);
if (defaultConfigs.measureName !== undefined) {
this.updateMeasure(
- this.dataConfig.sourceConfigs[0],
+ this.sourceConfig,
defaultConfigs.measureName,
);
}
@@ -202,20 +206,13 @@ export class ChartDataSettingsComponent implements OnInit {
);
}
- setStep(index: number) {
- this.step = index;
- }
-
changeDataAggregation() {
this.fieldSelectionPanel.applyDefaultFields();
this.triggerDataRefresh();
}
- addDataSource(measureName = '') {
- if (!this.dataConfig.sourceConfigs) {
- this.dataConfig.sourceConfigs = [];
- }
- this.dataConfig.sourceConfigs.push(this.makeSourceConfig(measureName));
+ initializeSourceConfig(measureName = '') {
+ this.dataConfig.sourceConfigs = [this.makeSourceConfig(measureName)];
}
makeSourceConfig(measureName = ''): SourceConfig {
@@ -268,22 +265,10 @@ export class ChartDataSettingsComponent implements OnInit {
*/
checkIfDefaultTableShouldBeShown(): boolean {
return (
- this.dataConfig.sourceConfigs.length === 1 &&
- !this.currentlyConfiguredWidget.widgetType
+ !!this.sourceConfig && !this.currentlyConfiguredWidget.widgetType
);
}
- removeSourceConfig(index: number) {
- this.dataConfig.sourceConfigs.splice(index, 1);
- }
-
- cloneSourceConfig(index: number) {
- const clonedConfig = this.deepCopy(
- this.dataConfig.sourceConfigs[index],
- );
- this.dataConfig.sourceConfigs.push(clonedConfig);
- }
-
triggerDataRefresh() {
this.widgetConfigService.notify({
refreshData: true,
@@ -306,38 +291,4 @@ export class ChartDataSettingsComponent implements OnInit {
navigateToPipelines(): void {
this.router.navigate(['pipelines']);
}
-
- deepCopy(obj) {
- let copy;
-
- if (null == obj || 'object' !== typeof obj) {
- return obj;
- }
-
- if (obj instanceof Date) {
- copy = new Date();
- copy.setTime(obj.getTime());
- return copy;
- }
-
- if (obj instanceof Array) {
- copy = [];
- for (let i = 0, len = obj.length; i < len; i++) {
- copy[i] = this.deepCopy(obj[i]);
- }
- return copy;
- }
-
- if (obj instanceof Object) {
- copy = {};
- for (const attr in obj) {
- if (obj.hasOwnProperty(attr)) {
- copy[attr] = this.deepCopy(obj[attr]);
- }
- }
- return copy;
- }
-
- throw new Error('Unable to copy.');
- }
}