This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new d405ca066 [STREAMPIPES-619] Improve edit mode behaviour in data
explorer
d405ca066 is described below
commit d405ca066a2d21d69bd704d7da59719e1fe9371e
Author: Dominik Riemer <[email protected]>
AuthorDate: Mon Nov 7 22:27:13 2022 +0100
[STREAMPIPES-619] Improve edit mode behaviour in data explorer
---
.../panel/data-explorer-dashboard-panel.component.ts | 17 +++++++++--------
.../widget-view/abstract-widget-view.directive.ts | 4 ++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git
a/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
b/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
index e1b382d57..06a7a5aaf 100644
---
a/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
+++
b/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
@@ -58,9 +58,6 @@ export class DataExplorerDashboardPanelComponent implements
OnInit, OnDestroy {
editMode = false;
timeRangeVisible = true;
- @Output()
- editModeChange: EventEmitter<boolean> = new EventEmitter();
-
@ViewChild('dashboardGrid')
dashboardGrid: DataExplorerDashboardGridComponent;
@@ -196,13 +193,11 @@ export class DataExplorerDashboardPanelComponent
implements OnInit, OnDestroy {
} else {
this.dashboardSlide.updateAllWidgets();
}
- this.editModeChange.emit(false);
this.closeDesignerPanel();
}
startEditMode(widgetModel: DataExplorerWidgetModel) {
this.editMode = true;
- this.editModeChange.emit(true);
this.updateCurrentlyConfiguredWidget(widgetModel);
this.showEditingHelpInfo = false;
}
@@ -265,9 +260,14 @@ export class DataExplorerDashboardPanelComponent
implements OnInit, OnDestroy {
triggerEditMode() {
this.showEditingHelpInfo = false;
- this.editMode = true;
- this.editModeChange.emit(true);
- this.createWidget();
+ if (this.dashboard.widgets.length > 0) {
+ this.currentlyConfiguredWidgetId = this.dashboard.widgets[0].id;
+ const currentView = this.dashboardGrid ? this.dashboardGrid :
this.dashboardSlide;
+
currentView.selectFirstWidgetForEditing(this.currentlyConfiguredWidgetId);
+ } else {
+ this.editMode = true;
+ this.createWidget();
+ }
}
createWidget() {
@@ -282,6 +282,7 @@ export class DataExplorerDashboardPanelComponent implements
OnInit, OnDestroy {
this.currentlyConfiguredWidget.baseAppearanceConfig.backgroundColor =
'#FFFFFF';
this.currentlyConfiguredWidget.baseAppearanceConfig.textColor = '#3e3e3e';
+ this.currentlyConfiguredWidget = {...this.currentlyConfiguredWidget};
this.newWidgetMode = true;
this.showDesignerPanel = true;
this.newWidgetMode = true;
diff --git
a/ui/src/app/data-explorer/components/widget-view/abstract-widget-view.directive.ts
b/ui/src/app/data-explorer/components/widget-view/abstract-widget-view.directive.ts
index a05811bcd..7be166aab 100644
---
a/ui/src/app/data-explorer/components/widget-view/abstract-widget-view.directive.ts
+++
b/ui/src/app/data-explorer/components/widget-view/abstract-widget-view.directive.ts
@@ -140,6 +140,10 @@ export abstract class AbstractWidgetViewDirective {
this.onOptionsChanged();
}
+ selectFirstWidgetForEditing(widgetId: string): void {
+ this.startEditModeEmitter.emit(this.configuredWidgets.get(widgetId));
+ }
+
abstract onOptionsChanged(): void;
abstract onWidgetsAvailable(): void;