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 2020/02/20 22:00:36 UTC
[incubator-streampipes] branch STREAMPIPES-79 updated: Change
components to match data explorer requirements
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-79
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-79 by this push:
new e15d5b3 Change components to match data explorer requirements
e15d5b3 is described below
commit e15d5b37e1d41e4607c9231bc22dec200278f740
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Feb 20 22:57:09 2020 +0100
Change components to match data explorer requirements
---
.../datalake/datalake-rest.service.ts | 34 ++---
.../add-visualization-dialog.component.ts | 70 ++++-----
... => data-explorer-dashboard-grid.component.css} | 0
...=> data-explorer-dashboard-grid.component.html} | 4 +-
...s => data-explorer-dashboard-grid.component.ts} | 41 +++--
.../overview/dashboard-overview.component.ts | 89 -----------
...data-explorer-dashboard-overview.component.css} | 0
...ata-explorer-dashboard-overview.component.html} | 7 +-
.../data-explorer-dashboard-overview.component.ts | 88 +++++++++++
...=> data-explorer-dashboard-panel.component.css} | 0
...> data-explorer-dashboard-panel.component.html} | 4 +-
... => data-explorer-dashboard-panel.component.ts} | 52 +++----
.../widget/dashboard-widget.component.html | 65 --------
...> data-explorer-dashboard-widget.component.css} | 0
.../data-explorer-dashboard-widget.component.html | 42 +++++
...=> data-explorer-dashboard-widget.component.ts} | 40 +++--
.../components/widgets/area/area-config.ts | 32 ----
.../widgets/area/area-widget.component.css | 24 ---
.../widgets/area/area-widget.component.html | 41 -----
.../widgets/area/area-widget.component.ts | 43 ------
.../components/widgets/base/base-config.ts | 4 +-
.../widgets/base/base-ngx-charts-widget.ts | 23 +--
.../widgets/base/base-ngx-line-charts-widget.ts | 74 ---------
.../widgets/base/base-ngx-line-config.ts | 47 ------
.../components/widgets/base/base-widget.ts | 48 +++---
.../components/widgets/gauge/gauge-config.ts | 48 ------
.../widgets/gauge/gauge-widget.component.css | 32 ----
.../widgets/gauge/gauge-widget.component.html | 36 -----
.../widgets/gauge/gauge-widget.component.ts | 67 --------
.../components/widgets/image/image-config.ts | 44 ------
.../widgets/image/image-widget.component.css | 31 ----
.../widgets/image/image-widget.component.html | 26 ----
.../widgets/image/image-widget.component.ts | 62 --------
.../components/widgets/line/line-config.ts | 30 ----
.../widgets/line/line-widget.component.css | 32 ----
.../widgets/line/line-widget.component.html | 41 -----
.../widgets/line/line-widget.component.ts | 46 ------
.../widgets/number/number-widget.component.ts | 15 +-
.../components/widgets/table/table-config.ts | 44 ------
.../widgets/table/table-widget.component.css | 26 ----
.../widgets/table/table-widget.component.html | 36 -----
.../widgets/table/table-widget.component.ts | 77 ----------
.../data-explorer-v2.component.html | 26 ++--
.../data-explorer-v2/data-explorer-v2.component.ts | 28 ++--
.../data-explorer-v2/data-explorer-v2.module.ts | 44 ++----
.../add-visualization-dialog.component.ts | 169 ---------------------
...xplorer-add-visualization-dialog.component.css} | 0
...plorer-add-visualization-dialog.component.html} | 10 +-
...-explorer-add-visualization-dialog.component.ts | 169 +++++++++++++++++++++
...a-explorer-edit-data-view-dialog.component.css} | 0
...-explorer-edit-data-view-dialog.component.html} | 6 +-
...ta-explorer-edit-data-view-dialog.component.ts} | 28 ++--
...hboard.model.ts => dataview-dashboard.model.ts} | 12 +-
.../data-explorer-v2/models/gridster-info.model.ts | 24 ---
.../data-explorer-v2/models/multi-series.model.ts | 9 +-
.../registry/widget-config-builder.ts | 48 +++---
.../data-explorer-v2/registry/widget-registry.ts | 24 +--
.../data-explorer-v2/services/dashboard.service.ts | 137 -----------------
.../services/data-view-dashboard.service.ts | 137 +++++++++++++++++
.../services/refresh-dashboard.service.ts | 6 +-
.../data-explorer-v2/services/resize.service.ts | 8 +-
.../data-explorer-v2/services/websocket.config.ts | 36 -----
.../services/websocket.settings.ts | 32 ----
63 files changed, 715 insertions(+), 1803 deletions(-)
diff --git a/ui/src/app/core-services/datalake/datalake-rest.service.ts b/ui/src/app/core-services/datalake/datalake-rest.service.ts
index 5a5e960..b23e67c 100644
--- a/ui/src/app/core-services/datalake/datalake-rest.service.ts
+++ b/ui/src/app/core-services/datalake/datalake-rest.service.ts
@@ -16,13 +16,13 @@
*
*/
-import {HttpClient, HttpRequest} from '@angular/common/http';
-import {InfoResult} from '../../core-model/datalake/InfoResult';
-import {AuthStatusService} from '../../services/auth-status.service';
-import {Injectable} from '@angular/core';
-import {PageResult} from '../../core-model/datalake/PageResult';
-import {DataResult} from '../../core-model/datalake/DataResult';
-import {GroupedDataResult} from '../../core-model/datalake/GroupedDataResult';
+import { HttpClient, HttpRequest } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { DataResult } from '../../core-model/datalake/DataResult';
+import { GroupedDataResult } from '../../core-model/datalake/GroupedDataResult';
+import { InfoResult } from '../../core-model/datalake/InfoResult';
+import { PageResult } from '../../core-model/datalake/PageResult';
+import { AuthStatusService } from '../../services/auth-status.service';
@Injectable()
export class DatalakeRestService {
@@ -36,12 +36,12 @@ export class DatalakeRestService {
}
private get dataLakeUrlV3() {
- return this.baseUrl + '/api/v3/users/' + this.authStatusService.email + '/datalake'
+ return this.baseUrl + '/api/v3/users/' + this.authStatusService.email + '/datalake';
}
getAllInfos() {
- return this.http.get<InfoResult[]>(this.dataLakeUrlV3 + "/info");
+ return this.http.get<InfoResult[]>(this.dataLakeUrlV3 + '/info');
}
getDataPage(index, itemsPerPage, page) {
@@ -81,28 +81,28 @@ export class DatalakeRestService {
@deprecate
*/
getFile(index, format) {
- const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + "?format=" + format, {
+ const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + '?format=' + format, {
reportProgress: true,
responseType: 'text'
});
- return this.http.request(request)
+ return this.http.request(request);
}
downloadRowData(index, format) {
- const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + "/download?format=" + format, {
+ const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + '/download?format=' + format, {
reportProgress: true,
responseType: 'text'
});
- return this.http.request(request)
+ return this.http.request(request);
}
downloadRowDataTimeInterval(index, format, startDate, endDate) {
- const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' + endDate + "/download" +
- "?format=" + format, {
+ const request = new HttpRequest('GET', this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' + endDate + '/download' +
+ '?format=' + format, {
reportProgress: true,
responseType: 'text'
});
- return this.http.request(request)
+ return this.http.request(request);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/dashboard-v2/dialogs/add-widget/add-visualization-dialog.component.ts b/ui/src/app/dashboard-v2/dialogs/add-widget/add-visualization-dialog.component.ts
index 24df862..9156c91 100644
--- a/ui/src/app/dashboard-v2/dialogs/add-widget/add-visualization-dialog.component.ts
+++ b/ui/src/app/dashboard-v2/dialogs/add-widget/add-visualization-dialog.component.ts
@@ -16,20 +16,20 @@
*
*/
-import {Component, Inject} from "@angular/core";
-import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
-import {DashboardService} from "../../services/dashboard.service";
-import {ElementIconText} from "../../../services/get-element-icon-text.service";
-import {WidgetRegistry} from "../../registry/widget-registry";
-import {MappingPropertyUnary} from "../../../connect/model/MappingPropertyUnary";
-import {MappingPropertyGenerator} from "../../sdk/matching/mapping-property-generator";
-import {EventProperty} from "../../../connect/schema-editor/model/EventProperty";
-import {EventSchema} from "../../../connect/schema-editor/model/EventSchema";
-import {DashboardWidget} from "../../../core-model/dashboard/DashboardWidget";
-import {DashboardWidgetSettings} from "../../../core-model/dashboard/DashboardWidgetSettings";
-import {VisualizablePipeline} from "../../../core-model/dashboard/VisualizablePipeline";
-import {Dashboard} from "../../models/dashboard.model";
-import {MappingPropertyNary} from "../../../connect/model/MappingPropertyNary";
+import { Component, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { MappingPropertyNary } from '../../../connect/model/MappingPropertyNary';
+import { MappingPropertyUnary } from '../../../connect/model/MappingPropertyUnary';
+import { EventProperty } from '../../../connect/schema-editor/model/EventProperty';
+import { EventSchema } from '../../../connect/schema-editor/model/EventSchema';
+import { DashboardWidget } from '../../../core-model/dashboard/DashboardWidget';
+import { DashboardWidgetSettings } from '../../../core-model/dashboard/DashboardWidgetSettings';
+import { VisualizablePipeline } from '../../../core-model/dashboard/VisualizablePipeline';
+import { ElementIconText } from '../../../services/get-element-icon-text.service';
+import { Dashboard } from '../../models/dashboard.model';
+import { WidgetRegistry } from '../../registry/widget-registry';
+import { MappingPropertyGenerator } from '../../sdk/matching/mapping-property-generator';
+import { DashboardService } from '../../services/dashboard.service';
@Component({
selector: 'add-visualization-dialog-component',
@@ -39,21 +39,21 @@ import {MappingPropertyNary} from "../../../connect/model/MappingPropertyNary";
export class AddVisualizationDialogComponent {
pages = [{
- type: "select-pipeline",
- title: "Select Pipeline",
- description: "Select a pipeline you'd like to visualize"
+ type: 'select-pipeline',
+ title: 'Select Pipeline',
+ description: 'Select a pipeline you\'d like to visualize'
}, {
- type: "select-widget",
- title: "Select Widget",
- description: "Select widget"
+ type: 'select-widget',
+ title: 'Select Widget',
+ description: 'Select widget'
}, {
- type: "configure-widget",
- title: "Configure Widget",
- description: "Configure widget"
+ type: 'configure-widget',
+ title: 'Configure Widget',
+ description: 'Configure widget'
}];
- visualizablePipelines: Array<VisualizablePipeline> = [];
- availableWidgets: Array<DashboardWidgetSettings>;
+ visualizablePipelines: VisualizablePipeline[] = [];
+ availableWidgets: DashboardWidgetSettings[];
selectedPipeline: VisualizablePipeline;
selectedWidget: DashboardWidgetSettings;
@@ -61,7 +61,7 @@ export class AddVisualizationDialogComponent {
dashboard: Dashboard;
selectedType: any;
- page: any = "select-pipeline";
+ page: any = 'select-pipeline';
dialogTitle: string;
@@ -74,13 +74,13 @@ export class AddVisualizationDialogComponent {
ngOnInit() {
if (!this.data) {
- this.dialogTitle = "Add widget";
+ this.dialogTitle = 'Add widget';
this.dashboardService.getVisualizablePipelines().subscribe(visualizations => {
this.visualizablePipelines = visualizations;
});
this.availableWidgets = WidgetRegistry.getAvailableWidgetTemplates();
} else {
- this.dialogTitle = "Edit widget";
+ this.dialogTitle = 'Edit widget';
this.selectedPipeline = this.data.widget.dashboardWidgetDataConfig;
this.selectedWidget = this.data.widget.dashboardWidgetSettings;
this.page = 'configure-widget';
@@ -101,15 +101,15 @@ export class AddVisualizationDialogComponent {
getSelectedCss(selected, current) {
if (selected == current) {
- return "wizard-preview wizard-preview-selected";
+ return 'wizard-preview wizard-preview-selected';
} else {
- return "wizard-preview";
+ return 'wizard-preview';
}
}
getTabCss(page) {
- if (page == this.page) return "md-fab md-accent";
- else return "md-fab md-accent wizard-inactive";
+ if (page == this.page) { return 'md-fab md-accent'; }
+ else { return 'md-fab md-accent wizard-inactive'; }
}
selectPipeline(vis) {
@@ -121,7 +121,7 @@ export class AddVisualizationDialogComponent {
this.selectedWidget = widget;
this.selectedWidget.config.forEach(sp => {
if (sp instanceof MappingPropertyUnary || sp instanceof MappingPropertyNary) {
- let requirement: EventProperty = this.findRequirement(this.selectedWidget.requiredSchema, sp.internalName);
+ const requirement: EventProperty = this.findRequirement(this.selectedWidget.requiredSchema, sp.internalName);
sp.mapsFromOptions = new MappingPropertyGenerator(requirement, this.selectedPipeline.schema.eventProperties).computeMatchingProperties();
}
});
@@ -138,7 +138,7 @@ export class AddVisualizationDialogComponent {
} else if (this.page == 'select-widget') {
this.page = 'configure-widget';
} else {
- let configuredWidget: DashboardWidget = new DashboardWidget();
+ const configuredWidget: DashboardWidget = new DashboardWidget();
configuredWidget.dashboardWidgetSettings = this.selectedWidget;
configuredWidget.dashboardWidgetDataConfig = this.selectedPipeline;
if (!this.data) {
@@ -166,4 +166,4 @@ export class AddVisualizationDialogComponent {
return this.elementIconText.getElementIconText(s);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.css b/ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.css
rename to ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.css
diff --git a/ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.html b/ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.html
similarity index 89%
rename from ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.html
rename to ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.html
index 62c4cc5..34b45b3 100644
--- a/ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.html
+++ b/ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.html
@@ -23,10 +23,10 @@
<gridster [options]="options" [ngClass]="editMode ? 'edit' : ''">
<ng-container *ngFor="let item of dashboard.widgets;let i=index">
<gridster-item [item]="item" #gridsterItemComponent>
- <dashboard-widget (updateCallback)="propagateItemUpdate($event)"
+ <sp-data-explorer-dashboard-widget (updateCallback)="propagateItemUpdate($event)"
(deleteCallback)="propagateItemRemoval($event)"
[item]="item" [widget]="item"
- [editMode]="editMode" [gridsterItemComponent]="gridsterItemComponent"></dashboard-widget>
+ [editMode]="editMode" [gridsterItemComponent]="gridsterItemComponent"></sp-data-explorer-dashboard-widget>
</gridster-item>
</ng-container>
</gridster>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.ts b/ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.ts
similarity index 67%
rename from ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.ts
rename to ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.ts
index fc17584..dc273a4 100644
--- a/ui/src/app/data-explorer-v2/components/grid/dashboard-grid.component.ts
+++ b/ui/src/app/data-explorer-v2/components/grid/data-explorer-dashboard-grid.component.ts
@@ -17,7 +17,6 @@
*/
import {
- AfterViewInit,
Component, EventEmitter,
Input,
OnChanges,
@@ -25,35 +24,35 @@ import {
QueryList,
SimpleChanges,
ViewChildren
-} from "@angular/core";
-import {Dashboard, DashboardConfig, DashboardItem} from "../../models/dashboard.model";
-import {GridsterInfo} from "../../models/gridster-info.model";
-import {ResizeService} from "../../services/resize.service";
-import {GridsterItemComponent, GridType} from "angular-gridster2";
-import {DashboardService} from "../../services/dashboard.service";
-import {RefreshDashboardService} from "../../services/refresh-dashboard.service";
-import {DashboardWidget} from "../../../core-model/dashboard/DashboardWidget";
+} from '@angular/core';
+import { GridsterItemComponent, GridType } from 'angular-gridster2';
+import { DashboardWidget } from '../../../core-model/dashboard/DashboardWidget';
+import { GridsterInfo } from '../../../dashboard-v2/models/gridster-info.model';
+import { IDataViewDashboard, IDataViewDashboardConfig, IDataViewDashboardItem } from '../../models/dataview-dashboard.model';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
+import { RefreshDashboardService } from '../../services/refresh-dashboard.service';
+import { ResizeService } from '../../services/resize.service';
@Component({
- selector: 'dashboard-grid',
- templateUrl: './dashboard-grid.component.html',
- styleUrls: ['./dashboard-grid.component.css']
+ selector: 'sp-data-explorer-dashboard-grid',
+ templateUrl: './data-explorer-dashboard-grid.component.html',
+ styleUrls: ['./data-explorer-dashboard-grid.component.css']
})
-export class DashboardGridComponent implements OnInit, OnChanges {
+export class DataExplorerDashboardGridComponent implements OnInit, OnChanges {
@Input() editMode: boolean;
- @Input() dashboard: Dashboard;
+ @Input() dashboard: IDataViewDashboard;
- @Output() deleteCallback: EventEmitter<DashboardItem> = new EventEmitter<DashboardItem>();
+ @Output() deleteCallback: EventEmitter<IDataViewDashboardItem> = new EventEmitter<IDataViewDashboardItem>();
@Output() updateCallback: EventEmitter<DashboardWidget> = new EventEmitter<DashboardWidget>();
- options: DashboardConfig;
- loaded: boolean = false;
+ options: IDataViewDashboardConfig;
+ loaded = false;
@ViewChildren(GridsterItemComponent) gridsterItemComponents: QueryList<GridsterItemComponent>;
constructor(private resizeService: ResizeService,
- private dashboardService: DashboardService,
+ private dashboardService: DataViewDashboardService,
private refreshDashboardService: RefreshDashboardService) {
}
@@ -79,7 +78,7 @@ export class DashboardGridComponent implements OnInit, OnChanges {
}
ngOnChanges(changes: SimpleChanges): void {
- if (changes["editMode"] && this.options) {
+ if (changes['editMode'] && this.options) {
this.options.draggable.enabled = this.editMode;
this.options.resizable.enabled = this.editMode;
this.options.displayGrid = this.editMode ? 'always' : 'none';
@@ -87,7 +86,7 @@ export class DashboardGridComponent implements OnInit, OnChanges {
}
}
- propagateItemRemoval(widget: DashboardItem) {
+ propagateItemRemoval(widget: IDataViewDashboardItem) {
this.deleteCallback.emit(widget);
}
@@ -95,4 +94,4 @@ export class DashboardGridComponent implements OnInit, OnChanges {
this.updateCallback.emit(dashboardWidget);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.ts b/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.ts
deleted file mode 100644
index e18af21..0000000
--- a/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.ts
+++ /dev/null
@@ -1,89 +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, EventEmitter, Input, OnInit, Output} from "@angular/core";
-import {Dashboard} from "../../models/dashboard.model";
-import {MatTableDataSource} from "@angular/material/table";
-import {MatDialog} from "@angular/material/dialog";
-import {DashboardService} from "../../services/dashboard.service";
-import {AddVisualizationDialogComponent} from "../../dialogs/add-widget/add-visualization-dialog.component";
-import {EditDashboardDialogComponent} from "../../dialogs/edit-dashboard/edit-dashboard-dialog.component";
-
-@Component({
- selector: 'dashboard-overview',
- templateUrl: './dashboard-overview.component.html',
- styleUrls: ['./dashboard-overview.component.css']
-})
-export class DashboardOverviewComponent implements OnInit {
-
- @Input() dashboards: Array<Dashboard>;
- @Output() reloadDashboardsEmitter = new EventEmitter<void>();
- @Output() selectDashboardEmitter = new EventEmitter<Dashboard>();
-
- dataSource = new MatTableDataSource<Dashboard>();
- displayedColumns: string[] = ['name', 'open', 'openWindow', 'edit', 'delete'];
-
- constructor(private dashboardService: DashboardService,
- public dialog: MatDialog) {
-
- }
-
- ngOnInit(): void {
- this.dataSource.data = this.dashboards;
- }
-
- openNewDashboardDialog() {
- let dashboard = {} as Dashboard;
- dashboard.widgets = [];
-
- this.openDashboardModificationDialog(true, dashboard);
- }
-
- openDashboardModificationDialog(createMode: boolean, dashboard: Dashboard) {
- const dialogRef = this.dialog.open(EditDashboardDialogComponent, {
- width: '70%',
- panelClass: 'custom-dialog-container'
- });
- dialogRef.componentInstance.createMode = createMode;
- dialogRef.componentInstance.dashboard = dashboard;
-
- dialogRef.afterClosed().subscribe(result => {
- this.reloadDashboardsEmitter.emit();
- });
- }
-
- openEditDashboardDialog(dashboard: Dashboard) {
- this.openDashboardModificationDialog(false, dashboard);
- }
-
- openDeleteDashboardDialog(dashboard: Dashboard) {
- // TODO add confirm dialog
- this.dashboardService.deleteDashboard(dashboard).subscribe(result => {
- this.reloadDashboardsEmitter.emit();
- });
- }
-
- showDashboard(dashboard: Dashboard) {
- this.selectDashboardEmitter.emit(dashboard);
- }
-
- openExternalDashboard(dashboard: Dashboard) {
-
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.css b/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.css
rename to ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.css
diff --git a/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.html b/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.html
similarity index 97%
rename from ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.html
rename to ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.html
index 86a80f4..37c380f 100644
--- a/ui/src/app/data-explorer-v2/components/overview/dashboard-overview.component.html
+++ b/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.html
@@ -16,16 +16,17 @@
~
-->
+
<div fxFlex="100" fxLayout="column" class="m-20">
<div fxLayout="row wrap">
- <button mat-button mat-raised-button color="primary" (click)="openNewDashboardDialog()">
- New dashboard
+ <button mat-button mat-raised-button color="primary" (click)="openNewDataViewDialog()">
+ New Data View
</button>
</div>
<div fxFlex="100" fxLayout="row wrap" fxLayoutAlign="start stretch">
<div fxFlex="100" class="assemblyOptions sp-blue-bg" style="padding:5px;">
<div fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
- <h4>My dashboards</h4>
+ <h4>My Data Views</h4>
<span flex></span>
</div>
</div>
diff --git a/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.ts b/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.ts
new file mode 100644
index 0000000..1c4bf3b
--- /dev/null
+++ b/ui/src/app/data-explorer-v2/components/overview/data-explorer-dashboard-overview.component.ts
@@ -0,0 +1,88 @@
+/*
+ * 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, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { MatTableDataSource } from '@angular/material/table';
+import { DataExplorerEditDataViewDialogComponent } from '../../dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component';
+import { IDataViewDashboard } from '../../models/dataview-dashboard.model';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
+
+@Component({
+ selector: 'sp-data-explorer-dashboard-overview',
+ templateUrl: './data-explorer-dashboard-overview.component.html',
+ styleUrls: ['./data-explorer-dashboard-overview.component.css']
+})
+export class DataExplorerDashboardOverviewComponent implements OnInit {
+
+ @Input() dataViewDashboards: IDataViewDashboard[];
+ @Output() reloadDashboardsEmitter = new EventEmitter<void>();
+ @Output() selectDashboardEmitter = new EventEmitter<IDataViewDashboard>();
+
+ dataSource = new MatTableDataSource<IDataViewDashboard>();
+ displayedColumns: string[] = ['name', 'open', 'openWindow', 'edit', 'delete'];
+
+ constructor(private dashboardService: DataViewDashboardService,
+ public dialog: MatDialog) {
+
+ }
+
+ ngOnInit(): void {
+ this.dataSource.data = this.dataViewDashboards;
+ }
+
+ openNewDataViewDialog() {
+ const dataViewDashboard = {} as IDataViewDashboard;
+ dataViewDashboard.widgets = [];
+
+ this.openDataViewModificationDialog(true, dataViewDashboard);
+ }
+
+ openDataViewModificationDialog(createMode: boolean, dashboard: IDataViewDashboard) {
+ const dialogRef = this.dialog.open(DataExplorerEditDataViewDialogComponent, {
+ width: '70%',
+ panelClass: 'custom-dialog-container'
+ });
+ dialogRef.componentInstance.createMode = createMode;
+ dialogRef.componentInstance.dashboard = dashboard;
+
+ dialogRef.afterClosed().subscribe(result => {
+ this.reloadDashboardsEmitter.emit();
+ });
+ }
+
+ openEditDataViewDialog(dashboard: IDataViewDashboard) {
+ this.openDataViewModificationDialog(false, dashboard);
+ }
+
+ openDeleteDashboardDialog(dashboard: IDataViewDashboard) {
+ // TODO add confirm dialog
+ this.dashboardService.deleteDashboard(dashboard).subscribe(result => {
+ this.reloadDashboardsEmitter.emit();
+ });
+ }
+
+ showDashboard(dashboard: IDataViewDashboard) {
+ this.selectDashboardEmitter.emit(dashboard);
+ }
+
+ openExternalDashboard(dashboard: IDataViewDashboard) {
+
+ }
+
+}
diff --git a/ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.css b/ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.css
rename to ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.css
diff --git a/ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.html b/ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.html
similarity index 90%
rename from ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.html
rename to ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.html
index 682418b..fc4bdac 100644
--- a/ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.html
+++ b/ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.html
@@ -28,8 +28,8 @@
visualization</button>
</div>
- <dashboard-grid [editMode]="editMode" [dashboard]="dashboard"
+ <sp-data-explorer-dashboard-grid [editMode]="editMode" [dashboard]="dashboard"
(updateCallback)="updateAndQueueItemForDeletion($event)"
(deleteCallback)="removeAndQueueItemForDeletion($event)"
- class="h-100"></dashboard-grid>
+ class="h-100"></sp-data-explorer-dashboard-grid>
</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.ts b/ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.ts
similarity index 67%
rename from ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.ts
rename to ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.ts
index 8b4895f..30dea71 100644
--- a/ui/src/app/data-explorer-v2/components/panel/dashboard-panel.component.ts
+++ b/ui/src/app/data-explorer-v2/components/panel/data-explorer-dashboard-panel.component.ts
@@ -16,34 +16,34 @@
*
*/
-import {Component, EventEmitter, Input, OnInit, Output} from "@angular/core";
-import {Dashboard, DashboardItem} from "../../models/dashboard.model";
-import {forkJoin, Observable, Subscription} from "rxjs";
-import {MatDialog} from "@angular/material/dialog";
-import {AddVisualizationDialogComponent} from "../../dialogs/add-widget/add-visualization-dialog.component";
-import {DashboardWidget} from "../../../core-model/dashboard/DashboardWidget";
-import {DashboardService} from "../../services/dashboard.service";
-import {RefreshDashboardService} from "../../services/refresh-dashboard.service";
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { forkJoin, Observable, Subscription } from 'rxjs';
+import { DashboardWidget } from '../../../core-model/dashboard/DashboardWidget';
+import { DataExplorerAddVisualizationDialogComponent } from '../../dialogs/add-widget/data-explorer-add-visualization-dialog.component';
+import { IDataViewDashboard, IDataViewDashboardItem } from '../../models/dataview-dashboard.model';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
+import { RefreshDashboardService } from '../../services/refresh-dashboard.service';
@Component({
- selector: 'dashboard-panel',
- templateUrl: './dashboard-panel.component.html',
- styleUrls: ['./dashboard-panel.component.css']
+ selector: 'sp-data-explorer-dashboard-panel',
+ templateUrl: './data-explorer-dashboard-panel.component.html',
+ styleUrls: ['./data-explorer-dashboard-panel.component.css']
})
-export class DashboardPanelComponent implements OnInit {
+export class DataExplorerDashboardPanelComponent implements OnInit {
- @Input() dashboard: Dashboard;
- @Input("editMode") editMode: boolean;
- @Output("editModeChange") editModeChange: EventEmitter<boolean> = new EventEmitter();
+ @Input() dashboard: IDataViewDashboard;
+ @Input('editMode') editMode: boolean;
+ @Output('editModeChange') editModeChange: EventEmitter<boolean> = new EventEmitter();
- public items: DashboardItem[];
+ public items: IDataViewDashboardItem[];
protected subscription: Subscription;
- widgetIdsToRemove: Array<string> = [];
+ widgetIdsToRemove: string[] = [];
widgetsToUpdate: Map<string, DashboardWidget> = new Map<string, DashboardWidget>();
- constructor(private dashboardService: DashboardService,
+ constructor(private dashboardService: DataViewDashboardService,
public dialog: MatDialog,
private refreshDashboardService: RefreshDashboardService) {
}
@@ -53,7 +53,7 @@ export class DashboardPanelComponent implements OnInit {
}
addWidget(): void {
- const dialogRef = this.dialog.open(AddVisualizationDialogComponent, {
+ const dialogRef = this.dialog.open(DataExplorerAddVisualizationDialogComponent, {
width: '70%',
height: '500px',
panelClass: 'custom-dialog-container'
@@ -67,7 +67,7 @@ export class DashboardPanelComponent implements OnInit {
}
addWidgetToDashboard(widget: DashboardWidget) {
- let dashboardItem = {} as DashboardItem;
+ const dashboardItem = {} as IDataViewDashboardItem;
dashboardItem.widgetId = widget._id;
dashboardItem.id = widget._id;
// TODO there should be a widget type DashboardWidget
@@ -87,9 +87,9 @@ export class DashboardPanelComponent implements OnInit {
});
} else {
this.deleteWidgets();
- this.closeEditModeAndReloadDashboard()
+ this.closeEditModeAndReloadDashboard();
}
- })
+ });
}
closeEditModeAndReloadDashboard() {
@@ -98,10 +98,10 @@ export class DashboardPanelComponent implements OnInit {
}
prepareWidgetUpdates(): Array<Observable<any>> {
- let promises: Array<Observable<any>> = [];
+ const promises: Array<Observable<any>> = [];
this.widgetsToUpdate.forEach((widget, key) => {
promises.push(this.dashboardService.updateWidget(widget));
- })
+ });
return promises;
}
@@ -111,7 +111,7 @@ export class DashboardPanelComponent implements OnInit {
this.refreshDashboardService.notify(this.dashboard._id);
}
- removeAndQueueItemForDeletion(widget: DashboardItem) {
+ removeAndQueueItemForDeletion(widget: IDataViewDashboardItem) {
this.dashboard.widgets.splice(this.dashboard.widgets.indexOf(widget), 1);
this.widgetIdsToRemove.push(widget.id);
}
@@ -125,4 +125,4 @@ export class DashboardPanelComponent implements OnInit {
this.dashboardService.deleteWidget(widgetId).subscribe();
});
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.html b/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.html
deleted file mode 100644
index 98851a7..0000000
--- a/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.html
+++ /dev/null
@@ -1,65 +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 style="height:100%;">
- <div class="box">
- <div class="assemblyOptions sp-blue-bg m-0 row header h-40" *ngIf="editMode">
- <div fxFlex="100" layout="row" fxLayoutAlign="end center">
- <button mat-button mat-icon-button color="white" (click)="editWidget()">
- <i class="material-icons">settings</i>
- </button>
- <button mat-button mat-icon-button color="white" (click)="removeWidget()">
- <i class="material-icons">clear</i>
- </button>
- </div>
- </div>
- <div class="h-100 p-0 row content">
- <!-- <div *ngIf="widget."></div>-->
- <div *ngIf="widgetLoaded" class="h-100">
- <div *ngIf="widget.widgetType === 'number'" class="h-100 p-0">
- <number-widget [gridsterItemComponent]="gridsterItemComponent" [gridsterItem]="item"
- [widget]="widget" [editMode]="editMode"
- [widgetConfig]="configuredWidget" class="h-100"></number-widget>
- </div>
- <div *ngIf="widget.widgetType === 'line'" class="h-100 p-0">
- <line-widget [gridsterItemComponent]="gridsterItemComponent" [editMode]="editMode"
- [gridsterItem]="item" [widget]="widget" [widgetConfig]="configuredWidget" class="h-100"></line-widget>
- </div>
- <div *ngIf="widget.widgetType === 'area'" class="h-100 p-0">
- <area-widget [gridsterItemComponent]="gridsterItemComponent" [editMode]="editMode"
- [gridsterItem]="item" [widget]="widget" [widgetConfig]="configuredWidget" class="h-100"></area-widget>
- </div>
- <div *ngIf="widget.widgetType === 'table'" class="h-100 p-0">
- <table-widget [gridsterItemComponent]="gridsterItemComponent"
- [gridsterItem]="item" [widget]="widget" [editMode]="editMode"
- [widgetConfig]="configuredWidget" class="h-100"></table-widget>
- </div>
- <div *ngIf="widget.widgetType === 'gauge'" class="h-100 p-0">
- <gauge-widget [gridsterItemComponent]="gridsterItemComponent"
- [gridsterItem]="item" [widget]="widget" [editMode]="editMode"
- [widgetConfig]="configuredWidget" class="h-100"></gauge-widget>
- </div>
- <div *ngIf="widget.widgetType === 'image'" class="h-100 p-0">
- <image-widget [gridsterItemComponent]="gridsterItemComponent"
- [gridsterItem]="item" [widget]="widget" [editMode]="editMode"
- [widgetConfig]="configuredWidget" class="h-100"></image-widget>
- </div>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.css b/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.css
rename to ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.css
diff --git a/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.html b/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.html
new file mode 100644
index 0000000..a1be73d
--- /dev/null
+++ b/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.html
@@ -0,0 +1,42 @@
+<!--
+ ~ 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 style="height:100%;">
+ <div class="box">
+ <div class="assemblyOptions sp-blue-bg m-0 row header h-40" *ngIf="editMode">
+ <div fxFlex="100" layout="row" fxLayoutAlign="end center">
+ <button mat-button mat-icon-button color="white" (click)="editWidget()">
+ <i class="material-icons">settings</i>
+ </button>
+ <button mat-button mat-icon-button color="white" (click)="removeWidget()">
+ <i class="material-icons">clear</i>
+ </button>
+ </div>
+ </div>
+ <div class="h-100 p-0 row content">
+ <!-- <div *ngIf="widget."></div>-->
+ <div *ngIf="widgetLoaded" class="h-100">
+ <div *ngIf="widget.widgetType === 'number'" class="h-100 p-0">
+ <sp-data-exploerer-number-widget [gridsterItemComponent]="gridsterItemComponent" [gridsterItem]="item"
+ [widget]="widget" [editMode]="editMode"
+ [widgetConfig]="configuredWidget" class="h-100"></sp-data-exploerer-number-widget>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.ts b/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.ts
similarity index 56%
rename from ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.ts
rename to ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.ts
index 60a480a..2cf2ea1 100644
--- a/ui/src/app/data-explorer-v2/components/widget/dashboard-widget.component.ts
+++ b/ui/src/app/data-explorer-v2/components/widget/data-explorer-dashboard-widget.component.ts
@@ -16,37 +16,33 @@
*
*/
-import {AfterViewInit, Component, ElementRef, EventEmitter, Input, OnInit, Output} from "@angular/core";
-import {Dashboard, DashboardItem} from "../../models/dashboard.model";
-import {DashboardService} from "../../services/dashboard.service";
-import {DashboardImageComponent} from "../../../app-transport-monitoring/components/dashboard-image/dashboard-image.component";
-import {DashboardWidget} from "../../../core-model/dashboard/DashboardWidget";
-import {Subject} from "rxjs";
-import {GridsterItem, GridsterItemComponent} from "angular-gridster2";
-import {GridsterInfo} from "../../models/gridster-info.model";
-import {ResizeService} from "../../services/resize.service";
-import {AddVisualizationDialogComponent} from "../../dialogs/add-widget/add-visualization-dialog.component";
-import {MatDialog} from "@angular/material/dialog";
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
+import { DashboardWidget } from '../../../core-model/dashboard/DashboardWidget';
+import { DataExplorerAddVisualizationDialogComponent } from '../../dialogs/add-widget/data-explorer-add-visualization-dialog.component';
+import { IDataViewDashboardItem } from '../../models/dataview-dashboard.model';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
@Component({
- selector: 'dashboard-widget',
- templateUrl: './dashboard-widget.component.html',
- styleUrls: ['./dashboard-widget.component.css']
+ selector: 'sp-data-explorer-dashboard-widget',
+ templateUrl: './data-explorer-dashboard-widget.component.html',
+ styleUrls: ['./data-explorer-dashboard-widget.component.css']
})
-export class DashboardWidgetComponent implements OnInit {
+export class DataExplorerDashboardWidgetComponent implements OnInit {
- @Input() widget: DashboardItem;
+ @Input() widget: IDataViewDashboardItem;
@Input() editMode: boolean;
@Input() item: GridsterItem;
@Input() gridsterItemComponent: GridsterItemComponent;
- @Output() deleteCallback: EventEmitter<DashboardItem> = new EventEmitter<DashboardItem>();
+ @Output() deleteCallback: EventEmitter<IDataViewDashboardItem> = new EventEmitter<IDataViewDashboardItem>();
@Output() updateCallback: EventEmitter<DashboardWidget> = new EventEmitter<DashboardWidget>();
- widgetLoaded: boolean = false;
+ widgetLoaded = false;
configuredWidget: DashboardWidget;
- constructor(private dashboardService: DashboardService,
+ constructor(private dashboardService: DataViewDashboardService,
private dialog: MatDialog) {
}
@@ -62,12 +58,12 @@ export class DashboardWidgetComponent implements OnInit {
}
editWidget(): void {
- const dialogRef = this.dialog.open(AddVisualizationDialogComponent, {
+ const dialogRef = this.dialog.open(DataExplorerAddVisualizationDialogComponent, {
width: '70%',
height: '500px',
panelClass: 'custom-dialog-container',
data: {
- "widget": this.configuredWidget
+ 'widget': this.configuredWidget
}
});
@@ -78,4 +74,4 @@ export class DashboardWidgetComponent implements OnInit {
}
});
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/area/area-config.ts b/ui/src/app/data-explorer-v2/components/widgets/area/area-config.ts
deleted file mode 100644
index 23d01a7..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/area/area-config.ts
+++ /dev/null
@@ -1,32 +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 {BaseNgxLineConfig} from "../base/base-ngx-line-config";
-
-export class AreaConfig extends BaseNgxLineConfig {
-
- getWidgetLabel(): string {
- return "area";
- }
-
- getWidgetName(): string {
- return "area";
- }
-
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.css b/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.css
deleted file mode 100644
index 4215dfd..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.css
+++ /dev/null
@@ -1,24 +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.
- */
-
-.title-panel {
- font-size:20px;
-}
-
-.mt-20 {
- margin-top:20px;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.html
deleted file mode 100644
index 9f9bbeb..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.html
+++ /dev/null
@@ -1,41 +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 fxFlex="100" fxLayoutAlign="center center" fxLayout="column" class="main-panel" [ngStyle]="{'background-color': selectedBackgroundColor, 'color': selectedPrimaryTextColor}">
- <div class="title-panel mt-20" *ngIf="hasTitlePanelSettings">
- {{selectedTitle}}
- </div>
- <ngx-charts-area-chart *ngIf="displayChart"
- [showXAxisLabel]="false"
- [showYAxisLabel]="false"
- [scheme]="colorScheme"
- [timeline]="false"
- [view]="view"
- [autoScale]="false"
- [xAxis]="true"
- [yAxis]="true"
- [yScaleMin]="minYAxisRange"
- [yScaleMax]="maxYAxisRange"
- [tooltipDisabled]="true"
- [animations]="false"
- [xAxisTickFormatting]="timestampTickFormatting"
- [results]="multi" style="margin-top:10px;margin-bottom:10px;"
- [ngStyle]="{'fill': selectedPrimaryTextColor}">
- </ngx-charts-area-chart>
-</div>
-
diff --git a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.ts
deleted file mode 100644
index aaa6db0..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/area/area-widget.component.ts
+++ /dev/null
@@ -1,43 +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, OnDestroy, OnInit} from "@angular/core";
-import {BaseNgxLineChartsStreamPipesWidget} from "../base/base-ngx-line-charts-widget";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {ResizeService} from "../../../services/resize.service";
-
-@Component({
- selector: 'area-widget',
- templateUrl: './area-widget.component.html',
- styleUrls: ['./area-widget.component.css']
-})
-export class AreaWidgetComponent extends BaseNgxLineChartsStreamPipesWidget implements OnInit, OnDestroy {
-
- constructor(rxStompService: RxStompService, resizeService: ResizeService) {
- super(rxStompService, resizeService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
- }
-
- ngOnDestroy(): void {
- super.ngOnDestroy();
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/base/base-config.ts b/ui/src/app/data-explorer-v2/components/widgets/base/base-config.ts
index fc221cb..531640b 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/base/base-config.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/base/base-config.ts
@@ -16,9 +16,9 @@
*
*/
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
+import { DashboardWidgetSettings } from '../../../../core-model/dashboard/DashboardWidgetSettings';
export abstract class WidgetConfig {
abstract getConfig(): DashboardWidgetSettings;
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-charts-widget.ts b/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-charts-widget.ts
index 619bd3d..ddfa0b6 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-charts-widget.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-charts-widget.ts
@@ -16,21 +16,21 @@
*
*/
-import {BaseStreamPipesWidget} from "./base-widget";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {ResizeService} from "../../../services/resize.service";
-import {GridsterInfo} from "../../../models/gridster-info.model";
-import {GridsterItemComponent} from "angular-gridster2";
+import { OnInit } from '@angular/core';
+import { GridsterItemComponent } from 'angular-gridster2';
+import { GridsterInfo } from '../../../../dashboard-v2/models/gridster-info.model';
+import { ResizeService } from '../../../services/resize.service';
+import { BaseStreamPipesWidget } from './base-widget';
-export abstract class BaseNgxChartsStreamPipesWidget extends BaseStreamPipesWidget {
+export abstract class BaseNgxChartsStreamPipesWidget extends BaseStreamPipesWidget implements OnInit {
view: any[] = [];
- displayChart: boolean = false;
+ displayChart = false;
colorScheme: any;
- constructor(rxStompService: RxStompService, protected resizeService: ResizeService) {
- super(rxStompService);
+ constructor(protected resizeService: ResizeService) {
+ super();
}
ngOnInit() {
@@ -60,7 +60,8 @@ export abstract class BaseNgxChartsStreamPipesWidget extends BaseStreamPipesWidg
}
computeCurrentHeight(gridsterItemComponent: GridsterItemComponent): number {
- return (gridsterItemComponent.height - (BaseNgxChartsStreamPipesWidget.PADDING * 2) - this.editModeOffset() - this.titlePanelOffset());
+ return (gridsterItemComponent.height - (BaseNgxChartsStreamPipesWidget.PADDING * 2)
+ - this.editModeOffset() - this.titlePanelOffset());
}
editModeOffset(): number {
@@ -71,4 +72,4 @@ export abstract class BaseNgxChartsStreamPipesWidget extends BaseStreamPipesWidg
return this.hasTitlePanelSettings ? 20 : 0;
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-charts-widget.ts b/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-charts-widget.ts
deleted file mode 100644
index 03d0172..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-charts-widget.ts
+++ /dev/null
@@ -1,74 +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 {RxStompService} from "@stomp/ng2-stompjs";
-import {ResizeService} from "../../../services/resize.service";
-import {BaseNgxChartsStreamPipesWidget} from "./base-ngx-charts-widget";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {LineConfig} from "../line/line-config";
-
-export abstract class BaseNgxLineChartsStreamPipesWidget extends BaseNgxChartsStreamPipesWidget {
-
- multi:any = [];
-
- selectedNumberProperty: string;
- selectedTimestampProperty: string;
- minYAxisRange: number;
- maxYAxisRange: number;
-
- constructor(rxStompService: RxStompService, resizeService: ResizeService) {
- super(rxStompService, resizeService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
- this.multi = [
- {
- "name": this.selectedNumberProperty,
- "series": [
- ]
- }];
- }
-
- protected extractConfig(extractor: StaticPropertyExtractor) {
- this.selectedNumberProperty = extractor.mappingPropertyValue(LineConfig.NUMBER_MAPPING_KEY);
- this.selectedTimestampProperty = extractor.mappingPropertyValue(LineConfig.TIMESTAMP_MAPPING_KEY);
- this.minYAxisRange = extractor.integerParameter(LineConfig.MIN_Y_AXIS_KEY);
- this.maxYAxisRange = extractor.integerParameter(LineConfig.MAX_Y_AXIS_KEY);
- }
-
- protected onEvent(event: any) {
- let time = event[this.selectedTimestampProperty];
- let value = event[this.selectedNumberProperty];
- this.makeEvent(time, value);
- }
-
- makeEvent(time: any, value: any): void {
- this.multi[0].series.push({"name": time, "value": value});
- if (this.multi[0].series.length > 10) {
- this.multi[0].series.shift();
- }
- this.multi = [...this.multi];
- }
-
- timestampTickFormatting(timestamp: any): string {
- var date = new Date(timestamp);
- let timeString = date.getHours() + ':' + date.getMinutes().toString().substr(-2) + ':' + date.getSeconds().toString().substr(-2);
- return timeString;
- }
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-config.ts b/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-config.ts
deleted file mode 100644
index 143d4c1..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/base/base-ngx-line-config.ts
+++ /dev/null
@@ -1,47 +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 {WidgetConfig} from "./base-config";
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
-import {SchemaRequirementsBuilder} from "../../../sdk/schema-requirements-builder";
-import {EpRequirements} from "../../../sdk/ep-requirements";
-
-export abstract class BaseNgxLineConfig extends WidgetConfig {
-
- static readonly NUMBER_MAPPING_KEY: string = "number-mapping";
- static readonly TIMESTAMP_MAPPING_KEY: string = "timestamp-mapping";
- static readonly MIN_Y_AXIS_KEY: string = "min-y-axis-key";
- static readonly MAX_Y_AXIS_KEY: string = "max-y-axis-key";
-
- getConfig(): DashboardWidgetSettings {
- return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel(this.getWidgetName(), this.getWidgetLabel())
- .requiredSchema(SchemaRequirementsBuilder
- .create()
- .requiredPropertyWithUnaryMapping(BaseNgxLineConfig.TIMESTAMP_MAPPING_KEY, "Timestamp field", "", EpRequirements.timestampReq())
- .requiredPropertyWithUnaryMapping(BaseNgxLineConfig.NUMBER_MAPPING_KEY, "Number field", "", EpRequirements.numberReq())
- .build())
- .requiredIntegerParameter(BaseNgxLineConfig.MIN_Y_AXIS_KEY, "Y-axis range (min)", "")
- .requiredIntegerParameter(BaseNgxLineConfig.MAX_Y_AXIS_KEY, "Y-axis range (min)", "")
- .build();
- }
-
- abstract getWidgetName(): string;
-
- abstract getWidgetLabel(): string;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/base/base-widget.ts b/ui/src/app/data-explorer-v2/components/widgets/base/base-widget.ts
index 79bd7da..d2b979f 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/base/base-widget.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/base/base-widget.ts
@@ -16,27 +16,28 @@
*
*/
-import {Input, OnChanges, OnInit, SimpleChanges} from "@angular/core";
-import {DashboardItem} from "../../../models/dashboard.model";
-import {DashboardWidget} from "../../../../core-model/dashboard/DashboardWidget";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {Message} from "@stomp/stompjs";
-import {Subscription} from "rxjs";
-import {GridsterItem, GridsterItemComponent} from "angular-gridster2";
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
+import { Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
+import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
+import { Subscription } from 'rxjs';
+import { DashboardWidget } from '../../../../core-model/dashboard/DashboardWidget';
+import { IDataViewDashboardItem } from '../../../models/dataview-dashboard.model';
+import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
+import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor';
-export abstract class BaseStreamPipesWidget implements OnChanges {
+export abstract class BaseStreamPipesWidget implements OnChanges, OnInit, OnDestroy {
- @Input() widget: DashboardItem;
+ protected constructor() {
+ }
+
+ static readonly PADDING: number = 20;
+ static readonly EDIT_HEADER_HEIGHT: number = 40;
+
+ @Input() widget: IDataViewDashboardItem;
@Input() widgetConfig: DashboardWidget;
@Input() gridsterItem: GridsterItem;
@Input() gridsterItemComponent: GridsterItemComponent;
@Input() editMode: boolean;
- static readonly PADDING: number = 20;
- static readonly EDIT_HEADER_HEIGHT: number = 40;
-
subscription: Subscription;
hasSelectableColorSettings: boolean;
@@ -47,22 +48,17 @@ export abstract class BaseStreamPipesWidget implements OnChanges {
selectedSecondaryTextColor: string;
selectedTitle: string;
- defaultBackgroundColor: string = "#1B1464";
- defaultPrimaryTextColor: string = "#FFFFFF";
- defaultSecondaryTextColor: string = "#39B54A";
-
- protected constructor(private rxStompService: RxStompService) {
- }
+ defaultBackgroundColor = '#1B1464';
+ defaultPrimaryTextColor = '#FFFFFF';
+ defaultSecondaryTextColor = '#39B54A';
ngOnInit(): void {
this.prepareConfigExtraction();
- this.subscription = this.rxStompService.watch("/topic/" +this.widgetConfig.dashboardWidgetDataConfig.topic).subscribe((message: Message) => {
- this.onEvent(JSON.parse(message.body));
- });
}
prepareConfigExtraction() {
- let extractor: StaticPropertyExtractor = new StaticPropertyExtractor(this.widgetConfig.dashboardWidgetDataConfig.schema, this.widgetConfig.dashboardWidgetSettings.config);
+ const extractor: StaticPropertyExtractor = new StaticPropertyExtractor(
+ this.widgetConfig.dashboardWidgetDataConfig.schema, this.widgetConfig.dashboardWidgetSettings.config);
if (extractor.hasStaticProperty(WidgetConfigBuilder.BACKGROUND_COLOR_KEY)) {
this.hasSelectableColorSettings = true;
this.selectedBackgroundColor = extractor.selectedColor(WidgetConfigBuilder.BACKGROUND_COLOR_KEY);
@@ -89,8 +85,8 @@ export abstract class BaseStreamPipesWidget implements OnChanges {
protected abstract onEvent(event: any);
ngOnChanges(changes: SimpleChanges): void {
- if (changes["widgetConfig"]) {
+ if (changes['widgetConfig']) {
this.prepareConfigExtraction();
}
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-config.ts b/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-config.ts
deleted file mode 100644
index 76eb3a8..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-config.ts
+++ /dev/null
@@ -1,48 +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 {WidgetConfig} from "../base/base-config";
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
-import {SchemaRequirementsBuilder} from "../../../sdk/schema-requirements-builder";
-import {EpRequirements} from "../../../sdk/ep-requirements";
-
-export class GaugeConfig extends WidgetConfig {
-
- static readonly TITLE_KEY: string = "title-key";
- static readonly NUMBER_MAPPING_KEY: string = "number-mapping";
- static readonly COLOR_KEY: string = "color-key";
- static readonly MIN_KEY: string = "min-key";
- static readonly MAX_KEY: string = "max-key";
-
- constructor() {
- super();
- }
-
- getConfig(): DashboardWidgetSettings {
- return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel("gauge", "gauge")
- .requiredSchema(SchemaRequirementsBuilder
- .create()
- .requiredPropertyWithUnaryMapping(GaugeConfig.NUMBER_MAPPING_KEY, "Select property", "", EpRequirements.numberReq())
- .build())
- .requiredIntegerParameter(GaugeConfig.MIN_KEY, "Min Y axis value", "")
- .requiredIntegerParameter(GaugeConfig.MAX_KEY, "Max Y axis value", "")
- .build();
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.css b/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.css
deleted file mode 100644
index 0dd319a..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.css
+++ /dev/null
@@ -1,32 +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.
- *
- */
-
-.main-panel {
- width:100%;
- height: 100%;
- display:inline-grid;
- align-content: center;
-}
-
-.mt-20 {
- margin-top:20px;
-}
-
-.title-panel {
- font-size:20px;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.html
deleted file mode 100644
index 9b6c9ee..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.html
+++ /dev/null
@@ -1,36 +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 fxFlex="100" fxLayoutAlign="center center" fxLayout="column" class="main-panel"
- [ngStyle]="{'background-color': selectedBackgroundColor, 'color': selectedPrimaryTextColor}">
- <div class="title-panel mt-20" *ngIf="hasTitlePanelSettings">
- {{selectedTitle}}
- </div>
- <ngx-charts-gauge
- [view]="view"
- [scheme]="colorScheme"
- [results]="data"
- [min]="min"
- [max]="max"
- [angleSpan]="240"
- [startAngle]="-120"
- [bigSegments]="10"
- [smallSegments]="5"
- [ngStyle]="{'fill': selectedPrimaryTextColor}" *ngIf="displayChart">
- </ngx-charts-gauge>
-</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.ts
deleted file mode 100644
index 479da83..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/gauge/gauge-widget.component.ts
+++ /dev/null
@@ -1,67 +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 {AfterViewInit, Component, ElementRef, OnDestroy, OnInit} from "@angular/core";
-import {BaseNgxChartsStreamPipesWidget} from "../base/base-ngx-charts-widget";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {ResizeService} from "../../../services/resize.service";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {GaugeConfig} from "./gauge-config";
-
-
-@Component({
- selector: 'gauge-widget',
- templateUrl: './gauge-widget.component.html',
- styleUrls: ['./gauge-widget.component.css']
-})
-export class GaugeWidgetComponent extends BaseNgxChartsStreamPipesWidget implements OnInit, OnDestroy {
-
- data: any = [];
- min: number;
- max: number;
-
- selectedProperty: string;
-
- constructor(rxStompService: RxStompService, resizeService: ResizeService, private el: ElementRef) {
- super(rxStompService, resizeService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
- }
-
- ngOnDestroy(): void {
- super.ngOnDestroy();
- }
-
- extractConfig(extractor: StaticPropertyExtractor) {
- this.min = extractor.integerParameter(GaugeConfig.MIN_KEY);
- this.max = extractor.integerParameter(GaugeConfig.MAX_KEY);
- this.selectedProperty = extractor.mappingPropertyValue(GaugeConfig.NUMBER_MAPPING_KEY);
- }
-
- isNumber(item: any): boolean {
- return false;
- }
-
- protected onEvent(event: any) {
- this.data[0] = ({"name": "value", "value": event[this.selectedProperty]});
- this.data = [...this.data];
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/image/image-config.ts b/ui/src/app/data-explorer-v2/components/widgets/image/image-config.ts
deleted file mode 100644
index 20e3086..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/image/image-config.ts
+++ /dev/null
@@ -1,44 +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 {WidgetConfig} from "../base/base-config";
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
-import {SchemaRequirementsBuilder} from "../../../sdk/schema-requirements-builder";
-import {EpRequirements} from "../../../sdk/ep-requirements";
-
-export class ImageConfig extends WidgetConfig {
-
- static readonly TITLE_KEY: string = "title-key";
- static readonly NUMBER_MAPPING_KEY: string = "number-mapping";
-
- constructor() {
- super();
- }
-
- getConfig(): DashboardWidgetSettings {
- return WidgetConfigBuilder.create("image", "image")
- .requiredSchema(SchemaRequirementsBuilder
- .create()
- .requiredPropertyWithUnaryMapping(ImageConfig.NUMBER_MAPPING_KEY, "Select property", "", EpRequirements.imageReq())
- .build())
- .requiredTextParameter(ImageConfig.TITLE_KEY, "Title", "The title")
- .build();
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.css b/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.css
deleted file mode 100644
index 340d4a7..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.css
+++ /dev/null
@@ -1,31 +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.
- *
- */
-
-.image-box {
- width:100%;
- height: 100%;
- color: #fff;
- text-align: center;
- left: 50%;
- display:inline-grid;
- align-content: center;
-}
-
-.image-title {
- font-size:14px;
-}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.html
deleted file mode 100644
index ea6be46..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.html
+++ /dev/null
@@ -1,26 +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 class="image-box" [ngStyle]="{'background-color': 'white'}">
- <div class="imageTitle">
- {{title}}
- </div>
- <div class="imageContent">
- <img style="width: 100%;" src="data:image/jpg;base64,{{item}}" *ngIf="item" />
- </div>
-</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.ts
deleted file mode 100644
index 6725eea..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/image/image-widget.component.ts
+++ /dev/null
@@ -1,62 +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, OnDestroy, OnInit} from "@angular/core";
-import {BaseNgxChartsStreamPipesWidget} from "../base/base-ngx-charts-widget";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {ResizeService} from "../../../services/resize.service";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {GaugeConfig} from "../gauge/gauge-config";
-
-@Component({
- selector: 'image-widget',
- templateUrl: './image-widget.component.html',
- styleUrls: ['./image-widget.component.css']
-})
-export class ImageWidgetComponent extends BaseNgxChartsStreamPipesWidget implements OnInit, OnDestroy {
-
- item: any;
- title: string;
- selectedProperty: string;
-
- constructor(rxStompService: RxStompService, resizeService: ResizeService) {
- super(rxStompService, resizeService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
- }
-
- ngOnDestroy(): void {
- super.ngOnDestroy();
- }
-
- extractConfig(extractor: StaticPropertyExtractor) {
- this.title = extractor.singleValueParameter(GaugeConfig.TITLE_KEY);
- this.selectedProperty = extractor.mappingPropertyValue(GaugeConfig.NUMBER_MAPPING_KEY);
- }
-
- isNumber(item: any): boolean {
- return false;
- }
-
- protected onEvent(event: any) {
- this.item = event[this.selectedProperty];
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line/line-config.ts b/ui/src/app/data-explorer-v2/components/widgets/line/line-config.ts
deleted file mode 100644
index da45420..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/line/line-config.ts
+++ /dev/null
@@ -1,30 +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 {BaseNgxLineConfig} from "../base/base-ngx-line-config";
-
-export class LineConfig extends BaseNgxLineConfig {
-
- getWidgetLabel(): string {
- return "line";
- }
-
- getWidgetName(): string {
- return "line";
- }
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.css b/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.css
deleted file mode 100644
index 0dd319a..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.css
+++ /dev/null
@@ -1,32 +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.
- *
- */
-
-.main-panel {
- width:100%;
- height: 100%;
- display:inline-grid;
- align-content: center;
-}
-
-.mt-20 {
- margin-top:20px;
-}
-
-.title-panel {
- font-size:20px;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.html
deleted file mode 100644
index e3eea5f..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.html
+++ /dev/null
@@ -1,41 +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 fxFlex="100" fxLayoutAlign="center center" fxLayout="column" class="main-panel" [ngStyle]="{'background-color': selectedBackgroundColor, 'color': selectedPrimaryTextColor}">
- <div class="title-panel mt-20" *ngIf="hasTitlePanelSettings">
- {{selectedTitle}}
- </div>
- <ngx-charts-line-chart *ngIf="displayChart"
- [showXAxisLabel]="false"
- [showYAxisLabel]="false"
- [scheme]="colorScheme"
- [timeline]="false"
- [view]="view"
- [autoScale]="false"
- [xAxis]="true"
- [yAxis]="true"
- [yScaleMin]="minYAxisRange"
- [yScaleMax]="maxYAxisRange"
- [tooltipDisabled]="true"
- [animations]="false"
- [xAxisTickFormatting]="timestampTickFormatting"
- [results]="multi" style="margin-top:10px;margin-bottom:10px;"
- [ngStyle]="{'fill': selectedPrimaryTextColor}">
- </ngx-charts-line-chart>
-</div>
-
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.ts
deleted file mode 100644
index 31d4ff2..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/line/line-widget.component.ts
+++ /dev/null
@@ -1,46 +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 {AfterViewInit, Component, ElementRef, OnDestroy, OnInit} from "@angular/core";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {LineConfig} from "./line-config";
-import {ResizeService} from "../../../services/resize.service";
-import {BaseNgxChartsStreamPipesWidget} from "../base/base-ngx-charts-widget";
-import {BaseNgxLineChartsStreamPipesWidget} from "../base/base-ngx-line-charts-widget";
-
-@Component({
- selector: 'line-widget',
- templateUrl: './line-widget.component.html',
- styleUrls: ['./line-widget.component.css']
-})
-export class LineWidgetComponent extends BaseNgxLineChartsStreamPipesWidget implements OnInit, OnDestroy {
-
- constructor(rxStompService: RxStompService, resizeService: ResizeService) {
- super(rxStompService, resizeService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
- }
-
- ngOnDestroy(): void {
- super.ngOnDestroy();
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/number/number-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/number/number-widget.component.ts
index 7157be8..389818b 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/number/number-widget.component.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/number/number-widget.component.ts
@@ -16,11 +16,10 @@
*
*/
-import {Component, Input, OnDestroy, OnInit} from "@angular/core";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {BaseStreamPipesWidget} from "../base/base-widget";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {NumberConfig} from "./number-config";
+import { Component, Input, OnDestroy, OnInit } from '@angular/core';
+import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor';
+import { BaseStreamPipesWidget } from '../base/base-widget';
+import { NumberConfig } from './number-config';
@Component({
selector: 'number-widget',
@@ -33,8 +32,8 @@ export class NumberWidgetComponent extends BaseStreamPipesWidget implements OnIn
selectedProperty: string;
- constructor(rxStompService: RxStompService) {
- super(rxStompService);
+ constructor() {
+ super();
}
ngOnInit(): void {
@@ -57,4 +56,4 @@ export class NumberWidgetComponent extends BaseStreamPipesWidget implements OnIn
this.item = event[this.selectedProperty];
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/table/table-config.ts b/ui/src/app/data-explorer-v2/components/widgets/table/table-config.ts
deleted file mode 100644
index 47b71f5..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/table/table-config.ts
+++ /dev/null
@@ -1,44 +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 {WidgetConfig} from "../base/base-config";
-import {DashboardWidgetSettings} from "../../../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfigBuilder} from "../../../registry/widget-config-builder";
-import {SchemaRequirementsBuilder} from "../../../sdk/schema-requirements-builder";
-import {EpRequirements} from "../../../sdk/ep-requirements";
-
-export class TableConfig extends WidgetConfig {
-
- static readonly TITLE_KEY: string = "title-key";
- static readonly SELECTED_PROPERTIES_KEYS: string = "selected-fields-key";
-
- constructor() {
- super();
- }
-
- getConfig(): DashboardWidgetSettings {
- return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel("table", "table")
- .requiredSchema(SchemaRequirementsBuilder
- .create()
- .requiredPropertyWithNaryMapping(TableConfig.SELECTED_PROPERTIES_KEYS, "Select properties", "", EpRequirements.anyProperty())
- .build())
- .requiredTextParameter(TableConfig.TITLE_KEY, "Title", "The title")
- .build();
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.css b/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.css
deleted file mode 100644
index 59023f4..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.css
+++ /dev/null
@@ -1,26 +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.
- *
- */
-
-.title-panel {
- font-size:20px;
- text-align:center;
-}
-
-.mt-20 {
- margin-top:20px;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.html
deleted file mode 100644
index dc55f14..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.html
+++ /dev/null
@@ -1,36 +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" fxFlex="100" [ngStyle]="{'background-color': selectedBackgroundColor, 'color':
-selectedPrimaryTextColor}">
- <div class="title-panel mt-20" *ngIf="hasTitlePanelSettings">
- {{selectedTitle}}
- </div>
- <table fxFlex="100" mat-table [dataSource]="dataSource" [ngStyle]="{'background': selectedBackgroundColor}">
-
- <ng-container *ngFor="let element of selectedProperties" [cdkColumnDef]="element">
- <th mat-header-cell [ngStyle]="{'color': selectedPrimaryTextColor}"
- *matHeaderCellDef><label>{{element}}</label></th>
- <td mat-cell *matCellDef="let row" [ngStyle]="{'color': selectedPrimaryTextColor}">{{row[element]}}</td>
- </ng-container>
-
- <tr mat-header-row *matHeaderRowDef="selectedProperties; sticky: true"></tr>
- <tr mat-row *matRowDef="let row; columns: selectedProperties;"></tr>
-
- </table>
-</div>
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.ts
deleted file mode 100644
index 56c970b..0000000
--- a/ui/src/app/data-explorer-v2/components/widgets/table/table-widget.component.ts
+++ /dev/null
@@ -1,77 +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, OnDestroy, OnInit} from "@angular/core";
-import {BaseStreamPipesWidget} from "../base/base-widget";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {StaticPropertyExtractor} from "../../../sdk/extractor/static-property-extractor";
-import {MatTableDataSource} from "@angular/material/table";
-import {TableConfig} from "./table-config";
-import {SemanticTypeUtilsService} from "../../../../core-services/semantic-type/semantic-type-utils.service";
-
-@Component({
- selector: 'table-widget',
- templateUrl: './table-widget.component.html',
- styleUrls: ['./table-widget.component.css']
-})
-export class TableWidgetComponent extends BaseStreamPipesWidget implements OnInit, OnDestroy {
-
- selectedProperties: Array<string>;
-
- displayedColumns: String[] = [];
- dataSource = new MatTableDataSource();
- semanticTypes: { [key: string]: string; } = {};
-
- constructor(rxStompService: RxStompService, private semanticTypeUtils: SemanticTypeUtilsService) {
- super(rxStompService);
- }
-
- ngOnInit(): void {
- super.ngOnInit();
-
- this.widgetConfig.dashboardWidgetDataConfig.schema.eventProperties.forEach((key, index) => {
- this.semanticTypes[key.runtimeName] = key.domainProperty
- });
- }
-
- ngOnDestroy(): void {
- super.ngOnDestroy();
- }
-
- extractConfig(extractor: StaticPropertyExtractor) {
- this.selectedProperties = extractor.mappingPropertyValues(TableConfig.SELECTED_PROPERTIES_KEYS);
- }
-
- protected onEvent(event: any) {
- this.dataSource.data.unshift(this.createTableObject(event));
- if (this.dataSource.data.length > 10) {
- this.dataSource.data.pop();
- }
- this.dataSource.data = [...this.dataSource.data];
- }
-
- createTableObject(event: any) {
- let object = {};
- this.selectedProperties.forEach((key, index) => {
- event[key] = this.semanticTypeUtils.getValue(event[key], this.semanticTypes[key]);
- object[key] = event[key];
- });
- return object;
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/data-explorer-v2.component.html b/ui/src/app/data-explorer-v2/data-explorer-v2.component.html
index 6bb288d..1319386 100644
--- a/ui/src/app/data-explorer-v2/data-explorer-v2.component.html
+++ b/ui/src/app/data-explorer-v2/data-explorer-v2.component.html
@@ -23,29 +23,29 @@
<div fxFlex fxLayoutAlign="start center">
<mat-tab-group [selectedIndex]="selectedIndex" (selectedIndexChange)="selectDashboard($event)">
<mat-tab label="Start"></mat-tab>
- <mat-tab *ngFor="let dashboard of dashboards" label="{{dashboard.name}}"></mat-tab>
+ <mat-tab *ngFor="let dataViewDashboard of dataViewDashboards" label="{{dataViewDashboard.name}}"></mat-tab>
</mat-tab-group>
</div>
<div fxFlex fxLayoutAlign="end center" class="mr-20">
- <button mat-button mat-icon-button color="primary"
- *ngIf="selectedIndex > 0" (click)="toggleEditMode()" [disabled]="editMode">
- <i class="material-icons">edit</i>
- </button>
+ <button mat-button mat-icon-button color="primary"
+ *ngIf="selectedIndex > 0" (click)="toggleEditMode()" [disabled]="editMode">
+ <i class="material-icons">edit</i>
+ </button>
</div>
</div>
</div>
</div>
<div class="fixed-height page-container-padding-inner" fxLayout="column" fxFlex="100" *ngIf="dashboardsLoaded">
- <dashboard-overview (selectDashboardEmitter)="openDashboard($event)"
- (reloadDashboardsEmitter)="getDashboards()"
- [dashboards]="dashboards"
- *ngIf="!dashboardTabSelected">
+ <sp-data-explorer-dashboard-overview (selectDashboardEmitter)="openDashboard($event)"
+ (reloadDashboardsEmitter)="getDashboards()"
+ [dataViewDashboards]="dataViewDashboards"
+ *ngIf="!dashboardTabSelected">
- </dashboard-overview>
- <dashboard-panel fxLayout="column" [(editMode)]="editMode" [dashboard]="selectedDashboard"
- style="height:100%;" *ngIf="dashboardTabSelected">
+ </sp-data-explorer-dashboard-overview>
+ <sp-data-explorer-dashboard-panel fxLayout="column" [(editMode)]="editMode" [dashboard]="selectedDataViewDashboard"
+ style="height:100%;" *ngIf="dashboardTabSelected">
- </dashboard-panel>
+ </sp-data-explorer-dashboard-panel>
</div>
</div>
diff --git a/ui/src/app/data-explorer-v2/data-explorer-v2.component.ts b/ui/src/app/data-explorer-v2/data-explorer-v2.component.ts
index eab8564..3efde57 100644
--- a/ui/src/app/data-explorer-v2/data-explorer-v2.component.ts
+++ b/ui/src/app/data-explorer-v2/data-explorer-v2.component.ts
@@ -17,27 +17,27 @@
*/
import { Component, OnInit } from '@angular/core';
-import { Dashboard } from './models/dashboard.model';
-import { DashboardService } from './services/dashboard.service';
+import { IDataViewDashboard } from './models/dataview-dashboard.model';
+import { DataViewDashboardService } from './services/data-view-dashboard.service';
import { RefreshDashboardService } from './services/refresh-dashboard.service';
@Component({
- selector: 'data-explorer-v2',
+ selector: 'sp-data-explorer-v2',
templateUrl: './data-explorer-v2.component.html',
styleUrls: ['./data-explorer-v2.component.css']
})
export class DataExplorerV2Component implements OnInit {
- selectedDashboard: Dashboard;
+ selectedDataViewDashboard: IDataViewDashboard;
selectedIndex = 0;
dashboardsLoaded = false;
dashboardTabSelected = false;
editMode = false;
- dashboards: Dashboard[];
+ dataViewDashboards: IDataViewDashboard[];
- constructor(private dashboardService: DashboardService,
+ constructor(private dataViewService: DataViewDashboardService,
private refreshDashboardService: RefreshDashboardService) {}
public ngOnInit() {
@@ -48,28 +48,28 @@ export class DataExplorerV2Component implements OnInit {
}
- openDashboard(dashboard: Dashboard) {
- const index = this.dashboards.indexOf(dashboard);
+ openDashboard(dashboard: IDataViewDashboard) {
+ const index = this.dataViewDashboards.indexOf(dashboard);
this.selectDashboard((index + 1));
}
selectDashboard(index: number) {
this.selectedIndex = index;
- if (index == 0) {
+ if (index === 0) {
this.dashboardTabSelected = false;
} else {
this.dashboardTabSelected = true;
- this.selectedDashboard = this.dashboards[(index - 1)];
+ this.selectedDataViewDashboard = this.dataViewDashboards[(index - 1)];
}
}
protected getDashboards(currentDashboardId?: string) {
this.dashboardsLoaded = false;
- this.dashboardService.getDashboards().subscribe(data => {
- this.dashboards = data;
+ this.dataViewService.getDataViews().subscribe(data => {
+ this.dataViewDashboards = data;
if (currentDashboardId) {
- const currentDashboard = this.dashboards.find(d => d._id === currentDashboardId);
- this.selectDashboard(this.dashboards.indexOf(currentDashboard) + 1);
+ const currentDashboard = this.dataViewDashboards.find(d => d._id === currentDashboardId);
+ this.selectDashboard(this.dataViewDashboards.indexOf(currentDashboard) + 1);
} else {
this.selectedIndex = 0;
}
diff --git a/ui/src/app/data-explorer-v2/data-explorer-v2.module.ts b/ui/src/app/data-explorer-v2/data-explorer-v2.module.ts
index 1e4d678..9147690 100644
--- a/ui/src/app/data-explorer-v2/data-explorer-v2.module.ts
+++ b/ui/src/app/data-explorer-v2/data-explorer-v2.module.ts
@@ -32,23 +32,17 @@ import { ConnectModule } from '../connect/connect.module';
import { SemanticTypeUtilsService } from '../core-services/semantic-type/semantic-type-utils.service';
import { CustomMaterialModule } from '../CustomMaterial/custom-material.module';
import { ElementIconText } from '../services/get-element-icon-text.service';
-import { DashboardGridComponent } from './components/grid/dashboard-grid.component';
-import { DashboardOverviewComponent } from './components/overview/dashboard-overview.component';
-import { DashboardPanelComponent } from './components/panel/dashboard-panel.component';
-import { DashboardWidgetComponent } from './components/widget/dashboard-widget.component';
-import { AreaWidgetComponent } from './components/widgets/area/area-widget.component';
-import { GaugeWidgetComponent } from './components/widgets/gauge/gauge-widget.component';
-import { ImageWidgetComponent } from './components/widgets/image/image-widget.component';
-import { LineWidgetComponent } from './components/widgets/line/line-widget.component';
+import { DataExplorerDashboardGridComponent } from './components/grid/data-explorer-dashboard-grid.component';
+import { DataExplorerDashboardOverviewComponent } from './components/overview/data-explorer-dashboard-overview.component';
+import { DataExplorerDashboardPanelComponent } from './components/panel/data-explorer-dashboard-panel.component';
+import { DataExplorerDashboardWidgetComponent } from './components/widget/data-explorer-dashboard-widget.component';
import { NumberWidgetComponent } from './components/widgets/number/number-widget.component';
-import { TableWidgetComponent } from './components/widgets/table/table-widget.component';
import { DataExplorerV2Component } from './data-explorer-v2.component';
-import { AddVisualizationDialogComponent } from './dialogs/add-widget/add-visualization-dialog.component';
-import { EditDashboardDialogComponent } from './dialogs/edit-dashboard/edit-dashboard-dialog.component';
-import { DashboardService } from './services/dashboard.service';
+import { DataExplorerAddVisualizationDialogComponent } from './dialogs/add-widget/data-explorer-add-visualization-dialog.component';
+import { DataExplorerEditDataViewDialogComponent } from './dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component';
+import { DataViewDashboardService } from './services/data-view-dashboard.service';
import { RefreshDashboardService } from './services/refresh-dashboard.service';
import { ResizeService } from './services/resize.service';
-import { streamPipesStompConfig } from './services/websocket.config';
const dashboardWidgets = [
@@ -75,21 +69,16 @@ const dashboardWidgets = [
],
declarations: [
DataExplorerV2Component,
- DashboardGridComponent,
- DashboardOverviewComponent,
- DashboardPanelComponent,
- DashboardWidgetComponent,
- AddVisualizationDialogComponent,
- EditDashboardDialogComponent,
- AreaWidgetComponent,
- LineWidgetComponent,
+ DataExplorerDashboardGridComponent,
+ DataExplorerDashboardOverviewComponent,
+ DataExplorerDashboardPanelComponent,
+ DataExplorerDashboardWidgetComponent,
+ DataExplorerAddVisualizationDialogComponent,
+ DataExplorerEditDataViewDialogComponent,
NumberWidgetComponent,
- TableWidgetComponent,
- GaugeWidgetComponent,
- ImageWidgetComponent
],
providers: [
- DashboardService,
+ DataViewDashboardService,
ResizeService,
RefreshDashboardService,
SemanticTypeUtilsService,
@@ -101,7 +90,6 @@ const dashboardWidgets = [
ElementIconText,
{
provide: InjectableRxStompConfig,
- useValue: streamPipesStompConfig
},
{
provide: RxStompService,
@@ -114,8 +102,8 @@ const dashboardWidgets = [
],
entryComponents: [
DataExplorerV2Component,
- AddVisualizationDialogComponent,
- EditDashboardDialogComponent
+ DataExplorerAddVisualizationDialogComponent,
+ DataExplorerEditDataViewDialogComponent
]
})
export class DataExplorerV2Module {
diff --git a/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.ts b/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.ts
deleted file mode 100644
index 24df862..0000000
--- a/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.ts
+++ /dev/null
@@ -1,169 +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, Inject} from "@angular/core";
-import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
-import {DashboardService} from "../../services/dashboard.service";
-import {ElementIconText} from "../../../services/get-element-icon-text.service";
-import {WidgetRegistry} from "../../registry/widget-registry";
-import {MappingPropertyUnary} from "../../../connect/model/MappingPropertyUnary";
-import {MappingPropertyGenerator} from "../../sdk/matching/mapping-property-generator";
-import {EventProperty} from "../../../connect/schema-editor/model/EventProperty";
-import {EventSchema} from "../../../connect/schema-editor/model/EventSchema";
-import {DashboardWidget} from "../../../core-model/dashboard/DashboardWidget";
-import {DashboardWidgetSettings} from "../../../core-model/dashboard/DashboardWidgetSettings";
-import {VisualizablePipeline} from "../../../core-model/dashboard/VisualizablePipeline";
-import {Dashboard} from "../../models/dashboard.model";
-import {MappingPropertyNary} from "../../../connect/model/MappingPropertyNary";
-
-@Component({
- selector: 'add-visualization-dialog-component',
- templateUrl: './add-visualization-dialog.component.html',
- styleUrls: ['./add-visualization-dialog.component.css']
-})
-export class AddVisualizationDialogComponent {
-
- pages = [{
- type: "select-pipeline",
- title: "Select Pipeline",
- description: "Select a pipeline you'd like to visualize"
- }, {
- type: "select-widget",
- title: "Select Widget",
- description: "Select widget"
- }, {
- type: "configure-widget",
- title: "Configure Widget",
- description: "Configure widget"
- }];
-
- visualizablePipelines: Array<VisualizablePipeline> = [];
- availableWidgets: Array<DashboardWidgetSettings>;
-
- selectedPipeline: VisualizablePipeline;
- selectedWidget: DashboardWidgetSettings;
-
- dashboard: Dashboard;
-
- selectedType: any;
- page: any = "select-pipeline";
- dialogTitle: string;
-
-
- constructor(
- public dialogRef: MatDialogRef<AddVisualizationDialogComponent>,
- @Inject(MAT_DIALOG_DATA) public data: any,
- private dashboardService: DashboardService,
- public elementIconText: ElementIconText) {
- }
-
- ngOnInit() {
- if (!this.data) {
- this.dialogTitle = "Add widget";
- this.dashboardService.getVisualizablePipelines().subscribe(visualizations => {
- this.visualizablePipelines = visualizations;
- });
- this.availableWidgets = WidgetRegistry.getAvailableWidgetTemplates();
- } else {
- this.dialogTitle = "Edit widget";
- this.selectedPipeline = this.data.widget.dashboardWidgetDataConfig;
- this.selectedWidget = this.data.widget.dashboardWidgetSettings;
- this.page = 'configure-widget';
- }
- }
-
- onCancel(): void {
- this.dialogRef.close();
- }
-
- getSelectedPipelineCss(vis) {
- return this.getSelectedCss(this.selectedPipeline, vis);
- }
-
- getSelectedVisTypeCss(type) {
- return this.getSelectedCss(this.selectedType, type);
- }
-
- getSelectedCss(selected, current) {
- if (selected == current) {
- return "wizard-preview wizard-preview-selected";
- } else {
- return "wizard-preview";
- }
- }
-
- getTabCss(page) {
- if (page == this.page) return "md-fab md-accent";
- else return "md-fab md-accent wizard-inactive";
- }
-
- selectPipeline(vis) {
- this.selectedPipeline = vis;
- this.next();
- }
-
- selectWidget(widget) {
- this.selectedWidget = widget;
- this.selectedWidget.config.forEach(sp => {
- if (sp instanceof MappingPropertyUnary || sp instanceof MappingPropertyNary) {
- let requirement: EventProperty = this.findRequirement(this.selectedWidget.requiredSchema, sp.internalName);
- sp.mapsFromOptions = new MappingPropertyGenerator(requirement, this.selectedPipeline.schema.eventProperties).computeMatchingProperties();
- }
- });
- this.next();
- }
-
- findRequirement(requiredSchema: EventSchema, internalName: string) {
- return requiredSchema.eventProperties.find(ep => ep.runtimeName === internalName);
- }
-
- next() {
- if (this.page == 'select-pipeline') {
- this.page = 'select-widget';
- } else if (this.page == 'select-widget') {
- this.page = 'configure-widget';
- } else {
- let configuredWidget: DashboardWidget = new DashboardWidget();
- configuredWidget.dashboardWidgetSettings = this.selectedWidget;
- configuredWidget.dashboardWidgetDataConfig = this.selectedPipeline;
- if (!this.data) {
- this.dashboardService.saveWidget(configuredWidget).subscribe(response => {
- this.dialogRef.close(response);
- });
- } else {
- configuredWidget._id = this.data.widget._id;
- configuredWidget._ref = this.data.widget._ref;
- configuredWidget.widgetId = this.data.widget.widgetId;
- this.dialogRef.close(configuredWidget);
- }
- }
- }
-
- back() {
- if (this.page == 'select-widget') {
- this.page = 'select-pipeline';
- } else if (this.page == 'configure-widget') {
- this.page = 'select-widget';
- }
- }
-
- iconText(s) {
- return this.elementIconText.getElementIconText(s);
- }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.css b/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.css
rename to ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.css
diff --git a/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.html b/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.html
similarity index 93%
rename from ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.html
rename to ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.html
index c746d86..32158f3 100644
--- a/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.html
+++ b/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.html
@@ -35,11 +35,11 @@
[cols]="3" [rowHeight]="200"
[gutterSize]="100">
- <mat-grid-tile class="gray" *ngFor="let pipeline of visualizablePipelines">
- <div [ngClass]="getSelectedPipelineCss(pipeline)"
- (click)="selectPipeline(pipeline)">
- {{iconText(pipeline.visualizationName)}}
- <h5>{{pipeline.visualizationName}}</h5>
+ <mat-grid-tile class="gray" *ngFor="let dataSet of visualizableData">
+ <div [ngClass]="getSelectedPipelineCss(dataSet)"
+ (click)="selectPipeline(dataSet)">
+ {{iconText(dataSet.measureName)}}
+ <h5>{{dataSet.measureName}}</h5>
</div>
</mat-grid-tile>
</mat-grid-list>
diff --git a/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts b/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
new file mode 100644
index 0000000..d83a242
--- /dev/null
+++ b/ui/src/app/data-explorer-v2/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
@@ -0,0 +1,169 @@
+/*
+ * 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, Inject, OnInit } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { MappingPropertyNary } from '../../../connect/model/MappingPropertyNary';
+import { MappingPropertyUnary } from '../../../connect/model/MappingPropertyUnary';
+import { EventProperty } from '../../../connect/schema-editor/model/EventProperty';
+import { EventSchema } from '../../../connect/schema-editor/model/EventSchema';
+import { DashboardWidget } from '../../../core-model/dashboard/DashboardWidget';
+import { DashboardWidgetSettings } from '../../../core-model/dashboard/DashboardWidgetSettings';
+import { InfoResult } from '../../../core-model/datalake/InfoResult';
+import { ElementIconText } from '../../../services/get-element-icon-text.service';
+import { IDataViewDashboard } from '../../models/dataview-dashboard.model';
+import { WidgetRegistry } from '../../registry/widget-registry';
+import { MappingPropertyGenerator } from '../../sdk/matching/mapping-property-generator';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
+
+@Component({
+ selector: 'sp-data-explorer-add-visualization-dialog-component',
+ templateUrl: './data-explorer-add-visualization-dialog.component.html',
+ styleUrls: ['./data-explorer-add-visualization-dialog.component.css']
+})
+export class DataExplorerAddVisualizationDialogComponent implements OnInit {
+
+
+ constructor(
+ public dialogRef: MatDialogRef<DataExplorerAddVisualizationDialogComponent>,
+ @Inject(MAT_DIALOG_DATA) public data: any,
+ private dashboardService: DataViewDashboardService,
+ public elementIconText: ElementIconText) {
+ }
+
+ pages = [{
+ type: 'select-pipeline',
+ title: 'Select Pipeline',
+ description: 'Select a pipeline you\'d like to visualize'
+ }, {
+ type: 'select-widget',
+ title: 'Select Widget',
+ description: 'Select widget'
+ }, {
+ type: 'configure-widget',
+ title: 'Configure Widget',
+ description: 'Configure widget'
+ }];
+
+ visualizableData: InfoResult[] = [];
+ availableWidgets: DashboardWidgetSettings[];
+
+ selectedDataSet: InfoResult;
+ selectedWidget: DashboardWidgetSettings;
+
+ dashboard: IDataViewDashboard;
+
+ selectedType: any;
+ page: any = 'select-pipeline';
+ dialogTitle: string;
+
+ static getSelectedCss(selected, current) {
+ if (selected === current) {
+ return 'wizard-preview wizard-preview-selected';
+ } else {
+ return 'wizard-preview';
+ }
+ }
+
+ ngOnInit() {
+ if (!this.data) {
+ this.dialogTitle = 'Add widget';
+ this.dashboardService.getVisualizableData().subscribe(visualizations => {
+ this.visualizableData = visualizations;
+ });
+ this.availableWidgets = WidgetRegistry.getAvailableWidgetTemplates();
+ } else {
+ this.dialogTitle = 'Edit widget';
+ this.selectedDataSet = this.data.widget.dashboardWidgetDataConfig;
+ this.selectedWidget = this.data.widget.dashboardWidgetSettings;
+ this.page = 'configure-widget';
+ }
+ }
+
+ onCancel(): void {
+ this.dialogRef.close();
+ }
+
+ getSelectedPipelineCss(vis) {
+ return DataExplorerAddVisualizationDialogComponent.getSelectedCss(this.selectedDataSet, vis);
+ }
+
+ getSelectedVisTypeCss(type) {
+ return DataExplorerAddVisualizationDialogComponent.getSelectedCss(this.selectedDataSet, type);
+ }
+
+ getTabCss(page) {
+ if (page === this.page) { return 'md-fab md-accent'; } else { return 'md-fab md-accent wizard-inactive'; }
+ }
+
+ selectPipeline(vis) {
+ this.selectedDataSet = vis;
+ this.next();
+ }
+
+ selectWidget(widget) {
+ this.selectedWidget = widget;
+ this.selectedWidget.config.forEach(sp => {
+ if (sp instanceof MappingPropertyUnary || sp instanceof MappingPropertyNary) {
+ const requirement: EventProperty = this.findRequirement(this.selectedWidget.requiredSchema, sp.internalName);
+ sp.mapsFromOptions = new MappingPropertyGenerator(requirement,
+ this.selectedDataSet.eventSchema.eventProperties).computeMatchingProperties();
+ }
+ });
+ this.next();
+ }
+
+ findRequirement(requiredSchema: EventSchema, internalName: string) {
+ return requiredSchema.eventProperties.find(ep => ep.runtimeName === internalName);
+ }
+
+ next() {
+ if (this.page === 'select-pipeline') {
+ this.page = 'select-widget';
+ } else if (this.page === 'select-widget') {
+ this.page = 'configure-widget';
+ } else {
+ const configuredWidget: DashboardWidget = new DashboardWidget();
+ configuredWidget.dashboardWidgetSettings = this.selectedWidget;
+ // configuredWidget.dashboardWidgetDataConfig = this.selectedDataSet;
+ if (!this.data) {
+ this.dashboardService.saveWidget(configuredWidget).subscribe(response => {
+ this.dialogRef.close(response);
+ });
+ } else {
+ configuredWidget._id = this.data.widget._id;
+ configuredWidget._ref = this.data.widget._ref;
+ configuredWidget.widgetId = this.data.widget.widgetId;
+ this.dialogRef.close(configuredWidget);
+ }
+ }
+ }
+
+ back() {
+ if (this.page === 'select-widget') {
+ this.page = 'select-pipeline';
+ } else if (this.page === 'configure-widget') {
+ this.page = 'select-widget';
+ }
+ }
+
+ iconText(s) {
+ return this.elementIconText.getElementIconText(s);
+ }
+
+}
diff --git a/ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.css b/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.css
similarity index 100%
rename from ui/src/app/data-explorer-v2/dialogs/add-widget/add-visualization-dialog.component.css
rename to ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.css
diff --git a/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.html b/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
similarity index 88%
rename from ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.html
rename to ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
index 980b679..5216331 100644
--- a/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.html
+++ b/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.html
@@ -18,7 +18,7 @@
<mat-toolbar>
<div class="md-toolbar-tools">
- <h2>{{createMode ? 'New dashboard' : 'Edit dashboard'}}</h2>
+ <h2>{{createMode ? 'New Data View' : 'Edit Data View'}}</h2>
<span fxFlex></span>
<button mat-icon-button (click)="onCancel()">
<i class="material-icons">close</i>
@@ -30,14 +30,14 @@
<div fxFlex="100">
<div fxFlex="100" fxLayout="column" style="margin:5px;width:100%">
<mat-form-field class="full-width">
- <mat-label>Dashboard Name</mat-label>
+ <mat-label>Data View Name</mat-label>
<input matInput [(ngModel)]="dashboard.name">
</mat-form-field>
<mat-form-field class="full-width">
<mat-label>Description</mat-label>
<input matInput [(ngModel)]="dashboard.description">
</mat-form-field>
- <mat-checkbox [(ngModel)]="dashboard.displayHeader">Show name and description in dashboard</mat-checkbox>
+ <!--<mat-checkbox [(ngModel)]="dashboard.displayHeader">Show name and description in dashboard</mat-checkbox>-->
</div>
</div>
diff --git a/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts b/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
similarity index 57%
rename from ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts
rename to ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
index 72d9433..6369a24 100644
--- a/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts
+++ b/ui/src/app/data-explorer-v2/dialogs/edit-dashboard/data-explorer-edit-data-view-dialog.component.ts
@@ -16,26 +16,24 @@
*
*/
-import {Component, Inject} from "@angular/core";
-import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
-import {DashboardService} from "../../services/dashboard.service";
-import {DashboardWidgetSettings} from "../../../core-model/dashboard/DashboardWidgetSettings";
-import {VisualizablePipeline} from "../../../core-model/dashboard/VisualizablePipeline";
-import {Dashboard} from "../../models/dashboard.model";
+import { Component, OnInit } from '@angular/core';
+import { MatDialogRef } from '@angular/material/dialog';
+import { IDataViewDashboard } from '../../models/dataview-dashboard.model';
+import { DataViewDashboardService } from '../../services/data-view-dashboard.service';
@Component({
- selector: 'edit-dashboard-dialog-component',
- templateUrl: './edit-dashboard-dialog.component.html',
- styleUrls: ['./edit-dashboard-dialog.component.css']
+ selector: 'sp-data-explorer-edit-data-view-dialog-component',
+ templateUrl: './data-explorer-edit-data-view-dialog.component.html',
+ styleUrls: ['./data-explorer-edit-data-view-dialog.component.css']
})
-export class EditDashboardDialogComponent {
+export class DataExplorerEditDataViewDialogComponent implements OnInit {
createMode: boolean;
- dashboard: Dashboard;
+ dashboard: IDataViewDashboard;
constructor(
- public dialogRef: MatDialogRef<EditDashboardDialogComponent>,
- private dashboardService: DashboardService) {
+ public dialogRef: MatDialogRef<DataExplorerEditDataViewDialogComponent>,
+ private dashboardService: DataViewDashboardService) {
}
ngOnInit() {
@@ -48,7 +46,7 @@ export class EditDashboardDialogComponent {
onSave(): void {
if (this.createMode) {
- this.dashboardService.saveDashboard(this.dashboard).subscribe();
+ this.dashboardService.saveDataView(this.dashboard).subscribe();
} else {
this.dashboardService.updateDashboard(this.dashboard).subscribe();
}
@@ -57,4 +55,4 @@ export class EditDashboardDialogComponent {
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/models/dashboard.model.ts b/ui/src/app/data-explorer-v2/models/dataview-dashboard.model.ts
similarity index 77%
rename from ui/src/app/data-explorer-v2/models/dashboard.model.ts
rename to ui/src/app/data-explorer-v2/models/dataview-dashboard.model.ts
index 1193e71..fed67f7 100644
--- a/ui/src/app/data-explorer-v2/models/dashboard.model.ts
+++ b/ui/src/app/data-explorer-v2/models/dataview-dashboard.model.ts
@@ -16,21 +16,21 @@
*
*/
-import {GridsterConfig, GridsterItem} from "angular-gridster2";
+import { GridsterConfig, GridsterItem } from 'angular-gridster2';
-export interface DashboardConfig extends GridsterConfig {}
+export interface IDataViewDashboardConfig extends GridsterConfig {}
-export interface DashboardItem extends GridsterItem {
+export interface IDataViewDashboardItem extends GridsterItem {
widgetId: string;
id: string;
}
-export interface Dashboard {
+export interface IDataViewDashboard {
id?: string;
name?: string;
description?: string;
displayHeader?: boolean;
- widgets?: Array<DashboardItem>;
+ widgets?: IDataViewDashboardItem[];
_id?: string;
_rev?: string;
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/models/gridster-info.model.ts b/ui/src/app/data-explorer-v2/models/gridster-info.model.ts
deleted file mode 100644
index 43c41de..0000000
--- a/ui/src/app/data-explorer-v2/models/gridster-info.model.ts
+++ /dev/null
@@ -1,24 +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 {GridsterItem, GridsterItemComponent} from "angular-gridster2";
-
-export interface GridsterInfo {
- gridsterItem: GridsterItem;
- gridsterItemComponent: GridsterItemComponent
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/models/multi-series.model.ts b/ui/src/app/data-explorer-v2/models/multi-series.model.ts
index e95f777..0e8ac8b 100644
--- a/ui/src/app/data-explorer-v2/models/multi-series.model.ts
+++ b/ui/src/app/data-explorer-v2/models/multi-series.model.ts
@@ -16,14 +16,13 @@
*
*/
-import {DashboardItem} from "./dashboard.model";
-export interface MultiSeries {
+export interface IMultiSeries {
name?: string;
- series?: Array<MultiSeriesEntry>;
+ series?: IMultiSeriesEntry[];
}
-export interface MultiSeriesEntry {
+export interface IMultiSeriesEntry {
name: string;
value: any;
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/registry/widget-config-builder.ts b/ui/src/app/data-explorer-v2/registry/widget-config-builder.ts
index ed9a5f8..defaee0 100644
--- a/ui/src/app/data-explorer-v2/registry/widget-config-builder.ts
+++ b/ui/src/app/data-explorer-v2/registry/widget-config-builder.ts
@@ -16,19 +16,19 @@
*
*/
-import {FreeTextStaticProperty} from "../../connect/model/FreeTextStaticProperty";
-import {CollectedSchemaRequirements} from "../sdk/collected-schema-requirements";
-import {DashboardWidgetSettings} from "../../core-model/dashboard/DashboardWidgetSettings";
-import {Datatypes} from "../sdk/model/datatypes";
-import {ColorPickerStaticProperty} from "../../connect/model/ColorPickerStaticProperty";
+import { ColorPickerStaticProperty } from '../../connect/model/ColorPickerStaticProperty';
+import { FreeTextStaticProperty } from '../../connect/model/FreeTextStaticProperty';
+import { DashboardWidgetSettings } from '../../core-model/dashboard/DashboardWidgetSettings';
+import { CollectedSchemaRequirements } from '../sdk/collected-schema-requirements';
+import { Datatypes } from '../sdk/model/datatypes';
export class WidgetConfigBuilder {
- static readonly BACKGROUND_COLOR_KEY: string = "spi-background-color-key";
- static readonly PRIMARY_TEXT_COLOR_KEY: string = "spi-primary-text-color-key";
- static readonly SECONDARY_TEXT_COLOR_KEY: string = "spi-secondary-text-color-key";
+ static readonly BACKGROUND_COLOR_KEY: string = 'spi-background-color-key';
+ static readonly PRIMARY_TEXT_COLOR_KEY: string = 'spi-primary-text-color-key';
+ static readonly SECONDARY_TEXT_COLOR_KEY: string = 'spi-secondary-text-color-key';
- static readonly TITLE_KEY: string = "spi-title-key";
+ static readonly TITLE_KEY: string = 'spi-title-key';
private widget: DashboardWidgetSettings;
@@ -38,16 +38,16 @@ export class WidgetConfigBuilder {
this.widget.widgetName = widgetName;
this.widget.config = [];
if (withColors) {
- this.requiredColorParameter(WidgetConfigBuilder.BACKGROUND_COLOR_KEY, "Background color", "The background" +
- " color", "#1B1464");
- this.requiredColorParameter(WidgetConfigBuilder.PRIMARY_TEXT_COLOR_KEY, "Primary text color", "The" +
- " primary text color", "#FFFFFF");
- this.requiredColorParameter(WidgetConfigBuilder.SECONDARY_TEXT_COLOR_KEY, "Secondary text color", "The" +
- " secondary text" +
- " color", "#bebebe")
+ this.requiredColorParameter(WidgetConfigBuilder.BACKGROUND_COLOR_KEY, 'Background color', 'The background' +
+ ' color', '#1B1464');
+ this.requiredColorParameter(WidgetConfigBuilder.PRIMARY_TEXT_COLOR_KEY, 'Primary text color', 'The' +
+ ' primary text color', '#FFFFFF');
+ this.requiredColorParameter(WidgetConfigBuilder.SECONDARY_TEXT_COLOR_KEY, 'Secondary text color', 'The' +
+ ' secondary text' +
+ ' color', '#bebebe');
}
if (withTitlePanel) {
- this.requiredTextParameter(WidgetConfigBuilder.TITLE_KEY, "Title", "The title")
+ this.requiredTextParameter(WidgetConfigBuilder.TITLE_KEY, 'Title', 'The title');
}
}
@@ -64,13 +64,13 @@ export class WidgetConfigBuilder {
}
requiredTextParameter(id: string, label: string, description: string): WidgetConfigBuilder {
- let fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.String.toUri())
+ const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.String.toUri());
this.widget.config.push(fst);
return this;
}
requiredColorParameter(id: string, label: string, description: string, defaultColor?: string): WidgetConfigBuilder {
- let csp = new ColorPickerStaticProperty();
+ const csp = new ColorPickerStaticProperty();
csp.internalName = id;
csp.label = label;
csp.description = description;
@@ -83,13 +83,13 @@ export class WidgetConfigBuilder {
requiredIntegerParameter(id: string, label: string, description: string): WidgetConfigBuilder {
- let fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Integer.toUri())
+ const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Integer.toUri());
this.widget.config.push(fst);
return this;
}
requiredFloatParameter(id: string, label: string, description: string): WidgetConfigBuilder {
- let fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Float.toUri())
+ const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Float.toUri());
this.widget.config.push(fst);
return this;
}
@@ -102,7 +102,7 @@ export class WidgetConfigBuilder {
}
prepareStaticProperty(id: string, label: string, description: string, datatype: string) {
- let fst: FreeTextStaticProperty = new FreeTextStaticProperty();
+ const fst: FreeTextStaticProperty = new FreeTextStaticProperty();
fst.internalName = id;
fst.label = label;
fst.description = description;
@@ -112,10 +112,10 @@ export class WidgetConfigBuilder {
}
build(): DashboardWidgetSettings {
- for(let i = 0; i < this.widget.config.length; i++) {
+ for (let i = 0; i < this.widget.config.length; i++) {
this.widget.config[i].index = i;
}
return this.widget;
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/registry/widget-registry.ts b/ui/src/app/data-explorer-v2/registry/widget-registry.ts
index 3c62fe6..fede291 100644
--- a/ui/src/app/data-explorer-v2/registry/widget-registry.ts
+++ b/ui/src/app/data-explorer-v2/registry/widget-registry.ts
@@ -16,29 +16,19 @@
*
*/
-import {NumberConfig} from "../components/widgets/number/number-config";
-import {DashboardWidgetSettings} from "../../core-model/dashboard/DashboardWidgetSettings";
-import {WidgetConfig} from "../components/widgets/base/base-config";
-import {LineConfig} from "../components/widgets/line/line-config";
-import {TableConfig} from "../components/widgets/table/table-config";
-import {GaugeConfig} from "../components/widgets/gauge/gauge-config";
-import {ImageConfig} from "../components/widgets/image/image-config";
-import {AreaConfig} from "../components/widgets/area/area-config";
+import { DashboardWidgetSettings } from '../../core-model/dashboard/DashboardWidgetSettings';
+import { WidgetConfig } from '../../dashboard-v2/components/widgets/base/base-config';
+import { NumberConfig } from '../components/widgets/number/number-config';
export class WidgetRegistry {
- private static availableWidgets: Array<WidgetConfig> = [
+ private static availableWidgets: WidgetConfig[] = [
new NumberConfig(),
- new LineConfig(),
- new TableConfig(),
- new GaugeConfig(),
- new ImageConfig(),
- new AreaConfig()
];
- static getAvailableWidgetTemplates(): Array<DashboardWidgetSettings> {
- let widgetTemplates = new Array<DashboardWidgetSettings>();
+ static getAvailableWidgetTemplates(): DashboardWidgetSettings[] {
+ const widgetTemplates = new Array<DashboardWidgetSettings>();
this.availableWidgets.forEach(widget => widgetTemplates.push(widget.getConfig()));
return widgetTemplates;
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/services/dashboard.service.ts b/ui/src/app/data-explorer-v2/services/dashboard.service.ts
deleted file mode 100644
index 2f97107..0000000
--- a/ui/src/app/data-explorer-v2/services/dashboard.service.ts
+++ /dev/null
@@ -1,137 +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 {HttpClient, HttpHeaders} from "@angular/common/http";
-import {Injectable} from "@angular/core";
-import {map} from "rxjs/operators";
-import {from, Observable} from "rxjs";
-import {AuthStatusService} from "../../services/auth-status.service";
-import {Dashboard} from "../models/dashboard.model";
-import {EventSchema} from "../../connect/schema-editor/model/EventSchema";
-import {EventProperty} from "../../connect/schema-editor/model/EventProperty";
-import {EventPropertyPrimitive} from "../../connect/schema-editor/model/EventPropertyPrimitive";
-import {TsonLdSerializerService} from "../../platform-services/tsonld-serializer.service";
-import {StatusMessage} from "../../connect/model/message/StatusMessage";
-import {RuntimeOptionsResponse} from "../../connect/model/connect/runtime/RuntimeOptionsResponse";
-import {DashboardWidget} from "../../core-model/dashboard/DashboardWidget";
-import {VisualizablePipeline} from "../../core-model/dashboard/VisualizablePipeline";
-
-@Injectable()
-export class DashboardService {
-
-
- constructor(private http: HttpClient,
- private authStatusService: AuthStatusService,
- private tsonLdSerializerService: TsonLdSerializerService,) {
- }
-
- getVisualizablePipelines(): Observable<Array<VisualizablePipeline>> {
- return this.http
- .get(this.visualizablePipelineUrl)
- .map(data => {
- return this.tsonLdSerializerService.fromJsonLdContainer(data, 'sp:VisualizablePipeline')
- });
- }
-
- getDashboards(): Observable<Array<Dashboard>> {
- return this.http.get(this.dashboardUrl).map(data => {
- return data as Dashboard[];
- });
- }
-
- updateDashboard(dashboard: Dashboard): Observable<Dashboard> {
- return this.http.put(this.dashboardUrl + "/" +dashboard._id, dashboard).map(data => {
- return data as Dashboard;
- });
- }
-
- deleteDashboard(dashboard: Dashboard): Observable<any> {
- return this.http.delete(this.dashboardUrl + "/" +dashboard._id);
- }
-
- saveDashboard(dashboard: Dashboard): Observable<any> {
- return this.http.post(this.dashboardUrl, dashboard);
- }
-
- private get baseUrl() {
- return '/streampipes-backend';
- }
-
- private get dashboardUrl() {
- return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/dashboards'
- }
-
- private get dashboardWidgetUrl() {
- return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/widgets'
- }
-
- private get visualizablePipelineUrl() {
- return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/pipelines'
- }
-
- getWidget(widgetId: string): Observable<DashboardWidget> {
- let promise = new Promise<DashboardWidget>((resolve, reject) => {
- this.http.get(this.dashboardWidgetUrl + "/" +widgetId).subscribe(response => {
- let dashboardWidget: DashboardWidget = this.tsonLdSerializerService.fromJsonLd(response, "sp:DashboardWidgetModel");
- dashboardWidget.dashboardWidgetSettings.config.sort((a, b) => {
- return a.index - b.index;
- });
- resolve(dashboardWidget);
- });
- });
- return from(promise);
- }
-
- saveWidget(widget: DashboardWidget): Observable<DashboardWidget> {
- return this.serializeAndPost(this.dashboardWidgetUrl, widget);
- }
-
- deleteWidget(widgetId: string): Observable<any> {
- return this.http.delete(this.dashboardWidgetUrl + "/" +widgetId);
- }
-
- updateWidget(widget: DashboardWidget): Observable<any> {
- let promise = new Promise<DashboardWidget>((resolve, reject) => {
- this.tsonLdSerializerService.toJsonLd(widget).subscribe(serialized => {
- this.http.put(this.dashboardWidgetUrl + "/" +widget._id, serialized, this.jsonLdHeaders()).subscribe(result => {
- resolve();
- })
- });
- });
- return from(promise);
- }
-
- serializeAndPost(url: string, object: any): Observable<DashboardWidget> {
- let promise = new Promise<DashboardWidget>((resolve, reject) => {
- this.tsonLdSerializerService.toJsonLd(object).subscribe(serialized => {
- this.http.post(url, serialized, this.jsonLdHeaders()).pipe(map(response => {
- resolve(this.tsonLdSerializerService.fromJsonLd(response, "sp:DashboardWidgetModel"));
- })).subscribe();
- });
- });
- return from(promise);
- }
-
- jsonLdHeaders(): any {
- return {
- headers: new HttpHeaders({
- 'Content-Type': 'application/ld+json',
- }),
- };
- }
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/services/data-view-dashboard.service.ts b/ui/src/app/data-explorer-v2/services/data-view-dashboard.service.ts
new file mode 100644
index 0000000..994572d
--- /dev/null
+++ b/ui/src/app/data-explorer-v2/services/data-view-dashboard.service.ts
@@ -0,0 +1,137 @@
+/*
+ * 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 { HttpClient, HttpHeaders } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { from, Observable } from 'rxjs';
+import 'rxjs-compat/add/observable/of';
+import { map } from 'rxjs/operators';
+import { DashboardWidget } from '../../core-model/dashboard/DashboardWidget';
+import { InfoResult } from '../../core-model/datalake/InfoResult';
+import { DatalakeRestService } from '../../core-services/datalake/datalake-rest.service';
+import { TsonLdSerializerService } from '../../platform-services/tsonld-serializer.service';
+import { AuthStatusService } from '../../services/auth-status.service';
+import { IDataViewDashboard } from '../models/dataview-dashboard.model';
+
+
+@Injectable()
+export class DataViewDashboardService {
+
+ localDashboards: IDataViewDashboard[] = [];
+
+ constructor(private http: HttpClient,
+ private authStatusService: AuthStatusService,
+ private tsonLdSerializerService: TsonLdSerializerService,
+ private dataLakeRestService: DatalakeRestService) {
+ }
+
+ getVisualizableData(): Observable<InfoResult[]> {
+ return this.dataLakeRestService.getAllInfos();
+ // return this.http
+ // .get(this.visualizablePipelineUrl)
+ // .map(data => {
+ // return this.tsonLdSerializerService.fromJsonLdContainer(data, 'sp:VisualizablePipeline');
+ // });
+ }
+
+ getDataViews(): Observable<IDataViewDashboard[]> {
+ return Observable.of(this.localDashboards);
+ }
+
+ updateDashboard(dashboard: IDataViewDashboard): Observable<IDataViewDashboard> {
+ return this.http.put(this.dashboardUrl + '/' + dashboard._id, dashboard).map(data => {
+ return data as IDataViewDashboard;
+ });
+ }
+
+ deleteDashboard(dashboard: IDataViewDashboard): Observable<any> {
+ return Observable.of(this.localDashboards);
+ }
+
+ saveDataView(dataViewDashboard: IDataViewDashboard): Observable<any> {
+ this.localDashboards.push(dataViewDashboard);
+ return Observable.of(this.localDashboards);
+ }
+
+ private get baseUrl() {
+ return '/streampipes-backend';
+ }
+
+ private get dashboardUrl() {
+ return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/dashboards';
+ }
+
+ private get dashboardWidgetUrl() {
+ return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/widgets';
+ }
+
+ private get visualizablePipelineUrl() {
+ return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/ld/pipelines';
+ }
+
+ getWidget(widgetId: string): Observable<DashboardWidget> {
+ const promise = new Promise<DashboardWidget>((resolve, reject) => {
+ this.http.get(this.dashboardWidgetUrl + '/' + widgetId).subscribe(response => {
+ const dashboardWidget: DashboardWidget = this.tsonLdSerializerService.fromJsonLd(response, 'sp:DashboardWidgetModel');
+ dashboardWidget.dashboardWidgetSettings.config.sort((a, b) => {
+ return a.index - b.index;
+ });
+ resolve(dashboardWidget);
+ });
+ });
+ return from(promise);
+ }
+
+ saveWidget(widget: DashboardWidget): Observable<DashboardWidget> {
+ return this.serializeAndPost(this.dashboardWidgetUrl, widget);
+ }
+
+ deleteWidget(widgetId: string): Observable<any> {
+ return this.http.delete(this.dashboardWidgetUrl + '/' + widgetId);
+ }
+
+ updateWidget(widget: DashboardWidget): Observable<any> {
+ const promise = new Promise<DashboardWidget>((resolve, reject) => {
+ this.tsonLdSerializerService.toJsonLd(widget).subscribe(serialized => {
+ this.http.put(this.dashboardWidgetUrl + '/' + widget._id, serialized, this.jsonLdHeaders()).subscribe(result => {
+ resolve();
+ });
+ });
+ });
+ return from(promise);
+ }
+
+ serializeAndPost(url: string, object: any): Observable<DashboardWidget> {
+ const promise = new Promise<DashboardWidget>((resolve, reject) => {
+ this.tsonLdSerializerService.toJsonLd(object).subscribe(serialized => {
+ this.http.post(url, serialized, this.jsonLdHeaders()).pipe(map(response => {
+ resolve(this.tsonLdSerializerService.fromJsonLd(response, 'sp:DashboardWidgetModel'));
+ })).subscribe();
+ });
+ });
+ return from(promise);
+ }
+
+ jsonLdHeaders(): any {
+ return {
+ headers: new HttpHeaders({
+ 'Content-Type': 'application/ld+json',
+ }),
+ };
+ }
+}
diff --git a/ui/src/app/data-explorer-v2/services/refresh-dashboard.service.ts b/ui/src/app/data-explorer-v2/services/refresh-dashboard.service.ts
index 4f9c0e3..82a667c 100644
--- a/ui/src/app/data-explorer-v2/services/refresh-dashboard.service.ts
+++ b/ui/src/app/data-explorer-v2/services/refresh-dashboard.service.ts
@@ -16,8 +16,8 @@
*
*/
-import {Injectable} from "@angular/core";
-import {ReplaySubject} from "rxjs";
+import { Injectable } from '@angular/core';
+import { ReplaySubject } from 'rxjs';
@Injectable()
export class RefreshDashboardService {
@@ -27,4 +27,4 @@ export class RefreshDashboardService {
public notify(currentDashboard: string): void {
this.refreshSubject.next(currentDashboard);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/services/resize.service.ts b/ui/src/app/data-explorer-v2/services/resize.service.ts
index 9c53041..e4f1e49 100644
--- a/ui/src/app/data-explorer-v2/services/resize.service.ts
+++ b/ui/src/app/data-explorer-v2/services/resize.service.ts
@@ -16,9 +16,9 @@
*
*/
-import {ReplaySubject} from "rxjs";
-import {Injectable} from "@angular/core";
-import {GridsterInfo} from "../models/gridster-info.model";
+import { Injectable } from '@angular/core';
+import { ReplaySubject } from 'rxjs';
+import { GridsterInfo } from '../../dashboard-v2/models/gridster-info.model';
@Injectable()
export class ResizeService {
@@ -28,4 +28,4 @@ export class ResizeService {
public notify(info: GridsterInfo): void {
this.resizeSubject.next(info);
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/data-explorer-v2/services/websocket.config.ts b/ui/src/app/data-explorer-v2/services/websocket.config.ts
deleted file mode 100644
index d58c891..0000000
--- a/ui/src/app/data-explorer-v2/services/websocket.config.ts
+++ /dev/null
@@ -1,36 +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 {InjectableRxStompConfig} from "@stomp/ng2-stompjs";
-import {WebsocketSettings} from "./websocket.settings";
-
-export const streamPipesStompConfig: InjectableRxStompConfig = {
-
- brokerURL: new WebsocketSettings().getBrokerUrl(),
-
- connectHeaders: {
- login: 'admin',
- passcode: 'admin'
- },
-
- heartbeatIncoming: 0,
- heartbeatOutgoing: 20000,
-
- reconnectDelay: 200,
-
-};
\ No newline at end of file
diff --git a/ui/src/app/data-explorer-v2/services/websocket.settings.ts b/ui/src/app/data-explorer-v2/services/websocket.settings.ts
deleted file mode 100644
index 9503872..0000000
--- a/ui/src/app/data-explorer-v2/services/websocket.settings.ts
+++ /dev/null
@@ -1,32 +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.
- *
- */
-
-export class WebsocketSettings {
-
- getBrokerUrl(): string {
- return this.getWebsocketScheme() + "//" + location.host + "/streampipes/ws";
- }
-
- getWebsocketScheme(): string {
- if (location.protocol === 'https:') {
- return "wss:";
- } else {
- return "ws:";
- }
- }
-}
\ No newline at end of file