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/07/12 13:34:34 UTC

[incubator-streampipes] 03/04: [STREAMPIPES-537] Clean up data explorer module

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

riemer pushed a commit to branch STREAMPIPES-558
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 8e089e59f8be4895c3dd5055eb77741c21585bdc
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue Jul 12 12:50:59 2022 +0200

    [STREAMPIPES-537] Clean up data explorer module
---
 .../app/app-overview/app-overview.component.html   |   2 +-
 .../app/data-explorer/data-explorer.component.css  |  78 ------------
 .../app/data-explorer/data-explorer.component.html |  51 --------
 .../app/data-explorer/data-explorer.component.ts   | 132 ---------------------
 ui/src/app/data-explorer/data-explorer.module.ts   |   3 -
 5 files changed, 1 insertion(+), 265 deletions(-)

diff --git a/ui/src/app/app-overview/app-overview.component.html b/ui/src/app/app-overview/app-overview.component.html
index 2a479a85c..40ad6e2ae 100644
--- a/ui/src/app/app-overview/app-overview.component.html
+++ b/ui/src/app/app-overview/app-overview.component.html
@@ -23,7 +23,7 @@
 
 
     <div fxFlex="100" fxLayout="column">
-        <h1>My apps</h1>
+        <sp-basic-header-title-component title="My apps"></sp-basic-header-title-component>
         <mat-card class="example-card" *ngFor="let app of apps">
             <div fxFlex="100" fxLayout="row">
                 <div fxFlex="75" fxLayout="column" fxLayoutAlign="center start">
diff --git a/ui/src/app/data-explorer/data-explorer.component.css b/ui/src/app/data-explorer/data-explorer.component.css
deleted file mode 100644
index 6fe48132c..000000000
--- a/ui/src/app/data-explorer/data-explorer.component.css
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-.mr-20 {
-    margin-right:20px;
-}
-
-.dashboard-panel {
-    height: 100%;
-    flex-direction: column;
-    box-sizing: border-box;
-    display: flex;
-    flex: 1 1 100%;
-    overflow-y: auto;
-}
-
-.ribbon {
-    position: absolute;
-    right: 5px; top: 55px;
-    z-index: 1;
-    overflow: hidden;
-    width: 75px; height: 75px;
-    text-align: right;
-}
-.ribbon span {
-    font-weight: bold;
-    color: #FFF;
-    text-transform: uppercase;
-    text-align: center;
-    line-height: 20px;
-    transform: rotate(45deg);
-    -webkit-transform: rotate(45deg);
-    width: 100px;
-    display: block;
-    background: #f5b53f;
-    background: linear-gradient(#f5b53f 0%, #f5b53f 100%);
-    position: absolute;
-    top: 19px; right: -21px;
-}
-.ribbon span::before {
-    content: "";
-    position: absolute; left: 0px; top: 100%;
-    z-index: -1;
-    border-left: 3px solid #f5b53f;
-    border-right: 3px solid transparent;
-    border-bottom: 3px solid transparent;
-    border-top: 3px solid #f5b53f;
-}
-
-.ribbon span::after {
-    content: "";
-    position: absolute; right: 0px; top: 100%;
-    z-index: -1;
-    border-left: 3px solid transparent;
-    border-right: 3px solid #f5b53f;
-    border-bottom: 3px solid transparent;
-    border-top: 3px solid #f5b53f;
-}
-
-
-.pl-10 {
-    padding-left: 10px;
-}
diff --git a/ui/src/app/data-explorer/data-explorer.component.html b/ui/src/app/data-explorer/data-explorer.component.html
deleted file mode 100644
index 19ea4ade6..000000000
--- a/ui/src/app/data-explorer/data-explorer.component.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  ~
-  -->
-
-<div fxLayout="column" class="page-container">
-    <div fxLayout="row" class="p-0 sp-bg-lightgray">
-        <div fxFlex="100" class="page-container-nav">
-            <div fxFlex="100" fxLayout="row">
-                <div fxFlex fxLayoutAlign="start center">
-                    <mat-tab-group [selectedIndex]="selectedIndex"
-                                   (selectedIndexChange)="selectDashboardInTab($event)"
-                                   color="accent">
-                        <mat-tab data-cy="data-explorer-start-tab"
-                                 label="Start"></mat-tab>
-                        <mat-tab *ngFor="let dataViewDashboard of dataViewDashboards"
-                                 label="{{dataViewDashboard.name}}"></mat-tab>
-                    </mat-tab-group>
-                </div>
-
-            </div>
-        </div>
-    </div>
-
-
-    <div fxLayout="column" fxFlex="100" *ngIf="dashboardsLoaded">
-        <sp-data-explorer-dashboard-overview *ngIf="!dashboardTabSelected">
-
-        </sp-data-explorer-dashboard-overview>
-        <sp-data-explorer-dashboard-panel fxLayout="column"
-                                          #dashboardPanel
-                                          [dashboard]="selectedDataViewDashboard"
-                                          [timeSettings]="selectedDataViewDashboard.dashboardTimeSettings"
-                                          class="dashboard-panel"
-                                          *ngIf="dashboardTabSelected">
-        </sp-data-explorer-dashboard-panel>
-    </div>
-</div>
diff --git a/ui/src/app/data-explorer/data-explorer.component.ts b/ui/src/app/data-explorer/data-explorer.component.ts
deleted file mode 100644
index c6cb9b9d2..000000000
--- a/ui/src/app/data-explorer/data-explorer.component.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { Component, OnInit, ViewChild } from '@angular/core';
-import { Dashboard, DataViewDataExplorerService } from '@streampipes/platform-services';
-import { RefreshDashboardService } from './services/refresh-dashboard.service';
-import { DataExplorerDashboardPanelComponent } from './components/panel/data-explorer-dashboard-panel.component';
-import { ActivatedRoute } from '@angular/router';
-import { AuthService } from '../services/auth.service';
-import { UserPrivilege } from '../_enums/user-privilege.enum';
-
-@Component({
-  selector: 'sp-data-explorer',
-  templateUrl: './data-explorer.component.html',
-  styleUrls: ['./data-explorer.component.css']
-})
-export class DataExplorerComponent implements OnInit {
-
-  selectedDataViewDashboard: Dashboard;
-  selectedIndex = 0;
-  dashboardsLoaded = false;
-  dashboardTabSelected = false;
-
-  dataViewDashboards: Dashboard[];
-
-  routeParams: any;
-
-  hasDataExplorerWritePrivileges = false;
-  hasDataExplorerDeletePrivileges = false;
-
-  @ViewChild('dashboardPanel') dashboardPanel: DataExplorerDashboardPanelComponent;
-
-  constructor(private dataViewService: DataViewDataExplorerService,
-              private refreshDashboardService: RefreshDashboardService,
-              private route: ActivatedRoute,
-              private authService: AuthService) {
-  }
-
-
-  public ngOnInit() {
-    this.authService.user$.subscribe(user => {
-      this.hasDataExplorerWritePrivileges = this.authService.hasRole(UserPrivilege.PRIVILEGE_WRITE_DATA_EXPLORER_VIEW);
-      this.hasDataExplorerDeletePrivileges = this.authService.hasRole(UserPrivilege.PRIVILEGE_DELETE_DATA_EXPLORER_VIEW);
-    });
-    this.route.queryParams.subscribe(params => {
-      this.routeParams = {
-        startTime: params['startTime'],
-        endTime: params['endTime'],
-        dashboardId: params['dashboardId']
-      };
-      this.getDashboards();
-    });
-    this.refreshDashboardService.refreshSubject.subscribe(currentDashboardId => {
-      this.getDashboards(currentDashboardId);
-    });
-
-  }
-
-  // openDashboard(dashboard: Tuple2<Dashboard, boolean>) {
-  //   const index = this.dataViewDashboards.indexOf(dashboard.a);
-  //   this.selectDashboard((index + 1), dashboard.b);
-  // }
-
-  selectDashboardInTab(index: number) {
-    if (index !== this.selectedIndex) {
-      this.selectDashboard(index);
-    }
-  }
-
-  selectDashboard(index: number, editMode = false) {
-    this.selectedIndex = index;
-    if (index === 0) {
-      this.dashboardTabSelected = false;
-    } else {
-      this.dashboardTabSelected = true;
-      this.applyTimeSettings(this.dataViewDashboards[(index - 1)]);
-      this.selectedDataViewDashboard = this.dataViewDashboards[(index - 1)];
-    }
-  }
-
-  applyTimeSettings(dashboard: Dashboard) {
-    if (this.routeParams.startTime && this.routeParams.endTime) {
-      dashboard.dashboardTimeSettings = {
-        startTime: this.routeParams.startTime * 1,
-        endTime: this.routeParams.endTime * 1,
-        dynamicSelection: -1
-      };
-    } else if (!dashboard.dashboardTimeSettings) {
-      const currentTime = new Date().getTime();
-      dashboard.dashboardTimeSettings = {
-        startTime: currentTime - 100000 * 60000,
-        endTime: currentTime,
-        dynamicSelection: -1
-      };
-    }
-  }
-
-  findAndSelectDashboard(dashboardId: string) {
-    const currentDashboard = this.dataViewDashboards.find(d => d._id === dashboardId);
-    this.selectDashboard(this.dataViewDashboards.indexOf(currentDashboard) + 1);
-  }
-
-  getDashboards(currentDashboardId?: string) {
-    this.dashboardsLoaded = false;
-    this.dataViewService.getDataViews().subscribe(data => {
-      this.dataViewDashboards = data.sort((a, b) => a.name.localeCompare(b.name));
-      if (currentDashboardId) {
-        this.findAndSelectDashboard(currentDashboardId);
-      } else if (this.routeParams.dashboardId) {
-        this.findAndSelectDashboard(this.routeParams.dashboardId);
-      } else {
-        this.selectedIndex = 0;
-      }
-      this.dashboardsLoaded = true;
-    });
-  }
-}
diff --git a/ui/src/app/data-explorer/data-explorer.module.ts b/ui/src/app/data-explorer/data-explorer.module.ts
index 2e71a44d3..69855ab16 100644
--- a/ui/src/app/data-explorer/data-explorer.module.ts
+++ b/ui/src/app/data-explorer/data-explorer.module.ts
@@ -64,7 +64,6 @@ import { LoadDataSpinnerComponent } from './components/widgets/utils/load-data-s
 import { NoDataInDateRangeComponent } from './components/widgets/utils/no-data/no-data-in-date-range.component';
 import { SelectPropertiesComponent } from './components/widgets/utils/select-properties/select-properties.component';
 import { SelectColorPropertiesComponent } from './components/widgets/utils/select-color-properties/select-color-properties.component';
-import { DataExplorerComponent } from './data-explorer.component';
 import { DataExplorerEditDataViewDialogComponent } from './dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component';
 import { RefreshDashboardService } from './services/refresh-dashboard.service';
 import { ResizeService } from './services/resize.service';
@@ -176,7 +175,6 @@ export const MY_NATIVE_FORMATS = {
   declarations: [
     AggregateConfigurationComponent,
     DataDownloadDialogComponent,
-    DataExplorerComponent,
     DataExplorerDashboardGridComponent,
     DataExplorerDashboardOverviewComponent,
     DataExplorerDashboardPanelComponent,
@@ -236,7 +234,6 @@ export const MY_NATIVE_FORMATS = {
     }
   ],
   exports: [
-    DataExplorerComponent
   ]
 })
 export class DataExplorerModule {