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/04/23 20:51:15 UTC

(streampipes) 01/01: feat: Make dashboard panel collapsible

This is an automated email from the ASF dual-hosted git repository.

dominikriemer pushed a commit to branch make-dashboard-panel-collapsible
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit c5473469aa54ab7e53923a540ddd06ba51199556
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Thu Apr 23 22:50:52 2026 +0200

    feat: Make dashboard panel collapsible
---
 .../panel/dashboard-panel.component.html           | 37 ++++++++++++++++++++--
 .../panel/dashboard-panel.component.scss           | 17 ++++++++++
 .../components/panel/dashboard-panel.component.ts  | 14 +++++++-
 3 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.html b/ui/src/app/dashboard/components/panel/dashboard-panel.component.html
index e7daf7b908..d524dee1cd 100644
--- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.html
+++ b/ui/src/app/dashboard/components/panel/dashboard-panel.component.html
@@ -68,7 +68,7 @@
                     class="designer-panel-container h-100 dashboard-grid"
                 >
                     <mat-drawer
-                        [opened]="editMode"
+                        [opened]="editMode && chartSelectionPanelExpanded"
                         mode="side"
                         position="end"
                         class="designer-panel"
@@ -85,7 +85,40 @@
                             }
                         </div>
                     </mat-drawer>
-                    <mat-drawer-content class="h-100 dashboard-grid">
+                    <mat-drawer-content
+                        class="h-100 dashboard-grid dashboard-content"
+                    >
+                        @if (editMode) {
+                            <button
+                                mat-icon-button
+                                type="button"
+                                class="panel-toggle-button"
+                                [class.panel-toggle-button-collapsed]="
+                                    !chartSelectionPanelExpanded
+                                "
+                                (click)="toggleChartSelectionPanel()"
+                                [attr.aria-label]="
+                                    (chartSelectionPanelExpanded
+                                        ? 'Collapse chart selection panel'
+                                        : 'Expand chart selection panel'
+                                    ) | translate
+                                "
+                                [matTooltip]="
+                                    (chartSelectionPanelExpanded
+                                        ? 'Collapse chart selection panel'
+                                        : 'Expand chart selection panel'
+                                    ) | translate
+                                "
+                            >
+                                <mat-icon>
+                                    {{
+                                        chartSelectionPanelExpanded
+                                            ? 'chevron_right'
+                                            : 'chevron_left'
+                                    }}
+                                </mat-icon>
+                            </button>
+                        }
                         @if (dashboard.widgets.length === 0) {
                             <div
                                 fxFlex="100"
diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss b/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss
index 6b94dd13a0..127f137aa2 100644
--- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss
+++ b/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss
@@ -34,6 +34,10 @@
     flex: 1 1 100%;
 }
 
+.dashboard-content {
+    position: relative;
+}
+
 .designer-panel-container {
     width: 100%;
     height: 100%;
@@ -43,6 +47,19 @@
     width: 350px;
 }
 
+.panel-toggle-button {
+    position: absolute;
+    top: 1rem;
+    right: 0.5rem;
+    z-index: 2;
+    background: var(--mat-sys-surface, #fff);
+    box-shadow: 0 0.125rem 0.5rem rgb(0 0 0 / 15%);
+}
+
+.panel-toggle-button-collapsed {
+    right: 1rem;
+}
+
 .edit-menu-btn {
     margin-right: 5px;
 }
diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts b/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
index 1c7fa97363..b508838153 100644
--- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
+++ b/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
@@ -62,6 +62,9 @@ import {
     MatDrawerContainer,
     MatDrawerContent,
 } from '@angular/material/sidenav';
+import { MatIcon } from '@angular/material/icon';
+import { MatIconButton } from '@angular/material/button';
+import { MatTooltip } from '@angular/material/tooltip';
 import { ChartSelectionPanelComponent } from './chart-selection-panel/chart-selection-panel.component';
 import {
     FlexDirective,
@@ -81,6 +84,9 @@ import {
         DashboardToolbarComponent,
         MatDrawerContainer,
         MatDrawer,
+        MatIcon,
+        MatIconButton,
+        MatTooltip,
         ChartSelectionPanelComponent,
         MatDrawerContent,
         DashboardGridViewComponent,
@@ -104,6 +110,7 @@ export class DashboardPanelComponent
     viewMode = 'grid';
 
     editMode = false;
+    chartSelectionPanelExpanded = false;
     timeRangeVisible = true;
 
     _dashboardGrid: DashboardGridViewComponent;
@@ -159,7 +166,7 @@ export class DashboardPanelComponent
                 UserPrivilege.PRIVILEGE_WRITE_DASHBOARD,
             );
             if (queryParams.editMode && this.hasDashboardWritePrivileges) {
-                this.editMode = true;
+                this.triggerEditMode();
             }
         });
     }
@@ -270,6 +277,11 @@ export class DashboardPanelComponent
 
     triggerEditMode() {
         this.editMode = true;
+        this.chartSelectionPanelExpanded = true;
+    }
+
+    toggleChartSelectionPanel() {
+        this.chartSelectionPanelExpanded = !this.chartSelectionPanelExpanded;
     }
 
     deleteDashboard() {