This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-145 by this push:
new f826e40 [STREAMPIPES-79] Use new Jackson serializer and
server-generated models in data explorer view
new 50a6a74 Merge branch 'STREAMPIPES-145' of
github.com:apache/incubator-streampipes into STREAMPIPES-145
f826e40 is described below
commit f826e40d077f5c9e219bbf03772fc20e35f077e2
Author: Dominik Riemer <[email protected]>
AuthorDate: Thu Aug 6 10:35:20 2020 +0200
[STREAMPIPES-79] Use new Jackson serializer and server-generated models in
data explorer view
---
.../rest/impl/datalake/DataLakeResourceV3.java | 20 +-
.../rest/impl/datalake/DataLakeWidgetResource.java | 25 +-
.../app-image-labeling.component.ts | 2 +-
.../core-model/datalake/DataExplorerWidgetModel.ts | 52 --
ui/src/app/core-model/datalake/DataLakeMeasure.ts | 34 --
.../datalake/datalake-rest.service.ts | 2 +-
.../image/image-viewer/image-viewer.component.ts | 3 -
.../grid/data-explorer-dashboard-grid.component.ts | 2 +-
.../data-explorer-dashboard-panel.component.ts | 2 +-
.../data-explorer-dashboard-widget.component.ts | 2 +-
.../components/widgets/base/base-config.ts | 4 +-
.../widgets/base/base-data-explorer-widget.ts | 32 +-
.../widgets/base/base-ngx-charts-widget.ts | 75 ---
.../components/widgets/image/image-config.ts | 6 +-
.../widgets/image/image-widget.component.ts | 8 +-
.../widgets/line-chart/line-chart-config.ts | 6 +-
.../line-chart/line-chart-widget.component.ts | 16 +-
.../datadownloadDialog/dataDownload.dialog.css | 56 ---
.../datadownloadDialog/dataDownload.dialog.html | 100 ----
.../datadownloadDialog/dataDownload.dialog.ts | 196 --------
.../base/baseVisualisation.component.ts | 146 ------
.../linechart/lineChart.component.css | 23 -
.../linechart/lineChart.component.html | 54 --
.../linechart/lineChart.component.ts | 548 ---------------------
.../table/table.component.css | 27 -
.../table/table.component.html | 66 ---
.../table/table.component.ts | 99 ----
.../old-explorer.component.html | 289 -----------
.../old-explorer-widget/old-explorer.component.ts | 417 ----------------
.../widgets/old-explorer-widget/old-explorer.css | 85 ----
.../components/widgets/table/table-config.ts | 7 +-
.../widgets/table/table-widget.component.ts | 8 +-
.../select-properties.component.ts | 10 +-
...-explorer-add-visualization-dialog.component.ts | 11 +-
.../services/data-view-data-explorer.service.ts | 70 +--
.../platform-services/tsonld-serializer.service.ts | 6 -
36 files changed, 99 insertions(+), 2410 deletions(-)
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
index 98f395b..03050c3 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
@@ -18,27 +18,21 @@
package org.apache.streampipes.rest.impl.datalake;
-import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
+import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.rest.impl.AbstractRestInterface;
import org.apache.streampipes.rest.impl.datalake.model.DataResult;
import org.apache.streampipes.rest.impl.datalake.model.GroupedDataResult;
import org.apache.streampipes.rest.impl.datalake.model.PageResult;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
-import org.apache.streampipes.rest.shared.annotation.JsonLdSerialized;
-import org.apache.streampipes.rest.shared.util.SpMediaType;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-import javax.ws.rs.core.UriInfo;
-
@Path("/v3/users/{username}/datalake")
public class DataLakeResourceV3 extends AbstractRestInterface {
private DataLakeManagementV3 dataLakeManagement;
@@ -78,13 +72,13 @@ public class DataLakeResourceV3 extends
AbstractRestInterface {
}
@GET
- @JsonLdSerialized
- @Produces(SpMediaType.JSONLD)
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
@Path("/info")
public Response getAllInfos() {
List<DataLakeMeasure> result = this.dataLakeManagement.getInfos();
- return ok(asContainer(result));
+ return ok(result);
}
@Deprecated
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
index f3eaea7..2e3c2b0 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
@@ -18,14 +18,10 @@
package org.apache.streampipes.rest.impl.datalake;
-import org.apache.streampipes.model.dashboard.DashboardWidgetModel;
import org.apache.streampipes.model.datalake.DataExplorerWidgetModel;
-import org.apache.streampipes.rest.api.dashboard.IDashboardWidget;
import org.apache.streampipes.rest.api.dataexplorer.IDataExplorerWidget;
import org.apache.streampipes.rest.impl.AbstractRestInterface;
-import org.apache.streampipes.rest.shared.annotation.JsonLdSerialized;
-import org.apache.streampipes.rest.shared.util.SpMediaType;
-import org.apache.streampipes.storage.api.IDashboardWidgetStorage;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.api.IDataExplorerWidgetStorage;
import javax.ws.rs.*;
@@ -36,16 +32,16 @@ import javax.ws.rs.core.Response;
public class DataLakeWidgetResource extends AbstractRestInterface implements
IDataExplorerWidget {
@GET
- @JsonLdSerialized
+ @JacksonSerialized
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response getAllDataExplorerWidgets() {
- return
ok(asContainer(getDataExplorerWidgetStorage().getAllDataExplorerWidgets()));
+ return ok(getDataExplorerWidgetStorage().getAllDataExplorerWidgets());
}
@GET
- @JsonLdSerialized
- @Produces(SpMediaType.JSONLD)
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
@Path("/{widgetId}")
@Override
public Response getDataExplorerWidget(@PathParam("widgetId") String
widgetId) {
@@ -53,8 +49,8 @@ public class DataLakeWidgetResource extends
AbstractRestInterface implements IDa
}
@PUT
- @JsonLdSerialized
- @Consumes(SpMediaType.JSONLD)
+ @JacksonSerialized
+ @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/{widgetId}")
@Override
@@ -64,6 +60,7 @@ public class DataLakeWidgetResource extends
AbstractRestInterface implements IDa
}
@DELETE
+ @JacksonSerialized
@Produces(MediaType.APPLICATION_JSON)
@Path("/{widgetId}")
@Override
@@ -73,9 +70,9 @@ public class DataLakeWidgetResource extends
AbstractRestInterface implements IDa
}
@POST
- @JsonLdSerialized
- @Produces(SpMediaType.JSONLD)
- @Consumes(SpMediaType.JSONLD)
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
@Override
public Response createDataExplorerWidget(DataExplorerWidgetModel
dataExplorerWidgetModel) {
String widgetId =
getDataExplorerWidgetStorage().storeDataExplorerWidget(dataExplorerWidgetModel);
diff --git a/ui/src/app/app-image-labeling/app-image-labeling.component.ts
b/ui/src/app/app-image-labeling/app-image-labeling.component.ts
index f6c923c..b044527 100644
--- a/ui/src/app/app-image-labeling/app-image-labeling.component.ts
+++ b/ui/src/app/app-image-labeling/app-image-labeling.component.ts
@@ -18,7 +18,7 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { DatalakeRestService } from
"../core-services/datalake/datalake-rest.service";
import { TsonLdSerializerService } from
"../platform-services/tsonld-serializer.service";
-import { DataLakeMeasure } from "../core-model/datalake/DataLakeMeasure";
+import {DataLakeMeasure} from "../core-model/gen/streampipes-model";
@Component({
selector: 'app-image-labeling',
diff --git a/ui/src/app/core-model/datalake/DataExplorerWidgetModel.ts
b/ui/src/app/core-model/datalake/DataExplorerWidgetModel.ts
deleted file mode 100644
index 38582a6..0000000
--- a/ui/src/app/core-model/datalake/DataExplorerWidgetModel.ts
+++ /dev/null
@@ -1,52 +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 { UnnamedStreamPipesEntity } from
'../../connect/model/UnnamedStreamPipesEntity';
-import { EventSchema } from '../../connect/schema-editor/model/EventSchema';
-import { RdfsClass } from '../../platform-services/tsonld/RdfsClass';
-import { RdfProperty } from '../../platform-services/tsonld/RdfsProperty';
-import { DataLakeMeasure } from './DataLakeMeasure';
-
-@RdfsClass('sp:DataExplorerWidgetModel')
-export class DataExplorerWidgetModel extends UnnamedStreamPipesEntity {
-
- @RdfProperty('sp:couchDbId')
- _id: string;
-
- @RdfProperty('sp:couchDbRev')
- _ref: string;
-
- @RdfProperty('sp:hasDashboardWidgetId')
- widgetId: string;
-
- // @RdfProperty('sp:hasMeasurementName')
- // measureName: string;
-
- @RdfProperty('sp:hasDashboardWidgetType')
- widgetType: string;
-
- @RdfProperty('sp:hasDataLakeMeasure')
- dataLakeMeasure: DataLakeMeasure;
-
- @RdfProperty('sp:hasSelectedKeys')
- selectedKeys: string[];
-
- constructor() {
- super();
- }
-}
diff --git a/ui/src/app/core-model/datalake/DataLakeMeasure.ts
b/ui/src/app/core-model/datalake/DataLakeMeasure.ts
deleted file mode 100644
index 73e649b..0000000
--- a/ui/src/app/core-model/datalake/DataLakeMeasure.ts
+++ /dev/null
@@ -1,34 +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 { EventSchema } from '../../connect/schema-editor/model/EventSchema';
-import { RdfsClass } from '../../platform-services/tsonld/RdfsClass';
-import { RdfProperty } from '../../platform-services/tsonld/RdfsProperty';
-
-@RdfsClass('sp:DataLakeMeasure')
-export class DataLakeMeasure {
-
- @RdfProperty('sp:hasMeasurementName')
- public measureName: string;
-
- @RdfProperty('sp:hasEventSchema')
- public eventSchema: EventSchema;
-
- constructor () {
- }
-}
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 a326d57..6235e9d 100644
--- a/ui/src/app/core-services/datalake/datalake-rest.service.ts
+++ b/ui/src/app/core-services/datalake/datalake-rest.service.ts
@@ -19,11 +19,11 @@
import { HttpClient, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
-import { DataLakeMeasure } from '../../core-model/datalake/DataLakeMeasure';
import { DataResult } from '../../core-model/datalake/DataResult';
import { GroupedDataResult } from
'../../core-model/datalake/GroupedDataResult';
import { PageResult } from '../../core-model/datalake/PageResult';
import { AuthStatusService } from '../../services/auth-status.service';
+import {DataLakeMeasure} from "../../core-model/gen/streampipes-model";
@Injectable()
export class DatalakeRestService {
diff --git a/ui/src/app/core-ui/image/image-viewer/image-viewer.component.ts
b/ui/src/app/core-ui/image/image-viewer/image-viewer.component.ts
index 281eb21..348b754 100644
--- a/ui/src/app/core-ui/image/image-viewer/image-viewer.component.ts
+++ b/ui/src/app/core-ui/image/image-viewer/image-viewer.component.ts
@@ -17,9 +17,6 @@
import { Component, OnInit } from '@angular/core';
import { DatalakeRestService } from
'../../../core-services/datalake/datalake-rest.service';
-import { Observable } from 'rxjs';
-import { DataLakeMeasure } from '../../../core-model/datalake/DataLakeMeasure';
-import { DataViewDataExplorerService } from
'../../../data-explorer/services/data-view-data-explorer.service';
import { TsonLdSerializerService } from
'../../../platform-services/tsonld-serializer.service';
@Component({
diff --git
a/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
b/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
index 1d38a95..1b6f702 100644
---
a/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
+++
b/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
@@ -26,13 +26,13 @@ import {
ViewChildren
} from '@angular/core';
import { GridsterItemComponent, GridType } from 'angular-gridster2';
-import { DataExplorerWidgetModel } from
'../../../core-model/datalake/DataExplorerWidgetModel';
import { DateRange } from '../../../core-model/datalake/DateRange';
import { GridsterInfo } from '../../../dashboard/models/gridster-info.model';
import { IDataViewDashboard, IDataViewDashboardConfig, IDataViewDashboardItem
} from '../../models/dataview-dashboard.model';
import { DataViewDataExplorerService } from
'../../services/data-view-data-explorer.service';
import { RefreshDashboardService } from
'../../services/refresh-dashboard.service';
import { ResizeService } from '../../services/resize.service';
+import {DataExplorerWidgetModel} from
"../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-dashboard-grid',
diff --git
a/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
b/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
index 4a05559..0c02b07 100644
---
a/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
+++
b/ui/src/app/data-explorer/components/panel/data-explorer-dashboard-panel.component.ts
@@ -20,12 +20,12 @@ import { Component, EventEmitter, Input, OnInit, Output }
from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Observable, Subscription } from 'rxjs';
import { forkJoin } from 'rxjs/internal/observable/forkJoin';
-import { DataExplorerWidgetModel } from
'../../../core-model/datalake/DataExplorerWidgetModel';
import { DateRange } from '../../../core-model/datalake/DateRange';
import { DataExplorerAddVisualizationDialogComponent } from
'../../dialogs/add-widget/data-explorer-add-visualization-dialog.component';
import { IDataViewDashboard, IDataViewDashboardItem } from
'../../models/dataview-dashboard.model';
import { DataViewDataExplorerService } from
'../../services/data-view-data-explorer.service';
import { RefreshDashboardService } from
'../../services/refresh-dashboard.service';
+import {DataExplorerWidgetModel} from
"../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-dashboard-panel',
diff --git
a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
index 2ec1b95..9aa4f2c 100644
---
a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
+++
b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
@@ -19,11 +19,11 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
-import { DataExplorerWidgetModel } from
'../../../core-model/datalake/DataExplorerWidgetModel';
import { DateRange } from '../../../core-model/datalake/DateRange';
import { DataExplorerAddVisualizationDialogComponent } from
'../../dialogs/add-widget/data-explorer-add-visualization-dialog.component';
import { IDataViewDashboardItem } from '../../models/dataview-dashboard.model';
import { DataViewDataExplorerService } from
'../../services/data-view-data-explorer.service';
+import {DataExplorerWidgetModel} from
"../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-dashboard-widget',
diff --git a/ui/src/app/data-explorer/components/widgets/base/base-config.ts
b/ui/src/app/data-explorer/components/widgets/base/base-config.ts
index 531640b..e2a078c 100644
--- a/ui/src/app/data-explorer/components/widgets/base/base-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-config.ts
@@ -16,7 +16,9 @@
*
*/
-import { DashboardWidgetSettings } from
'../../../../core-model/dashboard/DashboardWidgetSettings';
+
+
+import {DashboardWidgetSettings} from
"../../../../core-model/gen/streampipes-model";
export abstract class WidgetConfig {
diff --git
a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
index e6a6ff4..122c8a9 100644
---
a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
+++
b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
@@ -19,14 +19,15 @@
import { EventEmitter, Input, OnChanges, Output, SimpleChanges } from
'@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
-import { EventProperty } from
'../../../../connect/schema-editor/model/EventProperty';
-import { EventPropertyPrimitive } from
'../../../../connect/schema-editor/model/EventPropertyPrimitive';
-import { EventSchema } from
'../../../../connect/schema-editor/model/EventSchema';
-import { DataExplorerWidgetModel } from
'../../../../core-model/datalake/DataExplorerWidgetModel';
import { DateRange } from '../../../../core-model/datalake/DateRange';
import { DatalakeRestService } from
'../../../../core-services/datalake/datalake-rest.service';
import { IDataViewDashboardItem } from
'../../../models/dataview-dashboard.model';
import { DataDownloadDialog } from
'../../datadownloadDialog/dataDownload.dialog';
+import {
+ DataExplorerWidgetModel,
+ EventProperty, EventPropertyPrimitive, EventPropertyUnion,
+ EventSchema
+} from "../../../../core-model/gen/streampipes-model";
export abstract class BaseDataExplorerWidget implements OnChanges {
@@ -75,10 +76,10 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
public abstract updateData();
getValuePropertyKeys(eventSchema: EventSchema) {
- const propertyKeys: EventProperty[] = [];
+ const propertyKeys: EventPropertyUnion[] = [];
eventSchema.eventProperties.forEach(p => {
- if (p.domainProperty !== 'http://schema.org/DateTime') {
+ if (!(p.domainProperties.some(dp => dp ===
'http://schema.org/DateTime'))) {
propertyKeys.push(p);
}
});
@@ -87,10 +88,10 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
}
getNumericProperty(eventSchema: EventSchema) {
- const propertyKeys: EventProperty[] = [];
+ const propertyKeys: EventPropertyUnion[] = [];
eventSchema.eventProperties.forEach(p => {
- if (p.domainProperty !== 'http://schema.org/DateTime' &&
this.isNumber(p)) {
+ if (!(p.domainProperties.some(dp => dp ===
'http://schema.org/DateTime')) && this.isNumber(p)) {
propertyKeys.push(p);
}
});
@@ -99,7 +100,7 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
}
getDimensionProperties(eventSchema: EventSchema) {
- const result: EventProperty[] = [];
+ const result: EventPropertyUnion[] = [];
eventSchema.eventProperties.forEach(property => {
if (property.propertyScope === 'DIMENSION_PROPERTY') {
result.push(property);
@@ -110,16 +111,17 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
}
getNonNumericProperties(eventSchema: EventSchema) {
- const result: EventProperty[] = [];
+ const result: EventPropertyUnion[] = [];
eventSchema.eventProperties.forEach(p => {
- if (p.domainProperty !== 'http://schema.org/DateTime' &&
!this.isNumber(p)) {
+ if (!(p.domainProperties.some(dp => dp ===
'http://schema.org/DateTime')) && !this.isNumber(p)) {
result.push(p);
}
});
const b = new EventPropertyPrimitive();
- b.setRuntimeType('https://www.w3.org/2001/XMLSchema#string');
- b.setRuntimeName('sp_internal_label');
+ b["@class"] = "org.apache.streampipes.model.schema.EventPropertyPrimitive";
+ b.runtimeType = 'https://www.w3.org/2001/XMLSchema#string';
+ b.runtimeName = 'sp_internal_label';
result.push(b);
return result;
@@ -135,7 +137,7 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
return result;
}
- isNumber(p: EventProperty): boolean {
+ isNumber(p: EventPropertyUnion): boolean {
return (p instanceof EventPropertyPrimitive &&
((p as EventPropertyPrimitive).runtimeType ===
'http://www.w3.org/2001/XMLSchema#number') ||
(p as EventPropertyPrimitive).runtimeType ===
'http://www.w3.org/2001/XMLSchema#float') ||
@@ -145,7 +147,7 @@ export abstract class BaseDataExplorerWidget implements
OnChanges {
}
public isTimestamp(p: EventProperty) {
- return p.domainProperty === 'http://schema.org/DateTime';
+ return p.domainProperties.some(dp => dp === 'http://schema.org/DateTime');
}
getRuntimeNames(properties: EventProperty[]): string[] {
diff --git
a/ui/src/app/data-explorer/components/widgets/base/base-ngx-charts-widget.ts
b/ui/src/app/data-explorer/components/widgets/base/base-ngx-charts-widget.ts
deleted file mode 100644
index 0867c47..0000000
--- a/ui/src/app/data-explorer/components/widgets/base/base-ngx-charts-widget.ts
+++ /dev/null
@@ -1,75 +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 { 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 { BaseDataExplorerWidget } from './base-widget';
-
-export abstract class BaseNgxChartsStreamPipesWidget extends
BaseDataExplorerWidget implements OnInit {
-
- view: any[] = [];
- displayChart = false;
-
- colorScheme: any;
-
- constructor(protected resizeService: ResizeService) {
- super();
- }
-
- ngOnInit() {
- super.ngOnInit();
- this.colorScheme = {domain: [this.selectedSecondaryTextColor,
this.selectedPrimaryTextColor]};
- this.view = [this.computeCurrentWidth(this.gridsterItemComponent),
- this.computeCurrentHeight(this.gridsterItemComponent)];
- this.displayChart = true;
- this.resizeService.resizeSubject.subscribe(info => {
- this.onResize(info);
- });
- }
-
- onResize(info: GridsterInfo) {
- if (info.gridsterItem.id === this.gridsterItem.id) {
- setTimeout(() => {
- this.displayChart = false;
- this.view =
[this.computeCurrentWidth(info.gridsterItemComponent),
- this.computeCurrentHeight(info.gridsterItemComponent)];
- this.displayChart = true;
- }, 100);
- }
- }
-
- computeCurrentWidth(gridsterItemComponent: GridsterItemComponent): number {
- return (gridsterItemComponent.width -
(BaseNgxChartsStreamPipesWidget.PADDING * 2));
- }
-
- computeCurrentHeight(gridsterItemComponent: GridsterItemComponent): number
{
- return (gridsterItemComponent.height -
(BaseNgxChartsStreamPipesWidget.PADDING * 2)
- - this.editModeOffset() - this.titlePanelOffset());
- }
-
- editModeOffset(): number {
- return this.editMode ?
BaseNgxChartsStreamPipesWidget.EDIT_HEADER_HEIGHT : 0;
- }
-
- titlePanelOffset(): number {
- return this.hasTitlePanelSettings ? 20 : 0;
- }
-
-}
diff --git a/ui/src/app/data-explorer/components/widgets/image/image-config.ts
b/ui/src/app/data-explorer/components/widgets/image/image-config.ts
index 26f2c61..220ab13 100644
--- a/ui/src/app/data-explorer/components/widgets/image/image-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/image/image-config.ts
@@ -16,11 +16,11 @@
*
*/
-import { DashboardWidgetSettings } from
'../../../../core-model/dashboard/DashboardWidgetSettings';
-import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
import { EpRequirements } from '../../../sdk/ep-requirements';
-import { SchemaRequirementsBuilder } from
'../../../sdk/schema-requirements-builder';
import { WidgetConfig } from '../base/base-config';
+import {DashboardWidgetSettings} from
"../../../../core-model/gen/streampipes-model";
+import {WidgetConfigBuilder} from
"../../../../dashboard/registry/widget-config-builder";
+import {SchemaRequirementsBuilder} from
"../../../../dashboard/sdk/schema-requirements-builder";
export class ImageConfig extends WidgetConfig {
diff --git
a/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
b/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
index b576bd3..d4c7566 100644
---
a/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
+++
b/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
@@ -19,11 +19,11 @@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
-import { EventProperty } from
'../../../../connect/schema-editor/model/EventProperty';
import { DataResult } from '../../../../core-model/datalake/DataResult';
import { DatalakeRestService } from
'../../../../core-services/datalake/datalake-rest.service';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { MatDialog } from '@angular/material/dialog';
+import {EventPropertyUnion} from
"../../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-image-widget',
@@ -34,8 +34,8 @@ export class ImageWidgetComponent extends
BaseDataExplorerWidget implements OnIn
@ViewChild(MatSort, {static: true}) sort: MatSort;
- availableColumns: EventProperty[];
- selectedColumns: EventProperty[];
+ availableColumns: EventPropertyUnion[];
+ selectedColumns: EventPropertyUnion[];
columnNames: string[];
dataSource = new MatTableDataSource();
@@ -70,7 +70,7 @@ export class ImageWidgetComponent extends
BaseDataExplorerWidget implements OnIn
}
- setSelectedColumn(selectedColumns: EventProperty[]) {
+ setSelectedColumn(selectedColumns: EventPropertyUnion[]) {
this.selectedColumns = selectedColumns;
this.columnNames = this.getRuntimeNames(this.selectedColumns);
}
diff --git
a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-config.ts
b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-config.ts
index 8fb099f..db2afa5 100644
---
a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-config.ts
+++
b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-config.ts
@@ -16,10 +16,10 @@
*
*/
-import { DashboardWidgetSettings } from
'../../../../core-model/dashboard/DashboardWidgetSettings';
-import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
-import { SchemaRequirementsBuilder } from
'../../../sdk/schema-requirements-builder';
import { WidgetConfig } from '../base/base-config';
+import {DashboardWidgetSettings} from
"../../../../core-model/gen/streampipes-model";
+import {WidgetConfigBuilder} from
"../../../../dashboard/registry/widget-config-builder";
+import {SchemaRequirementsBuilder} from
"../../../../dashboard/sdk/schema-requirements-builder";
export class LineChartConfig extends WidgetConfig {
diff --git
a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
index 11f2201..892333f 100644
---
a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
+++
b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
@@ -19,7 +19,6 @@
import { Component, OnInit, Renderer2 } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { PlotlyService } from 'angular-plotly.js';
-import { EventProperty } from
'../../../../connect/schema-editor/model/EventProperty';
import { DataResult } from '../../../../core-model/datalake/DataResult';
import { GroupedDataResult } from
'../../../../core-model/datalake/GroupedDataResult';
import { DatalakeRestService } from
'../../../../core-services/datalake/datalake-rest.service';
@@ -27,6 +26,7 @@ import { ChangeChartmodeDialog } from
'../../../../core-ui/linechart/labeling-to
import { LabelingDialog } from
'../../../../core-ui/linechart/labeling-tool/dialogs/labeling/labeling.dialog';
import { ColorService } from
'../../../../core-ui/linechart/labeling-tool/services/color.service';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
+import {EventPropertyUnion} from
"../../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-line-chart-widget',
@@ -37,11 +37,11 @@ export class LineChartWidgetComponent extends
BaseDataExplorerWidget implements
data: any[] = undefined;
labels: any[] = undefined;
- availableColumns: EventProperty[] = [];
- availableNonNumericColumns: EventProperty[] = [];
- selectedColumns: EventProperty[] = [];
- selectedNonNumericColumn: EventProperty = undefined;
- dimensionProperties: EventProperty[] = [];
+ availableColumns: EventPropertyUnion[] = [];
+ availableNonNumericColumns: EventPropertyUnion[] = [];
+ selectedColumns: EventPropertyUnion[] = [];
+ selectedNonNumericColumn: EventPropertyUnion = undefined;
+ dimensionProperties: EventPropertyUnion[] = [];
yKeys: string[] = [];
xKey: string;
@@ -362,13 +362,13 @@ export class LineChartWidgetComponent extends
BaseDataExplorerWidget implements
return data;
}
- setSelectedColumn(selectedColumns: EventProperty[]) {
+ setSelectedColumn(selectedColumns: EventPropertyUnion[]) {
this.selectedColumns = selectedColumns;
this.yKeys = this.getRuntimeNames(selectedColumns);
this.updateData();
}
- setSelectedLabelColumn(selectedLabelColumn: EventProperty) {
+ setSelectedLabelColumn(selectedLabelColumn: EventPropertyUnion) {
this.selectedNonNumericColumn = selectedLabelColumn;
this.nonNumericKey = selectedLabelColumn.runtimeName;
this.updateData();
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.css
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.css
deleted file mode 100644
index c503893..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.css
+++ /dev/null
@@ -1,56 +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.
- *
- */
-
-example-radio-group {
- display: flex;
- flex-direction: column;
- margin: 15px 0;
-}
-.example-radio-button {
- margin: 5px;
- width: 100%;
-}
-
-mat-toolbar {
- background: #39b54a;
- color:white;
-}
-
-mat-dialog-content {
- padding: 24px;
- -webkit-box-ordinal-group: 2;
- -webkit-order: 1;
- order: 1;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- overflow: auto;
- -webkit-overflow-scrolling: touch;
-}
-
-.mat-dialog-content {
- width:100%;
- height:74%;
- margin: 0px;
-}
-
-.mat-dialog-actions {
- margin-bottom:0px;
- padding-right:10px;
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.html
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.html
deleted file mode 100644
index 055abed..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.html
+++ /dev/null
@@ -1,100 +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.
- ~
- -->
-
-<mat-toolbar>
- <div class="md-toolbar-tools">
- <h2>Download Data</h2>
- <span fxFlex></span>
- <button mat-icon-button (click)="exitDialog()">
- <i class="material-icons">close</i>
- </button>
- </div>
-</mat-toolbar>
-
-<div mat-dialog-content class="md-dialog-content">
-
-
- <mat-horizontal-stepper #stepper>
- <mat-step>
- <ng-template matStepLabel>Select Data</ng-template>
- <div>
- <mat-radio-group class="example-radio-group"
[(ngModel)]="selectedData">
- <mat-radio-button value="visible"
class="example-radio-button">
- Visible data in charts
- </mat-radio-button>
- <mat-radio-button value="all" class="example-radio-button">
- All data in database
- </mat-radio-button>
- <mat-radio-button value="customInterval"
class="example-radio-button">
- All data in custom time interval
- </mat-radio-button>
- </mat-radio-group>
- <div fxLayout="row" fxLayoutAlign="start center"
style="margin-left: 35px">
- <mat-form-field style="top: -10px; width: 270px">
- <input matInput [owlDateTime]="dt1"
[owlDateTimeTrigger]="dt1"
- [(ngModel)]="dateRange" [selectMode]="'range'"
[disabled]="selectedData !== 'customInterval'">
- <mat-icon matSuffix [owlDateTimeTrigger]="dt1"
*ngIf="selectedData === 'customInterval'">event</mat-icon>
- <mat-icon matSuffix style="color: #e0e0e0"
*ngIf="selectedData !== 'customInterval'">event</mat-icon>
- <owl-date-time #dt1></owl-date-time>
- </mat-form-field>
- </div>
- </div>
- </mat-step>
-
-
-
- <mat-step>
- <ng-template matStepLabel>Select Format</ng-template>
- <div>
- <mat-radio-group class="example-radio-group"
[(ngModel)]="downloadFormat">
- <mat-radio-button value="json"
class="example-radio-button">
- JSON
- </mat-radio-button>
- <mat-radio-button value="csv" class="example-radio-button">
- CSV
- </mat-radio-button>
- </mat-radio-group>
- </div>
- </mat-step>
-
-
-
-
-
- <mat-step>
- <ng-template matStepLabel>Download</ng-template>
- <div div fxLayout="column" fxLayoutAlign="space-around center"
*ngIf="!downloadFinish">
- <mat-spinner></mat-spinner>
- <label *ngIf="downloadedMBs !== undefined">{{downloadedMBs
| number : '1.0-2' }} Mb</label>
- <button mat-button warn color="warn"
(click)="cancelDownload()">Cancel</button>
- </div>
- <div div fxLayout="column" fxLayoutAlign="space-around center"
*ngIf="downloadFinish">
- <mat-icon style="font-size: 100px;height: 100px; width: 100px;
color:#b3b3b3;">check</mat-icon>
- </div>
- </mat-step>
- </mat-horizontal-stepper>
-
-</div>
-
-<mat-divider></mat-divider>
-<div mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
- <button mat-button *ngIf="stepper.selectedIndex == 1" color="primary"
(click)="previousStep()">Previous</button>
- <button mat-button mat-raised-button *ngIf="stepper.selectedIndex < 1"
color="primary" (click)="nextStep()">Next</button>
- <button mat-button mat-raised-button *ngIf="stepper.selectedIndex == 1"
color="accent" (click)="downloadData()">Download</button>
- <button mat-button mat-raised-button *ngIf="downloadFinish"
color="primary" (click)="exitDialog()">Close</button>
-</div>
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.ts
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.ts
deleted file mode 100644
index 310c141..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/datadownloadDialog/dataDownload.dialog.ts
+++ /dev/null
@@ -1,196 +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 { HttpEventType } from '@angular/common/http';
-import { Component, Inject, ViewChild } from '@angular/core';
-import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import { MatStepper } from '@angular/material/stepper';
-import { DatalakeRestService } from
'../../../../../core-services/datalake/datalake-rest.service';
-
-@Component({
- selector: 'sp-dataDownload-dialog',
- templateUrl: 'dataDownload.dialog.html',
- styleUrls: ['./dataDownload.dialog.css']
-})
-export class DataDownloadDialog {
-
-
- downloadFormat = 'csv';
- selectedData = 'visible';
- downloadFinish = false;
- downloadedMBs: number = undefined;
-
- @ViewChild('stepper', { static: true }) stepper: MatStepper;
-
- downloadHttpRequestSubscribtion;
-
- dateRange: Date [] = []; // [0] start, [1] end
-
-
- constructor(public dialogRef: MatDialogRef<DataDownloadDialog>,
- @Inject(MAT_DIALOG_DATA) public data, private restService:
DatalakeRestService) {
- this.dateRange[0] = new Date();
- this.dateRange[1] = new Date(this.dateRange[0].getTime() + 60000 * 60
* 24);
- }
-
- downloadData() {
- this.nextStep();
- switch (this.selectedData) {
- case 'visible':
-
- if (this.data.yAxesKeys === undefined) {
- this.createFile('', this.downloadFormat, this.data.index,
this.getDateString(this.data.date[0]),
- this.getDateString((this.data.date[1])));
-
- } else if (this.data.data['headers'] !== undefined) {
- // Single Data
- const result = this.convertData(this.data.data,
this.downloadFormat, this.data.xAxesKey, this.data.yAxesKeys);
- this.createFile(result, this.data.downloadFormat,
this.data.index, this.getDateString(this.data.date[0]),
- this.getDateString(this.data.date[1]));
- } else {
- // group data
- Object.keys(this.data.data.dataResults).forEach( groupName
=> {
- const dataResult =
this.data.data.dataResults[groupName];
- const result = this.convertData(dataResult,
this.downloadFormat, this.data.xAxesKey, this.data.yAxesKeys);
- const fileName = this.data.index + ' ' + groupName;
- this.createFile(result, this.data.downloadFormat,
fileName, this.getDateString(this.data.date[0]),
- this.getDateString(this.data.date[1]));
- });
-
- }
- this.downloadFinish = true;
- break;
- case 'all':
-
this.performRequest(this.restService.downloadRowData(this.data.index,
this.downloadFormat), '', '');
- break;
- case 'customInterval':
-
this.performRequest(this.restService.downloadRowDataTimeInterval(this.data.index,
this.downloadFormat,
- this.dateRange[0].getTime(), this.dateRange[1].getTime()),
this.getDateString(this.dateRange[0]),
- this.getDateString(this.dateRange[1]));
-
- }
- }
-
- performRequest(request, startDate, endDate) {
- this.downloadHttpRequestSubscribtion = request.subscribe(event => {
- // progress
- if (event.type === HttpEventType.DownloadProgress) {
- this.downloadedMBs = event.loaded / 1024 / 1014;
- }
-
- // finished
- if (event.type === HttpEventType.Response) {
- this.createFile(event.body, this.downloadFormat,
this.data.index, startDate, endDate);
- this.downloadFinish = true;
- }
- });
- }
-
- convertData(data, format, xAxesKey, yAxesKeys) {
- const indexXKey = data.headers.findIndex(headerName => headerName ===
xAxesKey);
- const indicesYKeys = [];
- yAxesKeys.forEach(key => {
- indicesYKeys.push(data.headers.findIndex(headerName => headerName
=== key));
- });
-
- if (format === 'json') {
- const resultJson = [];
-
-
- data.rows.forEach(row => {
- const tmp = {'time': new Date(row[indexXKey]).getTime()};
- indicesYKeys.forEach(index => {
- if (row[index] !== undefined) {
- tmp[data.headers[index]] = row[index];
- }
- });
- resultJson.push(tmp);
- });
-
- return JSON.stringify(resultJson);
- } else {
- // CSV
- let resultCsv = '';
-
- // header
- resultCsv += xAxesKey;
- yAxesKeys.forEach(key => {
- resultCsv += ';';
- resultCsv += key;
- });
-
-
- // content
- data.rows.forEach(row => {
- resultCsv += '\n';
- resultCsv += new Date(row[indexXKey]).getTime();
- indicesYKeys.forEach(index => {
- resultCsv += ';';
- if (row[index] !== undefined) {
- resultCsv += row[index];
- }
- });
- });
-
- return resultCsv;
- }
- }
-
- createFile(data, format, fileName, startDate, endDate) {
- const a = document.createElement('a');
- document.body.appendChild(a);
- a.style.display = 'display: none';
-
- // let name = 'sp_' + startDate + '_' + endDate + '_' + fileName + '.'
+ this.downloadFormat;
- let name = 'sp_' + startDate + '_' + fileName + '.' +
this.downloadFormat;
- name = name.replace('__', '_');
-
- const url = window.URL.createObjectURL(new Blob([String(data)], {
type: 'data:text/' + format + ';charset=utf-8' }));
- a.href = url;
- a.download = name;
- a.click();
- window.URL.revokeObjectURL(url);
- }
-
- cancelDownload() {
- try {
- this.downloadHttpRequestSubscribtion.unsubscribe();
- } finally {
- this.exitDialog();
- }
- }
-
-
- exitDialog(): void {
- this.dialogRef.close();
- }
-
- nextStep() {
- this.stepper.next();
- }
-
- previousStep() {
- this.stepper.previous();
- }
-
- getDateString(date: Date) {
- return date.toLocaleDateString() + 'T' +
date.toLocaleTimeString().replace(':', '.')
-
.replace(':', '.');
- }
-
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/base/baseVisualisation.component.ts
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/base/baseVisualisation.component.ts
deleted file mode 100644
index 7f33bf8..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/base/baseVisualisation.component.ts
+++ /dev/null
@@ -1,146 +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 { Directive, EventEmitter, Injectable, Input, Output } from
'@angular/core';
-import { EventSchema } from
'../../../../../../connect/schema-editor/model/EventSchema';
-import { DataResult } from '../../../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from
'../../../../../../core-model/datalake/GroupedDataResult';
-
-@Injectable()
-@Directive()
-export abstract class BaseVisualisationComponent {
-
-
- @Input() set datas(value: DataResult | GroupedDataResult) {
- if (value !== undefined) {
- this.data = this.clone(value);
- if (this.data !== undefined && this.xKey !== undefined &&
this.yKeys !== undefined) {
- this.transform();
- this.display();
- }
- } else {
- this.stopDisplayData();
- this.data = undefined;
- }
- }
- @Input() set xAxesKey(value: string) {
- if (value !== undefined) {
- this.xKey = value;
- if (this.data !== undefined && this.xKey !== undefined &&
this.yKeys !== undefined) {
- this.transform();
- this.display();
- }
- } else {
- this.stopDisplayData();
- this.xKey = undefined;
- }
- }
- @Input() set yAxesKeys(value: string[]) {
- if (value !== undefined) {
- this.yKeys = value;
- if (this.data !== undefined && this.xKey !== undefined &&
this.yKeys !== undefined) {
- if (this.transformedData === undefined) {
- this.transform();
- }
- this.display();
- }
- } else {
- this.stopDisplayData();
- this.yKeys = undefined;
- }
- }
-
- @Input() eventschema: EventSchema = undefined;
-
- @Input() startDateData: Date = undefined;
- @Input() endDateData: Date = undefined;
-
-
- @Input() currentPage: number = undefined;
- @Input() maxPage: number = undefined;
- @Input() enablePaging = false;
-
- @Output() previousPage = new EventEmitter<boolean>();
- @Output() nextPage = new EventEmitter<boolean>();
- @Output() firstPage = new EventEmitter<boolean>();
- @Output() lastPage = new EventEmitter<boolean>();
-
- xKey: string = undefined;
- yKeys: string[] = undefined;
-
- data: DataResult | GroupedDataResult = undefined;
- transformedData: DataResult | GroupedDataResult = undefined;
-
-
- dataMode = '';
-
-
- transform() {
- if (this.data['headers'] !== undefined) {
- this.transformedData = this.transformData(this.data as DataResult,
this.xKey);
- this.dataMode = 'single';
- } else {
- this.transformedData = this.transformGroupedData(this.data as
GroupedDataResult, this.xKey);
- this.dataMode = 'group';
- }
- }
-
- display() {
- if (this.data['headers'] !== undefined) {
- this.displayData(this.transformedData as DataResult, this.yKeys);
- } else {
- this.displayGroupedData(this.transformedData as GroupedDataResult,
this.yKeys);
- }
- }
-
- // transform the input data to the schema of the chart
- abstract transformData(data: DataResult, xKey: string): DataResult;
-
- // transform the grouped input data to the schema of the chart
- abstract transformGroupedData(data: GroupedDataResult, xKey: string):
GroupedDataResult;
-
- // display the data
- abstract displayData(transformedData: DataResult, yKeys: string[]);
-
- // display the grouped data
- abstract displayGroupedData(transformedData: GroupedDataResult, yKeys:
string[]);
-
- //
- abstract stopDisplayData();
-
- clickPreviousPage() {
- this.previousPage.emit();
- }
-
- clickNextPage() {
- this.nextPage.emit();
- }
-
- clickFirstPage() {
- this.firstPage.emit();
- }
-
- clickLastPage() {
- this.lastPage.emit();
- }
-
- clone(value): DataResult {
- return (JSON.parse(JSON.stringify(value)));
- }
-
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.css
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.css
deleted file mode 100644
index 724cdf8..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.css
+++ /dev/null
@@ -1,23 +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.
- *
- */
-
-.paging-button {
- top: 15px;
- border: #202020 solid 1px;
- margin-left: 5px;
-}
\ No newline at end of file
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.html
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.html
deleted file mode 100644
index fcce828..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.html
+++ /dev/null
@@ -1,54 +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="width: 100%; height: 500px">
-
-
- <div fxLayout="row">
- <div *ngIf="enablePaging" fxFlex="5">
- <button mat-icon-button (click)="clickPreviousPage()"
class="paging-button" matTooltip="Going backwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width: 30px">
- chevron_left
- </mat-icon>
- </button>
- </div>
-
-
- <!-- Chart -->
- <plotly-plot fxFlex
- *ngIf="dataToDisplay !== undefined"
- flex
- [data]="dataToDisplay"
- [layout]="graph.layout"
- [config]="graph.config"
- (relayout)="handleDefaultModeBarButtonClicks($event)"
- (selecting)="selectDataPoints($event)">
- </plotly-plot>
-
- <div *ngIf="enablePaging" fxFlex="5">
- <button mat-icon-button (click)="clickNextPage()"
class="paging-button" matTooltip="Going forwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width: 30px">
- chevron_right
- </mat-icon>
- </button>
- </div>
- </div>
-
-
-</div>
-
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.ts
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.ts
deleted file mode 100644
index 3abd64f..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/linechart/lineChart.component.ts
+++ /dev/null
@@ -1,548 +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, OnChanges, Output, Renderer2, SimpleChanges
} from '@angular/core';
-import { MatDialog } from '@angular/material/dialog';
-import { PlotlyService } from 'angular-plotly.js';
-import { DataResult } from '../../../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from
'../../../../../../core-model/datalake/GroupedDataResult';
-import { ColorService } from
'../../../../../../core-ui/linechart/labeling-tool/services/color.service';
-import { BaseVisualisationComponent } from
'../base/baseVisualisation.component';
-import {ChangeChartmodeDialog} from
"../../../../../../core-ui/linechart/labeling-tool/dialogs/change-chartmode/change-chartmode.dialog";
-import {LabelingDialog} from
"../../../../../../core-ui/linechart/labeling-tool/dialogs/labeling/labeling.dialog";
-
-
-@Component({
- selector: 'sp-lineChart',
- templateUrl: './lineChart.component.html',
- styleUrls: ['./lineChart.component.css']
-})
-export class LineChartComponent extends BaseVisualisationComponent implements
OnChanges {
-
- @Output() zoomEvent = new EventEmitter<[number, number]>();
-
- constructor(public dialog: MatDialog, public plotlyService: PlotlyService,
public colorService: ColorService,
- public renderer: Renderer2, private restService:
DatalakeRestService) {
- super();
- }
-
- dataToDisplay: any[] = undefined;
-
- selectedStartX = undefined;
- selectedEndX = undefined;
- n_selected_points = undefined;
-
- // mocked labels
- labels = {state: ['online', 'offline', 'active', 'inactive'], trend:
['increasing', 'decreasing'],
- daytime: ['day', 'night']};
-
- private dialogReference = undefined;
-
- // indicator variable if labeling mode is activated
- private labelingModeOn = false;
-
- // indicator variable if labels has been changed
- private changedLabels = false;
-
- updatemenus = [
- {
- buttons: [
- {
- args: ['mode', 'lines'],
- label: 'Line',
- method: 'restyle'
- },
- {
- args: ['mode', 'markers'],
- label: 'Dots',
- method: 'restyle'
- },
-
- {
- args: ['mode', 'lines+markers'],
- label: 'Dots + Lines',
- method: 'restyle'
- }
- ],
- direction: 'left',
- pad: {'r': 10, 't': 10},
- showactive: true,
- type: 'buttons',
- x: 0.0,
- xanchor: 'left',
- y: 1.3,
- yanchor: 'top',
- font: {color: '#000'},
- bgcolor: '#fafafa',
- bordercolor: '#000'
- }
- ];
-
- graph = {
- layout: {
- autosize: true,
- plot_bgcolor: '#fafafa',
- paper_bgcolor: '#fafafa',
- xaxis: {
- type: 'date',
- },
- yaxis: {
- fixedrange: true
- },
- updatemenus: this.updatemenus,
-
- // setting hovermode to 'closest'
- hovermode: 'closest',
- // adding shapes for displaying labeled time intervals
- shapes: [],
- // box selection with fixed height
- selectdirection: 'h',
-
- // default dragmode is zoom
- dragmode: 'zoom'
- },
- config: {
- // removing lasso-selection, box-selecting, toggling-spikelines
and exporting-to-image buttons
- modeBarButtonsToRemove: ['lasso2d', 'select2d',
'toggleSpikelines', 'toImage'],
- // adding custom button: labeling
- modeBarButtonsToAdd: [this.createLabelingModeBarButton()],
- // removing plotly-icon from graph
- displaylogo: false
- }
- };
-
- ngOnChanges(changes: SimpleChanges) {
- // TODO: is needed because bindings are not working correct
- if (changes.endDateData !== undefined) {
- this.endDateData = changes.endDateData.currentValue;
- }
- if (changes.startDateData !== undefined) {
- this.startDateData = changes.startDateData.currentValue;
- }
- // TODO should be done in displaydata
- if (this.startDateData !== undefined && this.endDateData !==
undefined) {
- this.graph.layout.xaxis['range'] = [this.startDateData.getTime(),
this.endDateData.getTime()];
- }
- }
-
-
- displayData(transformedData: DataResult, yKeys: string[]) {
- if (this.yKeys.length > 0) {
- const tmp = [];
- tmp['measureName'] = transformedData.measureName;
- this.yKeys.forEach(key => {
- transformedData.rows.forEach(serie => {
- if (serie.name === key) {
- tmp.push(serie);
-
- // adding customdata property in order to store labels
in graph
- if (transformedData.labels !== undefined &&
transformedData.labels.length !== 0) {
- serie['customdata'] = transformedData.labels;
- }
- else {
- serie['customdata'] =
Array(serie['x'].length).fill('');
- }
- // adding custom hovertemplate in order to display
labels in graph
- serie['hovertemplate'] = 'y: %{y}<br>' + 'x: %{x}<br>'
+ 'label: %{customdata}';
- }
- });
- });
- this.dataToDisplay = tmp;
- this.dataToDisplay['labels'] = transformedData.labels;
-
- if (this.dataToDisplay['labels'] !== undefined &&
this.dataToDisplay['labels'].length > 0) {
- this.addInitialColouredShapesToGraph();
- }
-
- } else {
- this.dataToDisplay = undefined;
- }
- }
-
- displayGroupedData(transformedData: GroupedDataResult, yKeys: string[]) {
- if (this.yKeys.length > 0) {
-
- const tmp = [];
-
- const groupNames = Object.keys(transformedData.dataResults);
- for (const groupName of groupNames) {
- const value = transformedData.dataResults[groupName];
- this.yKeys.forEach(key => {
- value.rows.forEach(serie => {
- if (serie.name === key) {
- serie.name = groupName + ' ' + serie.name;
- tmp.push(serie);
- }
- });
- });
- }
- this.dataToDisplay = tmp;
-
- } else {
- this.dataToDisplay = undefined;
- }
- }
-
- transformData(data: DataResult, xKey: string): DataResult {
- const tmp: any[] = [];
-
- const dataKeys = [];
- const label_column = [];
-
- data.rows.forEach(row => {
- data.headers.forEach((headerName, index) => {
- if (!dataKeys.includes(index) && typeof row[index] ==
'number') {
- dataKeys.push(index);
- } else if (!label_column.includes(index) && typeof row[index]
== 'string' && data.headers[index] == "sp_internal_label") {
- label_column.push(index);
- }
- });
- });
-
- const indexXkey = data.headers.findIndex(headerName => headerName ===
this.xKey);
- const labels = [];
-
- dataKeys.forEach(key => {
- const headerName = data.headers[key];
- tmp[key] = {
- type: 'scatter', mode: 'lines', name: headerName, connectgaps:
false, x: [], y: []};
- });
- data.rows.forEach(row => {
- data.headers.forEach((headerName, index) => {
- if (dataKeys.includes(index)) {
- tmp[index].x.push(new Date(row[indexXkey]));
- if ((row[index]) !== undefined) {
- tmp[index].y.push(row[index]);
- } else {
- tmp[index].y.push(null);
- }
- } else if (label_column.length > 0 &&
label_column.includes(index)) {
- labels.push(row[index]);
- }
- });
- });
- data.labels = labels;
- data.rows = tmp;
-
- return data;
- }
-
- transformGroupedData(data: GroupedDataResult, xKey: string):
GroupedDataResult {
- for (const key in data.dataResults) {
- const dataResult = data.dataResults[key];
- dataResult.rows = this.transformData(dataResult, xKey).rows;
- }
-
- return data;
- }
-
- stopDisplayData() {
- }
-
- zoomIn($event) {
- // custom zoom-in event handling is now deactivated (no graph
reloading)
- // this.zoomEvent.emit([$event['xaxis.range[0]'],
$event['xaxis.range[1]']]);
- }
-
- handleDefaultModeBarButtonClicks($event) {
- if (!('xaxis.autorange' in $event) && !('hovermode' in $event)) {
- if ($event.dragmode !== 'select') {
- this.deactivateLabelingMode();
- this.labelingModeOn = false;
- }
- } else if (($event['xaxis.autorange'] === true || $event['hovermode']
=== true) && this.labelingModeOn) {
- this.activateLabelingMode();
- }
- }
-
- selectDataPoints($event) {
- // getting selected time interval
- const xStart = $event['range']['x'][0];
- const xEnd = $event['range']['x'][1];
-
- // updating related global time interval properties
- this.setStartX(xStart);
- this.setEndX(xEnd);
-
- // getting number of selected data points
- let selected_points = 0;
- for (const series of this.dataToDisplay) {
- if (series['selectedpoints'] !== undefined) {
- selected_points = selected_points +
series['selectedpoints'].length;
- }
- }
-
- // updating related global variable
- this.setNSelectedPoints(selected_points);
-
- // opening Labeling-Dialog
- this.openLabelingDialog();
- this.dialogReference.componentInstance.data = {labels: this.labels,
selected_label: '',
- startX: this.selectedStartX, endX: this.selectedEndX,
n_selected_points: this.n_selected_points};
- }
-
- setStartX(startX: string) {
- this.selectedStartX = startX;
- }
-
- setEndX(endX: string) {
- this.selectedEndX = endX;
- }
-
- setNSelectedPoints(n_selected_points: number) {
- this.n_selected_points = n_selected_points;
- }
-
- private openLabelingDialog() {
- if (this.dialog.openDialogs.length === 0) {
-
- // displaying Info-Dialog 'Change Chart-Mode' if current graph
mode is 'lines'
- if (this.dataToDisplay[0]['mode'] === 'lines') {
-
- // deactivating labeling mode
- this.labelingModeOn = false;
- this.deactivateLabelingMode();
-
- const dialogRef = this.dialog.open(ChangeChartmodeDialog,
- {
- width: '400px',
- position: {top: '150px'}
- });
-
- this.dialogReference = dialogRef;
-
- // displaying Labeling-Dialog, obtaining selected label and
drawing coloured shape
- } else {
- const dialogRef = this.dialog.open(LabelingDialog,
- {
- width: '400px',
- height: 'auto',
- position: {top: '75px'},
- data: {labels: this.labels, selected_label: '',
startX: this.selectedStartX, endX:
- this.selectedEndX, n_selected_points:
this.n_selected_points}
- });
-
- this.dialogReference = dialogRef;
-
- // after closing Labeling-Dialog
- dialogRef.afterClosed().subscribe(result => {
-
- // adding selected label to displayed data points
- if (result !== undefined) {
- for (const series of this.dataToDisplay) {
- for (const point of series['selectedpoints']) {
- series['customdata'][point] = result;
- }
- }
- this.dataToDisplay['labels'] =
this.dataToDisplay[0]['customdata'];
- this.setChangedLabels(true);
-
- // adding coloured shape (based on selected label) to
graph (equals selected time interval)
- this.addShapeToGraph(this.selectedStartX,
this.selectedEndX, this.colorService.getColor(result));
-
- // remain in selection dragmode if labeling mode is
still activated
- if (this.labelingModeOn) {
- this.graph.layout.dragmode = 'select';
- } else {
- this.graph.layout.dragmode = 'zoom';
- }
- }
- });
- }
- }
- }
-
- private createLabelingModeBarButton() {
- const labelingModeBarButton = {
- name: 'Labeling',
- icon: this.plotlyService.getPlotly().Icons.pencil,
- direction: 'up',
- click: (gd) => {
-
- // only allowing to activate labeling mode if current graph
mode does not equal 'lines'
- if (this.dataToDisplay[0]['mode'] !== 'lines') {
- this.labelingModeOn = !this.labelingModeOn;
-
- // activating labeling mode
- if (this.labelingModeOn) {
- this.activateLabelingMode();
-
- // deactivating labeling mode
- } else {
- this.deactivateLabelingMode();
- }
-
- // otherwise displaying 'Change Chart Mode Dialog' or
deactivating labeling mode
- } else {
- if (this.labelingModeOn) {
- this.labelingModeOn = !this.labelingModeOn;
- this.deactivateLabelingMode();
- } else {
- this.openLabelingDialog();
- }
- }
- }
- };
- return labelingModeBarButton;
- }
-
- private activateLabelingMode() {
- const modeBarButtons = document.getElementsByClassName('modebar-btn');
-
- for (let i = 0; i < modeBarButtons.length; i++) {
- if (modeBarButtons[i].getAttribute('data-title') === 'Labeling') {
-
- // fetching path of labeling button icon
- const path =
modeBarButtons[i].getElementsByClassName('icon').item(0)
- .getElementsByTagName('path').item(0);
-
- // adding 'clicked' to class list
- modeBarButtons[i].classList.add('clicked');
-
- // changing color of fetched path
- this.renderer.setStyle(path, 'fill', '#39B54A');
- }
- }
-
- // changing dragmode to 'select'
- this.graph.layout.dragmode = 'select';
- }
-
- private deactivateLabelingMode() {
- const modeBarButtons = document.getElementsByClassName('modebar-btn');
-
- for (let i = 0; i < modeBarButtons.length; i++) {
- if (modeBarButtons[i].getAttribute('data-title') === 'Labeling') {
-
- // fetching path of labeling button icon
- const path =
modeBarButtons[i].getElementsByClassName('icon').item(0)
- .getElementsByTagName('path').item(0);
-
- // removing 'clicked' from class list
- modeBarButtons[i].classList.remove('clicked');
-
- // changing path color to default plotly modebar button color
- this.renderer.setStyle(path, 'fill', 'rgba(68, 68, 68, 0.3)');
- }
- }
-
- // changing dragmode to 'zoom'
- this.graph.layout.dragmode = 'zoom';
-
- // saving labels persistently
- if (this.getChangedLabels()) {
- this.saveLabelsInDatabase();
- }
- }
-
- private saveLabelsInDatabase() {
- let currentLabel = undefined;
- let indices = [];
- for (const label in this.dataToDisplay['labels']) {
- if (currentLabel !== this.dataToDisplay['labels'][label] &&
indices.length > 0) {
- const startdate = new
Date(this.dataToDisplay[0]['x'][indices[0]]).getTime() - 1;
- const enddate = new
Date(this.dataToDisplay[0]['x'][indices[indices.length - 1]]).getTime() + 1;
-
this.restService.saveLabelsInDatabase(this.dataToDisplay['measureName'],
startdate, enddate, currentLabel).subscribe(
- res => {
- // console.log('Successfully wrote label ' + currentLabel + '
into database.');
- }
- );
- currentLabel = undefined;
- indices = [];
- indices.push(label);
- } else {
- indices.push(label);
- }
-
- currentLabel = this.dataToDisplay['labels'][label];
- }
- const last_startdate = new
Date(this.dataToDisplay[0]['x'][indices[0]]).getTime() - 1;
- const last_enddate = new
Date(this.dataToDisplay[0]['x'][indices[indices.length - 1]]).getTime() + 1;
-
this.restService.saveLabelsInDatabase(this.dataToDisplay['measureName'],
last_startdate, last_enddate, currentLabel).subscribe(
- res => {
- // console.log('Successfully wrote label ' + currentLabel + '
in last iterastion into database.');
- });
- this.setChangedLabels(false);
-
- }
-
- private addInitialColouredShapesToGraph() {
- let selectedLabel = undefined;
- let indices = [];
- for (const label in this.dataToDisplay['labels']) {
- if (selectedLabel !== this.dataToDisplay['labels'][label] &&
indices.length > 0) {
- const startdate = new
Date(this.dataToDisplay[0]['x'][indices[0]]).getTime();
- const enddate = new
Date(this.dataToDisplay[0]['x'][indices[indices.length - 1]]).getTime();
- const color = this.colorService.getColor(selectedLabel);
-
- this.addShapeToGraph(startdate, enddate, color);
-
- selectedLabel = undefined;
- indices = [];
- indices.push(label);
- } else {
- indices.push(label);
- }
- selectedLabel = this.dataToDisplay['labels'][label];
- }
- const last_start = new
Date(this.dataToDisplay[0]['x'][indices[0]]).getTime();
- const last_end = new
Date(this.dataToDisplay[0]['x'][indices[indices.length - 1]]).getTime();
- const last_color = this.colorService.getColor(selectedLabel);
-
- this.addShapeToGraph(last_start, last_end, last_color);
- }
-
- private addShapeToGraph(start, end, color) {
- const shape = {
- // shape: rectangle
- type: 'rect',
-
- // x-reference is assigned to the x-values
- xref: 'x',
-
- // y-reference is assigned to the plot paper [0,1]
- yref: 'paper',
- y0: 0,
- y1: 1,
-
- // start x: left side of selected time interval
- x0: start,
- // end x: right side of selected time interval
- x1: end,
-
- // adding color
- fillcolor: color,
-
- // opacity of 20%
- opacity: 0.2,
-
- line: {
- width: 0
- }
- };
- this.graph.layout.shapes.push(shape);
- }
-
- public setChangedLabels(state: boolean) {
- this.changedLabels = state;
- }
-
- public getChangedLabels() {
- return this.changedLabels;
- }
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.css
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.css
deleted file mode 100644
index 937c182..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.css
+++ /dev/null
@@ -1,27 +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.
- *
- */
-
-table {
- background: none;
- width: 100%;
-}
-
-.paging-button {
- border: #202020 solid 1px;
- margin: 5px;
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.html
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.html
deleted file mode 100644
index 6ebd3fa..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.html
+++ /dev/null
@@ -1,66 +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>
- <div fxLayout="column" fxLayoutAlign=" stretch">
- <div *ngIf="enablePaging" fxLayout="row" fxLayoutAlign="space-between
center">
- <div>
- <button mat-icon-button (click)="clickPreviousPage()"
class="paging-button" matTooltip="Going backwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">
- chevron_left
- </mat-icon>
- </button>
- </div>
-
- <div *ngIf="dataMode === 'group' && transformedData !== undefined">
- <mat-form-field style="margin-right: 1px;top: -3px;height:
1px" appearance="outline">
- <mat-label>Select Group</mat-label>
- <mat-select [ngModel]="this.selectedGroup"
(selectionChange)="selectGroup($event.value)">
- <mat-option *ngFor="let key of getGroupKeys()"
[value]="key" style="background-color: #FFFFFF">
- {{key}}
- </mat-option>
- </mat-select>
- </mat-form-field>
- </div>
-
- <div>
- <button mat-icon-button (click)="clickNextPage()"
class="paging-button" matTooltip="Going forwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">
- chevron_right
- </mat-icon>
- </button>
- </div>
- </div>
-
-
- <div style="overflow: auto">
- <table mat-table [dataSource]="dataSource">
-
- <ng-container *ngFor="let element of displayedColumns"
[cdkColumnDef]="element">
- <th mat-header-cell *matHeaderCellDef><label
style="font-size: large">{{element}}</label></th>
- <td mat-cell *matCellDef="let row">{{row[element]}}</td>
- </ng-container>
-
- <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:
true"></tr>
- <tr mat-row *matRowDef="let row; columns:
displayedColumns;"></tr>
-
- </table>
- </div>
-
- </div>
-</div>
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.ts
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.ts
deleted file mode 100644
index 62f3e30..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/explorer-visualisations/table/table.component.ts
+++ /dev/null
@@ -1,99 +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, Output } from '@angular/core';
-import { MatTableDataSource } from '@angular/material/table';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from
'../../../../core-model/datalake/GroupedDataResult';
-import { BaseVisualisationComponent } from
'../base/baseVisualisation.component';
-
-@Component({
- selector: 'sp-table',
- templateUrl: './table.component.html',
- styleUrls: ['./table.component.css']
-})
-export class TableComponent extends BaseVisualisationComponent {
-
- displayedColumns: string[] = [];
- dataSource = new MatTableDataSource();
-
- selectedGroup: string = undefined;
-
- constructor() {
- super();
- }
-
- transformData(data: DataResult, xKey: string): DataResult {
- const tmp = [];
- data.rows.forEach(row =>
- tmp.push(this.createTableObject(data.headers, row))
- );
- data.rows = tmp;
-
- return data;
- }
-
- transformGroupedData(data: GroupedDataResult, xKey: string):
GroupedDataResult {
- for (const key in data.dataResults) {
- const dataResult = data.dataResults[key];
- dataResult.rows = this.transformData(dataResult, xKey).rows;
- }
- return data;
- }
-
- displayData(transformedData: DataResult, yKeys: string[]) {
- this.displayedColumns = Object.assign([], yKeys);
- this.displayedColumns.unshift(this.xKey);
-
- this.dataSource.data = transformedData.rows;
- }
-
- displayGroupedData(transformedData: GroupedDataResult, yKeys: string[]) {
- this.displayedColumns = {...[], ...yKeys};
- this.displayedColumns.unshift(this.xKey);
-
- if (this.selectedGroup === undefined) {
- this.selectedGroup = this.getGroupKeys()[0];
- }
- this.dataSource.data =
transformedData.dataResults[this.selectedGroup].rows;
- }
-
- stopDisplayData() {
- // this.dataSource.data = [];
- }
-
- createTableObject(keys, values) {
- const object = {};
- keys.forEach((key, index) => {
- object[key] = values[index];
- });
- return object;
- }
-
- getGroupKeys() {
- return Object.keys((this.transformedData as
GroupedDataResult).dataResults);
- }
-
- selectGroup(value) {
- this.selectedGroup = value;
- if (this.selectedGroup !== undefined) {
- this.dataSource.data = (this.transformedData as GroupedDataResult)
- .dataResults[this.selectedGroup].rows;
- }
- }
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.html
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.html
deleted file mode 100644
index 861fb27..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.html
+++ /dev/null
@@ -1,289 +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>
- <div class="assemblyOptions sp-blue-bg">
-
- <!--<div fxLayout="row" fxLayoutAlign="space-between start" >-->
- <div>
- <h4 style="display: initial">Select Index:</h4>
- <mat-form-field style="margin-top: 0px; margin-bottom: -20px;
margin-left: 14px;">
- <input type="text" matInput [formControl]="myControl"
[matAutocomplete]="auto">
- <mat-autocomplete #auto="matAutocomplete"
(optionSelected)="selectIndex($event.option.value)">
- <mat-option *ngFor="let indexInfo of
filteredIndexInfos | async" [value]="indexInfo.measureName">
- {{indexInfo.measureName}}
- </mat-option>
- </mat-autocomplete>
- </mat-form-field>
- </div>
- <div fxLayout="column" style="margin-top: 10px; margin-left: 5px"
*ngIf="selectedInfoResult !== undefined">
- <div fxLayout="row" fxLayoutAlign="start stretch">
- <mat-form-field style="margin-right: 1px;top: -3px;height:
1px; width: 100px" appearance="outline"
- *ngIf="dimensionProperties.length > 0">
- <mat-label>Group by</mat-label>
- <mat-select
(selectionChange)="selectDimensionProperty($event.value)">
- <mat-option style="background-color:
#FFFFFF">None</mat-option>
- <mat-option *ngFor="let key of
dimensionProperties" [value]="key" style="background-color: #FFFFFF">
- {{key}}
- </mat-option>
- </mat-select>
- </mat-form-field>
- <mat-form-field style="margin-right: 1px;top: -3px;height:
1px;" appearance="outline">
- <mat-label>Select Data</mat-label>
- <mat-select [ngModel]="this.yAxesKeys"
(selectionChange)="selectKey($event.value)" multiple>
- <mat-option *ngFor="let key of dataKeys"
[value]="key" style="background-color: #FFFFFF">
- {{key}}
- </mat-option>
- </mat-select>
- </mat-form-field>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== '1 Hour'" (click)="selectTimeUnit('1 Hour')">1
Hour</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === '1 Hour'"color="primary" mat-raised-button>1
Hour</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== '1 Day'" (click)="selectTimeUnit('1 Day')">1
Day</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === '1 Day'"color="primary" mat-raised-button>1
Day</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== '1 Week'" (click)="selectTimeUnit('1 Week')">1
Week</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === '1 Week'" color="primary" mat-raised-button>1
Week</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== '1 Month'" (click)="selectTimeUnit('1 Month')">1
Month</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === '1 Month'" color="primary" mat-raised-button>1
Month</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== '1 Year'" (click)="selectTimeUnit('1 Year')">1
Year</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === '1 Year'" color="primary" mat-raised-button>1
Year</button>
-
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit !== 'Custom'"
(click)="selectTimeUnit('Custom')">Custom</button>
- <button mat-button mat-stroked-button
*ngIf="selectedTimeUnit === 'Custom'" color="primary"
mat-raised-button>Custom</button>
-
- <button mat-icon-button *ngIf="!enableAdvanceOptions"
class="icon" (click)="enableAdvanceOptions = true"
- style="margin-left: 5px; margin-top: -15px;"
color="primary" matTooltip="Display Advanced Options">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">expand_more</mat-icon>
- </button>
- <button mat-icon-button *ngIf="enableAdvanceOptions"
mat-raised-button class="icon" (click)="enableAdvanceOptions = false"
- style="margin-left: 5px; margin-top: -15px;"
color="primary" matTooltip="Hide Advanced Options">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">expand_less</mat-icon>
- </button>
-
- <button mat-icon-button matTooltip="Download data"
class="icon" (click)="downloadDataAsFile()"
- style="margin-top: -15px;" color="primary">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">
- get_app
- </mat-icon>
- </button>
- </div>
- <div class="optionContainer clearfix">
- <div *ngIf=enableAdvanceOptions>
- <div class="option" style="margin-left: 5px">
- <div class="optionName">Group values by time</div>
- <mat-form-field style="top: -10px; width: 80px;
margin-right: 5px">
- <input matInput type="number"
[(ngModel)]="groupbyValue">
- </mat-form-field>
- <mat-form-field style="top: -10px; width: 100px">
- <mat-select [(value)]="groupbyUnit">
- <!-- <mat-option
style="background-color: #FFFFFF" value="ns">Nanoseconds</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="u">Microseconds</mat-option> -->
- <mat-option style="background-color:
#FFFFFF" value="ms">Milliseconds</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="s">Second</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="m">Minute</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="h">Hour</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="d">Day</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="w">Week</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="month">Month</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="year">Year</mat-option>
- </mat-select>
- </mat-form-field>
- </div>
- </div>
-
- <div *ngIf="selectedTimeUnit === 'Custom'">
- <div class="option">
- <div class="optionName">Date range</div>
- <mat-form-field style="top: -10px; width: 270px">
- <input matInput [owlDateTime]="dt1"
[owlDateTimeTrigger]="dt1"
- [(ngModel)]="dateRange"
[selectMode]="'range'" (dateTimeChange)="loadData()">
- <mat-icon matSuffix [owlDateTimeTrigger]="dt1"
style="color: white">event</mat-icon>
- <owl-date-time #dt1></owl-date-time>
- </mat-form-field>
- </div>
- </div>
-
- <button *ngIf="enableAdvanceOptions"
- mat-icon-button class="icon" style="margin-left:
5px" color="primary">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px" (click)="loadData()">autorenew</mat-icon>
- </button>
- <!--
- <div class="option" style="margin-left: 5px">
- <div class="optionName">Aggregation</div>
- <mat-form-field style="top: -10px">
- <mat-select [(value)]="sad">
- <mat-option style="background-color:
#FFFFFF" value="ns">Min</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="u">Max</mat-option>
- <mat-option style="background-color:
#FFFFFF" value="ms">Mean</mat-option>
- </mat-select>
- </mat-form-field>
- </div>
- -->
- </div>
-
- </div>
- <!--</div>-->
-
-
-
- </div>
-
-
-
-
- <div layout="row">
- <div class="sp-blue-border" style="padding-top: 0px">
-
- <!-- loading -->
- <div *ngIf="displayIsLoadingData" fxLayout="column"
fxLayoutAlign="space-around center" >
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <mat-spinner></mat-spinner>
- </div>
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <h3>Loading Data</h3>
- </div>
- </div>
-
- <!-- No Data in Timerange -->
- <div *ngIf="noDateFoundinTimeRange" fxLayout="column"
fxLayoutAlign="space-around center" >
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <!-- TODO Icon -->
- </div>
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <button mat-icon-button (click)="handlePreviousPage()"
class="paging-button" matTooltip="Going backwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">
- chevron_left
- </mat-icon>
- </button>
- <h3>Found no data in selected time range ({{dateRange[0] |
date:'MM/dd/yyyy HH:mm'}} - {{dateRange[1] | date:'MM/dd/yyyy HH:mm'}})</h3>
- <button mat-icon-button (click)="handleNextPage()"
class="paging-button" matTooltip="Going forwards in time">
- <mat-icon style="font-size: 30px;height: 30px; width:
30px">
- chevron_right
- </mat-icon>
- </button>
- </div>
- </div>
-
- <!-- No Data Keys Selected -->
- <div *ngIf="noKeySelected" fxLayout="column"
fxLayoutAlign="space-around center" >
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <!-- TODO Icon -->
- </div>
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <h3>Please select data key(s)</h3>
- </div>
- </div>
-
- <!-- No Index Selected -->
- <div *ngIf="noIndexSelection" fxLayout="column"
fxLayoutAlign="space-around center" >
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <!-- TODO Icon -->
- </div>
- <div fxLayout="row" fxLayoutAlign="center center"
style="margin-top: 30px">
- <h3>Please select Index</h3>
- </div>
- </div>
-
- <!-- update data -->
- <div fxLayout="row" fxLayoutAlign="end center"
*ngIf="!displayIsLoadingData && data !== undefined && yAxesKeys.length > 0">
- <button mat-icon-button class="icon" (click)="reloadData()"
style="margin-right: 5px; top: 5px; z-index: 100" color="primary">
- <mat-icon style="font-size: 30px; margin-top: -4px; width:
30px"
- [ngClass]="{'rotate':
autoUpdateData}">autorenew</mat-icon>
- <label *ngIf="optionAutoUpdateData" style="font-size:
12px; position: absolute;
- margin-left: -19px;">A</label>
- </button>
-
- <button mat-icon-button [matMenuTriggerFor]="menu"
style="z-index: 100;top: 4px; margin-left: -10px;
- margin-right: -5px;">
- <mat-icon>more_vert</mat-icon>
- </button>
- <mat-menu #menu="matMenu">
- <div mat-menu-item (click)="$event.stopPropagation();">
- <mat-slide-toggle
- [checked]="optionAutoUpdateData"
- (change)="optionAutoUpdateData =
$event.checked"
- [color]="'primary'">
- Automatic periodic update
- </mat-slide-toggle>
- </div>
- <div mat-menu-item *ngIf="optionAutoUpdateData"
(click)="$event.stopPropagation();">
- <mat-icon>timelapse</mat-icon>
- <mat-form-field>
- <input matInput type="number"
[(ngModel)]="autoUpdatePeriod"
- placeholder="Update period in secs">
- </mat-form-field>
- </div>
- <!--
- <div mat-menu-item disabled
(click)="$event.stopPropagation();">
- <mat-slide-toggle
- [color]="'primary'">
- Reload all data instead just new ones
- </mat-slide-toggle>
- </div>
- -->
- </mat-menu>
-
- </div>
-
-
- <!-- Charts -->
- <mat-tab-group *ngIf="!displayIsLoadingData && data !== undefined
&& yAxesKeys.length > 0"
- [selectedIndex]="selectedMatGroup.value"
-
(selectedIndexChange)="selectedMatGroup.setValue($event)"
- style="margin-top: -35px;">
- <mat-tab label="Table">
- <sp-table
- *ngIf="selectedInfoResult !== undefined"
- [datas]="data"
- [xAxesKey]="xAxesKey"
- [yAxesKeys]="yAxesKeys"
- [eventschema]="selectedInfoResult.eventSchema"
- [startDateData]="dateRange[0]"
- [endDateData]="dateRange[1]"
- [currentPage]="currentPage"
- [maxPage]="maxPage"
- [enablePaging]="true"
- (nextPage)="handleNextPage()"
- (previousPage)="handlePreviousPage()"
- (firstPage)=handleFirstPage()
- (lastPage)="handleLastPage()">
- </sp-table>
- </mat-tab>
- <mat-tab label="Line chart">
- <sp-lineChart
- *ngIf="selectedInfoResult !== undefined &&
selectedMatGroup.value === 1"
- [datas]="data"
- [xAxesKey]="xAxesKey"
- [yAxesKeys]="yAxesKeys"
- [eventschema]="selectedInfoResult.eventSchema"
- [startDateData]="dateRange[0]"
- [endDateData]="dateRange[1]"
- [currentPage]="currentPage"
- [maxPage]="maxPage"
- [enablePaging]="true"
- (nextPage)="handleNextPage()"
- (previousPage)="handlePreviousPage()"
- (firstPage)=handleFirstPage()
- (lastPage)="handleLastPage()"
- (zoomEvent)="zoomEventHandler($event)">
- </sp-lineChart>
- </mat-tab>
- </mat-tab-group>
- </div>
-
- </div>
-</div>
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.ts
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.ts
deleted file mode 100644
index f907ea0..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.component.ts
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { Component, OnInit } from '@angular/core';
-import { FormControl, FormGroup } from '@angular/forms';
-import { MatDialog } from '@angular/material/dialog';
-import { MatSnackBar } from '@angular/material/snack-bar';
-import { timer } from 'rxjs/internal/observable/timer';
-import { Observable } from 'rxjs/Observable';
-import { map, startWith } from 'rxjs/operators';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from
'../../../../core-model/datalake/GroupedDataResult';
-import { DataLakeMeasure } from
'../../../../core-model/datalake/DataLakeMeasure';
-import { DatalakeRestService } from
'../../../../core-services/datalake/datalake-rest.service';
-import { DataDownloadDialog } from './datadownloadDialog/dataDownload.dialog';
-
-@Component({
- selector: 'sp-old-explorer',
- templateUrl: './old-explorer.component.html',
- styleUrls: ['./old-explorer.css'],
-})
-export class OldExplorerComponent implements OnInit {
-
-
- myControl = new FormControl();
- infoResult: DataLakeMeasure[];
- filteredIndexInfos: Observable<DataLakeMeasure[]>;
-
- page = 0;
- // selectedIndex: string = '';
- selectedInfoResult: DataLakeMeasure = undefined;
-
- // timeunit selection
- selectedTimeUnit = '1 Hour';
-
- // aggregation / advanced options
- // group by
- enableAdvanceOptions = false;
- groupbyUnit = 'd';
- groupbyValue = 1;
-
- // key selections
- dataKeys: string[] = [];
-
- // grouped Data
- dimensionProperties: string[] = [];
- selectedGroup = undefined;
-
- // y and x axe
- yAxesKeys: [] = [];
- xAxesKey = 'time';
-
- data;
-
- isLoadingData;
- displayIsLoadingData = false;
-
- // user messages
- noDateFoundinTimeRange;
- noKeySelected;
- noIndexSelection;
-
- // custom time range
- dateRange: Date []; // [0] start, [1] end
-
- // Mat Group
- selectedMatGroup = new FormControl(0);
-
- // auto update data
- optionAutoUpdateData = false;
- autoUpdateData = false;
- autoUpdatePeriod = 10;
- autoUpdateTimer;
- autoUpdateTimerSubcribtion;
-
- constructor(private restService: DatalakeRestService, private snackBar:
MatSnackBar, public dialog: MatDialog) {
- const dateTmp = new Date();
- this.setDateRange(dateTmp, new Date(dateTmp.getTime() - 60000 * 60 *
1));
- }
-
- ngOnInit(): void {
- this.restService.getAllInfos().subscribe(res => {
- this.infoResult = res;
- this.filteredIndexInfos = this.myControl.valueChanges
- .pipe(
- startWith(''),
- map(value => this._filter(value))
- );
- this.noIndexSelection = true;
- }
- );
- }
-
- // selectTimeUnit(value) {
- // this.selectedTimeUnit = value;
- //
- // if (this.selectedTimeUnit === '1 Day') {
- // this.groupbyUnit = 's';
- // this.groupbyValue = 10;
- // } else if (this.selectedTimeUnit === '1 Day') {
- // this.groupbyUnit = 'm';
- // this.groupbyValue = 1;
- // } else if (this.selectedTimeUnit === '1 Week') {
- // this.groupbyUnit = 'm';
- // this.groupbyValue = 30;
- // } else if (this.selectedTimeUnit === '1 Month') {
- // this.groupbyUnit = 'h';
- // this.groupbyValue = 4;
- // } else if (this.selectedTimeUnit === '1 Year') {
- // this.groupbyUnit = 'h';
- // this.groupbyValue = 12;
- // }
- //
- // this.loadData(false);
- // }
-
- loadData(silentLoading?) {
- this.isLoadingData = true;
- this.noDateFoundinTimeRange = false;
- this.noIndexSelection = false;
-
- if (!silentLoading) {
- this.displayIsLoadingData = true;
- }
-
- if (this.selectedTimeUnit !== 'Custom') {
- const endDateTmp = new Date();
- let startDateTmp;
-
- if (this.selectedTimeUnit === '1 Hour') {
- startDateTmp = new Date(endDateTmp.getTime() - 60000 * 60 *
1); // 1 Hour
- } else if (this.selectedTimeUnit === '1 Day') {
- startDateTmp = new Date(endDateTmp.getTime() - 60000 * 60 * 24
* 1); // 1 Day
- } else if (this.selectedTimeUnit === '1 Week') {
- startDateTmp = new Date(endDateTmp.getTime() - 60000 * 60 * 24
* 7); // 7 Days
- } else if (this.selectedTimeUnit === '1 Month') {
- startDateTmp = new Date(endDateTmp.getTime() - 60000 * 60 * 24
* 30); // 30 Days
- } else if (this.selectedTimeUnit === '1 Year') {
- startDateTmp = new Date(endDateTmp.getTime() - 60000 * 60 * 24
* 365); // 365 Days
- }
- this.setDateRange(startDateTmp, endDateTmp);
- }
-
- if (this.enableAdvanceOptions) {
- let groupbyUnit = this.groupbyUnit;
- let groupbyValue = this.groupbyValue;
- if (this.groupbyUnit === 'month') {
- groupbyUnit = 'w';
- groupbyValue = 4 * groupbyValue;
- } else if (this.groupbyUnit === 'year') {
- groupbyUnit = 'd';
- groupbyValue = 365 * groupbyValue;
- }
- if (this.selectedGroup === undefined) {
- const startTime = new Date().getTime();
- this.restService.getData(this.selectedInfoResult.measureName,
this.dateRange[0].getTime(), this.dateRange[1].getTime(),
- groupbyUnit, groupbyValue).subscribe(
- res => {
- this.processReceivedData(res);
-
- }
- );
- } else {
-
this.restService.getGroupedData(this.selectedInfoResult.measureName,
this.dateRange[0].getTime(),
- this.dateRange[1].getTime(), groupbyUnit, groupbyValue,
this.selectedGroup).subscribe(
- res => {
- this.processReceivedGroupedData(res);
- }
- );
- }
-
- } else {
- if (this.selectedGroup === undefined) {
- this.restService
- .getDataAutoAggregation(this.selectedInfoResult.measureName,
this.dateRange[0].getTime(), this.dateRange[1].getTime())
- .subscribe(
- res => {
- this.processReceivedData(res);
- }
- );
- } else {
-
this.restService.getGroupedDataAutoAggergation(this.selectedInfoResult.measureName,
this.dateRange[0].getTime(),
- this.dateRange[1].getTime(), this.selectedGroup).subscribe(
- res => {
- this.processReceivedGroupedData(res);
- }
- );
- }
-
- }
-
- }
-
- reloadData() {
- if (this.optionAutoUpdateData) {
- if (this.autoUpdateData) {
- this.autoUpdateData = false;
- this.autoUpdateTimerSubcribtion.unsubscribe();
- } else {
- this.autoUpdateData = true;
- this.autoUpdateTimer = timer(this.autoUpdatePeriod * 1000,
this.autoUpdatePeriod * 1000);
- this.autoUpdateTimerSubcribtion =
this.autoUpdateTimer.subscribe(val => {
- // Just Load new data if last request finished
- if (!this.isLoadingData) {
- this.loadData(true);
- }
- });
- }
- } else {
- this.loadData(false);
- }
- }
-
- processReceivedData(res) {
- if (res.total > 0) {
- this.data = res as DataResult;
- this.noDateFoundinTimeRange = false;
- if (this.yAxesKeys.length === 0) {
- this.noKeySelected = true;
- }
- } else {
- this.data = undefined;
- this.noDateFoundinTimeRange = true;
- this.noKeySelected = false;
- }
- this.isLoadingData = false;
- this.displayIsLoadingData = false;
- }
-
- processReceivedGroupedData(res) {
- if (res.total > 0) {
- this.data = res as GroupedDataResult;
- } else {
- this.data = undefined;
- this.noDateFoundinTimeRange = true;
- this.noKeySelected = false;
- }
- this.isLoadingData = false;
- this.displayIsLoadingData = false;
- }
-
- selectIndex(index: string) {
- this.dataKeys = [];
- this.dimensionProperties = [];
- this.selectedGroup = undefined;
- this.selectedInfoResult = this._filter(index)[0];
- this.selectedInfoResult.eventSchema.eventProperties.forEach(property
=> {
-
- // Check if property is Primitive (only primitives has a
runtimeType
- if (property['runtimeType'] !== undefined) {
- if (property['propertyScope'] !== undefined &&
property['propertyScope'] === 'DIMENSION_PROPERTY') {
- this.dimensionProperties.push(property['runtimeName']);
- } else if (this.isNumberProperty(property) &&
- (property['domainProperties'] === undefined ||
(property.domainProperty !== 'http://schema.org/DateTime' &&
- property['domainProperties'][0] !==
'http://schema.org/DateTime'))) {
-
- this.dataKeys.push(property['runtimeName']);
- }
- } else {
- // list and nested properties
- this.dataKeys.push(property['runtimeName']);
- }
- });
- this.selectKey(this.dataKeys.slice(0, 3));
- this.loadData(false);
- }
-
- selectKey(value) {
- if (this.data === undefined) {
- this.noDateFoundinTimeRange = true;
- } else {
- this.noDateFoundinTimeRange = false;
- }
- if (value.length === 0 && !this.noDateFoundinTimeRange) {
- this.noKeySelected = true;
- } else {
- this.noKeySelected = false;
- }
- this.yAxesKeys = value;
-
- }
-
- selectDimensionProperty(value) {
- if (value !== this.selectedGroup) {
- // remove group property from the "data selection"
- this.dataKeys = this.dataKeys.filter(key => key !== value);
- this.selectKey(this.dataKeys.filter(key => key !== value));
-
- // add last grouped property
- if (this.selectedGroup !== undefined) {
- this.dataKeys.push(this.selectedGroup);
- }
-
-
- this.selectedGroup = value;
- this.loadData(false);
- }
- }
-
- downloadDataAsFile() {
- const dialogRef = this.dialog.open(DataDownloadDialog, {
- width: '600px',
- data:
- { data: this.data,
- xAxesKey: this.xAxesKey,
- yAxesKeys: this.yAxesKeys,
- index: this.selectedInfoResult.measureName,
- date: this.dateRange},
- panelClass: 'custom-dialog-container'
-
- });
- }
-
-
- handleNextPage() {
- let offset;
- if (this.selectedTimeUnit === 'Custom') {
- offset = this.dateRange[1].getTime() - this.dateRange[0].getTime();
- } else {
- if (this.selectedTimeUnit === '1 Day') {
- offset = 60000 * 60 * 24 * 1;
- } else if (this.selectedTimeUnit === '1 Week') {
- offset = 60000 * 60 * 24 * 7;
- } else if (this.selectedTimeUnit === '1 Month') {
- offset = 60000 * 60 * 24 * 30;
- } else if (this.selectedTimeUnit === '1 Year') {
- offset = 60000 * 60 * 24 * 365;
- }
- this.selectedTimeUnit = 'Custom';
- }
- this.setDateRange(new Date(this.dateRange[0].getTime() + offset), new
Date(this.dateRange[1].getTime() + offset));
- this.loadData(false);
- }
-
- handlePreviousPage() {
- let offset;
- if (this.selectedTimeUnit === 'Custom') {
- offset = -(this.dateRange[1].getTime() -
this.dateRange[0].getTime());
- } else {
- if (this.selectedTimeUnit === '1 Day') {
- offset = -60000 * 60 * 24 * 1;
- } else if (this.selectedTimeUnit === '1 Week') {
- offset = -60000 * 60 * 24 * 7;
- } else if (this.selectedTimeUnit === '1 Month') {
- offset = -60000 * 60 * 24 * 30;
- } else if (this.selectedTimeUnit === '1 Year') {
- offset = -60000 * 60 * 24 * 365;
- }
- this.selectedTimeUnit = 'Custom';
- }
- this.setDateRange(new Date(this.dateRange[0].getTime() + offset), new
Date(this.dateRange[1].getTime() + offset));
- this.loadData(false);
- }
-
- handleFirstPage() {
- // TODO
- }
-
- handleLastPage() {
- // TODO
- }
-
- setDateRange(start, end) {
- this.dateRange = [];
- this.dateRange[0] = start;
- this.dateRange[1] = end;
- }
-
- openSnackBar(message: string) {
- this.snackBar.open(message, 'Close', {
- duration: 2000,
- });
- }
-
- _filter(value: string): DataLakeMeasure[] {
- const filterValue = value.toLowerCase();
-
- return this.infoResult.filter(option =>
option.measureName.toLowerCase().includes(filterValue));
- }
-
-
- isNumberProperty(prop) {
- if (prop.runtimeType === 'http://schema.org/Number' ||
- prop.runtimeType === 'http://www.w3.org/2001/XMLSchema#float' ||
- prop.runtimeType === 'http://www.w3.org/2001/XMLSchema#integer' ||
- prop.runtimeType === 'http://www.w3.org/2001/XMLSchema#double' ||
- prop.runtimeType === 'http://www.w3.org/2001/XMLSchema#decimal') {
-
- return true;
- } else {
- return false;
- }
- }
-
- zoomEventHandler(timeRange) {
- this.selectedTimeUnit = 'Custom';
- if (timeRange[0] !== undefined) {
- this.setDateRange(new Date(timeRange[0]), new Date(timeRange[1]));
- }
- this.loadData(true);
- }
-}
diff --git
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.css
b/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.css
deleted file mode 100644
index ed244b2..0000000
---
a/ui/src/app/data-explorer/components/widgets/old-explorer-widget/old-explorer.css
+++ /dev/null
@@ -1,85 +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.
- *
- */
-
-::ng-deep .mat-form-field-underline {
- background-color: rgba(255, 255, 255, 0.8);
-}
-
-::ng-deep .mat-select-content{
- width:2000px;
- background-color: red;
- font-size: 10px;
-}
-
-.option {
- border: #ffffff solid 1px;
- border-radius: 5px;
- margin-top: 10px;
- height: 50px;
- float: left;
- padding-left: 5px;
- padding-right: 5px;
-}
-
-.optionName {
- margin-top: -10px;
- margin-left: 8px;
- padding-left: 3px;
- padding-right: 2px;
- width: fit-content;
- background:#9c9c9c;
-}
-
-.icon {
- top: 15px;
- border: #202020 solid 1px;
- margin-left: 5px
-}
-
-.optionContainer {
-}
-
-.clearfix:after {
- content: "";
- display: table;
- clear: both;
-}
-
-.paging-button {
- top: 6px;
- margin: 10px;
- border: #202020 solid 1px;
-}
-
-.custom-dialog-container .mat-dialog-container {
- padding-top: 0px !important;
-}
-
-.rotate {
- -webkit-animation:spin 4s linear infinite;
- -moz-animation:spin 4s linear infinite;
- animation:spin 4s linear infinite;
-}
-
-@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
-@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
-@keyframes spin { 100% { -webkit-transform: rotate(360deg);
transform:rotate(360deg); } }
-
-::ng-deep .mat-select-panel {
- max-height: 70vh !important;
-}
\ No newline at end of file
diff --git a/ui/src/app/data-explorer/components/widgets/table/table-config.ts
b/ui/src/app/data-explorer/components/widgets/table/table-config.ts
index 9397e69..7bbbfef 100644
--- a/ui/src/app/data-explorer/components/widgets/table/table-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/table/table-config.ts
@@ -16,11 +16,10 @@
*
*/
-import { DashboardWidgetSettings } from
'../../../../core-model/dashboard/DashboardWidgetSettings';
-import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
-import { EpRequirements } from '../../../sdk/ep-requirements';
-import { SchemaRequirementsBuilder } from
'../../../sdk/schema-requirements-builder';
import { WidgetConfig } from '../base/base-config';
+import {WidgetConfigBuilder} from
"../../../../dashboard/registry/widget-config-builder";
+import {SchemaRequirementsBuilder} from
"../../../../dashboard/sdk/schema-requirements-builder";
+import {DashboardWidgetSettings} from
"../../../../core-model/gen/streampipes-model";
export class TableConfig extends WidgetConfig {
diff --git
a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
index 4c83e05..a52d8a1 100644
---
a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
+++
b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
@@ -20,10 +20,10 @@ import { Component, OnDestroy, OnInit, ViewChild } from
'@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
-import { EventProperty } from
'../../../../connect/schema-editor/model/EventProperty';
import { DataResult } from '../../../../core-model/datalake/DataResult';
import { DatalakeRestService } from
'../../../../core-services/datalake/datalake-rest.service';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
+import {EventPropertyUnion} from
"../../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-table-widget',
@@ -35,8 +35,8 @@ export class TableWidgetComponent extends
BaseDataExplorerWidget implements OnIn
@ViewChild(MatSort, {static: true}) sort: MatSort;
- availableColumns: EventProperty[];
- selectedColumns: EventProperty[];
+ availableColumns: EventPropertyUnion[];
+ selectedColumns: EventPropertyUnion[];
columnNames: string[];
dataSource = new MatTableDataSource();
@@ -92,7 +92,7 @@ export class TableWidgetComponent extends
BaseDataExplorerWidget implements OnIn
return object;
}
- setSelectedColumn(selectedColumns: EventProperty[]) {
+ setSelectedColumn(selectedColumns: EventPropertyUnion[]) {
this.selectedColumns = selectedColumns;
this.columnNames = this.getRuntimeNames(this.selectedColumns);
}
diff --git
a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
index e254599..1307311 100644
---
a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
+++
b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
@@ -17,7 +17,7 @@
*/
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { EventProperty } from
'../../../../../connect/schema-editor/model/EventProperty';
+import {EventPropertyUnion} from
"../../../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-select-properties',
@@ -27,13 +27,13 @@ import { EventProperty } from
'../../../../../connect/schema-editor/model/EventP
export class SelectPropertiesComponent implements OnInit {
@Output()
- changeSelectedProperties: EventEmitter<EventProperty[]> = new EventEmitter();
+ changeSelectedProperties: EventEmitter<EventPropertyUnion[]> = new
EventEmitter();
@Input()
- availableProperties: EventProperty[];
+ availableProperties: EventPropertyUnion[];
@Input()
- selectedProperties: EventProperty[];
+ selectedProperties: EventPropertyUnion[];
@Input()
label: string;
@@ -46,7 +46,7 @@ export class SelectPropertiesComponent implements OnInit {
ngOnInit(): void {
}
- triggerSelectedProperties(properties: EventProperty[]) {
+ triggerSelectedProperties(properties: EventPropertyUnion[]) {
this.changeSelectedProperties.emit(properties);
}
diff --git
a/ui/src/app/data-explorer/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
b/ui/src/app/data-explorer/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
index 40352f9..3527dbf 100644
---
a/ui/src/app/data-explorer/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
+++
b/ui/src/app/data-explorer/dialogs/add-widget/data-explorer-add-visualization-dialog.component.ts
@@ -18,13 +18,15 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import { EventSchema } from '../../../connect/schema-editor/model/EventSchema';
-import { DataExplorerWidgetModel } from
'../../../core-model/datalake/DataExplorerWidgetModel';
-import { DataLakeMeasure } from '../../../core-model/datalake/DataLakeMeasure';
import { ElementIconText } from
'../../../services/get-element-icon-text.service';
import { IDataViewDashboard } from '../../models/dataview-dashboard.model';
import { DataExplorerWidgetRegistry } from
'../../registry/data-explorer-widget-registry';
import { DataViewDataExplorerService } from
'../../services/data-view-data-explorer.service';
+import {
+ DataExplorerWidgetModel,
+ DataLakeMeasure,
+ EventSchema
+} from "../../../core-model/gen/streampipes-model";
@Component({
selector: 'sp-data-explorer-add-visualization-dialog-component',
@@ -122,7 +124,7 @@ export class DataExplorerAddVisualizationDialogComponent
implements OnInit {
this.page = 'select-widget';
} else if (this.page === 'select-widget') {
const configuredWidget: DataExplorerWidgetModel = new
DataExplorerWidgetModel();
-
+ configuredWidget["@class"] =
"org.apache.streampipes.model.datalake.DataExplorerWidgetModel";
// TODO find solution for event schema
// configuredWidget.eventSchema = new EventSchema();
// configuredWidget.eventSchema.eventProperties =
this.selectedDataSet.eventSchema.eventProperties;
@@ -131,6 +133,7 @@ export class DataExplorerAddVisualizationDialogComponent
implements OnInit {
// }
configuredWidget.dataLakeMeasure = this.selectedDataSet;
+ configuredWidget.dataLakeMeasure["@class"] =
"org.apache.streampipes.model.datalake.DataLakeMeasure";
configuredWidget.widgetType = this.selectedWidget;
this.dataViewDataExplorerService.saveWidget(configuredWidget).subscribe(response
=> {
this.dialogRef.close(response);
diff --git
a/ui/src/app/data-explorer/services/data-view-data-explorer.service.ts
b/ui/src/app/data-explorer/services/data-view-data-explorer.service.ts
index 6ae3680..efe58ec 100644
--- a/ui/src/app/data-explorer/services/data-view-data-explorer.service.ts
+++ b/ui/src/app/data-explorer/services/data-view-data-explorer.service.ts
@@ -16,18 +16,17 @@
*
*/
-import { HttpClient, HttpHeaders } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-import { from, Observable } from 'rxjs';
+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 { DataExplorerWidgetModel } from
'../../core-model/datalake/DataExplorerWidgetModel';
-import { DataLakeMeasure } from '../../core-model/datalake/DataLakeMeasure';
-import { DatalakeRestService } from
'../../core-services/datalake/datalake-rest.service';
-import { SharedDatalakeRestService } from
'../../core-services/shared/shared-dashboard.service';
-import { TsonLdSerializerService } from
'../../platform-services/tsonld-serializer.service';
-import { AuthStatusService } from '../../services/auth-status.service';
-import { IDataViewDashboard } from '../models/dataview-dashboard.model';
+import {map} from 'rxjs/operators';
+import {DatalakeRestService} from
'../../core-services/datalake/datalake-rest.service';
+import {SharedDatalakeRestService} from
'../../core-services/shared/shared-dashboard.service';
+import {TsonLdSerializerService} from
'../../platform-services/tsonld-serializer.service';
+import {AuthStatusService} from '../../services/auth-status.service';
+import {IDataViewDashboard} from '../models/dataview-dashboard.model';
+import {DataExplorerWidgetModel, DataLakeMeasure} from
"../../core-model/gen/streampipes-model";
@Injectable()
@@ -37,14 +36,14 @@ export class DataViewDataExplorerService {
constructor(private http: HttpClient,
private authStatusService: AuthStatusService,
- private tsonLdSerializerService: TsonLdSerializerService,
private dataLakeRestService: DatalakeRestService,
private sharedDatalakeRestService: SharedDatalakeRestService) {
}
getVisualizableData(): Observable<DataLakeMeasure[]> {
+
return this.dataLakeRestService.getAllInfos().map(data => {
- return this.tsonLdSerializerService.fromJsonLdContainer(data,
'sp:DataLakeMeasure');
+ return (data as any[]).map(d => DataLakeMeasure.fromData(d as
DataLakeMeasure));
});
}
@@ -77,31 +76,15 @@ export class DataViewDataExplorerService {
}
getWidget(widgetId: string): Observable<DataExplorerWidgetModel> {
- const promise = new Promise<DataExplorerWidgetModel>((resolve, reject) => {
- this.http.get(this.getDashboardWidgetUrl() + '/' +
widgetId).subscribe(response => {
-
this.tsonLdSerializerService.jsonLdToFlattenJsonLd(response).subscribe(res => {
- const dashboardWidget: DataExplorerWidgetModel =
- this.tsonLdSerializerService.fromJsonLd(res,
'sp:DataExplorerWidgetModel');
- resolve(dashboardWidget);
- });
- });
- });
- return from(promise);
+ return this.http.get(this.getDashboardWidgetUrl() + '/' +
widgetId).pipe(map(response => {
+ return DataExplorerWidgetModel.fromData(response as
DataExplorerWidgetModel);
+ }));
}
saveWidget(widget: DataExplorerWidgetModel):
Observable<DataExplorerWidgetModel> {
- const promise = new Promise<DataExplorerWidgetModel>((resolve, reject) => {
- this.tsonLdSerializerService.toJsonLd(widget).subscribe(serialized => {
- this.http.post(this.getDashboardWidgetUrl(), serialized,
this.jsonLdHeaders()).pipe(map(response => {
-
-
this.tsonLdSerializerService.jsonLdToFlattenJsonLd(response).subscribe(res => {
- resolve(this.tsonLdSerializerService.fromJsonLd(res,
'sp:DataExplorerWidgetModel'));
- });
-
- })).subscribe();
- });
- });
- return from(promise);
+ return this.http.post(this.getDashboardWidgetUrl(),
widget).pipe(map(response => {
+ return DataExplorerWidgetModel.fromData(response as
DataExplorerWidgetModel);
+ }));
}
deleteWidget(widgetId: string): Observable<any> {
@@ -109,21 +92,6 @@ export class DataViewDataExplorerService {
}
updateWidget(widget: DataExplorerWidgetModel): Observable<any> {
- const promise = new Promise<DataExplorerWidgetModel>((resolve, reject) => {
- this.tsonLdSerializerService.toJsonLd(widget).subscribe(serialized => {
- this.http.put(this.getDashboardWidgetUrl() + '/' + widget._id,
serialized, this.jsonLdHeaders()).subscribe(result => {
- resolve();
- });
- });
- });
- return from(promise);
- }
-
- jsonLdHeaders(): any {
- return {
- headers: new HttpHeaders({
- 'Content-Type': 'application/ld+json',
- }),
- };
+ return this.http.put(this.getDashboardWidgetUrl() + '/' + widget._id,
widget);
}
}
diff --git a/ui/src/app/platform-services/tsonld-serializer.service.ts
b/ui/src/app/platform-services/tsonld-serializer.service.ts
index 730bf44..34c408e 100644
--- a/ui/src/app/platform-services/tsonld-serializer.service.ts
+++ b/ui/src/app/platform-services/tsonld-serializer.service.ts
@@ -96,8 +96,6 @@ import {DashboardWidget} from
"../core-model/dashboard/DashboardWidget";
import {DashboardWidgetSettings} from
"../core-model/dashboard/DashboardWidgetSettings";
import {ColorPickerStaticProperty} from
"../connect/model/ColorPickerStaticProperty";
import {MappingPropertyNary} from "../connect/model/MappingPropertyNary";
-import { DataExplorerWidgetModel } from
"../core-model/datalake/DataExplorerWidgetModel";
-import { DataLakeMeasure } from "../core-model/datalake/DataLakeMeasure";
import {UserDefinedOutputStrategy} from
"../connect/model/output/UserDefinedOutputStrategy";
import {CodeInputStaticProperty} from
"../connect/model/CodeInputStaticProperty";
import {DataSourceDescription} from "../connect/model/DataSourceDescription";
@@ -204,10 +202,6 @@ export class TsonLdSerializerService {
tsonld.addClassMapping(VisualizablePipeline);
tsonld.addClassMapping(ColorPickerStaticProperty);
- tsonld.addClassMapping(DataExplorerWidgetModel);
- tsonld.addClassMapping(DataLakeMeasure);
-
-
tsonld.addContext('sp', 'https://streampipes.org/vocabulary/v1/');
tsonld.addContext('spi', 'urn:streampipes.org:spi:');
tsonld.addContext('foaf', 'http://xmlns.com/foaf/0.1/');