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 2022/06/05 14:42:56 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-539] Add data view configuration dialog, support selection of default view mode

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 9fcb040bf [STREAMPIPES-539] Add data view configuration dialog, support selection of default view mode
9fcb040bf is described below

commit 9fcb040bfd905058c6b4b06bdd728572647227cf
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Jun 5 16:42:48 2022 +0200

    [STREAMPIPES-539] Add data view configuration dialog, support selection of default view mode
---
 .../data-explorer-dashboard-overview.component.html    | 18 ++++++++++++------
 .../data-explorer-dashboard-overview.component.ts      |  1 -
 .../panel/data-explorer-dashboard-panel.component.ts   |  1 +
 .../data-explorer-edit-data-view-dialog.component.html | 10 ++++++++++
 .../data-explorer-edit-data-view-dialog.component.scss | 11 +++++++++++
 .../data-explorer-edit-data-view-dialog.component.ts   |  4 +++-
 6 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.html b/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.html
index d8b002a18..4a7cc1132 100644
--- a/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.html
+++ b/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.html
@@ -54,26 +54,32 @@
                         <td fxFlex="40" fxLayoutAlign="start center" mat-cell *matCellDef="let element">
                             <div fxLayout="row" fxFlex="100">
                                 <span fxFlex fxFlexOrder="1" fxLayout="row" fxLayoutAlign="center center">
-                                <button mat-button mat-icon-button color="accent"
+                                <button mat-button mat-icon-button color="accent" matTooltip="Show data view"
                                         (click)="showDashboard(element)">
                                     <i class="material-icons">visibility</i>
                                 </button>
                                 </span>
                                 <span fxFlex fxFlexOrder="2" fxLayout="row" fxLayoutAlign="center center" *ngIf="hasDataExplorerWritePrivileges">
-                                <button mat-button mat-icon-button color="accent"
+                                <button mat-button mat-icon-button color="accent" matTooltip="Edit data view"
                                         [attr.data-cy]="'edit-dashboard-' + element.name"
                                         (click)="editDashboard(element)">
                                     <i class="material-icons">edit</i>
                                 </button>
                                 </span>
-                                <span fxFlex fxFlexOrder="3" fxLayout="row" fxLayoutAlign="center center" *ngIf="isAdmin">
-                                <button mat-button mat-icon-button color="accent"
+                                <span fxFlex fxFlexOrder="3" fxLayout="row" fxLayoutAlign="center center" *ngIf="hasDataExplorerWritePrivileges">
+                                <button mat-button mat-icon-button color="accent" matTooltip="Edit data view settings"
+                                        (click)="openEditDataViewDialog(element)">
+                                    <i class="material-icons">settings</i>
+                                </button>
+                                </span>
+                                <span fxFlex fxFlexOrder="4" fxLayout="row" fxLayoutAlign="center center" *ngIf="isAdmin">
+                                <button mat-button mat-icon-button color="accent" matTooltip="Manage permissions"
                                         (click)="showPermissionsDialog(element)">
                                     <i class="material-icons">share</i>
                                 </button>
                                 </span>
-                                <span fxFlex fxFlexOrder="4" fxLayout="row" fxLayoutAlign="center center" *ngIf="hasDataExplorerDeletePrivileges">
-                                <button mat-button mat-icon-button color="accent"
+                                <span fxFlex fxFlexOrder="5" fxLayout="row" fxLayoutAlign="center center" *ngIf="hasDataExplorerDeletePrivileges">
+                                <button mat-button mat-icon-button color="accent" matTooltip="Delete data view"
                                         [attr.data-cy]="'delete-dashboard-' + element.name"
                                         (click)="openDeleteDashboardDialog(element)">
                                     <i class="material-icons">delete</i>
diff --git a/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.ts b/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.ts
index 31fc2bad1..8e38a01c1 100644
--- a/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.ts
+++ b/ui/src/app/data-explorer/components/overview/data-explorer-dashboard-overview.component.ts
@@ -20,7 +20,6 @@ import { Component, OnInit } from '@angular/core';
 import { MatTableDataSource } from '@angular/material/table';
 import { DataExplorerEditDataViewDialogComponent } from '../../dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component';
 import { DataViewDataExplorerService, Dashboard } from '@streampipes/platform-services';
-import { Tuple2 } from '../../../core-model/base/Tuple2';
 import { DialogService, PanelType } from '@streampipes/shared-ui';
 import { ObjectPermissionDialogComponent } from '../../../core-ui/object-permission-dialog/object-permission-dialog.component';
 import { UserRole } from '../../../_enums/user-role.enum';
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 52c876bec..05c223bed 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
@@ -293,6 +293,7 @@ export class DataExplorerDashboardPanelComponent implements OnInit {
       this.dashboard = data.filter(
         (dashboard) => dashboard._id === dashboardId
       )[0];
+      this.viewMode = this.dashboard.dashboardGeneralSettings.defaultViewMode || 'grid';
       this.timeSettings = (startTime && endTime) ? this.overrideTime(+startTime, +endTime) : this.dashboard.dashboardTimeSettings;
       if (this.dashboard.widgets.length === 0 && this.editMode) {
         this.triggerEditMode();
diff --git a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
index 20a5501cf..d64581ed5 100644
--- a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
+++ b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
@@ -30,6 +30,16 @@
                     <mat-label>Description</mat-label>
                     <input matInput [(ngModel)]="dashboard.description">
                 </mat-form-field>
+                <label>Default view mode</label>
+                <mat-radio-group
+                        [(ngModel)]="dashboard.dashboardGeneralSettings.defaultViewMode">
+                    <mat-radio-button class="view-radio-button" [value]="'grid'">
+                        Grid View
+                    </mat-radio-button>
+                    <mat-radio-button class="view-radio-button" [value]="'slide'">
+                        Slide View
+                    </mat-radio-button>
+                </mat-radio-group>
                 <!--<mat-checkbox [(ngModel)]="dashboard.displayHeader">Show name and description in dashboard</mat-checkbox>-->
 
             </div>
diff --git a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.scss b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.scss
index 2c22a1cc7..ff0c283e0 100644
--- a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.scss
+++ b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.scss
@@ -30,3 +30,14 @@
 .mr-10 {
     margin-right: 10px;
 }
+
+.view-radio-group {
+    display: flex;
+    flex-direction: column;
+    margin: 15px 0;
+    align-items: flex-start;
+}
+
+.view-radio-button {
+    margin: 5px;
+}
diff --git a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
index 1af1ab8a8..8d5a3fc6e 100644
--- a/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
+++ b/ui/src/app/data-explorer/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
@@ -36,7 +36,9 @@ export class DataExplorerEditDataViewDialogComponent implements OnInit {
   }
 
   ngOnInit() {
-
+    if (!this.dashboard.dashboardGeneralSettings.defaultViewMode) {
+      this.dashboard.dashboardGeneralSettings.defaultViewMode = 'grid';
+    }
   }
 
   onCancel(): void {