From 949bb5a781017edf1684a2e3000875eb01bc8eba Mon Sep 17 00:00:00 2001 From: Dominik Riemer Date: Sat, 25 Jan 2025 23:27:36 +0100 Subject: [PATCH] feat(#3441): Remove deprecated live dashboard --- .../streampipes/export/AssetLinkResolver.java | 2 - .../export/dataimport/ImportGenerator.java | 21 -- .../dataimport/PerformImportGenerator.java | 15 - .../dataimport/PreviewImportGenerator.java | 11 - .../generator/ExportPackageGenerator.java | 16 - .../export/resolver/DashboardResolver.java | 74 ----- .../resolver/DashboardWidgetResolver.java | 59 ---- .../model/dashboard/DashboardEntity.java | 1 - .../model/dashboard/DashboardWidgetModel.java | 78 ----- .../dashboard/DashboardWidgetSettings.java | 93 ------ .../model/dashboard/VisualizablePipeline.java | 76 ----- .../management/DashboardResourceManager.java | 28 -- .../management/SpResourceManager.java | 4 - .../streampipes/rest/ResetManagement.java | 19 -- .../rest/impl/dashboard/Dashboard.java | 46 --- .../rest/impl/dashboard/DashboardWidget.java | 83 ----- .../VisualizablePipelineResource.java | 86 ----- .../storage/api/INoSqlStorage.java | 5 - .../couchdb/CouchDbStorageManager.java | 17 - .../dashboard/dashboardTest.smoke.spec.ts | 40 --- .../tests/dashboard/dashboardWidgets.spec.ts | 81 ----- .../tests/dashboard/editDashboardTest.spec.ts | 71 ---- .../dashboard/standaloneDashboardTest.spec.ts | 46 --- ui/deployment/app-routing.module.mst | 2 - ui/deployment/home.service.mst | 2 - ui/deployment/modules.yml | 4 +- .../src/lib/apis/dashboard.service.ts | 143 -------- .../src/lib/model/gen/streampipes-model.ts | 2 +- .../platform-services/src/public-api.ts | 1 - .../dialog/base-asset-links.directive.ts | 11 +- .../edit-asset-link-dialog.component.ts | 3 - .../manage-asset-links-dialog.component.ts | 3 - .../grid/dashboard-grid.component.html | 43 --- .../grid/dashboard-grid.component.scss | 31 -- .../grid/dashboard-grid.component.ts | 172 ---------- .../dashboard-overview.component.html | 155 +-------- .../dashboard-overview.component.scss | 36 -- .../overview/dashboard-overview.component.ts | 119 +------ .../panel/dashboard-panel.component.html | 86 ----- .../panel/dashboard-panel.component.scss | 47 --- .../panel/dashboard-panel.component.ts | 231 ------------- .../standalone-dashboard.component.html | 26 -- .../standalone-dashboard.component.scss | 31 -- .../standalone-dashboard.component.ts | 59 ---- .../widget/dashboard-widget.component.html | 314 ------------------ .../widget/dashboard-widget.component.scss | 67 ---- .../widget/dashboard-widget.component.ts | 207 ------------ .../components/widgets/area/area-config.ts | 37 --- .../widgets/area/area-widget.component.html | 52 --- .../widgets/area/area-widget.component.scss | 24 -- .../widgets/area/area-widget.component.ts | 47 --- .../widgets/bar-race/bar-race-config.ts | 60 ---- .../bar-race/bar-race-widget.component.html | 42 --- .../bar-race/bar-race-widget.component.scss | 53 --- .../bar-race/bar-race-widget.component.ts | 190 ----------- .../components/widgets/base/base-config.ts | 31 -- .../widgets/base/base-echarts-widget.ts | 54 --- .../widgets/base/base-ngx-charts-widget.ts | 61 ---- .../base/base-ngx-line-charts-widget.ts | 98 ------ .../widgets/base/base-ngx-line-config.ts | 69 ---- .../components/widgets/base/base-widget.ts | 299 ----------------- .../components/widgets/gauge/gauge-config.ts | 65 ---- .../widgets/gauge/gauge-widget.component.html | 46 --- .../widgets/gauge/gauge-widget.component.scss | 32 -- .../widgets/gauge/gauge-widget.component.ts | 83 ----- .../components/widgets/html/html-config.ts | 50 --- .../widgets/html/html-widget.component.html | 34 -- .../widgets/html/html-widget.component.scss | 32 -- .../widgets/html/html-widget.component.ts | 79 ----- .../components/widgets/image/image-config.ts | 50 --- .../widgets/image/image-widget.component.html | 26 -- .../widgets/image/image-widget.component.scss | 31 -- .../widgets/image/image-widget.component.ts | 86 ----- .../components/widgets/line/line-config.ts | 37 --- .../widgets/line/line-widget.component.html | 52 --- .../widgets/line/line-widget.component.scss | 32 -- .../widgets/line/line-widget.component.ts | 47 --- .../components/widgets/map/map-config.ts | 87 ----- .../widgets/map/map-widget.component.html | 42 --- .../widgets/map/map-widget.component.scss | 31 -- .../widgets/map/map-widget.component.ts | 207 ------------ .../widgets/number/number-config.ts | 50 --- .../number/number-widget.component.html | 38 --- .../number/number-widget.component.scss | 48 --- .../widgets/number/number-widget.component.ts | 98 ------ .../components/widgets/raw/raw-config.ts | 41 --- .../widgets/raw/raw-widget.component.html | 39 --- .../widgets/raw/raw-widget.component.scss | 36 -- .../widgets/raw/raw-widget.component.ts | 74 ----- .../stacked-line-chart-config.ts | 54 --- .../stacked-line-chart-widget.component.html | 42 --- .../stacked-line-chart-widget.component.scss | 53 --- .../stacked-line-chart-widget.component.ts | 154 --------- .../widgets/status/status-config.ts | 46 --- .../status/status-widget.component.html | 42 --- .../status/status-widget.component.scss | 62 ---- .../widgets/status/status-widget.component.ts | 89 ----- .../components/widgets/table/table-config.ts | 53 --- .../widgets/table/table-widget.component.html | 62 ---- .../widgets/table/table-widget.component.scss | 33 -- .../widgets/table/table-widget.component.ts | 109 ------ .../trafficlight/traffic-light-config.ts | 74 ----- .../traffic-light-widget.component.html | 65 ---- .../traffic-light-widget.component.scss | 56 ---- .../traffic-light-widget.component.ts | 155 --------- .../widgets/wordcloud/wordcloud-config.ts | 65 ---- .../wordcloud/wordcloud-widget.component.html | 39 --- .../wordcloud/wordcloud-widget.component.scss | 45 --- .../wordcloud/wordcloud-widget.component.ts | 171 ---------- .../dashboard.can-deactivate.guard.ts | 33 -- ui/src/app/dashboard/dashboard.module.ts | 61 +--- .../add-visualization-dialog.component.html | 138 -------- .../add-visualization-dialog.component.scss | 53 --- .../add-visualization-dialog.component.ts | 293 ---------------- .../edit-dashboard-dialog.component.html | 92 ----- .../edit-dashboard-dialog.component.scss | 32 -- .../edit-dashboard-dialog.component.ts | 55 --- .../dashboard/models/multi-series.model.ts | 27 -- .../registry/widget-config-builder.ts | 276 --------------- .../app/dashboard/registry/widget-registry.ts | 80 ----- .../sdk/collected-schema-requirements.ts | 42 --- ui/src/app/dashboard/sdk/ep-requirements.ts | 118 ------- .../extractor/static-property-extractor.ts | 109 ------ .../dashboard/sdk/matching/datatype-match.ts | 48 --- .../sdk/matching/domain-property-match.ts | 34 -- .../sdk/matching/list-property-match.ts | 32 -- .../matching/mapping-property-generator.ts | 46 --- .../sdk/matching/primitive-property-match.ts | 40 --- .../dashboard/sdk/matching/property-match.ts | 41 --- .../dashboard/sdk/matching/schema-match.ts | 29 -- .../sdk/schema-requirements-builder.ts | 102 ------ .../dashboard/services/edit-mode.service.ts | 29 -- .../services/refresh-dashboard.service.ts | 29 -- .../services/reload-pipeline.service.ts | 29 -- .../app/dashboard/services/resize.service.ts | 30 -- .../models/gridster-info.model.ts | 6 - .../services/resize.service.ts | 2 +- .../data-explorer-dashboard-grid.component.ts | 2 +- 138 files changed, 16 insertions(+), 8818 deletions(-) delete mode 100644 streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardResolver.java delete mode 100644 streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardWidgetResolver.java delete mode 100644 streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetModel.java delete mode 100644 streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetSettings.java delete mode 100644 streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/VisualizablePipeline.java delete mode 100644 streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java delete mode 100644 streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/Dashboard.java delete mode 100644 streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java delete mode 100644 streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/VisualizablePipelineResource.java delete mode 100644 ui/cypress/tests/dashboard/dashboardTest.smoke.spec.ts delete mode 100644 ui/cypress/tests/dashboard/dashboardWidgets.spec.ts delete mode 100644 ui/cypress/tests/dashboard/editDashboardTest.spec.ts delete mode 100644 ui/cypress/tests/dashboard/standaloneDashboardTest.spec.ts delete mode 100644 ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts delete mode 100644 ui/src/app/dashboard/components/grid/dashboard-grid.component.html delete mode 100644 ui/src/app/dashboard/components/grid/dashboard-grid.component.scss delete mode 100644 ui/src/app/dashboard/components/grid/dashboard-grid.component.ts delete mode 100644 ui/src/app/dashboard/components/panel/dashboard-panel.component.html delete mode 100644 ui/src/app/dashboard/components/panel/dashboard-panel.component.scss delete mode 100644 ui/src/app/dashboard/components/panel/dashboard-panel.component.ts delete mode 100644 ui/src/app/dashboard/components/standalone/standalone-dashboard.component.html delete mode 100644 ui/src/app/dashboard/components/standalone/standalone-dashboard.component.scss delete mode 100644 ui/src/app/dashboard/components/standalone/standalone-dashboard.component.ts delete mode 100644 ui/src/app/dashboard/components/widget/dashboard-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widget/dashboard-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widget/dashboard-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/area/area-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/area/area-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/area/area-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/area/area-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/bar-race/bar-race-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-echarts-widget.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-ngx-charts-widget.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-ngx-line-charts-widget.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-ngx-line-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/base/base-widget.ts delete mode 100644 ui/src/app/dashboard/components/widgets/gauge/gauge-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/html/html-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/html/html-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/html/html-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/html/html-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/image/image-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/image/image-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/image/image-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/image/image-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/line/line-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/line/line-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/line/line-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/line/line-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/map/map-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/map/map-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/map/map-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/map/map-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/number/number-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/number/number-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/number/number-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/number/number-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/raw/raw-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/raw/raw-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/raw/raw-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/raw/raw-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/status/status-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/status/status-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/status/status-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/status/status-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/table/table-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/table/table-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/table/table-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/table/table-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.ts delete mode 100644 ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-config.ts delete mode 100644 ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.html delete mode 100644 ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.scss delete mode 100644 ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts delete mode 100644 ui/src/app/dashboard/dashboard.can-deactivate.guard.ts delete mode 100644 ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html delete mode 100644 ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.scss delete mode 100644 ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.ts delete mode 100644 ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.html delete mode 100644 ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.scss delete mode 100644 ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts delete mode 100644 ui/src/app/dashboard/models/multi-series.model.ts delete mode 100644 ui/src/app/dashboard/registry/widget-config-builder.ts delete mode 100644 ui/src/app/dashboard/registry/widget-registry.ts delete mode 100644 ui/src/app/dashboard/sdk/collected-schema-requirements.ts delete mode 100644 ui/src/app/dashboard/sdk/ep-requirements.ts delete mode 100644 ui/src/app/dashboard/sdk/extractor/static-property-extractor.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/datatype-match.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/domain-property-match.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/list-property-match.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/mapping-property-generator.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/primitive-property-match.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/property-match.ts delete mode 100644 ui/src/app/dashboard/sdk/matching/schema-match.ts delete mode 100644 ui/src/app/dashboard/sdk/schema-requirements-builder.ts delete mode 100644 ui/src/app/dashboard/services/edit-mode.service.ts delete mode 100644 ui/src/app/dashboard/services/refresh-dashboard.service.ts delete mode 100644 ui/src/app/dashboard/services/reload-pipeline.service.ts delete mode 100644 ui/src/app/dashboard/services/resize.service.ts rename ui/src/app/{dashboard => data-explorer-shared}/models/gridster-info.model.ts (91%) diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/AssetLinkResolver.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/AssetLinkResolver.java index 7b8f3f0e1e..4de74304bf 100644 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/AssetLinkResolver.java +++ b/streampipes-data-export/src/main/java/org/apache/streampipes/export/AssetLinkResolver.java @@ -20,7 +20,6 @@ import org.apache.streampipes.export.constants.ResolvableAssetLinks; import org.apache.streampipes.export.resolver.AdapterResolver; -import org.apache.streampipes.export.resolver.DashboardResolver; import org.apache.streampipes.export.resolver.DataSourceResolver; import org.apache.streampipes.export.resolver.DataViewResolver; import org.apache.streampipes.export.resolver.FileResolver; @@ -58,7 +57,6 @@ public AssetExportConfiguration resolveResources() { exportConfig.setAssetId(this.assetId); exportConfig.setAssetName(asset.getAssetName()); exportConfig.setAdapters(new AdapterResolver().resolve(getLinks(assetLinks, ResolvableAssetLinks.ADAPTER))); - exportConfig.setDashboards(new DashboardResolver().resolve(getLinks(assetLinks, ResolvableAssetLinks.DASHBOARD))); exportConfig.setDataViews(new DataViewResolver().resolve(getLinks(assetLinks, ResolvableAssetLinks.DATA_VIEW))); exportConfig.setDataSources( new DataSourceResolver().resolve(getLinks(assetLinks, ResolvableAssetLinks.DATA_SOURCE))); diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/ImportGenerator.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/ImportGenerator.java index 55b7bfda6d..5084580c1f 100644 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/ImportGenerator.java +++ b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/ImportGenerator.java @@ -67,14 +67,6 @@ public T generate(InputStream inputStream) throws IOException { } } - for (String dashboardId : manifest.getDashboards()) { - try { - handleDashboard(asString(previewFiles.get(dashboardId)), dashboardId); - } catch (DocumentConflictException e) { - LOG.warn("Skipping import of dashboard {} (already present with the same id)", dashboardId); - } - } - for (String dataViewId : manifest.getDataViews()) { try { handleDataView(asString(previewFiles.get(dataViewId)), dataViewId); @@ -107,14 +99,6 @@ public T generate(InputStream inputStream) throws IOException { } } - for (String dashboardWidgetId : manifest.getDashboardWidgets()) { - try { - handleDashboardWidget(asString(previewFiles.get(dashboardWidgetId)), dashboardWidgetId); - } catch (DocumentConflictException e) { - LOG.warn("Skipping import of dashboard widget {} (already present with the same id)", dashboardWidgetId); - } - } - for (String dataViewWidgetId : manifest.getDataViewWidgets()) { try { handleDataViewWidget(asString(previewFiles.get(dataViewWidgetId)), dataViewWidgetId); @@ -149,8 +133,6 @@ private StreamPipesApplicationPackage getManifest(Map previewFil protected abstract void handleAdapter(String document, String adapterId) throws JsonProcessingException; - protected abstract void handleDashboard(String document, String dashboardId) throws JsonProcessingException; - protected abstract void handleDataView(String document, String dataViewId) throws JsonProcessingException; protected abstract void handleDataSource(String document, String dataSourceId) throws JsonProcessingException; @@ -160,9 +142,6 @@ private StreamPipesApplicationPackage getManifest(Map previewFil protected abstract void handleDataLakeMeasure(String document, String dataLakeMeasureId) throws JsonProcessingException; - protected abstract void handleDashboardWidget(String document, String dashboardWidgetId) - throws JsonProcessingException; - protected abstract void handleDataViewWidget(String document, String dataViewWidgetId) throws JsonProcessingException; protected abstract void handleFile(String document, String fileMetadataId, Map zipContent) diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PerformImportGenerator.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PerformImportGenerator.java index f056e0fefb..bf529a51a5 100644 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PerformImportGenerator.java +++ b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PerformImportGenerator.java @@ -20,8 +20,6 @@ import org.apache.streampipes.export.model.PermissionInfo; import org.apache.streampipes.export.resolver.AdapterResolver; -import org.apache.streampipes.export.resolver.DashboardResolver; -import org.apache.streampipes.export.resolver.DashboardWidgetResolver; import org.apache.streampipes.export.resolver.DataSourceResolver; import org.apache.streampipes.export.resolver.DataViewResolver; import org.apache.streampipes.export.resolver.DataViewWidgetResolver; @@ -77,14 +75,6 @@ protected void handleAdapter(String document, String adapterId) throws JsonProce } } - @Override - protected void handleDashboard(String document, String dashboardId) throws JsonProcessingException { - if (shouldStore(dashboardId, config.getDashboards())) { - new DashboardResolver().writeDocument(document); - permissionsToStore.add(new PermissionInfo(dashboardId, DashboardModel.class)); - } - } - @Override protected void handleDataView(String document, String dataViewId) throws JsonProcessingException { if (shouldStore(dataViewId, config.getDataViews())) { @@ -117,11 +107,6 @@ protected void handleDataLakeMeasure(String document, String dataLakeMeasureId) } } - @Override - protected void handleDashboardWidget(String document, String dashboardWidgetId) throws JsonProcessingException { - new DashboardWidgetResolver().writeDocument(document); - } - @Override protected void handleDataViewWidget(String document, String dataViewWidget) throws JsonProcessingException { new DataViewWidgetResolver().writeDocument(document); diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PreviewImportGenerator.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PreviewImportGenerator.java index 55d3acf43e..6a114a6855 100644 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PreviewImportGenerator.java +++ b/streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/PreviewImportGenerator.java @@ -20,7 +20,6 @@ import org.apache.streampipes.export.resolver.AdapterResolver; -import org.apache.streampipes.export.resolver.DashboardResolver; import org.apache.streampipes.export.resolver.DataSourceResolver; import org.apache.streampipes.export.resolver.DataViewResolver; import org.apache.streampipes.export.resolver.FileResolver; @@ -76,11 +75,6 @@ protected void handleAdapter(String document, } } - @Override - protected void handleDashboard(String document, String dashboardId) throws JsonProcessingException { - addExportItem(dashboardId, new DashboardResolver().readDocument(document).getName(), importConfig::addDashboard); - } - @Override protected void handleDataView(String document, String dataViewId) throws JsonProcessingException { addExportItem(dataViewId, new DataViewResolver().readDocument(document).getName(), importConfig::addDataView); @@ -102,11 +96,6 @@ protected void handleDataLakeMeasure(String document, String measurementId) thro importConfig::addDataLakeMeasure); } - @Override - protected void handleDashboardWidget(String document, String dashboardWidgetId) { - - } - @Override protected void handleDataViewWidget(String document, String dataViewWidget) { diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/generator/ExportPackageGenerator.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/generator/ExportPackageGenerator.java index 13abd92077..cff63086b5 100644 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/generator/ExportPackageGenerator.java +++ b/streampipes-data-export/src/main/java/org/apache/streampipes/export/generator/ExportPackageGenerator.java @@ -21,8 +21,6 @@ import org.apache.streampipes.commons.exceptions.ElementNotFoundException; import org.apache.streampipes.export.resolver.AbstractResolver; import org.apache.streampipes.export.resolver.AdapterResolver; -import org.apache.streampipes.export.resolver.DashboardResolver; -import org.apache.streampipes.export.resolver.DashboardWidgetResolver; import org.apache.streampipes.export.resolver.DataSourceResolver; import org.apache.streampipes.export.resolver.DataViewResolver; import org.apache.streampipes.export.resolver.DataViewWidgetResolver; @@ -55,12 +53,10 @@ public class ExportPackageGenerator { private final ExportConfiguration exportConfiguration; private ObjectMapper defaultMapper; - private ObjectMapper spMapper; public ExportPackageGenerator(ExportConfiguration exportConfiguration) { this.exportConfiguration = exportConfiguration; this.defaultMapper = SerializationUtils.getDefaultObjectMapper(); - this.spMapper = SerializationUtils.getSpObjectMapper(); } public byte[] generateExportPackage() throws IOException { @@ -80,18 +76,6 @@ public byte[] generateExportPackage() throws IOException { new AdapterResolver(), manifest::addAdapter)); - config.getDashboards().forEach(item -> { - var resolver = new DashboardResolver(); - addDoc(builder, - item, - resolver, - manifest::addDashboard); - - var widgets = resolver.getWidgets(item.getResourceId()); - var widgetResolver = new DashboardWidgetResolver(); - widgets.forEach(widgetId -> addDoc(builder, widgetId, widgetResolver, manifest::addDashboardWidget)); - }); - config.getDataSources().forEach(item -> addDoc(builder, item, new DataSourceResolver(), diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardResolver.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardResolver.java deleted file mode 100644 index 35354044f8..0000000000 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardResolver.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.export.resolver; - -import org.apache.streampipes.export.utils.SerializationUtils; -import org.apache.streampipes.model.dashboard.DashboardItem; -import org.apache.streampipes.model.dashboard.DashboardModel; -import org.apache.streampipes.model.export.ExportItem; - -import com.fasterxml.jackson.core.JsonProcessingException; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -public class DashboardResolver extends AbstractResolver { - - @Override - public DashboardModel findDocument(String resourceId) { - return getNoSqlStore().getDashboardStorage().getElementById(resourceId); - } - - @Override - public DashboardModel modifyDocumentForExport(DashboardModel doc) { - doc.setRev(null); - return doc; - } - - @Override - protected boolean existsDoc(DashboardModel doc) { - return Objects.nonNull(doc) && doc.getElementId() != null; - } - - @Override - public DashboardModel readDocument(String serializedDoc) throws JsonProcessingException { - return SerializationUtils.getSpObjectMapper().readValue(serializedDoc, DashboardModel.class); - } - - @Override - public ExportItem convert(DashboardModel document) { - return new ExportItem(document.getElementId(), document.getName(), true); - } - - @Override - public void writeDocument(String document) throws JsonProcessingException { - getNoSqlStore().getDashboardStorage().persist(deserializeDocument(document)); - } - - @Override - protected DashboardModel deserializeDocument(String document) throws JsonProcessingException { - return this.spMapper.readValue(document, DashboardModel.class); - } - - public List getWidgets(String resourceId) { - var document = findDocument(resourceId); - return document.getWidgets().stream().map(DashboardItem::getId).collect(Collectors.toList()); - } -} diff --git a/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardWidgetResolver.java b/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardWidgetResolver.java deleted file mode 100644 index 73632e97e3..0000000000 --- a/streampipes-data-export/src/main/java/org/apache/streampipes/export/resolver/DashboardWidgetResolver.java +++ /dev/null @@ -1,59 +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. - * - */ - -package org.apache.streampipes.export.resolver; - -import org.apache.streampipes.export.utils.SerializationUtils; -import org.apache.streampipes.model.dashboard.DashboardWidgetModel; -import org.apache.streampipes.model.export.ExportItem; - -import com.fasterxml.jackson.core.JsonProcessingException; - -public class DashboardWidgetResolver extends AbstractResolver { - - @Override - public DashboardWidgetModel findDocument(String resourceId) { - return getNoSqlStore().getDashboardWidgetStorage().getElementById(resourceId); - } - - @Override - public DashboardWidgetModel modifyDocumentForExport(DashboardWidgetModel doc) { - doc.setRev(null); - return doc; - } - - @Override - public DashboardWidgetModel readDocument(String serializedDoc) throws JsonProcessingException { - return SerializationUtils.getSpObjectMapper().readValue(serializedDoc, DashboardWidgetModel.class); - } - - @Override - public ExportItem convert(DashboardWidgetModel document) { - return new ExportItem(document.getElementId(), document.getVisualizationName(), true); - } - - @Override - public void writeDocument(String document) throws JsonProcessingException { - getNoSqlStore().getDashboardWidgetStorage().persist(deserializeDocument(document)); - } - - @Override - protected DashboardWidgetModel deserializeDocument(String document) throws JsonProcessingException { - return this.spMapper.readValue(document, DashboardWidgetModel.class); - } -} diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardEntity.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardEntity.java index b2ec89845a..b990e99966 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardEntity.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardEntity.java @@ -26,7 +26,6 @@ import com.google.gson.annotations.SerializedName; @JsonSubTypes({ - @JsonSubTypes.Type(DashboardWidgetModel.class), @JsonSubTypes.Type(DataExplorerWidgetModel.class) }) public abstract class DashboardEntity implements Storable { diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetModel.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetModel.java deleted file mode 100644 index 5308789df5..0000000000 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetModel.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.model.dashboard; - -import org.apache.streampipes.model.shared.annotation.TsModel; - -@TsModel -public class DashboardWidgetModel extends DashboardEntity { - - private String widgetId; - - private String widgetType; - - private DashboardWidgetSettings dashboardWidgetSettings; - - private String pipelineId; - private String visualizationName; - - public DashboardWidgetModel() { - super(); - } - - public String getWidgetId() { - return widgetId; - } - - public void setWidgetId(String widgetId) { - this.widgetId = widgetId; - } - - public DashboardWidgetSettings getDashboardWidgetSettings() { - return dashboardWidgetSettings; - } - - public void setDashboardWidgetSettings(DashboardWidgetSettings dashboardWidgetSettings) { - this.dashboardWidgetSettings = dashboardWidgetSettings; - } - - public String getPipelineId() { - return pipelineId; - } - - public void setPipelineId(String pipelineId) { - this.pipelineId = pipelineId; - } - - public String getVisualizationName() { - return visualizationName; - } - - public void setVisualizationName(String visualizationName) { - this.visualizationName = visualizationName; - } - - public String getWidgetType() { - return widgetType; - } - - public void setWidgetType(String widgetType) { - this.widgetType = widgetType; - } -} diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetSettings.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetSettings.java deleted file mode 100644 index c28e823b77..0000000000 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardWidgetSettings.java +++ /dev/null @@ -1,93 +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. - * - */ - -package org.apache.streampipes.model.dashboard; - -import org.apache.streampipes.model.schema.EventSchema; -import org.apache.streampipes.model.shared.annotation.TsModel; -import org.apache.streampipes.model.staticproperty.StaticProperty; - -import java.util.List; - -@TsModel -public class DashboardWidgetSettings { - - private String widgetLabel; - - private String widgetName; - - private List config; - - private EventSchema requiredSchema; - - private String widgetIconName; - - private String widgetDescription; - - public DashboardWidgetSettings() { - super(); - } - - public String getWidgetLabel() { - return widgetLabel; - } - - public void setWidgetLabel(String widgetLabel) { - this.widgetLabel = widgetLabel; - } - - public String getWidgetName() { - return widgetName; - } - - public void setWidgetName(String widgetName) { - this.widgetName = widgetName; - } - - public List getConfig() { - return config; - } - - public void setConfig(List config) { - this.config = config; - } - - public EventSchema getRequiredSchema() { - return requiredSchema; - } - - public void setRequiredSchema(EventSchema requiredSchema) { - this.requiredSchema = requiredSchema; - } - - public String getWidgetIconName() { - return widgetIconName; - } - - public void setWidgetIconName(String widgetIconName) { - this.widgetIconName = widgetIconName; - } - - public String getWidgetDescription() { - return widgetDescription; - } - - public void setWidgetDescription(String widgetDescription) { - this.widgetDescription = widgetDescription; - } -} diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/VisualizablePipeline.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/VisualizablePipeline.java deleted file mode 100644 index edb4b61f25..0000000000 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/VisualizablePipeline.java +++ /dev/null @@ -1,76 +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. - * - */ - -package org.apache.streampipes.model.dashboard; - -import org.apache.streampipes.model.schema.EventSchema; -import org.apache.streampipes.model.shared.annotation.TsModel; - -@TsModel -public class VisualizablePipeline { - - private String pipelineId; - private EventSchema schema; - private String visualizationName; - private String topic; - private String pipelineName; - - public VisualizablePipeline() { - super(); - } - - public String getPipelineId() { - return pipelineId; - } - - public void setPipelineId(String pipelineId) { - this.pipelineId = pipelineId; - } - - public EventSchema getSchema() { - return schema; - } - - public void setSchema(EventSchema schema) { - this.schema = schema; - } - - public String getVisualizationName() { - return visualizationName; - } - - public void setVisualizationName(String visualizationName) { - this.visualizationName = visualizationName; - } - - public String getTopic() { - return topic; - } - - public void setTopic(String topic) { - this.topic = topic; - } - - public String getPipelineName() { - return pipelineName; - } - - public void setPipelineName(String pipelineName) { - this.pipelineName = pipelineName; - } -} diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java deleted file mode 100644 index b6db9d83ac..0000000000 --- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java +++ /dev/null @@ -1,28 +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. - * - */ -package org.apache.streampipes.resource.management; - -import org.apache.streampipes.model.dashboard.DashboardModel; -import org.apache.streampipes.storage.management.StorageDispatcher; - -public class DashboardResourceManager extends AbstractCRUDResourceManager { - - public DashboardResourceManager() { - super(StorageDispatcher.INSTANCE.getNoSqlStore().getDashboardStorage(), DashboardModel.class); - } -} diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java index 9e080dfa65..e875732755 100644 --- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java +++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java @@ -30,10 +30,6 @@ public AdapterDescriptionResourceManager manageAdapterDescriptions() { return new AdapterDescriptionResourceManager(); } - public DashboardResourceManager manageDashboards() { - return new DashboardResourceManager(); - } - public DataExplorerResourceManager manageDataExplorer() { return new DataExplorerResourceManager(); } diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java index 0c88e461b6..e5804a563c 100644 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java +++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java @@ -75,10 +75,6 @@ public static void reset(String username) { removeAllDataViews(); - removeAllDashboardWidgets(); - - removeAllDashboards(); - removeAllAssets(username); removeAllPipelineTemplates(); @@ -163,21 +159,6 @@ private static void removeAllDataViews() { .forEach(dashboard -> dataLakeDashboardStorage.deleteElementById(dashboard.getElementId())); } - private static void removeAllDashboardWidgets() { - var dashboardWidgetStorage = - StorageDispatcher.INSTANCE.getNoSqlStore() - .getDashboardWidgetStorage(); - dashboardWidgetStorage.findAll() - .forEach(widget -> dashboardWidgetStorage.deleteElementById(widget.getElementId())); - } - - private static void removeAllDashboards() { - var dashboardStorage = StorageDispatcher.INSTANCE.getNoSqlStore() - .getDashboardStorage(); - dashboardStorage.findAll() - .forEach(dashboard -> dashboardStorage.deleteElementById(dashboard.getElementId())); - } - private static void removeAllAssets(String username) { IGenericStorage genericStorage = StorageDispatcher.INSTANCE.getNoSqlStore() .getGenericStorage(); diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/Dashboard.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/Dashboard.java deleted file mode 100644 index cbba2b024e..0000000000 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/Dashboard.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.rest.impl.dashboard; - -import org.apache.streampipes.model.client.user.DefaultPrivilege; -import org.apache.streampipes.model.dashboard.DashboardModel; -import org.apache.streampipes.resource.management.AbstractCRUDResourceManager; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/api/v2/dashboard/dashboards") -public class Dashboard extends AbstractDashboardResource { - - @Override - protected AbstractCRUDResourceManager getResourceManager() { - return getSpResourceManager().manageDashboards(); - } - - @Override - public boolean hasReadAuthority() { - return isAdminOrHasAnyAuthority(DefaultPrivilege.Constants.PRIVILEGE_READ_DASHBOARD_VALUE); - } - - @Override - public boolean hasWriteAuthority() { - return isAdminOrHasAnyAuthority(DefaultPrivilege.Constants.PRIVILEGE_WRITE_DASHBOARD_VALUE); - } -} diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java deleted file mode 100644 index 91687ee4d5..0000000000 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java +++ /dev/null @@ -1,83 +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. - * - */ - -package org.apache.streampipes.rest.impl.dashboard; - -import org.apache.streampipes.model.dashboard.DashboardWidgetModel; -import org.apache.streampipes.rest.core.base.impl.AbstractRestResource; -import org.apache.streampipes.storage.api.CRUDStorage; - -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.UUID; - -@RestController -@RequestMapping("/api/v2/dashboard/widgets") -public class DashboardWidget extends AbstractRestResource { - - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getAllDashboardWidgets() { - return ok(getDashboardWidgetStorage().findAll()); - } - - @GetMapping(path = "/{widgetId}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getDashboardWidget(@PathVariable("widgetId") String widgetId) { - return ok(getDashboardWidgetStorage().getElementById(widgetId)); - } - - @PutMapping( - path = "/{widgetId}", - produces = MediaType.APPLICATION_JSON_VALUE, - consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity modifyDashboardWidget(@RequestBody DashboardWidgetModel dashboardWidgetModel) { - getDashboardWidgetStorage().updateElement(dashboardWidgetModel); - return ok(); - } - - @DeleteMapping(path = "/{widgetId}") - public ResponseEntity deleteDashboardWidget(@PathVariable("widgetId") String widgetId) { - getDashboardWidgetStorage().deleteElementById(widgetId); - return ok(); - } - - @PostMapping( - produces = MediaType.APPLICATION_JSON_VALUE, - consumes = MediaType.APPLICATION_JSON_VALUE - ) - public ResponseEntity createDashboardWidget( - @RequestBody DashboardWidgetModel dashboardWidgetModel) { - String elementId = UUID.randomUUID().toString(); - dashboardWidgetModel.setElementId(elementId); - getDashboardWidgetStorage().persist(dashboardWidgetModel); - return ok(getDashboardWidgetStorage().getElementById(elementId)); - } - - private CRUDStorage getDashboardWidgetStorage() { - return getNoSqlStorage().getDashboardWidgetStorage(); - } -} diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/VisualizablePipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/VisualizablePipelineResource.java deleted file mode 100644 index 01d63dc410..0000000000 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/VisualizablePipelineResource.java +++ /dev/null @@ -1,86 +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. - * - */ - -package org.apache.streampipes.rest.impl.dashboard; - -import org.apache.streampipes.model.dashboard.VisualizablePipeline; -import org.apache.streampipes.model.graph.DataSinkInvocation; -import org.apache.streampipes.model.pipeline.Pipeline; -import org.apache.streampipes.rest.security.AuthConstants; - -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PostFilter; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.ArrayList; -import java.util.List; - -@RestController -@RequestMapping("/api/v2/dashboard/pipelines") -public class VisualizablePipelineResource extends AbstractPipelineExtractionResource { - - private static final String DashboardAppId = "org.apache.streampipes.sinks.internal.jvm.dashboard"; - private static final String VisualizationFieldInternalName = "visualization-name"; - - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - @PreAuthorize(AuthConstants.HAS_READ_DASHBOARD_PRIVILEGE) - @PostFilter("hasPermission(filterObject.pipelineId, 'READ')") - public List getVisualizablePipelines() { - return extract(new ArrayList<>(), DashboardAppId); - } - - @GetMapping(path = "{pipelineId}/{visualizationName}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getVisPipelineByIdAndVisualizationName(@PathVariable("pipelineId") String pipelineId, - @PathVariable("visualizationName") - String visualizationName) { - return getPipelineByIdAndFieldValue(DashboardAppId, pipelineId, visualizationName); - } - - private String makeTopic(DataSinkInvocation sink) { - return extractInputTopic(sink) + "-" + normalize(extractFieldValue(sink, VisualizationFieldInternalName)); - } - - private String normalize(String visualizationName) { - return visualizationName.replaceAll(" ", "").toLowerCase(); - } - - @Override - protected org.apache.streampipes.model.dashboard.VisualizablePipeline convert(Pipeline pipeline, - DataSinkInvocation sink) { - VisualizablePipeline visualizablePipeline = new org.apache.streampipes.model.dashboard.VisualizablePipeline(); - visualizablePipeline.setPipelineId(pipeline.getPipelineId()); - visualizablePipeline.setPipelineName(pipeline.getName()); - visualizablePipeline.setVisualizationName(extractFieldValue(sink, VisualizationFieldInternalName)); - visualizablePipeline.setSchema(sink.getInputStreams().get(0).getEventSchema()); - visualizablePipeline.setTopic(makeTopic(sink)); - return visualizablePipeline; - } - - @Override - protected boolean matches(VisualizablePipeline pipeline, - String pipelineId, - String visualizationName) { - return pipeline.getPipelineId().equals(pipelineId) - && pipeline.getVisualizationName().equals(visualizationName); - } -} diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java index 0a64296929..742adf1409 100644 --- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java +++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java @@ -23,7 +23,6 @@ import org.apache.streampipes.model.client.user.Role; import org.apache.streampipes.model.client.user.UserActivationToken; import org.apache.streampipes.model.dashboard.DashboardModel; -import org.apache.streampipes.model.dashboard.DashboardWidgetModel; import org.apache.streampipes.model.datalake.DataExplorerWidgetModel; import org.apache.streampipes.model.datalake.DataLakeMeasure; import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; @@ -53,12 +52,8 @@ public interface INoSqlStorage { CRUDStorage getFileMetadataStorage(); - CRUDStorage getDashboardStorage(); - CRUDStorage getDataExplorerDashboardStorage(); - CRUDStorage getDashboardWidgetStorage(); - CRUDStorage getDataExplorerWidgetStorage(); IPipelineElementTemplateStorage getPipelineElementTemplateStorage(); diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java index ab2ce7e4b1..c6edb2cfcf 100644 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java @@ -23,7 +23,6 @@ import org.apache.streampipes.model.client.user.Role; import org.apache.streampipes.model.client.user.UserActivationToken; import org.apache.streampipes.model.dashboard.DashboardModel; -import org.apache.streampipes.model.dashboard.DashboardWidgetModel; import org.apache.streampipes.model.datalake.DataExplorerWidgetModel; import org.apache.streampipes.model.datalake.DataLakeMeasure; import org.apache.streampipes.model.extensions.configuration.SpServiceConfiguration; @@ -131,14 +130,6 @@ public CRUDStorage getFileMetadataStorage() { ); } - @Override - public CRUDStorage getDashboardStorage() { - return new DefaultCrudStorage<>( - () -> Utils.getCouchDbGsonClient("dashboard"), - DashboardModel.class - ); - } - @Override public CRUDStorage getDataExplorerDashboardStorage() { return new DefaultCrudStorage<>( @@ -147,14 +138,6 @@ public CRUDStorage getDataExplorerDashboardStorage() { ); } - @Override - public CRUDStorage getDashboardWidgetStorage() { - return new DefaultCrudStorage<>( - () -> Utils.getCouchDbGsonClient("dashboardwidget"), - DashboardWidgetModel.class - ); - } - @Override public CRUDStorage getDataExplorerWidgetStorage() { return new DefaultCrudStorage<>( diff --git a/ui/cypress/tests/dashboard/dashboardTest.smoke.spec.ts b/ui/cypress/tests/dashboard/dashboardTest.smoke.spec.ts deleted file mode 100644 index cda2547aef..0000000000 --- a/ui/cypress/tests/dashboard/dashboardTest.smoke.spec.ts +++ /dev/null @@ -1,40 +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 { ConnectUtils } from '../../support/utils/connect/ConnectUtils'; -import { DashboardUtils } from '../../support/utils/DashboardUtils'; - -describe('Test live dashboard', () => { - beforeEach('Setup Test', () => { - cy.initStreamPipesTest(); - ConnectUtils.addMachineDataSimulator('simulator', true); - }); - - it('Perform Test', () => { - DashboardUtils.goToDashboard(); - - // Add new dashboard - const dashboardName = 'testDashboard'; - DashboardUtils.addAndEditDashboard(dashboardName); - - DashboardUtils.addWidget('Persist_simulator', 'raw'); - - // Validate that data is coming (at least 3 events) - DashboardUtils.validateRawWidgetEvents(3); - }); -}); diff --git a/ui/cypress/tests/dashboard/dashboardWidgets.spec.ts b/ui/cypress/tests/dashboard/dashboardWidgets.spec.ts deleted file mode 100644 index 2ef797590c..0000000000 --- a/ui/cypress/tests/dashboard/dashboardWidgets.spec.ts +++ /dev/null @@ -1,81 +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 { ConnectUtils } from '../../support/utils/connect/ConnectUtils'; -import { DashboardUtils } from '../../support/utils/DashboardUtils'; - -describe('Test All Widgets', () => { - const dashboardName = 'testDashboard'; - - beforeEach('Setup Test', () => { - cy.initStreamPipesTest(); - ConnectUtils.addMachineDataSimulator('simulator', true); - DashboardUtils.goToDashboard(); - }); - - it('Perform Test', () => { - DashboardUtils.addAndEditDashboard(dashboardName); - - // Test area chart - DashboardUtils.testWidget('area', dashboardName, { - minYaxis: '0', - maxYaxis: '50', - }); - - // Test bar race chart - DashboardUtils.testWidget('bar-race', dashboardName); - - // Test gauge widget - DashboardUtils.testWidget('gauge', dashboardName, { - minYaxis: '0', - maxYaxis: '50', - }); - - // Test html widget - DashboardUtils.testWidget('html', dashboardName); - - // Test line widget - DashboardUtils.testWidget('line', dashboardName, { - minYaxis: '0', - maxYaxis: '50', - }); - - // Test raw widget - DashboardUtils.testWidget('raw', dashboardName); - - // Test single value widget - DashboardUtils.testWidget('number', dashboardName); - - // Test stacked line chart widget - DashboardUtils.testWidget('stacked-line-chart', dashboardName); - - // Test status widget - DashboardUtils.testWidget('status', dashboardName, { - intervalKey: '5', - }); - - // Test table widget - DashboardUtils.testWidget('table', dashboardName); - - // Test traffic light widget - DashboardUtils.testWidget('trafficlight', dashboardName, { - warningRange: '5', - criticalValue: '5', - }); - }); -}); diff --git a/ui/cypress/tests/dashboard/editDashboardTest.spec.ts b/ui/cypress/tests/dashboard/editDashboardTest.spec.ts deleted file mode 100644 index f2fed10437..0000000000 --- a/ui/cypress/tests/dashboard/editDashboardTest.spec.ts +++ /dev/null @@ -1,71 +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 { ConnectUtils } from '../../support/utils/connect/ConnectUtils'; -import { DashboardUtils } from '../../support/utils/DashboardUtils'; - -describe('Test edit dashboard', () => { - beforeEach('Setup Test', () => { - cy.initStreamPipesTest(); - ConnectUtils.addMachineDataSimulator('simulator', true); - }); - - it('Perform Test', () => { - DashboardUtils.goToDashboard(); - - // Add new dashboard - const dashboardName = 'testDashboard'; - DashboardUtils.addAndEditDashboard(dashboardName); - DashboardUtils.addWidget('Persist_simulator', 'raw'); - cy.dataCy('save-data-explorer-go-back-to-overview').click(); - - // Change dashboard name - cy.dataCy('change-dashboard-settings-button').click(); - cy.dataCy('dashboard-name-input') - .clear() - .type(dashboardName + 'New') - .wait(1000); - cy.dataCy('dashboard-save-btn').should('not.be.disabled'); - cy.dataCy('dashboard-save-btn').click(); - - // Verify that new dashboard was renamed correctly - cy.contains('testDashboardNew').should('exist'); - - // Edit dashboard and change widget to line chart - cy.dataCy('edit-dashboard-testDashboardNew').click().wait(2000); - cy.dataCy('widget-settings-button').click(); - cy.dataCy('edit-widget-back-btn').click(); - cy.dataCy('dashboard-select-widget-line').click(); - cy.dataCy('min-y-axis-key').type('40'); - cy.dataCy('max-y-axis-key').type('50'); - cy.dataCy('dashboard-new-widget-next-btn').should('not.be.disabled'); - cy.dataCy('dashboard-new-widget-next-btn').click(); - - // Verify that new dashboard displays correct chart - cy.get('g').should('have.class', 'line-chart chart'); - - // Add second chart, single value chart - DashboardUtils.addWidget('Persist_simulator', 'number'); - - // Go back and check if two newly added charts are displayed correctly in standalone dashboard - cy.dataCy('save-data-explorer-go-back-to-overview').click(); - cy.dataCy('show-dashboard-testDashboardNew').click(); - cy.get('g').should('have.class', 'line-chart chart'); - cy.get('div').should('have.class', 'circleNumber'); - }); -}); diff --git a/ui/cypress/tests/dashboard/standaloneDashboardTest.spec.ts b/ui/cypress/tests/dashboard/standaloneDashboardTest.spec.ts deleted file mode 100644 index 6481ce43ac..0000000000 --- a/ui/cypress/tests/dashboard/standaloneDashboardTest.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ConnectUtils } from '../../support/utils/connect/ConnectUtils'; -import { DashboardUtils } from '../../support/utils/DashboardUtils'; - -describe('Test live dashboard in standalone mode', () => { - beforeEach('Setup Test', () => { - cy.initStreamPipesTest(); - ConnectUtils.addMachineDataSimulator('simulator', true); - }); - - it('Perform Test', () => { - DashboardUtils.goToDashboard(); - - // Add new dashboard - const dashboardName = 'testDashboard'; - DashboardUtils.addAndEditDashboard(dashboardName); - - DashboardUtils.addWidget('Persist_simulator', 'raw'); - - cy.wait(1000); - - DashboardUtils.goToDashboard(); - - DashboardUtils.showStandaloneDashboard(dashboardName); - - // Validate that data is coming (at least 3 events) - DashboardUtils.validateRawWidgetEvents(3); - }); -}); diff --git a/ui/deployment/app-routing.module.mst b/ui/deployment/app-routing.module.mst index 5ee435c816..ff88b83fb0 100644 --- a/ui/deployment/app-routing.module.mst +++ b/ui/deployment/app-routing.module.mst @@ -22,7 +22,6 @@ import {HomeComponent} from "./home/home.component"; import {LoginComponent} from "./login/components/login/login.component"; import {SetupComponent} from "./login/components/setup/setup.component"; import {StreampipesComponent} from "./core/components/streampipes/streampipes.component"; -import {StandaloneDashboardComponent} from "./dashboard/components/standalone/standalone-dashboard.component"; import {AuthCanActivateChildrenGuard} from "./_guards/auth.can-activate-children.guard"; import {ConfiguredCanActivateGuard} from "./_guards/configured.can-activate.guard"; import {StartupComponent} from "./login/components/startup/startup.component"; @@ -56,7 +55,6 @@ const routes: Routes = [ { path: 'restore-password', component: RestorePasswordComponent, canActivate: [RestorePasswordAllowedCanActivateGuard] }, { path: 'set-new-password', component: SetNewPasswordComponent, canActivate: [RestorePasswordAllowedCanActivateGuard] }, { path: 'startup', component: StartupComponent }, - { path: 'standalone/:dashboardId', component: StandaloneDashboardComponent }, { path: '', component: StreampipesComponent, children: [ { path: '', component: HomeComponent, canActivate: [ConfiguredCanActivateGuard] }, {{#modulesActive}} diff --git a/ui/deployment/home.service.mst b/ui/deployment/home.service.mst index 6d79e7631a..2459c8936a 100644 --- a/ui/deployment/home.service.mst +++ b/ui/deployment/home.service.mst @@ -22,7 +22,6 @@ import { AuthService } from '../services/auth.service'; import { ServiceLink } from './models/home.model'; import { AdapterService, - DashboardService, DataViewDataExplorerService, PipelineElementService, PipelineService } from '@streampipes/platform-services'; @@ -33,7 +32,6 @@ export class HomeService { constructor(private authService: AuthService, private adapterService: AdapterService, - private dashboardService: DashboardService, private dataViewService: DataViewDataExplorerService, private pipelineService: PipelineService, private pipelineElementService: PipelineElementService) { diff --git a/ui/deployment/modules.yml b/ui/deployment/modules.yml index b9c929780a..d5282f4955 100644 --- a/ui/deployment/modules.yml +++ b/ui/deployment/modules.yml @@ -118,7 +118,7 @@ spDashboard: createLinks: "['dashboard']" title: 'Dashboards' createTitle: 'New dashboard' - dataFns: '[this.dashboardService.getDashboards()]' + dataFns: '[this.dataViewService.getDataViews()]' viewRoles: '[UserPrivilege.PRIVILEGE_READ_DASHBOARD, UserPrivilege.PRIVILEGE_WRITE_DASHBOARD]' createRoles: '[UserPrivilege.PRIVILEGE_WRITE_DASHBOARD]' spDataExplorer: @@ -140,6 +140,6 @@ spDataExplorer: createLinks: "['dataexplorer']" title: 'Data Views' createTitle: 'New data view' - dataFns: '[this.dataViewService.getDataViews()]' + dataFns: '[this.dataViewService.getAllWidgets()]' viewRoles: '[UserPrivilege.PRIVILEGE_READ_DATA_EXPLORER_VIEW, UserPrivilege.PRIVILEGE_WRITE_DATA_EXPLORER_VIEW]' createRoles: '[UserPrivilege.PRIVILEGE_WRITE_DATA_EXPLORER_VIEW]' diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts b/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts deleted file mode 100644 index b26c60be9b..0000000000 --- a/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { map } from 'rxjs/operators'; -import { Observable } from 'rxjs'; -import { MeasurementUnit } from '../model/measurement-unit/MeasurementUnit'; -import { PlatformServicesCommons } from './commons.service'; -import { DashboardWidgetModel, Pipeline } from '../model/gen/streampipes-model'; -import { Dashboard } from '../model/dashboard/dashboard.model'; - -@Injectable({ - providedIn: 'root', -}) -export class DashboardService { - constructor( - private http: HttpClient, - private platformServicesCommons: PlatformServicesCommons, - ) {} - - getPipelineById(id: string): Observable { - return this.http.get(this.pipelinesUrl + '/' + id).pipe( - map(data => { - return Pipeline.fromData(data as any); - }), - ); - } - - getDashboards(): Observable { - return this.http.get(this.dashboardUrl).pipe( - map(data => { - return data as Dashboard[]; - }), - ); - } - - getDashboard(dashboardId: string): Observable { - return this.http.get(this.dashboardUrl + '/' + dashboardId).pipe( - map(data => { - return data as Dashboard; - }), - ); - } - - getMeasurementUnitInfo( - measurementUnitResource: string, - ): Observable { - return this.http - .get( - this.measurementUnitsUrl + - '/' + - encodeURIComponent(measurementUnitResource), - ) - .pipe( - map(data => { - return data as MeasurementUnit; - }), - ); - } - - updateDashboard(dashboard: Dashboard): Observable { - return this.http - .put(this.dashboardUrl + '/' + dashboard.elementId, dashboard) - .pipe( - map(data => { - return data as Dashboard; - }), - ); - } - - deleteDashboard(dashboard: Dashboard): Observable { - return this.http.delete(this.dashboardUrl + '/' + dashboard.elementId); - } - - saveDashboard(dashboard: Dashboard): Observable { - return this.http.post(this.dashboardUrl, dashboard); - } - - private get baseUrl() { - return this.platformServicesCommons.apiBasePath; - } - - private get measurementUnitsUrl() { - return this.baseUrl + '/measurement-units'; - } - - private get dashboardUrl() { - return this.baseUrl + '/dashboard/dashboards'; - } - - private get pipelinesUrl() { - return this.baseUrl + '/pipelines'; - } - - private get dashboardWidgetUrl() { - return this.baseUrl + '/dashboard/widgets'; - } - - getWidget(widgetId: string): Observable { - return this.http.get(this.dashboardWidgetUrl + '/' + widgetId).pipe( - map(d => { - return DashboardWidgetModel.fromData(d as DashboardWidgetModel); - }), - ); - } - - saveWidget(widget: DashboardWidgetModel): Observable { - return this.http.post(this.dashboardWidgetUrl, widget).pipe( - map(response => { - return DashboardWidgetModel.fromData( - response as DashboardWidgetModel, - ); - }), - ); - } - - deleteWidget(widgetId: string): Observable { - return this.http.delete(this.dashboardWidgetUrl + '/' + widgetId); - } - - updateWidget(widget: DashboardWidgetModel): Observable { - return this.http.put( - this.dashboardWidgetUrl + '/' + widget.elementId, - widget, - ); - } -} diff --git a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts index 3aa23a65bf..31f14e6b19 100644 --- a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts +++ b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts @@ -20,7 +20,7 @@ /* tslint:disable */ /* eslint-disable */ // @ts-nocheck -// Generated using typescript-generator version 3.2.1263 on 2024-10-29 10:04:46. +// Generated using typescript-generator version 3.2.1263 on 2025-01-25 23:02:05. export class NamedStreamPipesEntity implements Storable { '@class': diff --git a/ui/projects/streampipes/platform-services/src/public-api.ts b/ui/projects/streampipes/platform-services/src/public-api.ts index caa7068565..f2ba0acf83 100644 --- a/ui/projects/streampipes/platform-services/src/public-api.ts +++ b/ui/projects/streampipes/platform-services/src/public-api.ts @@ -29,7 +29,6 @@ export * from './lib/apis/asset-management.service'; export * from './lib/apis/compact-pipeline.service'; export * from './lib/apis/data-view-data-explorer.service'; export * from './lib/apis/datalake-rest.service'; -export * from './lib/apis/dashboard.service'; export * from './lib/apis/files.service'; export * from './lib/apis/functions.service'; export * from './lib/apis/general-config.service'; diff --git a/ui/src/app/assets/dialog/base-asset-links.directive.ts b/ui/src/app/assets/dialog/base-asset-links.directive.ts index 121d60fc27..ada264cc8d 100644 --- a/ui/src/app/assets/dialog/base-asset-links.directive.ts +++ b/ui/src/app/assets/dialog/base-asset-links.directive.ts @@ -21,7 +21,7 @@ import { AdapterDescription, AdapterService, Dashboard, - DashboardService, + DataExplorerWidgetModel, DataLakeMeasure, DatalakeRestService, DataViewDataExplorerService, @@ -39,7 +39,7 @@ import { zip } from 'rxjs'; export abstract class BaseAssetLinksDirective { // Resources pipelines: Pipeline[]; - dataViews: Dashboard[]; + dataViews: DataExplorerWidgetModel[]; dashboards: Dashboard[]; dataLakeMeasures: DataLakeMeasure[]; dataSources: SpDataStream[]; @@ -52,7 +52,6 @@ export abstract class BaseAssetLinksDirective { protected genericStorageService: GenericStorageService, protected pipelineService: PipelineService, protected dataViewService: DataViewDataExplorerService, - protected dashboardService: DashboardService, protected dataLakeService: DatalakeRestService, protected pipelineElementService: PipelineElementService, protected adapterService: AdapterService, @@ -66,8 +65,8 @@ export abstract class BaseAssetLinksDirective { getAllResources() { zip( this.pipelineService.getPipelines(), + this.dataViewService.getAllWidgets(), this.dataViewService.getDataViews(), - this.dashboardService.getDashboards(), this.pipelineElementService.getDataStreams(), this.dataLakeService.getAllMeasurementSeries(), this.filesService.getFileMetadata(), @@ -86,7 +85,9 @@ export abstract class BaseAssetLinksDirective { a.name.localeCompare(b.name), ); this.dataViews = dataViews.sort((a, b) => - a.name.localeCompare(b.name), + a.baseAppearanceConfig.name.localeCompare( + b.baseAppearanceConfig.name, + ), ); this.dashboards = dashboards.sort((a, b) => a.name.localeCompare(b.name), diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts index 080b67bcd4..2801a19667 100644 --- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts +++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts @@ -22,7 +22,6 @@ import { AdapterService, AssetLink, AssetLinkType, - DashboardService, DatalakeRestService, DataViewDataExplorerService, GenericStorageService, @@ -65,7 +64,6 @@ export class EditAssetLinkDialogComponent protected genericStorageService: GenericStorageService, protected pipelineService: PipelineService, protected dataViewService: DataViewDataExplorerService, - protected dashboardService: DashboardService, protected dataLakeService: DatalakeRestService, protected pipelineElementService: PipelineElementService, protected adapterService: AdapterService, @@ -75,7 +73,6 @@ export class EditAssetLinkDialogComponent genericStorageService, pipelineService, dataViewService, - dashboardService, dataLakeService, pipelineElementService, adapterService, diff --git a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts index 7963c3ad38..40c4589e12 100644 --- a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts +++ b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts @@ -22,7 +22,6 @@ import { AdapterService, AssetLink, AssetLinkType, - DashboardService, DatalakeRestService, DataViewDataExplorerService, GenericStorageService, @@ -60,7 +59,6 @@ export class SpManageAssetLinksDialogComponent protected genericStorageService: GenericStorageService, protected pipelineService: PipelineService, protected dataViewService: DataViewDataExplorerService, - protected dashboardService: DashboardService, protected dataLakeService: DatalakeRestService, protected pipelineElementService: PipelineElementService, protected adapterService: AdapterService, @@ -70,7 +68,6 @@ export class SpManageAssetLinksDialogComponent genericStorageService, pipelineService, dataViewService, - dashboardService, dataLakeService, pipelineElementService, adapterService, diff --git a/ui/src/app/dashboard/components/grid/dashboard-grid.component.html b/ui/src/app/dashboard/components/grid/dashboard-grid.component.html deleted file mode 100644 index 6bdb5994de..0000000000 --- a/ui/src/app/dashboard/components/grid/dashboard-grid.component.html +++ /dev/null @@ -1,43 +0,0 @@ - - -
-

{{ dashboard.name }}

-

{{ dashboard.description }}

-
- - - - - - - diff --git a/ui/src/app/dashboard/components/grid/dashboard-grid.component.scss b/ui/src/app/dashboard/components/grid/dashboard-grid.component.scss deleted file mode 100644 index 98005658a3..0000000000 --- a/ui/src/app/dashboard/components/grid/dashboard-grid.component.scss +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -gridster ::ng-deep { - background: white; -} - -gridster.edit ::ng-deep { - background: #d3d3d3; -} - -gridster.scrollVertical ::ng-deep { - min-height: 100%; - display: flex; - flex: 1 1 100%; -} diff --git a/ui/src/app/dashboard/components/grid/dashboard-grid.component.ts b/ui/src/app/dashboard/components/grid/dashboard-grid.component.ts deleted file mode 100644 index b2bf6246b4..0000000000 --- a/ui/src/app/dashboard/components/grid/dashboard-grid.component.ts +++ /dev/null @@ -1,172 +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 { - AfterContentInit, - Component, - EventEmitter, - Input, - OnChanges, - OnDestroy, - OnInit, - Output, - QueryList, - SimpleChanges, - ViewChildren, -} from '@angular/core'; -import { - Dashboard, - DashboardConfig, - DashboardItem, - DashboardWidgetModel, - DataLakeMeasure, - DatalakeRestService, - SpQueryResult, -} from '@streampipes/platform-services'; -import { ResizeService } from '../../services/resize.service'; -import { GridsterItemComponent, GridType } from 'angular-gridster2'; -import { GridsterInfo } from '../../models/gridster-info.model'; -import { DashboardWidgetComponent } from '../widget/dashboard-widget.component'; -import { exhaustMap } from 'rxjs/operators'; -import { Observable, Subscription, timer } from 'rxjs'; - -@Component({ - selector: 'sp-dashboard-grid', - templateUrl: './dashboard-grid.component.html', - styleUrls: ['./dashboard-grid.component.scss'], -}) -export class DashboardGridComponent - implements OnInit, OnChanges, AfterContentInit, OnDestroy -{ - @Input() editMode: boolean; - @Input() headerVisible: boolean; - @Input() dashboard: Dashboard; - @Input() allMeasurements: DataLakeMeasure[]; - - @Output() deleteCallback: EventEmitter = - new EventEmitter(); - @Output() updateCallback: EventEmitter = - new EventEmitter(); - - options: DashboardConfig; - loaded = false; - - subscription: Subscription; - - @ViewChildren(GridsterItemComponent) - gridsterItemComponents: QueryList; - @ViewChildren(DashboardWidgetComponent) - dashboardWidgetComponents: QueryList; - - constructor( - private resizeService: ResizeService, - private datalakeRestService: DatalakeRestService, - ) {} - - ngOnInit(): void { - this.options = { - disablePushOnDrag: true, - draggable: { enabled: this.editMode }, - gridType: GridType.VerticalFixed, - minCols: 12, - maxCols: 12, - minRows: 4, - fixedRowHeight: 50, - fixedColWidth: 50, - margin: 5, - resizable: { enabled: this.editMode }, - displayGrid: this.editMode ? 'always' : 'none', - itemResizeCallback: (item, itemComponent) => { - this.resizeService.notify({ - gridsterItem: item, - gridsterItemComponent: itemComponent, - } as GridsterInfo); - }, - itemInitCallback: (item, itemComponent) => { - this.resizeService.notify({ - gridsterItem: item, - gridsterItemComponent: itemComponent, - } as GridsterInfo); - }, - }; - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['editMode'] && this.options) { - this.options.draggable.enabled = this.editMode; - this.options.resizable.enabled = this.editMode; - this.options.displayGrid = this.editMode ? 'always' : 'none'; - this.options.api.optionsChanged(); - } - } - - propagateItemRemoval(widget: DashboardItem) { - this.deleteCallback.emit(widget); - } - - propagateItemUpdate(dashboardWidget: DashboardWidgetModel) { - this.updateCallback.emit(dashboardWidget); - } - - ngAfterContentInit(): void { - if (this.dashboard.dashboardGeneralSettings.globalRefresh) { - this.checkWidgetsReady(); - } - } - - checkWidgetsReady() { - if (this.dashboardWidgetComponents) { - this.createQuerySubscription(); - } else { - setTimeout(() => this.checkWidgetsReady(), 1000); - } - } - - createQuerySubscription() { - this.subscription = timer( - 0, - this.dashboard.dashboardGeneralSettings.refreshIntervalInSeconds * - 1000, - ) - .pipe(exhaustMap(() => this.makeQueryObservable())) - .subscribe(res => { - if (res.length > 0) { - this.dashboardWidgetComponents.forEach((widget, index) => { - const widgetId = widget.getWidgetId(); - const queryResult = res.find(r => r.forId === widgetId); - if (queryResult) { - widget.processQueryResponse(queryResult); - } - }); - } - }); - } - - makeQueryObservable(): Observable { - const queries = this.dashboardWidgetComponents - .map(dw => dw.getWidgetQuery()) - .filter(query => query !== undefined); - return this.datalakeRestService.performMultiQuery(queries); - } -} diff --git a/ui/src/app/dashboard/components/overview/dashboard-overview.component.html b/ui/src/app/dashboard/components/overview/dashboard-overview.component.html index 687671bc98..99a0619991 100644 --- a/ui/src/app/dashboard/components/overview/dashboard-overview.component.html +++ b/ui/src/app/dashboard/components/overview/dashboard-overview.component.html @@ -19,159 +19,8 @@ - -
- -
- -
-
- warning - The live refresh feature has been integrated into the Data - Explorer. The original Live Dashboard will be removed in - future versions. Please migrate your current dashboards to - the Data Explorer! -
-
-
- -
- - - - Dashboard - - -
- {{ element.name }} -
-
- {{ element.description }} -
- -
- - - - -
- - - - - - -
- -
-
-
-
-
+
diff --git a/ui/src/app/dashboard/components/overview/dashboard-overview.component.scss b/ui/src/app/dashboard/components/overview/dashboard-overview.component.scss index 066c70c1c9..13cbc4aacb 100644 --- a/ui/src/app/dashboard/components/overview/dashboard-overview.component.scss +++ b/ui/src/app/dashboard/components/overview/dashboard-overview.component.scss @@ -15,39 +15,3 @@ * limitations under the License. * */ - -.mat-mdc-header-cell { - font-weight: bold; -} - -.m-20 { - margin: 20px; -} - -.options-bar { - padding: 0px; - border-bottom: 1px solid #cccccc; - margin-bottom: 10px; - height: 50px; -} - -.options-bar-item { - display: inline; - margin-right: 10px; -} - -.warning { - border: 1px solid #dea843; - background: #f1f1e6; - padding: 10px; - display: flex; - align-items: center; - gap: 8px; - box-sizing: border-box; - font-size: 10pt; -} - -.warning-icon { - color: #dea843; - font-size: 18px; -} diff --git a/ui/src/app/dashboard/components/overview/dashboard-overview.component.ts b/ui/src/app/dashboard/components/overview/dashboard-overview.component.ts index d32eb11261..d5580428c1 100644 --- a/ui/src/app/dashboard/components/overview/dashboard-overview.component.ts +++ b/ui/src/app/dashboard/components/overview/dashboard-overview.component.ts @@ -17,23 +17,15 @@ */ import { Component, OnInit } from '@angular/core'; -import { Dashboard, DashboardService } from '@streampipes/platform-services'; -import { MatTableDataSource } from '@angular/material/table'; import { MatDialog } from '@angular/material/dialog'; -import { EditDashboardDialogComponent } from '../../dialogs/edit-dashboard/edit-dashboard-dialog.component'; -import { Router } from '@angular/router'; -import { ObjectPermissionDialogComponent } from '../../../core-ui/object-permission-dialog/object-permission-dialog.component'; import { CurrentUserService, - DialogService, - PanelType, SpBreadcrumbService, } from '@streampipes/shared-ui'; import { UserRole } from '../../../_enums/user-role.enum'; import { AuthService } from '../../../services/auth.service'; import { UserPrivilege } from '../../../_enums/user-privilege.enum'; import { SpDashboardRoutes } from '../../dashboard.routes'; -import { zip } from 'rxjs'; @Component({ selector: 'sp-dashboard-overview', @@ -41,20 +33,13 @@ import { zip } from 'rxjs'; styleUrls: ['./dashboard-overview.component.scss'], }) export class DashboardOverviewComponent implements OnInit { - dashboards: Dashboard[] = []; - filteredDashboards: Dashboard[] = []; - - dataSource = new MatTableDataSource(); displayedColumns: string[] = []; isAdmin = false; hasDashboardWritePrivileges = false; constructor( - private dashboardService: DashboardService, public dialog: MatDialog, - private router: Router, - private dialogService: DialogService, private authService: AuthService, private currentUserService: CurrentUserService, private breadcrumbService: SpBreadcrumbService, @@ -71,109 +56,7 @@ export class DashboardOverviewComponent implements OnInit { ); this.displayedColumns = ['name', 'actions']; }); - this.getDashboards(); - } - - getDashboards() { - this.dashboardService.getDashboards().subscribe(data => { - this.dashboards = data.sort((a, b) => a.name.localeCompare(b.name)); - this.applyDashboardFilters(); - }); - } - - openNewDashboardDialog() { - const dashboard = {} as Dashboard; - dashboard.widgets = []; - dashboard.dashboardGeneralSettings = {}; - - this.openDashboardModificationDialog(true, dashboard); - } - - openDashboardModificationDialog(createMode: boolean, dashboard: Dashboard) { - const dialogRef = this.dialogService.open( - EditDashboardDialogComponent, - { - panelType: PanelType.STANDARD_PANEL, - title: createMode ? 'New Dashboard' : 'Edit Dashboard', - width: '50vw', - data: { - createMode: createMode, - dashboard: dashboard, - }, - }, - ); - - dialogRef.afterClosed().subscribe(result => { - this.getDashboards(); - }); - } - - openEditDashboardDialog(dashboard: Dashboard) { - this.openDashboardModificationDialog(false, dashboard); - } - - openDeleteDashboardDialog(dashboard: Dashboard) { - // TODO add confirm dialog - const widgetsToDelete = dashboard.widgets.map(widget => - this.dashboardService.deleteWidget(widget.id), - ); - zip( - ...widgetsToDelete, - this.dashboardService.deleteDashboard(dashboard), - ).subscribe(result => { - this.getDashboards(); - }); - } - - showDashboard(dashboard: Dashboard): void { - this.router.navigate(['dashboard', dashboard.elementId]); - } - - editDashboard(dashboard: Dashboard): void { - this.router.navigate(['dashboard', dashboard.elementId], { - queryParams: { action: 'edit' }, - }); - } - - openExternalDashboard(dashboard: Dashboard) { - const href = this.router.createUrlTree([ - 'standalone', - dashboard.elementId, - ]); - // TODO fixes bug that hashing strategy is ignored by createUrlTree - window.open('#' + href.toString(), '_blank'); - } - - showPermissionsDialog(dashboard: Dashboard) { - const dialogRef = this.dialogService.open( - ObjectPermissionDialogComponent, - { - panelType: PanelType.SLIDE_IN_PANEL, - title: 'Manage permissions', - width: '50vw', - data: { - objectInstanceId: dashboard.elementId, - headerTitle: - 'Manage permissions for dashboard ' + dashboard.name, - }, - }, - ); - - dialogRef.afterClosed().subscribe(refresh => { - if (refresh) { - this.getDashboards(); - } - }); } - applyDashboardFilters(elementIds: Set = new Set()): void { - this.filteredDashboards = this.dashboards.filter(a => { - if (elementIds.size === 0) { - return true; - } else { - return elementIds.has(a.elementId); - } - }); - this.dataSource.data = this.filteredDashboards; - } + applyDashboardFilters(elements: Set): void {} } diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.html b/ui/src/app/dashboard/components/panel/dashboard-panel.component.html deleted file mode 100644 index 2245de2115..0000000000 --- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.html +++ /dev/null @@ -1,86 +0,0 @@ - - - -
-
- - - - - - Show widget controls - -
-
-
- -
-
diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss b/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss deleted file mode 100644 index a76a9a7a2b..0000000000 --- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.scss +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.mr-10 { - margin-right: 10px; -} - -.m-20 { - margin: 20px; -} - -.h-100 { - height: 100%; -} - -.dashboard-grid { - display: flex; - flex-direction: column; - flex: 1 1 100%; -} - -.options-bar { - padding: 0px; - border-bottom: 1px solid var(--color-bg-2); - margin-bottom: 10px; - height: 50px; -} - -.options-bar-item { - display: inline; - margin-right: 10px; -} diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts b/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts deleted file mode 100644 index c20cd66d12..0000000000 --- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts +++ /dev/null @@ -1,231 +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, OnInit, Output } from '@angular/core'; -import { - ClientDashboardItem, - Dashboard, - DashboardService, - DashboardWidgetModel, - DataLakeMeasure, - DatalakeRestService, -} from '@streampipes/platform-services'; -import { forkJoin, Observable, of, Subscription } from 'rxjs'; -import { AddVisualizationDialogComponent } from '../../dialogs/add-widget/add-visualization-dialog.component'; -import { RefreshDashboardService } from '../../services/refresh-dashboard.service'; -import { - ConfirmDialogComponent, - CurrentUserService, - DialogService, - PanelType, - SpBreadcrumbService, -} from '@streampipes/shared-ui'; -import { - ActivatedRoute, - ActivatedRouteSnapshot, - RouterStateSnapshot, -} from '@angular/router'; -import { UserPrivilege } from '../../../_enums/user-privilege.enum'; -import { AuthService } from '../../../services/auth.service'; -import { SpDashboardRoutes } from '../../dashboard.routes'; -import { map } from 'rxjs/operators'; -import { MatDialog } from '@angular/material/dialog'; - -@Component({ - selector: 'sp-dashboard-panel', - templateUrl: './dashboard-panel.component.html', - styleUrls: ['./dashboard-panel.component.scss'], -}) -export class DashboardPanelComponent implements OnInit { - dashboard: Dashboard; - editMode: boolean; - @Output() editModeChange: EventEmitter = new EventEmitter(); - - public items: ClientDashboardItem[]; - - protected subscription: Subscription; - - widgetIdsToRemove: string[] = []; - widgetsToUpdate: Map = new Map< - string, - DashboardWidgetModel - >(); - allMeasurements: DataLakeMeasure[]; - - headerVisible = true; - - constructor( - private dashboardService: DashboardService, - private datalakeRestService: DatalakeRestService, - private dialogService: DialogService, - private dialog: MatDialog, - private refreshDashboardService: RefreshDashboardService, - private route: ActivatedRoute, - private authService: AuthService, - private currentUserService: CurrentUserService, - private breadcrumbService: SpBreadcrumbService, - ) {} - - public ngOnInit() { - const params = this.route.snapshot.params; - const queryParams = this.route.snapshot.queryParams; - - this.currentUserService.user$.subscribe(user => { - const hasDashboardWritePrivileges = this.authService.hasRole( - UserPrivilege.PRIVILEGE_WRITE_DASHBOARD, - ); - if (queryParams.action === 'edit' && hasDashboardWritePrivileges) { - this.editMode = true; - } - }); - - this.getDashboard(params.id); - this.getAllMeasurements(); - } - - getDashboard(dashboardId: string): void { - this.dashboardService.getDashboard(dashboardId).subscribe(dashboard => { - if (dashboard) { - this.dashboard = dashboard; - this.breadcrumbService.updateBreadcrumb( - this.breadcrumbService.makeRoute( - [SpDashboardRoutes.BASE], - this.dashboard.name, - ), - ); - } - }); - } - - getAllMeasurements(): void { - this.datalakeRestService - .getAllMeasurementSeries() - .subscribe(res => (this.allMeasurements = res)); - } - - addWidget(): void { - const dialogRef = this.dialogService.open( - AddVisualizationDialogComponent, - { - panelType: PanelType.SLIDE_IN_PANEL, - title: 'Add widget', - width: '50vw', - }, - ); - - dialogRef.afterClosed().subscribe(widget => { - if (widget) { - this.addWidgetToDashboard(widget); - } - }); - } - - addWidgetToDashboard(widget: DashboardWidgetModel) { - const dashboardItem = {} as ClientDashboardItem; - dashboardItem.widgetId = widget.elementId; - dashboardItem.id = widget.elementId; - // TODO there should be a widget type DashboardWidget - dashboardItem.widgetType = widget.dashboardWidgetSettings.widgetName; - dashboardItem.cols = 4; - dashboardItem.rows = 4; - dashboardItem.x = 0; - dashboardItem.y = 0; - this.dashboard.widgets.push(dashboardItem); - } - - updateDashboardAndCloseEditMode() { - this.dashboardService - .updateDashboard(this.dashboard) - .subscribe(result => { - if (this.widgetsToUpdate.size > 0) { - forkJoin(this.prepareWidgetUpdates()).subscribe(() => { - this.closeEditModeAndReloadDashboard(); - }); - } else { - this.deleteWidgets(); - this.closeEditModeAndReloadDashboard(); - } - }); - } - - closeEditModeAndReloadDashboard() { - this.editMode = !this.editMode; - this.getDashboard(this.dashboard.elementId); - } - - prepareWidgetUpdates(): Observable[] { - const promises: Observable[] = []; - this.widgetsToUpdate.forEach((widget, key) => { - promises.push(this.dashboardService.updateWidget(widget)); - }); - - return promises; - } - - discardChanges() { - this.editModeChange.emit(!this.editMode); - this.refreshDashboardService.notify(this.dashboard.elementId); - } - - removeAndQueueItemForDeletion(widget: ClientDashboardItem) { - this.dashboard.widgets.splice( - this.dashboard.widgets.indexOf(widget), - 1, - ); - this.widgetIdsToRemove.push(widget.id); - } - - updateAndQueueItemForDeletion(dashboardWidget: DashboardWidgetModel) { - this.widgetsToUpdate.set(dashboardWidget.elementId, dashboardWidget); - } - - deleteWidgets() { - this.widgetIdsToRemove.forEach(widgetId => { - this.dashboardService.deleteWidget(widgetId).subscribe(); - }); - } - - confirmLeaveDashboard( - route: ActivatedRouteSnapshot, - state: RouterStateSnapshot, - ): Observable { - if (this.editMode) { - const dialogRef = this.dialog.open(ConfirmDialogComponent, { - width: '500px', - data: { - title: 'Save changes?', - subtitle: - 'Update all changes to dashboard widgets or discard current changes.', - cancelTitle: 'Discard changes', - okTitle: 'Update', - confirmAndCancel: true, - }, - }); - return dialogRef.afterClosed().pipe( - map(shouldUpdate => { - if (shouldUpdate) { - this.updateDashboardAndCloseEditMode(); - } - return true; - }), - ); - } else { - return of(true); - } - } -} diff --git a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.html b/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.html deleted file mode 100644 index da3b8e011b..0000000000 --- a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.html +++ /dev/null @@ -1,26 +0,0 @@ - -
- - -
diff --git a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.scss b/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.scss deleted file mode 100644 index 317cffc3d4..0000000000 --- a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.scss +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.panel { - height: calc(100vh - 20px); -} - -.h-100 { - height: 100%; -} - -.icon-overlay { - position: absolute; - bottom: 20px; - right: 10px; - z-index: 20; -} diff --git a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.ts b/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.ts deleted file mode 100644 index 776145cf28..0000000000 --- a/ui/src/app/dashboard/components/standalone/standalone-dashboard.component.ts +++ /dev/null @@ -1,59 +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 { - Dashboard, - DashboardService, - DataLakeMeasure, - DatalakeRestService, -} from '@streampipes/platform-services'; -import { ActivatedRoute } from '@angular/router'; -import { zip } from 'rxjs'; - -@Component({ - templateUrl: './standalone-dashboard.component.html', - styleUrls: ['./standalone-dashboard.component.scss'], -}) -export class StandaloneDashboardComponent implements OnInit { - dashboard: Dashboard; - dashboardReady = false; - - allMeasurements: DataLakeMeasure[] = []; - - constructor( - private activatedRoute: ActivatedRoute, - private dashboardService: DashboardService, - private datalakeRestService: DatalakeRestService, - ) {} - - ngOnInit(): void { - this.activatedRoute.params.subscribe(params => { - if (params['dashboardId']) { - const dashboardId = params['dashboardId']; - zip([ - this.datalakeRestService.getAllMeasurementSeries(), - this.dashboardService.getDashboard(dashboardId), - ]).subscribe(res => { - this.allMeasurements = res[0]; - this.dashboard = res[1]; - this.dashboardReady = true; - }); - } - }); - } -} diff --git a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html b/ui/src/app/dashboard/components/widget/dashboard-widget.component.html deleted file mode 100644 index 9ed91e5b88..0000000000 --- a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html +++ /dev/null @@ -1,314 +0,0 @@ - - -
-
-
-
- - -
-
-
-
- block -
- Widget not found, did you modify the pipeline? -
- -
-
- link_off -
- Pipeline {{ pipeline.name }} is not running, did you - start the pipeline? -
- -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widget/dashboard-widget.component.scss b/ui/src/app/dashboard/components/widget/dashboard-widget.component.scss deleted file mode 100644 index e6be476f6f..0000000000 --- a/ui/src/app/dashboard/components/widget/dashboard-widget.component.scss +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.h-100 { - height: 100%; -} - -.h-40 { - height: 40px; -} - -.p-0 { - padding: 0; -} - -.p-20 { - padding: 20px; -} - -.m-0 { - margin: 0; -} - -.box { - display: flex; - flex-flow: column; - height: 100%; - border: 0px solid black; -} - -.box .row.content { - flex: 1 1 auto; -} - -.box .row.header { - flex: 0 1 auto; -} - -.pipeline-not-running { - background: var(--color-bg-dialog); - border: 1px solid var(--color-warn); - padding: 20px; - display: flex; - align-items: center; - justify-content: center; - width: 100%; -} - -.disconnect-icon { - font-size: 36pt; - color: var(--color-warn); -} diff --git a/ui/src/app/dashboard/components/widget/dashboard-widget.component.ts b/ui/src/app/dashboard/components/widget/dashboard-widget.component.ts deleted file mode 100644 index a1c87d3a4e..0000000000 --- a/ui/src/app/dashboard/components/widget/dashboard-widget.component.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - Component, - EventEmitter, - Input, - OnInit, - Output, - ViewChild, -} from '@angular/core'; -import { AddVisualizationDialogComponent } from '../../dialogs/add-widget/add-visualization-dialog.component'; -import { - DashboardItem, - DashboardService, - DashboardWidgetModel, - DataLakeMeasure, - DatalakeQueryParameters, - DatalakeRestService, - DataViewDataExplorerService, - Pipeline, - PipelineService, - SpQueryResult, -} from '@streampipes/platform-services'; -import { DialogService, PanelType } from '@streampipes/shared-ui'; -import { EditModeService } from '../../services/edit-mode.service'; -import { ReloadPipelineService } from '../../services/reload-pipeline.service'; -import { zip } from 'rxjs'; -import { GridsterItemComponent } from 'angular-gridster2'; -import { ResizeService } from '../../services/resize.service'; -import { GridsterInfo } from '../../models/gridster-info.model'; -import { BaseStreamPipesWidget } from '../widgets/base/base-widget'; - -@Component({ - selector: 'sp-dashboard-widget', - templateUrl: './dashboard-widget.component.html', - styleUrls: ['./dashboard-widget.component.scss'], -}) -export class DashboardWidgetComponent implements OnInit { - @Input() widget: DashboardItem; - @Input() editMode: boolean; - @Input() headerVisible = false; - @Input() itemWidth: number; - @Input() itemHeight: number; - @Input() gridsterItemComponent: GridsterItemComponent; - @Input() globalRefresh: boolean; - @Input() allMeasurements: DataLakeMeasure[]; - - @Output() deleteCallback: EventEmitter = - new EventEmitter(); - @Output() updateCallback: EventEmitter = - new EventEmitter(); - - widgetLoaded = false; - configuredWidget: DashboardWidgetModel; - widgetDataConfig: DataLakeMeasure; - pipeline: Pipeline; - - pipelineRunning = false; - widgetNotAvailable = false; - - _activeWidget: BaseStreamPipesWidget; - - constructor( - private dashboardService: DashboardService, - private dialogService: DialogService, - private pipelineService: PipelineService, - private editModeService: EditModeService, - private reloadPipelineService: ReloadPipelineService, - private dataExplorerService: DataViewDataExplorerService, - private dataLakeRestService: DatalakeRestService, - private resizeService: ResizeService, - ) {} - - ngOnInit(): void { - this.loadWidget(); - this.reloadPipelineService.reloadPipelineSubject.subscribe(() => { - this.loadWidget(); - }); - } - - loadWidget() { - this.dashboardService.getWidget(this.widget.id).subscribe(response => { - this.configuredWidget = response; - this.loadVisualizablePipeline(); - }); - } - - loadVisualizablePipeline() { - zip( - this.dataExplorerService.getPersistedDataStream( - this.configuredWidget.pipelineId, - this.configuredWidget.visualizationName, - ), - ).subscribe( - res => { - const vizPipeline = res[0]; - const measurement = this.allMeasurements.find( - m => m.measureName === vizPipeline.measureName, - ); - vizPipeline.eventSchema = measurement.eventSchema; - this.widgetDataConfig = vizPipeline; - this.dashboardService - .getPipelineById(vizPipeline.pipelineId) - .subscribe(pipeline => { - this.pipeline = pipeline; - this.pipelineRunning = pipeline.running; - this.widgetNotAvailable = false; - this.widgetLoaded = true; - setTimeout(() => { - this.resizeService.notify({ - gridsterItem: this.widget, - gridsterItemComponent: - this.gridsterItemComponent, - } as GridsterInfo); - }, 20); - }); - }, - err => { - this.widgetLoaded = true; - this.widgetNotAvailable = true; - }, - ); - } - - removeWidget() { - this.deleteCallback.emit(this.widget); - } - - startPipeline() { - if (!this.pipelineRunning) { - this.pipelineService - .startPipeline(this.pipeline._id) - .subscribe(status => { - this.reloadPipelineService.reloadPipelineSubject.next(); - }); - } - } - - modifyWidget() { - this.editModeService.notify(true); - this.editWidget(); - } - - editWidget(): void { - const dialogRef = this.dialogService.open( - AddVisualizationDialogComponent, - { - panelType: PanelType.SLIDE_IN_PANEL, - title: 'Edit widget', - width: '50vw', - data: { - widget: this.configuredWidget, - pipeline: this.widgetDataConfig, - editMode: true, - startPage: this.widgetNotAvailable - ? 'select-pipeline' - : 'configure-widget', - }, - }, - ); - - dialogRef.afterClosed().subscribe(widget => { - if (widget) { - this.configuredWidget = widget; - this.loadVisualizablePipeline(); - this.updateCallback.emit(this.configuredWidget); - } - }); - } - - @ViewChild('activeWidget') - set activeWidget(activeWidget: BaseStreamPipesWidget) { - this._activeWidget = activeWidget; - } - - getWidgetQuery(): DatalakeQueryParameters { - if (this._activeWidget) { - return this._activeWidget.buildQuery(true); - } else { - return undefined; - } - } - - processQueryResponse(res: SpQueryResult) { - this._activeWidget.processQueryResult(res); - } - - getWidgetId(): string { - return this.widget.id; - } -} diff --git a/ui/src/app/dashboard/components/widgets/area/area-config.ts b/ui/src/app/dashboard/components/widgets/area/area-config.ts deleted file mode 100644 index 792e692601..0000000000 --- a/ui/src/app/dashboard/components/widgets/area/area-config.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { BaseNgxLineConfig } from '../base/base-ngx-line-config'; - -export class AreaConfig extends BaseNgxLineConfig { - getWidgetLabel(): string { - return 'Area Chart'; - } - - getWidgetName(): string { - return 'area'; - } - - getWidgetDescription(): string { - return 'An area chart with customizable axes and fields to display'; - } - - getWidgetIcon(): string { - return 'fas fa-chart-area'; - } -} diff --git a/ui/src/app/dashboard/components/widgets/area/area-widget.component.html b/ui/src/app/dashboard/components/widgets/area/area-widget.component.html deleted file mode 100644 index 803541df2c..0000000000 --- a/ui/src/app/dashboard/components/widgets/area/area-widget.component.html +++ /dev/null @@ -1,52 +0,0 @@ - - -
-
- {{ selectedTitle }} -
- - -
diff --git a/ui/src/app/dashboard/components/widgets/area/area-widget.component.scss b/ui/src/app/dashboard/components/widgets/area/area-widget.component.scss deleted file mode 100644 index 18d0557671..0000000000 --- a/ui/src/app/dashboard/components/widgets/area/area-widget.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.title-panel { - font-size: 20px; -} - -.mt-20 { - margin-top: 20px; -} diff --git a/ui/src/app/dashboard/components/widgets/area/area-widget.component.ts b/ui/src/app/dashboard/components/widgets/area/area-widget.component.ts deleted file mode 100644 index 20d46b1902..0000000000 --- a/ui/src/app/dashboard/components/widgets/area/area-widget.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseNgxLineChartsStreamPipesWidget } from '../base/base-ngx-line-charts-widget'; -import { ResizeService } from '../../../services/resize.service'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-area-widget', - templateUrl: './area-widget.component.html', - styleUrls: ['./area-widget.component.scss'], -}) -export class AreaWidgetComponent - extends BaseNgxLineChartsStreamPipesWidget - implements OnInit, OnDestroy -{ - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService); - } - - ngOnInit(): void { - super.ngOnInit(); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-config.ts b/ui/src/app/dashboard/components/widgets/bar-race/bar-race-config.ts deleted file mode 100644 index 1ef1afe85f..0000000000 --- a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-config.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class BarRaceConfig extends WidgetConfig { - static readonly PARTITION_KEY: string = 'partition-key'; - static readonly VALUE_KEY: string = 'value-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'bar-race', - 'Bar Race Chart', - ) - .withIcon('fas fa-chart-bar') - .withDescription( - 'Renders ordered, separate bar charts based on a partition field (e.g., device id).', - ) - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - BarRaceConfig.PARTITION_KEY, - 'Partition field', - '', - EpRequirements.stringReq(), - ) - .requiredPropertyWithUnaryMapping( - BarRaceConfig.VALUE_KEY, - 'Value field', - '', - EpRequirements.numberReq(), - ) - .build(), - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.html b/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.html deleted file mode 100644 index 76884aada9..0000000000 --- a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.scss b/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.scss deleted file mode 100644 index 527d47a5f5..0000000000 --- a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.scss +++ /dev/null @@ -1,53 +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. - * - */ - -.status-panel { - width: 100%; - height: 100%; - text-align: center; - left: 50%; - display: flex; - flex-direction: column; - align-content: flex-start; -} - -.title-panel { - font-size: 20px; -} - -.status-light { - border-radius: 50%; - float: left; - margin: 10px 10px; -} - -.status-light-red { - background-color: #c22; - box-shadow: - #338 0 -1px 7px 1px, - inset #600 0 -1px 9px, - #f00 0 0px 8px; -} - -.status-light-green { - background-color: #690; - box-shadow: - #225 0 -1px 7px 1px, - inset #460 0 -1px 9px, - #7d0 0 0px 8px; -} diff --git a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.ts b/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.ts deleted file mode 100644 index b736892389..0000000000 --- a/ui/src/app/dashboard/components/widgets/bar-race/bar-race-widget.component.ts +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { ECharts } from 'echarts/core'; -import { EChartsOption } from 'echarts'; -import { BarRaceConfig } from './bar-race-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-bar-race-widget', - templateUrl: './bar-race-widget.component.html', - styleUrls: ['./bar-race-widget.component.scss'], -}) -export class BarRaceWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - currentWidth: number; - currentHeight: number; - - configReady = false; - - eChartsInstance: ECharts; - dynamicData: any; - - partitionField: string; - valueField: string; - - chartOption = { - grid: { - left: 100, - top: 10, - right: 120, - bottom: 100, - }, - xAxis: { - max: 'dataMax', - label: { - formatter: n => { - return Math.round(n); - }, - }, - axisLabel: { - textStyle: { - color: '#FFFFFF', - }, - }, - }, - dataset: { - source: [], - }, - yAxis: { - type: 'category', - inverse: true, - interval: 0, - data: [], - axisLabel: { - show: true, - formatter: value => { - return value; - }, - textStyle: { - color: '#FFFFFF', - }, - }, - animationDuration: 300, - animationDurationUpdate: 300, - }, - series: [ - { - data: [], - realtimeSort: true, - seriesLayoutBy: 'column', - type: 'bar', - itemStyle: { - color: param => { - return this.selectedPrimaryTextColor; - }, - }, - encode: { - x: 'value', - y: 'name', - }, - label: { - show: true, - precision: 1, - position: 'right', - valueAnimation: true, - fontFamily: 'monospace', - color: param => { - return this.selectedPrimaryTextColor; - }, - }, - }, - ], - // Disable init animation. - animationDuration: 0, - animationDurationUpdate: 1000, - animationEasing: 'linear', - animationEasingUpdate: 'linear', - }; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - protected extractConfig(extractor: StaticPropertyExtractor) { - this.partitionField = extractor.mappingPropertyValue( - BarRaceConfig.PARTITION_KEY, - ); - this.valueField = extractor.mappingPropertyValue( - BarRaceConfig.VALUE_KEY, - ); - this.chartOption.xAxis.axisLabel.textStyle.color = - this.selectedPrimaryTextColor; - this.chartOption.yAxis.axisLabel.textStyle.color = - this.selectedPrimaryTextColor; - } - - protected onEvent(events: any[]) { - this.dynamicData = this.chartOption; - const partitionValue = events[0][this.partitionField]; - const value = events[0][this.valueField]; - if ( - this.dynamicData.series[0].data.some(d => d.name === partitionValue) - ) { - this.dynamicData.series[0].data.find( - d => d.name === partitionValue, - ).value = value; - } else { - this.dynamicData.series[0].data.push({ - name: partitionValue, - value, - }); - this.dynamicData.yAxis.data.push(partitionValue); - } - - if (this.eChartsInstance) { - this.eChartsInstance.setOption(this.dynamicData as EChartsOption); - } - } - - protected onSizeChanged(width: number, height: number) { - this.currentWidth = width; - this.currentHeight = height; - this.configReady = true; - this.applySize(width, height); - } - - onChartInit(ec) { - this.eChartsInstance = ec; - this.applySize(this.currentWidth, this.currentHeight); - } - - applySize(width: number, height: number) { - if (this.eChartsInstance) { - this.eChartsInstance.resize({ width, height }); - } - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return [this.partitionField, this.valueField]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-config.ts b/ui/src/app/dashboard/components/widgets/base/base-config.ts deleted file mode 100644 index 4c7965afb3..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-config.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Tuple2 } from '../../../../core-model/base/Tuple2'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export abstract class WidgetConfig { - abstract getConfig(): DashboardWidgetSettings; - - makeOption(optionName: string): Tuple2 { - const option: Tuple2 = {} as Tuple2; - option.a = optionName; - option.b = optionName.replace(' ', '-'); - return option; - } -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-echarts-widget.ts b/ui/src/app/dashboard/components/widgets/base/base-echarts-widget.ts deleted file mode 100644 index 0c51014e29..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-echarts-widget.ts +++ /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. - * - */ - -import { BaseStreamPipesWidget } from './base-widget'; -import { ResizeService } from '../../../services/resize.service'; -import { Directive } from '@angular/core'; -import { ECharts } from 'echarts/core'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Directive() -export abstract class BaseEchartsWidget extends BaseStreamPipesWidget { - currentWidth: number; - currentHeight: number; - - configReady = false; - - eChartsInstance: ECharts; - dynamicData: any; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - protected onSizeChanged(width: number, height: number) { - this.currentWidth = width; - this.currentHeight = height; - this.configReady = true; - if (this.eChartsInstance) { - this.eChartsInstance.resize({ width, height }); - } - } - - onChartInit(ec) { - this.eChartsInstance = ec; - } -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-ngx-charts-widget.ts b/ui/src/app/dashboard/components/widgets/base/base-ngx-charts-widget.ts deleted file mode 100644 index 5945cb3e8c..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-ngx-charts-widget.ts +++ /dev/null @@ -1,61 +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 { BaseStreamPipesWidget } from './base-widget'; -import { ResizeService } from '../../../services/resize.service'; -import { Directive, OnInit } from '@angular/core'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Directive() -export abstract class BaseNgxChartsStreamPipesWidget - extends BaseStreamPipesWidget - implements OnInit -{ - view: any[] = []; - displayChart = false; - - colorScheme: any; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, true); - } - - ngOnInit() { - super.ngOnInit(); - this.colorScheme = { - domain: [ - this.selectedSecondaryTextColor, - this.selectedPrimaryTextColor, - ], - }; - this.view = [ - this.computeCurrentWidth(this.itemWidth), - this.computeCurrentHeight(this.itemHeight), - ]; - this.displayChart = true; - } - - protected onSizeChanged(width: number, height: number) { - this.displayChart = false; - this.view = [width, height]; - this.displayChart = true; - } -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-ngx-line-charts-widget.ts b/ui/src/app/dashboard/components/widgets/base/base-ngx-line-charts-widget.ts deleted file mode 100644 index 9c470b3b22..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-ngx-line-charts-widget.ts +++ /dev/null @@ -1,98 +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 { ResizeService } from '../../../services/resize.service'; -import { BaseNgxChartsStreamPipesWidget } from './base-ngx-charts-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { LineConfig } from '../line/line-config'; -import { Directive, OnInit } from '@angular/core'; -import { DatalakeRestService } from '@streampipes/platform-services'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { BaseStreamPipesWidget } from './base-widget'; - -@Directive() -export abstract class BaseNgxLineChartsStreamPipesWidget - extends BaseNgxChartsStreamPipesWidget - implements OnInit -{ - multi: any = []; - - selectedNumberProperty: string; - selectedTimestampProperty: string; - minYAxisRange: number; - maxYAxisRange: number; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService); - } - - ngOnInit(): void { - super.ngOnInit(); - this.multi = [ - { - name: this.selectedNumberProperty, - series: [], - }, - ]; - } - - protected extractConfig(extractor: StaticPropertyExtractor) { - this.selectedNumberProperty = extractor.mappingPropertyValue( - LineConfig.NUMBER_MAPPING_KEY, - ); - this.minYAxisRange = extractor.integerParameter( - LineConfig.MIN_Y_AXIS_KEY, - ); - this.maxYAxisRange = extractor.integerParameter( - LineConfig.MAX_Y_AXIS_KEY, - ); - } - - protected onEvent(events: any[]) { - this.multi[0].series = events.map(ev => { - return { - name: ev[BaseStreamPipesWidget.TIMESTAMP_KEY], - value: ev[this.selectedNumberProperty], - }; - }); - this.multi = [...this.multi]; - } - - timestampTickFormatting(timestamp: any): string { - const padL = (nr, len = 2, chr = `0`) => `${nr}`.padStart(2, chr); - const date = new Date(timestamp); - return ( - date.getHours() + - ':' + - `${padL(date.getMinutes())}` + - ':' + - `${padL(date.getSeconds())}` - ); - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return extractor.integerParameter(WidgetConfigBuilder.QUERY_LIMIT_KEY); - } - - getFieldsToQuery(): string[] { - return [this.selectedNumberProperty]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-ngx-line-config.ts b/ui/src/app/dashboard/components/widgets/base/base-ngx-line-config.ts deleted file mode 100644 index 57bc8bec69..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-ngx-line-config.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from './base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export abstract class BaseNgxLineConfig extends WidgetConfig { - static readonly NUMBER_MAPPING_KEY: string = 'number-mapping'; - static readonly TIMESTAMP_MAPPING_KEY: string = 'timestamp-mapping'; - static readonly MIN_Y_AXIS_KEY: string = 'min-y-axis-key'; - static readonly MAX_Y_AXIS_KEY: string = 'max-y-axis-key'; - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - this.getWidgetName(), - this.getWidgetLabel(), - ) - .withDescription(this.getWidgetDescription()) - .withIcon(this.getWidgetIcon()) - .withNumberOfPastEvents() - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - BaseNgxLineConfig.NUMBER_MAPPING_KEY, - 'Number field', - '', - EpRequirements.numberReq(), - ) - .build(), - ) - .requiredIntegerParameter( - BaseNgxLineConfig.MIN_Y_AXIS_KEY, - 'Y-axis range (min)', - '', - ) - .requiredIntegerParameter( - BaseNgxLineConfig.MAX_Y_AXIS_KEY, - 'Y-axis range (max)', - '', - ) - .build(); - } - - abstract getWidgetName(): string; - - abstract getWidgetLabel(): string; - - abstract getWidgetDescription(): string; - - abstract getWidgetIcon(): string; -} diff --git a/ui/src/app/dashboard/components/widgets/base/base-widget.ts b/ui/src/app/dashboard/components/widgets/base/base-widget.ts deleted file mode 100644 index ccee55aa1e..0000000000 --- a/ui/src/app/dashboard/components/widgets/base/base-widget.ts +++ /dev/null @@ -1,299 +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, - Input, - OnChanges, - OnDestroy, - OnInit, - SimpleChanges, -} from '@angular/core'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { BehaviorSubject, interval, Observable, Subscription } from 'rxjs'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { ResizeService } from '../../../services/resize.service'; -import { - DashboardWidgetModel, - DataLakeMeasure, - DatalakeQueryParameterBuilder, - DatalakeQueryParameters, - DatalakeRestService, - EventPropertyPrimitive, - EventPropertyUnion, - FieldConfig, - SpQueryResult, -} from '@streampipes/platform-services'; -import { exhaustMap, map, switchMap } from 'rxjs/operators'; -import { GridsterItemComponent } from 'angular-gridster2'; - -@Directive() -export abstract class BaseStreamPipesWidget - implements OnInit, OnChanges, OnDestroy -{ - protected constructor( - protected dataLakeService: DatalakeRestService, - protected resizeService: ResizeService, - protected adjustPadding: boolean, - ) {} - - static readonly PADDING: number = 20; - static readonly EDIT_HEADER_HEIGHT: number = 40; - static readonly TIMESTAMP_KEY = 'time'; - - @Input() widgetConfig: DashboardWidgetModel; - @Input() widgetDataConfig: DataLakeMeasure; - @Input() gridsterItemComponent: GridsterItemComponent; - @Input() itemWidth: number; - @Input() itemHeight: number; - @Input() editMode: boolean; - @Input() globalRefresh: boolean; - - subscription: Subscription; - intervalSubject: BehaviorSubject; - - hasSelectableColorSettings: boolean; - hasTitlePanelSettings: boolean; - - selectedBackgroundColor: string; - selectedPrimaryTextColor: string; - selectedSecondaryTextColor: string; - selectedTitle: string; - - defaultBackgroundColor = '#1B1464'; - defaultPrimaryTextColor = '#FFFFFF'; - defaultSecondaryTextColor = '#39B54A'; - - refreshIntervalInSeconds = 5; - queryLimit = 1; - - resizeSub: Subscription; - - ngOnInit(): void { - const widthOffset = 0; - const heightOffset = 0; - this.resizeSub = this.resizeService.resizeSubject.subscribe(info => { - if (info.gridsterItem.id === this.widgetConfig.elementId) { - this.onSizeChanged( - this.computeCurrentWidth( - this.gridsterItemComponent.width - widthOffset, - ), - this.computeCurrentHeight( - this.gridsterItemComponent.height - heightOffset, - ), - ); - } - }); - - this.prepareConfigExtraction(); - - if (!this.globalRefresh) { - this.fireQuery().subscribe(result => - this.processQueryResult(result), - ); - - this.intervalSubject = new BehaviorSubject( - this.refreshIntervalInSeconds, - ); - this.subscription = this.intervalSubject - .pipe(switchMap(val => interval(val * 1000))) - .pipe(exhaustMap(() => this.fireQuery())) - .subscribe(result => { - this.processQueryResult(result); - }); - } - } - - prepareConfigExtraction() { - const extractor: StaticPropertyExtractor = new StaticPropertyExtractor( - this.widgetDataConfig.eventSchema, - this.widgetConfig.dashboardWidgetSettings.config, - ); - if ( - extractor.hasStaticProperty( - WidgetConfigBuilder.BACKGROUND_COLOR_KEY, - ) - ) { - this.hasSelectableColorSettings = true; - this.selectedBackgroundColor = extractor.selectedColor( - WidgetConfigBuilder.BACKGROUND_COLOR_KEY, - ); - this.selectedPrimaryTextColor = extractor.selectedColor( - WidgetConfigBuilder.PRIMARY_TEXT_COLOR_KEY, - ); - this.selectedSecondaryTextColor = extractor.selectedColor( - WidgetConfigBuilder.SECONDARY_TEXT_COLOR_KEY, - ); - } else { - this.selectedBackgroundColor = this.defaultBackgroundColor; - this.selectedPrimaryTextColor = this.defaultPrimaryTextColor; - this.selectedSecondaryTextColor = this.defaultSecondaryTextColor; - } - if (extractor.hasStaticProperty(WidgetConfigBuilder.TITLE_KEY)) { - this.hasTitlePanelSettings = true; - this.selectedTitle = extractor.stringParameter( - WidgetConfigBuilder.TITLE_KEY, - ); - } - if ( - extractor.hasStaticProperty( - WidgetConfigBuilder.REFRESH_INTERVAL_KEY, - ) - ) { - this.refreshIntervalInSeconds = extractor.integerParameter( - WidgetConfigBuilder.REFRESH_INTERVAL_KEY, - ); - if (this.intervalSubject) { - this.intervalSubject.next(this.refreshIntervalInSeconds); - } - } - this.queryLimit = this.getQueryLimit(extractor); - this.extractConfig(extractor); - } - - ngOnDestroy(): void { - if (this.subscription) { - this.subscription.unsubscribe(); - this.intervalSubject.unsubscribe(); - } - if (this.resizeSub) { - this.resizeSub.unsubscribe(); - } - } - - computeCurrentWidth(width: number): number { - return this.adjustPadding - ? width - BaseStreamPipesWidget.PADDING * 2 - : width; - } - - computeCurrentHeight(height: number): number { - return this.adjustPadding - ? height - - BaseStreamPipesWidget.PADDING * 2 - - this.editModeOffset() - - this.titlePanelOffset() - : height - this.editModeOffset() - this.titlePanelOffset(); - } - - editModeOffset(): number { - return this.editMode ? BaseStreamPipesWidget.EDIT_HEADER_HEIGHT : 0; - } - - titlePanelOffset(): number { - return this.hasTitlePanelSettings ? 20 : 0; - } - - protected abstract extractConfig(extractor: StaticPropertyExtractor); - - protected abstract getQueryLimit( - extractor: StaticPropertyExtractor, - ): number; - - protected abstract onEvent(events: any[]); - - protected abstract onSizeChanged(width: number, height: number); - - ngOnChanges(changes: SimpleChanges): void { - if (changes['widgetConfig']) { - this.prepareConfigExtraction(); - } - } - - fireQuery(): Observable { - return this.dataLakeService - .getData(this.widgetDataConfig.measureName, this.buildQuery(), true) - .pipe(map(res => res as SpQueryResult)); - } - - processQueryResult(queryResult: SpQueryResult) { - if (queryResult.total > 0) { - if (queryResult.allDataSeries.length === 1) { - const series = queryResult.allDataSeries[0]; - const events = []; - series.rows.forEach(row => { - const event = {}; - series.headers.forEach((fieldName, index) => { - event[fieldName] = row[index]; - }); - events.push(event); - }); - this.onEvent(events.reverse()); - } - } - } - - public buildQuery(includeMeasure = false): DatalakeQueryParameters { - const queryBuilder = DatalakeQueryParameterBuilder.create(); - const columns = this.getFieldsToQuery(); - if (columns) { - if ( - this.hasOnlyDimensionFields( - this.widgetDataConfig.eventSchema.eventProperties, - columns, - ) - ) { - const firstMeasurementField = this.getAnyMeasurementField( - this.widgetDataConfig.eventSchema.eventProperties, - ); - columns.push(firstMeasurementField); - } - const fields: FieldConfig[] = columns.map(f => { - return { runtimeName: f, selected: false, numeric: false }; - }); - queryBuilder.withColumnFilter(fields, false); - } - - const queryParams = queryBuilder - .withLimit(this.queryLimit) - .withOrdering('DESC') - .build(); - - if (includeMeasure) { - queryParams.measureName = this.widgetDataConfig.measureName; - queryParams.forId = this.widgetConfig.elementId; - } - - return queryParams; - } - - getAnyMeasurementField(eventProperties: EventPropertyUnion[]): string { - return eventProperties - .filter(ep => ep instanceof EventPropertyPrimitive) - .find(ep => ep.propertyScope === 'MEASUREMENT_PROPERTY') - .runtimeName; - } - - hasOnlyDimensionFields( - eventProperties: EventPropertyUnion[], - columns: string[], - ): boolean { - return columns - .map(column => - eventProperties.find(ep => ep.runtimeName === column), - ) - .filter(ep => ep instanceof EventPropertyPrimitive) - .every( - ep => - (ep as EventPropertyPrimitive).propertyScope === - 'DIMENSION_PROPERTY', - ); - } - - abstract getFieldsToQuery(): string[]; -} diff --git a/ui/src/app/dashboard/components/widgets/gauge/gauge-config.ts b/ui/src/app/dashboard/components/widgets/gauge/gauge-config.ts deleted file mode 100644 index eee43e4d0f..0000000000 --- a/ui/src/app/dashboard/components/widgets/gauge/gauge-config.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class GaugeConfig extends WidgetConfig { - static readonly TITLE_KEY: string = 'title-key'; - static readonly NUMBER_MAPPING_KEY: string = 'number-mapping'; - static readonly COLOR_KEY: string = 'color-key'; - static readonly MIN_KEY: string = 'min-key'; - static readonly MAX_KEY: string = 'max-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'gauge', - 'Gauge', - ) - .withDescription('A gauge visualization') - .withIcon('fas fa-tachometer-alt') - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - GaugeConfig.NUMBER_MAPPING_KEY, - 'Select property', - '', - EpRequirements.numberReq(), - ) - .build(), - ) - .requiredIntegerParameter( - GaugeConfig.MIN_KEY, - 'Min Y axis value', - '', - ) - .requiredIntegerParameter( - GaugeConfig.MAX_KEY, - 'Max Y axis value', - '', - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.html b/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.html deleted file mode 100644 index 5979a4e19f..0000000000 --- a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.html +++ /dev/null @@ -1,46 +0,0 @@ - - -
-
- {{ selectedTitle }} -
- - -
diff --git a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.scss b/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.scss deleted file mode 100644 index cda3c3f6a6..0000000000 --- a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.scss +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} - -.mt-20 { - margin-top: 20px; -} - -.title-panel { - font-size: 20px; -} diff --git a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.ts b/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.ts deleted file mode 100644 index 976888597a..0000000000 --- a/ui/src/app/dashboard/components/widgets/gauge/gauge-widget.component.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseNgxChartsStreamPipesWidget } from '../base/base-ngx-charts-widget'; -import { ResizeService } from '../../../services/resize.service'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { GaugeConfig } from './gauge-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-gauge-widget', - templateUrl: './gauge-widget.component.html', - styleUrls: ['./gauge-widget.component.scss'], -}) -export class GaugeWidgetComponent - extends BaseNgxChartsStreamPipesWidget - implements OnInit, OnDestroy -{ - data: any = []; - min: number; - max: number; - - selectedProperty: string; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService); - } - - ngOnInit(): void { - super.ngOnInit(); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.min = extractor.integerParameter(GaugeConfig.MIN_KEY); - this.max = extractor.integerParameter(GaugeConfig.MAX_KEY); - this.selectedProperty = extractor.mappingPropertyValue( - GaugeConfig.NUMBER_MAPPING_KEY, - ); - } - - isNumber(item: any): boolean { - return false; - } - - protected onEvent(events: any[]) { - this.data[0] = { - name: 'value', - value: events[0][this.selectedProperty], - }; - this.data = [...this.data]; - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return [this.selectedProperty]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/html/html-config.ts b/ui/src/app/dashboard/components/widgets/html/html-config.ts deleted file mode 100644 index c79e12401d..0000000000 --- a/ui/src/app/dashboard/components/widgets/html/html-config.ts +++ /dev/null @@ -1,50 +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 { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { WidgetConfig } from '../base/base-config'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class HtmlConfig extends WidgetConfig { - static readonly HTML_MAPPING_KEY = 'html-field'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'html', - 'HTML page', - ) - .withDescription('Renders HTML markup (e.g., from a website)') - .withIcon('far fa-window-maximize') - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - HtmlConfig.HTML_MAPPING_KEY, - 'HTML field', - '', - EpRequirements.anyProperty(), - ) - .build(), - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/html/html-widget.component.html b/ui/src/app/dashboard/components/widgets/html/html-widget.component.html deleted file mode 100644 index 20e97bb9b3..0000000000 --- a/ui/src/app/dashboard/components/widgets/html/html-widget.component.html +++ /dev/null @@ -1,34 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/html/html-widget.component.scss b/ui/src/app/dashboard/components/widgets/html/html-widget.component.scss deleted file mode 100644 index 07d6961678..0000000000 --- a/ui/src/app/dashboard/components/widgets/html/html-widget.component.scss +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} - -.mt-20 { - margin: 10px; -} - -.title-panel { - font-size: 20px; - height: 30px; -} diff --git a/ui/src/app/dashboard/components/widgets/html/html-widget.component.ts b/ui/src/app/dashboard/components/widgets/html/html-widget.component.ts deleted file mode 100644 index 4e37ec3f06..0000000000 --- a/ui/src/app/dashboard/components/widgets/html/html-widget.component.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { HtmlConfig } from './html-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-html-widget', - templateUrl: './html-widget.component.html', - styleUrls: ['./html-widget.component.scss'], -}) -export class HtmlWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - item: string; - width: number; - height: number; - - selectedHtmlField: string; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.width = this.computeCurrentWidth(this.itemWidth); - this.height = this.computeCurrentHeight(this.itemHeight); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.selectedHtmlField = extractor.mappingPropertyValue( - HtmlConfig.HTML_MAPPING_KEY, - ); - } - - protected onEvent(events: any[]) { - this.item = events[0][this.selectedHtmlField]; - } - - protected onSizeChanged(width: number, height: number) { - this.width = width; - this.height = height; - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return [this.selectedHtmlField]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/image/image-config.ts b/ui/src/app/dashboard/components/widgets/image/image-config.ts deleted file mode 100644 index 9feecf03ce..0000000000 --- a/ui/src/app/dashboard/components/widgets/image/image-config.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class ImageConfig extends WidgetConfig { - static readonly TITLE_KEY: string = 'title-key'; - static readonly IMAGE_MAPPING_KEY: string = 'image-mapping'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.create('image', 'Image') - .withDescription('Displays an image (e.g., from a camera)') - .withIcon('fas fa-image') - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - ImageConfig.IMAGE_MAPPING_KEY, - 'Select image field', - '', - EpRequirements.imageReq(), - ) - .build(), - ) - .requiredTextParameter(ImageConfig.TITLE_KEY, 'Title', 'The title') - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/image/image-widget.component.html b/ui/src/app/dashboard/components/widgets/image/image-widget.component.html deleted file mode 100644 index 5918c8558a..0000000000 --- a/ui/src/app/dashboard/components/widgets/image/image-widget.component.html +++ /dev/null @@ -1,26 +0,0 @@ - - -
-
- {{ title }} -
-
- -
-
diff --git a/ui/src/app/dashboard/components/widgets/image/image-widget.component.scss b/ui/src/app/dashboard/components/widgets/image/image-widget.component.scss deleted file mode 100644 index dc6ec35824..0000000000 --- a/ui/src/app/dashboard/components/widgets/image/image-widget.component.scss +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.image-box { - width: 100%; - height: 100%; - color: #fff; - text-align: center; - left: 50%; - display: inline-grid; - align-content: center; -} - -.image-title { - font-size: 14px; -} diff --git a/ui/src/app/dashboard/components/widgets/image/image-widget.component.ts b/ui/src/app/dashboard/components/widgets/image/image-widget.component.ts deleted file mode 100644 index cf0d5fca16..0000000000 --- a/ui/src/app/dashboard/components/widgets/image/image-widget.component.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseNgxChartsStreamPipesWidget } from '../base/base-ngx-charts-widget'; -import { ResizeService } from '../../../services/resize.service'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { GaugeConfig } from '../gauge/gauge-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; -import { SafeUrl } from '@angular/platform-browser'; -import { SecurePipe } from '../../../../services/secure.pipe'; -import { ImageConfig } from './image-config'; - -@Component({ - selector: 'sp-image-widget', - templateUrl: './image-widget.component.html', - styleUrls: ['./image-widget.component.scss'], -}) -export class ImageWidgetComponent - extends BaseNgxChartsStreamPipesWidget - implements OnInit, OnDestroy -{ - item: any; - title: string; - selectedProperty: string; - imageBaseUrl: string; - currentImageUrl: SafeUrl; - imageReady = false; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - private securePipe: SecurePipe, - ) { - super(dataLakeService, resizeService); - } - - ngOnInit(): void { - super.ngOnInit(); - this.imageBaseUrl = this.dataLakeService.dataLakeUrl + '/images/'; - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.title = extractor.singleValueParameter(GaugeConfig.TITLE_KEY); - this.selectedProperty = extractor.mappingPropertyValue( - ImageConfig.IMAGE_MAPPING_KEY, - ); - } - - protected onEvent(events: any[]) { - const url = this.imageBaseUrl + events[0][this.selectedProperty]; - this.securePipe.transform(url).subscribe(res => { - this.currentImageUrl = res; - if (!this.imageReady) { - this.imageReady = true; - } - }); - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return [this.selectedProperty]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/line/line-config.ts b/ui/src/app/dashboard/components/widgets/line/line-config.ts deleted file mode 100644 index abb3ecd9cf..0000000000 --- a/ui/src/app/dashboard/components/widgets/line/line-config.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { BaseNgxLineConfig } from '../base/base-ngx-line-config'; - -export class LineConfig extends BaseNgxLineConfig { - getWidgetLabel(): string { - return 'Line Chart'; - } - - getWidgetName(): string { - return 'line'; - } - - getWidgetDescription(): string { - return 'A line chart with customizable axes and fields to display'; - } - - getWidgetIcon(): string { - return 'fas fa-chart-line'; - } -} diff --git a/ui/src/app/dashboard/components/widgets/line/line-widget.component.html b/ui/src/app/dashboard/components/widgets/line/line-widget.component.html deleted file mode 100644 index 3998d3d464..0000000000 --- a/ui/src/app/dashboard/components/widgets/line/line-widget.component.html +++ /dev/null @@ -1,52 +0,0 @@ - - -
-
- {{ selectedTitle }} -
- - -
diff --git a/ui/src/app/dashboard/components/widgets/line/line-widget.component.scss b/ui/src/app/dashboard/components/widgets/line/line-widget.component.scss deleted file mode 100644 index cda3c3f6a6..0000000000 --- a/ui/src/app/dashboard/components/widgets/line/line-widget.component.scss +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} - -.mt-20 { - margin-top: 20px; -} - -.title-panel { - font-size: 20px; -} diff --git a/ui/src/app/dashboard/components/widgets/line/line-widget.component.ts b/ui/src/app/dashboard/components/widgets/line/line-widget.component.ts deleted file mode 100644 index cec204bde9..0000000000 --- a/ui/src/app/dashboard/components/widgets/line/line-widget.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { ResizeService } from '../../../services/resize.service'; -import { BaseNgxLineChartsStreamPipesWidget } from '../base/base-ngx-line-charts-widget'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-line-widget', - templateUrl: './line-widget.component.html', - styleUrls: ['./line-widget.component.scss'], -}) -export class LineWidgetComponent - extends BaseNgxLineChartsStreamPipesWidget - implements OnInit, OnDestroy -{ - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService); - } - - ngOnInit(): void { - super.ngOnInit(); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/map/map-config.ts b/ui/src/app/dashboard/components/widgets/map/map-config.ts deleted file mode 100644 index 527c898ef0..0000000000 --- a/ui/src/app/dashboard/components/widgets/map/map-config.ts +++ /dev/null @@ -1,87 +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 { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { WidgetConfig } from '../base/base-config'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class MapConfig extends WidgetConfig { - static readonly LATITUDE_MAPPING_KEY: string = 'latitude-mapping'; - static readonly LONGITUDE_MAPPING_KEY: string = 'longitude-mapping'; - static readonly ITEMS_MAPPING_KEY: string = 'items-mapping'; - static readonly ID_MAPPING_KEY: string = 'ids-mapping'; - static readonly MARKER_TYPE_KEY: string = 'marker-type-mapping'; - static readonly CENTER_MAP_KEY: string = 'center-map-mapping'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'map', - 'Map', - ) - .withIcon('fas fa-map') - .withDescription( - 'A map including a marker to show the live position of a thing', - ) - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - MapConfig.LATITUDE_MAPPING_KEY, - 'Latitude field', - '', - EpRequirements.latitudeReq(), - ) - .requiredPropertyWithUnaryMapping( - MapConfig.LONGITUDE_MAPPING_KEY, - 'Latitude field', - '', - EpRequirements.longitudeReq(), - ) - .requiredPropertyWithNaryMapping( - MapConfig.ID_MAPPING_KEY, - 'Group Markers', - 'Each id gets its own marker', - EpRequirements.anyProperty(), - ) - .requiredPropertyWithNaryMapping( - MapConfig.ITEMS_MAPPING_KEY, - 'Fields to display', - '', - EpRequirements.anyProperty(), - ) - .build(), - ) - .requiredSingleValueSelection( - MapConfig.CENTER_MAP_KEY, - 'Center map', - 'Center the map around new markers', - [this.makeOption('Center'), this.makeOption('No Center')], - ) - .requiredSingleValueSelection( - MapConfig.MARKER_TYPE_KEY, - 'Marker type', - '', - [this.makeOption('Default'), this.makeOption('Car')], - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/map/map-widget.component.html b/ui/src/app/dashboard/components/widgets/map/map-widget.component.html deleted file mode 100644 index 0564b8b224..0000000000 --- a/ui/src/app/dashboard/components/widgets/map/map-widget.component.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/map/map-widget.component.scss b/ui/src/app/dashboard/components/widgets/map/map-widget.component.scss deleted file mode 100644 index d6dcfdf097..0000000000 --- a/ui/src/app/dashboard/components/widgets/map/map-widget.component.scss +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} - -.mt-20 { - margin: 10px; -} - -.title-panel { - font-size: 20px; -} diff --git a/ui/src/app/dashboard/components/widgets/map/map-widget.component.ts b/ui/src/app/dashboard/components/widgets/map/map-widget.component.ts deleted file mode 100644 index f697fbdce7..0000000000 --- a/ui/src/app/dashboard/components/widgets/map/map-widget.component.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { MapConfig } from './map-config'; -import { - Content, - icon, - latLng, - LatLng, - LatLngExpression, - Map, - Marker, - marker, - tileLayer, -} from 'leaflet'; -import { ResizeService } from '../../../services/resize.service'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-map-widget', - templateUrl: './map-widget.component.html', - styleUrls: ['./map-widget.component.scss'], -}) -export class MapWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - item: any; - - selectedLatitudeField: string; - selectedLongitudeField: string; - selectedMarkerIcon: string; - idsToDisplay: string[]; - additionalItemsToDisplay: string[]; - centerMap: boolean; - - map: Map; - showMarkers = false; - markerLayers: Marker[]; - markerIds: string[]; - - mapWidth: number; - mapHeight: number; - - options = { - layers: [ - tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 18, - attribution: - "© OpenStreetMap Contributors", - }), - ], - zoom: 5, - center: latLng(46.879966, -121.726909), - }; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.markerLayers = []; - this.markerIds = []; - this.showMarkers = true; - this.mapWidth = this.computeCurrentWidth(this.itemWidth); - this.mapHeight = this.computeCurrentHeight(this.itemHeight); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.selectedLatitudeField = extractor.mappingPropertyValue( - MapConfig.LATITUDE_MAPPING_KEY, - ); - this.selectedLongitudeField = extractor.mappingPropertyValue( - MapConfig.LONGITUDE_MAPPING_KEY, - ); - this.selectedMarkerIcon = this.markerImage( - extractor.selectedSingleValue(MapConfig.MARKER_TYPE_KEY), - ); - this.additionalItemsToDisplay = extractor.mappingPropertyValues( - MapConfig.ITEMS_MAPPING_KEY, - ); - this.idsToDisplay = extractor.mappingPropertyValues( - MapConfig.ID_MAPPING_KEY, - ); - const b = extractor.singleValueParameter(MapConfig.CENTER_MAP_KEY); - this.centerMap = - extractor.selectedSingleValue(MapConfig.CENTER_MAP_KEY) === - 'Center'; - } - - getFieldsToQuery(): string[] { - return [ - this.selectedLatitudeField, - this.selectedLongitudeField, - ...this.idsToDisplay, - ]; - } - - markerImage(selectedMarker: string): string { - return selectedMarker === 'Default' - ? 'assets/img/marker-icon.png' - : 'assets/img/pe_icons/car.png'; - } - - onMapReady(map: Map) { - this.map = map; - this.map.invalidateSize(); - } - - protected onEvent(events: any[]) { - // TODO handle when user selected id field - - const tmpMarker = this.getMarker(events)[0]; - - // Set one marker when no ids are selected - if (this.idsToDisplay.length === 0) { - this.markerLayers = [tmpMarker]; - } else { - const id = this.getId(events[0]); - const index = this.markerIds.indexOf(id); - if (index > -1) { - this.markerLayers[index] = tmpMarker; - } else { - this.markerIds.push(id); - this.markerLayers.push(tmpMarker); - } - } - } - - getMarker(event) { - const lat = event[this.selectedLatitudeField]; - const long = event[this.selectedLongitudeField]; - let text = ''; - this.additionalItemsToDisplay.forEach(item => { - text = text.concat( - '' + item + '' + ': ' + event[item] + '
', - ); - }); - - const content: Content = text; - const point: LatLngExpression = new LatLng(lat, long); - const result = this.makeMarker(point); - result.setLatLng(point); - result.bindTooltip(content); - - if (this.centerMap) { - this.map.panTo(point); - } - return result; - } - - makeMarker(point: LatLngExpression): Marker { - return marker(point, { - icon: icon({ - iconSize: [25, 41], - iconAnchor: [13, 41], - iconUrl: this.selectedMarkerIcon, - shadowUrl: 'assets/img/marker-shadow.png', - }), - }); - } - - getId(event) { - let result = ''; - - for (const id of this.idsToDisplay) { - result = result + event[id]; - } - - return result; - } - - protected onSizeChanged(width: number, height: number) { - this.mapWidth = width; - this.mapHeight = height; - this.map.invalidateSize(); - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } -} diff --git a/ui/src/app/dashboard/components/widgets/number/number-config.ts b/ui/src/app/dashboard/components/widgets/number/number-config.ts deleted file mode 100644 index bcd459b5cb..0000000000 --- a/ui/src/app/dashboard/components/widgets/number/number-config.ts +++ /dev/null @@ -1,50 +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 { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { WidgetConfig } from '../base/base-config'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class NumberConfig extends WidgetConfig { - static readonly NUMBER_MAPPING_KEY: string = 'number-mapping'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'number', - 'Single Value', - ) - .withDescription('Displays a single number or text value') - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - NumberConfig.NUMBER_MAPPING_KEY, - 'Select property', - '', - EpRequirements.anyProperty(), - ) - .build(), - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/number/number-widget.component.html b/ui/src/app/dashboard/components/widgets/number/number-widget.component.html deleted file mode 100644 index 88281cd4a7..0000000000 --- a/ui/src/app/dashboard/components/widgets/number/number-widget.component.html +++ /dev/null @@ -1,38 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
{{ item }}
-
{{ item }}
-
-
- {{ measurementUnitAbbrev }} -
-
-
diff --git a/ui/src/app/dashboard/components/widgets/number/number-widget.component.scss b/ui/src/app/dashboard/components/widgets/number/number-widget.component.scss deleted file mode 100644 index cc6d7d9b56..0000000000 --- a/ui/src/app/dashboard/components/widgets/number/number-widget.component.scss +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.circleNumber { - width: 100%; - height: 100%; - text-align: center; - left: 50%; - display: inline-grid; - align-content: center; -} - -.numberItem { - font-size: 20px; - font-weight: bold; -} - -.measurementUnitItem { - font-size: 20px; - display: flex; - justify-content: center; -} - -.title-panel { - font-size: 20px; -} - -.value-panel { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; -} diff --git a/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts b/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts deleted file mode 100644 index 6cc332431f..0000000000 --- a/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { NumberConfig } from './number-config'; -import { ResizeService } from '../../../services/resize.service'; -import { - DashboardService, - DatalakeRestService, - EventPropertyPrimitive, -} from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-number-widget', - templateUrl: './number-widget.component.html', - styleUrls: ['./number-widget.component.scss'], -}) -export class NumberWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - item: any = '-'; - - selectedProperty: string; - measurementUnitAbbrev: string; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - private dashboardService: DashboardService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.selectedProperty = extractor.mappingPropertyValue( - NumberConfig.NUMBER_MAPPING_KEY, - ); - const eventProperty: EventPropertyPrimitive = - extractor.getEventPropertyByName( - this.selectedProperty, - ) as EventPropertyPrimitive; - if (eventProperty.measurementUnit) { - this.dashboardService - .getMeasurementUnitInfo(eventProperty.measurementUnit) - .subscribe(unit => { - this.measurementUnitAbbrev = unit.abbreviation; - }); - } - } - - isNumber(item: any): boolean { - return false; - } - - protected onEvent(events: any[]) { - let value = events[0][this.selectedProperty]; - if (typeof value === 'number') { - value = value.toFixed(2); - } - this.item = value; - } - - protected onSizeChanged(width: number, height: number) {} - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return [this.selectedProperty]; - } -} diff --git a/ui/src/app/dashboard/components/widgets/raw/raw-config.ts b/ui/src/app/dashboard/components/widgets/raw/raw-config.ts deleted file mode 100644 index ef6fb40075..0000000000 --- a/ui/src/app/dashboard/components/widgets/raw/raw-config.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { WidgetConfig } from '../base/base-config'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class RawConfig extends WidgetConfig { - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'raw', - 'Raw', - ) - .withIcon('fas fa-terminal') - .withDescription( - 'Displays the raw message as it comes in for testing purposes', - ) - .withNumberOfPastEvents() - .requiredSchema(SchemaRequirementsBuilder.create().build()) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.html b/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.html deleted file mode 100644 index 9dc9a5b1ec..0000000000 --- a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.html +++ /dev/null @@ -1,39 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
- {{ item }} -
-
-
diff --git a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.scss b/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.scss deleted file mode 100644 index 927e78adf5..0000000000 --- a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.scss +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} - -.mt-20 { - margin: 10px; -} - -.p-10 { - padding: 10px; -} - -.title-panel { - font-size: 20px; - height: 30px; -} diff --git a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.ts b/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.ts deleted file mode 100644 index 1a4dcb0194..0000000000 --- a/ui/src/app/dashboard/components/widgets/raw/raw-widget.component.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { DatalakeRestService } from '@streampipes/platform-services'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; - -@Component({ - selector: 'sp-raw-widget', - templateUrl: './raw-widget.component.html', - styleUrls: ['./raw-widget.component.scss'], -}) -export class RawWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - items: Array; - width: number; - height: number; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.width = this.computeCurrentWidth(this.itemWidth); - this.height = this.computeCurrentHeight(this.itemHeight); - this.items = []; - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) {} - - protected onEvent(events: any[]) { - this.items = events.map(ev => JSON.stringify(ev)).reverse(); - } - - protected onSizeChanged(width: number, height: number) { - this.width = width; - this.height = height; - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return extractor.integerParameter(WidgetConfigBuilder.QUERY_LIMIT_KEY); - } - - getFieldsToQuery(): string[] { - return undefined; - } -} diff --git a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-config.ts b/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-config.ts deleted file mode 100644 index 82fabe386d..0000000000 --- a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-config.ts +++ /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. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class StackedLineChartConfig extends WidgetConfig { - static readonly VALUE_KEY: string = 'value-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'stacked-line-chart', - 'Stacked Line Chart', - ) - .withIcon('fas fa-chart-line') - .withDescription( - 'Shows a stacked line chart based on multiple measurements.', - ) - .withNumberOfPastEvents() - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithNaryMapping( - StackedLineChartConfig.VALUE_KEY, - 'Measurement fields', - '', - EpRequirements.numberReq(), - ) - .build(), - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.html b/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.html deleted file mode 100644 index 76884aada9..0000000000 --- a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.scss b/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.scss deleted file mode 100644 index 527d47a5f5..0000000000 --- a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.scss +++ /dev/null @@ -1,53 +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. - * - */ - -.status-panel { - width: 100%; - height: 100%; - text-align: center; - left: 50%; - display: flex; - flex-direction: column; - align-content: flex-start; -} - -.title-panel { - font-size: 20px; -} - -.status-light { - border-radius: 50%; - float: left; - margin: 10px 10px; -} - -.status-light-red { - background-color: #c22; - box-shadow: - #338 0 -1px 7px 1px, - inset #600 0 -1px 9px, - #f00 0 0px 8px; -} - -.status-light-green { - background-color: #690; - box-shadow: - #225 0 -1px 7px 1px, - inset #460 0 -1px 9px, - #7d0 0 0px 8px; -} diff --git a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.ts b/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.ts deleted file mode 100644 index a7853e79b5..0000000000 --- a/ui/src/app/dashboard/components/widgets/stacked-line-chart/stacked-line-chart-widget.component.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { BaseEchartsWidget } from '../base/base-echarts-widget'; -import { StackedLineChartConfig } from './stacked-line-chart-config'; -import { EChartsOption } from 'echarts'; -import { DatalakeRestService } from '@streampipes/platform-services'; -import { BaseNgxLineChartsStreamPipesWidget } from '../base/base-ngx-line-charts-widget'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; - -@Component({ - selector: 'sp-stacked-line-chart-widget', - templateUrl: './stacked-line-chart-widget.component.html', - styleUrls: ['./stacked-line-chart-widget.component.scss'], -}) -export class StackedLineChartWidgetComponent - extends BaseEchartsWidget - implements OnInit, OnDestroy -{ - partitionField: string; - valueFields: string[]; - timestampField: string; - - chartOption = { - grid: { - left: 50, - top: 10, - right: 50, - bottom: 100, - }, - tooltip: { - trigger: 'axis', - formatter(params) { - params = params[0]; - const date = new Date(params.value[0]); - return ( - date.getHours() + - ':' + - (date.getMinutes() + 1) + - ':' + - date.getSeconds() + - ' : ' + - params.value[1] - ); - }, - axisPointer: { - animation: false, - }, - }, - xAxis: { - type: 'time', - axisLabel: { - formatter: params => { - const date = new Date(params); - return ( - date.getHours() + - ':' + - date.getMinutes() + - ':' + - date.getSeconds() - ); - }, - textStyle: { - color: this.selectedPrimaryTextColor, - }, - }, - }, - yAxis: { - type: 'value', - axisLabel: { - textStyle: { - color: this.selectedPrimaryTextColor, - }, - }, - }, - series: [], - animationDuration: 300, - }; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService); - this.configReady = true; - } - - protected extractConfig(extractor: StaticPropertyExtractor) { - this.valueFields = extractor.mappingPropertyValues( - StackedLineChartConfig.VALUE_KEY, - ); - this.chartOption.xAxis.axisLabel.textStyle.color = - this.selectedPrimaryTextColor; - this.chartOption.yAxis.axisLabel.textStyle.color = - this.selectedPrimaryTextColor; - } - - getFieldsToQuery(): string[] { - return this.valueFields; - } - - protected onEvent(events: any) { - this.dynamicData = this.chartOption; - this.dynamicData.series = []; - - this.valueFields.forEach(field => { - const series = this.makeNewSeries(field); - series.data = events.map(event => { - const timestamp = - event[BaseNgxLineChartsStreamPipesWidget.TIMESTAMP_KEY]; - return { - name: timestamp.toString(), - value: [timestamp, event[field]], - }; - }); - this.dynamicData.series.push(series); - }); - - if (this.eChartsInstance) { - this.eChartsInstance.setOption(this.dynamicData as EChartsOption); - } - } - - makeNewSeries(seriesName: string): any { - return { - type: 'line', - smooth: true, - name: seriesName, - data: [], - }; - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return extractor.integerParameter(WidgetConfigBuilder.QUERY_LIMIT_KEY); - } -} diff --git a/ui/src/app/dashboard/components/widgets/status/status-config.ts b/ui/src/app/dashboard/components/widgets/status/status-config.ts deleted file mode 100644 index 7ab9dd5f75..0000000000 --- a/ui/src/app/dashboard/components/widgets/status/status-config.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class StatusWidgetConfig extends WidgetConfig { - static readonly INTERVAL_KEY: string = 'interval-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'status', - 'Status', - ) - .withIcon('fas fa-lightbulb') - .withDescription('Status light') - .requiredSchema(SchemaRequirementsBuilder.create().build()) - .requiredIntegerParameter( - StatusWidgetConfig.INTERVAL_KEY, - 'Interval [sec]', - 'Interval in seconds in which an event must arrive', - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/status/status-widget.component.html b/ui/src/app/dashboard/components/widgets/status/status-widget.component.html deleted file mode 100644 index 7b0d7f4342..0000000000 --- a/ui/src/app/dashboard/components/widgets/status/status-widget.component.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
Last seen: {{ lastTimestamp | date: 'short' }}
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/status/status-widget.component.scss b/ui/src/app/dashboard/components/widgets/status/status-widget.component.scss deleted file mode 100644 index 8c20cb2d9c..0000000000 --- a/ui/src/app/dashboard/components/widgets/status/status-widget.component.scss +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.status-panel { - width: 100%; - height: 100%; - text-align: center; - left: 50%; - display: flex; - flex-direction: column; - align-content: flex-start; -} - -.title-panel { - font-size: 20px; -} - -.value-panel { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - align-content: center; - flex: 1; -} - -.status-light { - border-radius: 50%; - float: left; - margin: 10px 10px; -} - -.status-light-red { - background-color: #c22; - box-shadow: - #338 0 -1px 7px 1px, - inset #600 0 -1px 9px, - #f00 0 0px 8px; -} - -.status-light-green { - background-color: #690; - box-shadow: - #225 0 -1px 7px 1px, - inset #460 0 -1px 9px, - #7d0 0 0px 8px; -} diff --git a/ui/src/app/dashboard/components/widgets/status/status-widget.component.ts b/ui/src/app/dashboard/components/widgets/status/status-widget.component.ts deleted file mode 100644 index fcd56f16d0..0000000000 --- a/ui/src/app/dashboard/components/widgets/status/status-widget.component.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { StatusWidgetConfig } from './status-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-dashboard-status-widget', - templateUrl: './status-widget.component.html', - styleUrls: ['./status-widget.component.scss'], -}) -export class StatusWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - interval: number; - active = false; - lastTimestamp = 0; - - statusLightWidth: string; - statusLightHeight: string; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.onSizeChanged( - this.computeCurrentWidth(this.itemWidth), - this.computeCurrentHeight(this.itemHeight), - ); - } - - protected extractConfig(extractor: StaticPropertyExtractor) { - this.interval = extractor.integerParameter( - StatusWidgetConfig.INTERVAL_KEY, - ); - } - - protected onEvent(events: any[]) { - if (events.length > 0) { - const timestamp = new Date().getTime(); - this.lastTimestamp = new Date( - events[0][BaseStreamPipesWidget.TIMESTAMP_KEY], - ).getTime(); - this.active = - this.lastTimestamp >= timestamp - this.interval * 1000; - } else { - this.active = false; - } - } - - protected onSizeChanged(width: number, height: number) { - const size: string = Math.min(width, height) * 0.5 + 'px'; - this.statusLightWidth = size; - this.statusLightHeight = size; - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } - - getFieldsToQuery(): string[] { - return undefined; - } -} diff --git a/ui/src/app/dashboard/components/widgets/table/table-config.ts b/ui/src/app/dashboard/components/widgets/table/table-config.ts deleted file mode 100644 index 45d669e50c..0000000000 --- a/ui/src/app/dashboard/components/widgets/table/table-config.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class TableConfig extends WidgetConfig { - static readonly TITLE_KEY: string = 'title-key'; - static readonly SELECTED_PROPERTIES_KEYS: string = 'selected-fields-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'table', - 'Table', - ) - .withIcon('fas fa-table') - .withDescription('A table visualization with customizable columns') - .withNumberOfPastEvents() - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithNaryMapping( - TableConfig.SELECTED_PROPERTIES_KEYS, - 'Fields to display', - '', - EpRequirements.anyProperty(), - ) - .build(), - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/table/table-widget.component.html b/ui/src/app/dashboard/components/widgets/table/table-widget.component.html deleted file mode 100644 index 8ebd413e66..0000000000 --- a/ui/src/app/dashboard/components/widgets/table/table-widget.component.html +++ /dev/null @@ -1,62 +0,0 @@ - - -
-
- {{ selectedTitle }} -
- - - - - - - - -
- - - {{ row[element] }} -
-
diff --git a/ui/src/app/dashboard/components/widgets/table/table-widget.component.scss b/ui/src/app/dashboard/components/widgets/table/table-widget.component.scss deleted file mode 100644 index 547eb1ac26..0000000000 --- a/ui/src/app/dashboard/components/widgets/table/table-widget.component.scss +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -.title-panel { - font-size: 20px; - text-align: center; -} - -.mt-20 { - margin-top: 20px; -} - -.main-panel { - width: 100%; - height: 100%; - display: inline-grid; - align-content: center; -} diff --git a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts b/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts deleted file mode 100644 index 768ee61ebb..0000000000 --- a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { MatTableDataSource } from '@angular/material/table'; -import { TableConfig } from './table-config'; -import { ResizeService } from '../../../services/resize.service'; -import { - DatalakeRestService, - SemanticType, -} from '@streampipes/platform-services'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; - -@Component({ - selector: 'sp-table-widget', - templateUrl: './table-widget.component.html', - styleUrls: ['./table-widget.component.scss'], -}) -export class TableWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - selectedProperties: string[]; - fields: string[]; - - displayedColumns: string[] = []; - dataSource = new MatTableDataSource(); - semanticTypes: { [key: string]: string } = {}; - tableDisplayed = false; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - - this.widgetDataConfig.eventSchema.eventProperties.forEach( - (key, index) => { - this.semanticTypes[key.runtimeName] = key.semanticType; - }, - ); - this.semanticTypes[BaseStreamPipesWidget.TIMESTAMP_KEY] = - SemanticType.TIMESTAMP; - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.selectedProperties = extractor.mappingPropertyValues( - TableConfig.SELECTED_PROPERTIES_KEYS, - ); - this.fields = extractor.mappingPropertyValues( - TableConfig.SELECTED_PROPERTIES_KEYS, - ); - this.selectedProperties.push(BaseStreamPipesWidget.TIMESTAMP_KEY); - } - - getFieldsToQuery(): string[] { - return this.fields; - } - - protected onEvent(events: any[]) { - this.dataSource.data = events - .map(ev => this.createTableObject(ev)) - .reverse(); - this.dataSource.data = [...this.dataSource.data]; - } - - createTableObject(event: any) { - const object = {}; - this.selectedProperties.forEach((key, index) => { - event[key] = SemanticType.getValue( - event[key], - this.semanticTypes[key], - ); - object[key] = event[key]; - }); - return object; - } - - protected onSizeChanged(width: number, height: number) {} - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return extractor.integerParameter(WidgetConfigBuilder.QUERY_LIMIT_KEY); - } -} diff --git a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-config.ts b/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-config.ts deleted file mode 100644 index 8103f71bfb..0000000000 --- a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-config.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { WidgetConfig } from '../base/base-config'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class TrafficLightConfig extends WidgetConfig { - static readonly NUMBER_MAPPING_KEY = 'number-field'; - static readonly CRITICAL_VALUE_KEY = 'critical-value-key'; - static readonly CRITICAL_VALUE_LIMIT = 'critical-value-limit'; - static readonly WARNING_RANGE_KEY = 'warning-range'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'trafficlight', - 'Traffic Light', - ) - .withIcon('fas fa-traffic-light') - .withDescription( - 'A traffic light visualization with customizable warning range and threshold', - ) - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - TrafficLightConfig.NUMBER_MAPPING_KEY, - 'Field to observe', - '', - EpRequirements.numberReq(), - ) - .build(), - ) - .requiredIntegerParameter( - TrafficLightConfig.CRITICAL_VALUE_KEY, - 'Threshold', - '', - ) - .requiredSingleValueSelection( - TrafficLightConfig.CRITICAL_VALUE_LIMIT, - 'Operator', - '', - [ - this.makeOption('Upper' + ' Limit'), - this.makeOption('Under Limit'), - ], - ) - .requiredIntegerParameter( - TrafficLightConfig.WARNING_RANGE_KEY, - 'Warning range (percent)', - '', - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.html b/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.html deleted file mode 100644 index bb03903ece..0000000000 --- a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.html +++ /dev/null @@ -1,65 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.scss b/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.scss deleted file mode 100644 index a8a78bbe4e..0000000000 --- a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.scss +++ /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. - */ - -.h-100 { - height: 100%; -} - -.tl-container { - background-color: gray; - display: flex; - align-items: center; - justify-content: space-between; - flex-direction: column; - padding: 10px; -} - -.light { - background-color: rgba(0, 0, 0, 0.3); - border-radius: 50%; -} - -.light-red { - background-color: red; - box-shadow: 0 0 20px 5px red; -} - -.light-yellow { - background-color: yellow; - box-shadow: 0 0 20px 5px yellow; -} - -.light-green { - background-color: green; - box-shadow: 0 0 20px 5px green; -} - -.title-panel { - font-size: 20px; - height: 30px; - margin-top: 10px; - margin-bottom: 10px; -} diff --git a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.ts b/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.ts deleted file mode 100644 index dfbe6b85a3..0000000000 --- a/ui/src/app/dashboard/components/widgets/trafficlight/traffic-light-widget.component.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { TrafficLightConfig } from './traffic-light-config'; -import { DatalakeRestService } from '@streampipes/platform-services'; - -@Component({ - selector: 'sp-traffic-light-widget', - templateUrl: './traffic-light-widget.component.html', - styleUrls: ['./traffic-light-widget.component.scss'], -}) -export class TrafficLightWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - items: string[]; - width: number; - height: number; - - containerWidth: number; - containerHeight: number; - - lightWidth: number; - lightHeight: number; - - selectedWarningRange: number; - selectedFieldToObserve: string; - selectedLimitGreaterThan: boolean; - selectedThreshold: number; - - activeClass = 'red'; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.width = this.computeCurrentWidth(this.itemWidth); - this.height = this.computeCurrentHeight(this.itemHeight); - this.updateContainerSize(); - this.updateLightSize(); - this.items = []; - } - - updateContainerSize() { - this.containerHeight = this.height - 60; - this.containerWidth = this.containerHeight / 3; - } - - updateLightSize() { - this.lightWidth = (this.containerHeight - 60) / 3; - this.lightHeight = this.lightWidth; - } - - ngOnDestroy(): void { - super.ngOnDestroy(); - } - - extractConfig(extractor: StaticPropertyExtractor) { - this.selectedThreshold = extractor.integerParameter( - TrafficLightConfig.CRITICAL_VALUE_KEY, - ); - this.selectedFieldToObserve = extractor.mappingPropertyValue( - TrafficLightConfig.NUMBER_MAPPING_KEY, - ); - this.selectedWarningRange = extractor.integerParameter( - TrafficLightConfig.WARNING_RANGE_KEY, - ); - this.selectedLimitGreaterThan = - extractor.selectedSingleValue( - TrafficLightConfig.CRITICAL_VALUE_LIMIT, - ) === 'Upper Limit'; - } - - getFieldsToQuery(): string[] { - return [this.selectedFieldToObserve]; - } - - protected onEvent(events: any[]) { - const item = events[0][this.selectedFieldToObserve]; - if (this.isInOkRange(item)) { - this.activeClass = 'green'; - } else if (this.isInWarningRange(item)) { - this.activeClass = 'yellow'; - } else { - this.activeClass = 'red'; - } - } - - exceedsThreshold(value) { - if (this.selectedLimitGreaterThan) { - return value >= this.selectedThreshold; - } else { - return value <= this.selectedThreshold; - } - } - - isInWarningRange(value) { - if (this.exceedsThreshold(value)) { - return false; - } else { - if (this.selectedLimitGreaterThan) { - return ( - value >= - this.selectedThreshold - - this.selectedThreshold * - (this.selectedWarningRange / 100) - ); - } else { - return ( - value <= - this.selectedThreshold + - this.selectedThreshold * - (this.selectedWarningRange / 100) - ); - } - } - } - isInOkRange(value) { - return !this.exceedsThreshold(value) && !this.isInWarningRange(value); - } - - protected onSizeChanged(width: number, height: number) { - this.width = width; - this.height = height; - this.updateContainerSize(); - this.updateLightSize(); - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return 1; - } -} diff --git a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-config.ts b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-config.ts deleted file mode 100644 index dbab97b8d1..0000000000 --- a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-config.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { WidgetConfig } from '../base/base-config'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; -import { SchemaRequirementsBuilder } from '../../../sdk/schema-requirements-builder'; -import { EpRequirements } from '../../../sdk/ep-requirements'; -import { DashboardWidgetSettings } from '@streampipes/platform-services'; - -export class WordCloudConfig extends WidgetConfig { - static readonly TITLE_KEY: string = 'title-key'; - static readonly COUNT_PROPERTY_KEY: string = 'count-property-key'; - static readonly NAME_PROPERTY_KEY: string = 'name-property-key'; - static readonly WINDOW_SIZE_KEY: string = 'window-size-key'; - - constructor() { - super(); - } - - getConfig(): DashboardWidgetSettings { - return WidgetConfigBuilder.createWithSelectableColorsAndTitlePanel( - 'wordcloud', - 'Word Cloud', - ) - .withIcon('fas fa-font') - .withDescription('A wordcloud visualization') - .requiredSchema( - SchemaRequirementsBuilder.create() - .requiredPropertyWithUnaryMapping( - WordCloudConfig.COUNT_PROPERTY_KEY, - 'Count field', - '', - EpRequirements.integerReq(), - ) - .requiredPropertyWithUnaryMapping( - WordCloudConfig.NAME_PROPERTY_KEY, - 'Name field', - '', - EpRequirements.stringReq(), - ) - .build(), - ) - .requiredIntegerParameter( - WordCloudConfig.WINDOW_SIZE_KEY, - 'Window size', - 'The maximum number of events', - ) - .build(); - } -} diff --git a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.html b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.html deleted file mode 100644 index bdf4435ecb..0000000000 --- a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.html +++ /dev/null @@ -1,39 +0,0 @@ - - -
-
- {{ selectedTitle }} -
-
-
-
-
diff --git a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.scss b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.scss deleted file mode 100644 index 83de85bd1e..0000000000 --- a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.scss +++ /dev/null @@ -1,45 +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. - * - */ - -.wordcloud-panel { - width: 100%; - height: 100%; - text-align: center; - left: 50%; - display: inline-grid; - align-content: start; -} - -.title-panel { - font-size: 20px; -} - -.value-panel { - display: flex; - height: 100%; - width: 100%; - flex-direction: column; - align-items: center; - justify-content: center; - align-content: center; -} - -.wordcloud { - height: 100%; - width: 100%; -} diff --git a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts deleted file mode 100644 index f241295f12..0000000000 --- a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { BaseStreamPipesWidget } from '../base/base-widget'; -import { StaticPropertyExtractor } from '../../../sdk/extractor/static-property-extractor'; -import { ResizeService } from '../../../services/resize.service'; -import { - DatalakeRestService, - EventPropertyList, -} from '@streampipes/platform-services'; -import { WordCloudConfig } from './wordcloud-config'; - -import { EChartsOption } from 'echarts'; -import 'echarts-wordcloud'; -import { ECharts } from 'echarts/core'; -import { WidgetConfigBuilder } from '../../../registry/widget-config-builder'; - -@Component({ - selector: 'sp-wordcloud-widget', - templateUrl: './wordcloud-widget.component.html', - styleUrls: ['./wordcloud-widget.component.scss'], -}) -export class WordcloudWidgetComponent - extends BaseStreamPipesWidget - implements OnInit, OnDestroy -{ - countProperty: string; - nameProperty: string; - windowSize: number; - eventProperty: EventPropertyList; - - words: any[] = new Array(); - - currentWidth: number; - currentHeight: number; - - configReady = false; - - eChartsInstance: ECharts; - dynamicData: EChartsOption; - // @ts-ignore - chartOption: any = { - series: [ - { - type: 'wordCloud', - shape: 'circle', - left: 'center', - top: 'center', - width: '100%', - height: '100%', - right: null, - bottom: null, - sizeRange: [12, 60], - rotationRange: [-90, 90], - rotationStep: 45, - gridSize: 8, - drawOutOfBound: false, - layoutAnimation: true, - - textStyle: { - fontFamily: 'sans-serif', - fontWeight: 'bold', - color() { - return ( - 'rgb(' + - [ - Math.round(Math.random() * 160), - Math.round(Math.random() * 160), - Math.round(Math.random() * 160), - ].join(',') + - ')' - ); - }, - }, - emphasis: { - focus: 'self', - - textStyle: { - shadowBlur: 10, - shadowColor: '#333', - }, - }, - data: [], - }, - ], - }; - - constructor( - dataLakeService: DatalakeRestService, - resizeService: ResizeService, - ) { - super(dataLakeService, resizeService, false); - } - - ngOnInit(): void { - super.ngOnInit(); - this.onSizeChanged(this.itemWidth, this.itemHeight); - } - - protected extractConfig(extractor: StaticPropertyExtractor) { - this.countProperty = extractor.mappingPropertyValue( - WordCloudConfig.COUNT_PROPERTY_KEY, - ); - this.nameProperty = extractor.mappingPropertyValue( - WordCloudConfig.NAME_PROPERTY_KEY, - ); - this.windowSize = extractor.integerParameter( - WordCloudConfig.WINDOW_SIZE_KEY, - ); - } - - getFieldsToQuery(): string[] { - return [this.countProperty, this.nameProperty]; - } - - protected onEvent(event: any) { - const value = event[this.countProperty]; - const name = event[this.nameProperty]; - this.dynamicData = this.chartOption; - if (this.dynamicData.series[0].data.some(d => d.name == name)) { - this.dynamicData.series[0].data.find(d => d.name == name).value = - value; - } else { - this.dynamicData.series[0].data.push({ name, value }); - } - if (this.dynamicData.series[0].data.length > this.windowSize) { - this.dynamicData.series[0].data.shift(); - } - if (this.eChartsInstance) { - this.eChartsInstance.setOption(this.dynamicData); - } - } - - protected onSizeChanged(width: number, height: number) { - this.currentWidth = width; - this.currentHeight = height; - this.configReady = true; - this.applySize(width, height); - } - - onChartInit(ec: ECharts) { - this.eChartsInstance = ec; - this.applySize(this.currentWidth, this.currentHeight); - } - - applySize(width: number, height: number) { - if (this.eChartsInstance) { - this.eChartsInstance.resize({ width, height }); - } - } - - protected getQueryLimit(extractor: StaticPropertyExtractor): number { - return extractor.integerParameter(WidgetConfigBuilder.QUERY_LIMIT_KEY); - } -} diff --git a/ui/src/app/dashboard/dashboard.can-deactivate.guard.ts b/ui/src/app/dashboard/dashboard.can-deactivate.guard.ts deleted file mode 100644 index 35a66e2b18..0000000000 --- a/ui/src/app/dashboard/dashboard.can-deactivate.guard.ts +++ /dev/null @@ -1,33 +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 { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { Observable } from 'rxjs'; -import { DashboardPanelComponent } from './components/panel/dashboard-panel.component'; - -@Injectable({ providedIn: 'root' }) -export class DashboardPanelCanDeactivateGuard { - canDeactivate( - component: DashboardPanelComponent, - route: ActivatedRouteSnapshot, - state: RouterStateSnapshot, - ): Observable | boolean { - return component.confirmLeaveDashboard(route, state); - } -} diff --git a/ui/src/app/dashboard/dashboard.module.ts b/ui/src/app/dashboard/dashboard.module.ts index c7d0ab59d7..cffb204b8a 100644 --- a/ui/src/app/dashboard/dashboard.module.ts +++ b/ui/src/app/dashboard/dashboard.module.ts @@ -20,41 +20,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FlexLayoutModule } from '@ngbracket/ngx-layout'; import { GridsterModule } from 'angular-gridster2'; -import { DashboardPanelComponent } from './components/panel/dashboard-panel.component'; import { MatTabsModule } from '@angular/material/tabs'; -import { DashboardWidgetComponent } from './components/widget/dashboard-widget.component'; import { FormsModule } from '@angular/forms'; import { ColorPickerModule } from 'ngx-color-picker'; -import { AddVisualizationDialogComponent } from './dialogs/add-widget/add-visualization-dialog.component'; import { MatGridListModule } from '@angular/material/grid-list'; -import { NumberWidgetComponent } from './components/widgets/number/number-widget.component'; import { DashboardOverviewComponent } from './components/overview/dashboard-overview.component'; -import { EditDashboardDialogComponent } from './dialogs/edit-dashboard/edit-dashboard-dialog.component'; -import { DashboardGridComponent } from './components/grid/dashboard-grid.component'; -import { LineWidgetComponent } from './components/widgets/line/line-widget.component'; import { NgxChartsModule } from '@swimlane/ngx-charts'; -import { TableWidgetComponent } from './components/widgets/table/table-widget.component'; import { CdkTableModule } from '@angular/cdk/table'; -import { GaugeWidgetComponent } from './components/widgets/gauge/gauge-widget.component'; -import { ImageWidgetComponent } from './components/widgets/image/image-widget.component'; -import { AreaWidgetComponent } from './components/widgets/area/area-widget.component'; -import { MapWidgetComponent } from './components/widgets/map/map-widget.component'; import { LeafletModule } from '@asymmetrik/ngx-leaflet'; -import { RawWidgetComponent } from './components/widgets/raw/raw-widget.component'; -import { HtmlWidgetComponent } from './components/widgets/html/html-widget.component'; -import { TrafficLightWidgetComponent } from './components/widgets/trafficlight/traffic-light-widget.component'; -import { StandaloneDashboardComponent } from './components/standalone/standalone-dashboard.component'; import { CoreUiModule } from '../core-ui/core-ui.module'; -import { WordcloudWidgetComponent } from './components/widgets/wordcloud/wordcloud-widget.component'; -import { NgxEchartsModule } from 'ngx-echarts'; -import { StatusWidgetComponent } from './components/widgets/status/status-widget.component'; -import { BarRaceWidgetComponent } from './components/widgets/bar-race/bar-race-widget.component'; -import { StackedLineChartWidgetComponent } from './components/widgets/stacked-line-chart/stacked-line-chart-widget.component'; import { PlatformServicesModule } from '@streampipes/platform-services'; import { ServicesModule } from '../services/services.module'; import { RouterModule } from '@angular/router'; import { SharedUiModule } from '@streampipes/shared-ui'; -import { DashboardPanelCanDeactivateGuard } from './dashboard.can-deactivate.guard'; import { MatDividerModule } from '@angular/material/divider'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatTableModule } from '@angular/material/table'; @@ -106,14 +84,6 @@ import { MatSliderModule } from '@angular/material/slider'; MatButtonToggleModule, MatChipsModule, MatSliderModule, - NgxEchartsModule.forRoot({ - /** - * This will import all modules from echarts. - * If you only need custom modules, - * please refer to [Custom Build] section. - */ - echarts: () => import('echarts'), - }), CommonModule, CoreUiModule, MatTabsModule, @@ -140,40 +110,13 @@ import { MatSliderModule } from '@angular/material/slider'; path: '', component: DashboardOverviewComponent, }, - { - path: ':id', - component: DashboardPanelComponent, - canDeactivate: [DashboardPanelCanDeactivateGuard], - }, ], }, ]), ], - declarations: [ - BarRaceWidgetComponent, - DashboardGridComponent, - DashboardOverviewComponent, - DashboardPanelComponent, - DashboardWidgetComponent, - AddVisualizationDialogComponent, - EditDashboardDialogComponent, - AreaWidgetComponent, - LineWidgetComponent, - NumberWidgetComponent, - TableWidgetComponent, - GaugeWidgetComponent, - ImageWidgetComponent, - MapWidgetComponent, - RawWidgetComponent, - StackedLineChartWidgetComponent, - HtmlWidgetComponent, - StatusWidgetComponent, - TrafficLightWidgetComponent, - WordcloudWidgetComponent, - StandaloneDashboardComponent, - ], + declarations: [DashboardOverviewComponent], providers: [], - exports: [DashboardWidgetComponent, StandaloneDashboardComponent], + exports: [], }) export class DashboardModule { constructor() {} diff --git a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html b/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html deleted file mode 100644 index 4293ee14f6..0000000000 --- a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html +++ /dev/null @@ -1,138 +0,0 @@ - - -
-
-
-
-
-

{{ pages[0].description }}

- - -
- {{ iconText(pipeline.measureName) }} -
- {{ - pipeline.pipelineName - }} - {{ - pipeline.measureName - }} -
-
-
- - -
-

{{ pages[1].description }}

- - -
- {{ - iconText(widget.widgetLabel) - }} - -
- {{ - widget.widgetLabel - }} - {{ - widget.widgetDescription - }} -
-
-
- - -
-

{{ pages[2].description }}

-
- - -
-
-
-
-
- -
- - - -
-
diff --git a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.scss b/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.scss deleted file mode 100644 index 4497d55380..0000000000 --- a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.scss +++ /dev/null @@ -1,53 +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 '../../../../scss/sp/sp-dialog.scss'; - -.element-margin { - margin-top: 10px; - margin-bottom: 10px; -} - -.mat-radio-button { - padding: 10px; -} - -.pipeline-avatar { - align-items: center; - justify-content: center; - display: flex; - color: white; -} - -.list-item:hover { - background: var(--color-bg-1); - cursor: pointer; -} - -.list-item { - border-bottom: 1px solid #bdbdbd; -} - -.mr-10 { - margin-right: 10px; -} - -.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar { - border-radius: var(--mdc-list-list-item-leading-avatar-shape); - background-color: var(--color-accent); -} diff --git a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.ts b/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.ts deleted file mode 100644 index 241189b4cd..0000000000 --- a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.ts +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - AfterViewInit, - ChangeDetectorRef, - Component, - Input, - OnInit, -} from '@angular/core'; -import { ElementIconText } from '../../../services/get-element-icon-text.service'; -import { WidgetConfigBuilder } from '../../registry/widget-config-builder'; -import { WidgetRegistry } from '../../registry/widget-registry'; -import { MappingPropertyGenerator } from '../../sdk/matching/mapping-property-generator'; -import { - Dashboard, - DashboardService, - DashboardWidgetModel, - DashboardWidgetSettings, - DataLakeMeasure, - DatalakeRestService, - DataViewDataExplorerService, - EventPropertyUnion, - EventSchema, - FreeTextStaticProperty, - MappingPropertyNary, - MappingPropertyUnary, - PipelineService, -} from '@streampipes/platform-services'; -import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { DialogRef } from '@streampipes/shared-ui'; -import { zip } from 'rxjs'; - -@Component({ - selector: 'sp-add-visualization-dialog-component', - templateUrl: './add-visualization-dialog.component.html', - styleUrls: ['./add-visualization-dialog.component.scss'], -}) -export class AddVisualizationDialogComponent implements OnInit, AfterViewInit { - pages = [ - { - type: 'select-pipeline', - title: 'Select Pipeline', - description: "Select a pipeline you'd like to visualize", - }, - { - type: 'select-widget', - title: 'Select Widget', - description: 'Select widget', - }, - { - type: 'configure-widget', - title: 'Configure Widget', - description: 'Configure widget', - }, - ]; - - visualizablePipelines: DataLakeMeasure[] = []; - availableWidgets: DashboardWidgetSettings[]; - - selectedPipeline: DataLakeMeasure; - selectedWidget: DashboardWidgetSettings; - - dashboard: Dashboard; - - selectedType: any; - page = 'select-pipeline'; - dialogTitle: string; - - parentForm: UntypedFormGroup; - - formValid = false; - viewInitialized = false; - - @Input() - pipeline: DataLakeMeasure; - - @Input() - widget: DashboardWidgetModel; - - @Input() - editMode: boolean; - - @Input() - startPage: string; - - constructor( - private dialogRef: DialogRef, - private dashboardService: DashboardService, - private dataLakeRestService: DatalakeRestService, - private dataExplorerService: DataViewDataExplorerService, - private pipelineService: PipelineService, - public elementIconText: ElementIconText, - private fb: UntypedFormBuilder, - private changeDetectorRef: ChangeDetectorRef, - ) {} - - ngOnInit() { - this.parentForm = this.fb.group({}); - this.parentForm.statusChanges.subscribe(status => { - this.formValid = this.viewInitialized && this.parentForm.valid; - }); - if (!this.editMode) { - this.dialogTitle = 'Add widget'; - this.loadVisualizablePipelines(); - } else { - this.loadVisualizablePipelines(); - this.dialogTitle = 'Edit widget'; - this.selectedPipeline = this.pipeline; - this.selectedWidget = this.widget.dashboardWidgetSettings; - this.page = this.startPage; - } - } - - ngAfterViewInit() { - this.viewInitialized = true; - this.formValid = this.viewInitialized && this.parentForm.valid; - this.changeDetectorRef.detectChanges(); - } - - loadVisualizablePipelines() { - zip( - this.dataExplorerService.getAllPersistedDataStreams(), - this.dataLakeRestService.getAllMeasurementSeries(), - ).subscribe(res => { - const availableVisualizablePipelines = []; - const visualizablePipelines = res[0]; - visualizablePipelines.forEach(p => { - const measurement = res[1].find(m => { - return m.measureName === p.measureName; - }); - if (measurement) { - p.eventSchema = measurement.eventSchema; - availableVisualizablePipelines.push(p); - } - }); - this.visualizablePipelines = this.sortPipeline( - availableVisualizablePipelines, - ); - }); - } - - sortPipeline(visualizations: DataLakeMeasure[]): DataLakeMeasure[] { - return visualizations.sort((a, b) => { - if (a.pipelineName === b.pipelineName) { - return a.measureName.toLowerCase() < b.measureName.toLowerCase() - ? -1 - : 1; - } else { - return a.pipelineName.toLowerCase() < - b.pipelineName.toLowerCase() - ? -1 - : 1; - } - }); - } - - onCancel(): void { - this.dialogRef.close(); - } - - getSelectedPipelineCss(vis) { - return this.getSelectedCss(this.selectedPipeline, vis); - } - - getSelectedVisTypeCss(type) { - return this.getSelectedCss(this.selectedType, type); - } - - getSelectedCss(selected, current) { - if (selected === current) { - return 'wizard-preview wizard-preview-selected'; - } else { - return 'wizard-preview'; - } - } - - getTabCss(page) { - if (page === this.page) { - return 'md-fab md-accent'; - } else { - return 'md-fab md-accent wizard-inactive'; - } - } - - selectPipeline(vis) { - this.selectedPipeline = vis; - this.next(); - } - - selectWidget(widget) { - this.selectedWidget = widget; - this.selectedWidget.config.forEach(sp => { - if ( - sp instanceof MappingPropertyUnary || - sp instanceof MappingPropertyNary - ) { - const requirement: EventPropertyUnion = this.findRequirement( - this.selectedWidget.requiredSchema, - sp.internalName, - ); - sp.mapsFromOptions = new MappingPropertyGenerator( - requirement, - this.selectedPipeline.eventSchema.eventProperties, - ).computeMatchingProperties(); - } - if ( - sp instanceof FreeTextStaticProperty && - sp.internalName === WidgetConfigBuilder.TITLE_KEY - ) { - sp.value = this.selectedPipeline.measureName; - } - }); - this.next(); - } - - findRequirement(requiredSchema: EventSchema, internalName: string) { - return requiredSchema.eventProperties.find( - ep => ep.runtimeName === internalName, - ); - } - - loadAvailableWidgets() { - this.availableWidgets = WidgetRegistry.getCompatibleWidgetTemplates( - this.selectedPipeline, - ); - this.availableWidgets.sort((a, b) => { - return a.widgetLabel < b.widgetLabel ? -1 : 1; - }); - } - - next() { - if (this.page === 'select-pipeline') { - this.loadAvailableWidgets(); - this.page = 'select-widget'; - } else if (this.page === 'select-widget') { - this.page = 'configure-widget'; - } else { - const configuredWidget: DashboardWidgetModel = - new DashboardWidgetModel(); - configuredWidget['@class'] = - 'org.apache.streampipes.model.dashboard.DashboardWidgetModel'; - configuredWidget.dashboardWidgetSettings = this.selectedWidget; - configuredWidget.dashboardWidgetSettings['@class'] = - 'org.apache.streampipes.model.dashboard.DashboardWidgetSettings'; - configuredWidget.visualizationName = - this.selectedPipeline.measureName; - configuredWidget.pipelineId = this.selectedPipeline.pipelineId; - configuredWidget.widgetType = - configuredWidget.dashboardWidgetSettings.widgetName; - if (!this.editMode) { - this.dashboardService - .saveWidget(configuredWidget) - .subscribe(response => { - this.dialogRef.close(response); - }); - } else { - configuredWidget.elementId = this.widget.elementId; - configuredWidget.rev = this.widget.rev; - configuredWidget.widgetId = this.widget.widgetId; - this.dialogRef.close(configuredWidget); - } - } - } - - back() { - if (this.page === 'select-widget') { - this.page = 'select-pipeline'; - } else if (this.page === 'configure-widget') { - this.loadAvailableWidgets(); - this.page = 'select-widget'; - } - } - - iconText(s) { - return this.elementIconText.getElementIconText(s); - } -} diff --git a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.html b/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.html deleted file mode 100644 index bd4ee231e4..0000000000 --- a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.html +++ /dev/null @@ -1,92 +0,0 @@ - - -
-
-
-
- - Dashboard Name - - - - Description - - - Show name and description in dashboard - -
- - Use same update frequency for all widgets (will override - widget-specific intervals) - - - - Refresh interval (seconds) - - -
-
-
-
- -
- - -
-
diff --git a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.scss b/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.scss deleted file mode 100644 index 4afad74a89..0000000000 --- a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.scss +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -@import '../../../../scss/sp/sp-dialog.scss'; - -.element-margin { - margin-top: 10px; - margin-bottom: 10px; -} - -.mat-radio-button { - padding: 10px; -} - -.mr-10 { - margin-right: 10px; -} diff --git a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts b/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts deleted file mode 100644 index 3863992b38..0000000000 --- a/ui/src/app/dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component.ts +++ /dev/null @@ -1,55 +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, Input } from '@angular/core'; -import { Dashboard, DashboardService } from '@streampipes/platform-services'; -import { DialogRef } from '@streampipes/shared-ui'; - -@Component({ - selector: 'sp-edit-dashboard-dialog-component', - templateUrl: './edit-dashboard-dialog.component.html', - styleUrls: ['./edit-dashboard-dialog.component.scss'], -}) -export class EditDashboardDialogComponent { - @Input() - createMode: boolean; - - @Input() - dashboard: Dashboard; - - constructor( - public dialogRef: DialogRef, - private dashboardService: DashboardService, - ) {} - - onCancel(): void { - this.dialogRef.close(); - } - - onSave(): void { - if (this.createMode) { - this.dashboardService - .saveDashboard(this.dashboard) - .subscribe(result => this.onCancel()); - } else { - this.dashboardService - .updateDashboard(this.dashboard) - .subscribe(result => this.onCancel()); - } - } -} diff --git a/ui/src/app/dashboard/models/multi-series.model.ts b/ui/src/app/dashboard/models/multi-series.model.ts deleted file mode 100644 index a105ed64f8..0000000000 --- a/ui/src/app/dashboard/models/multi-series.model.ts +++ /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. - * - */ - -export interface MultiSeries { - name?: string; - series?: MultiSeriesEntry[]; -} - -export interface MultiSeriesEntry { - name: string; - value: any; -} diff --git a/ui/src/app/dashboard/registry/widget-config-builder.ts b/ui/src/app/dashboard/registry/widget-config-builder.ts deleted file mode 100644 index 8d41d608c7..0000000000 --- a/ui/src/app/dashboard/registry/widget-config-builder.ts +++ /dev/null @@ -1,276 +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 { CollectedSchemaRequirements } from '../sdk/collected-schema-requirements'; -import { Tuple2 } from '../../core-model/base/Tuple2'; -import { - ColorPickerStaticProperty, - DashboardWidgetSettings, - DataType, - FreeTextStaticProperty, - OneOfStaticProperty, - Option, - StaticProperty, -} from '@streampipes/platform-services'; - -export class WidgetConfigBuilder { - static readonly BACKGROUND_COLOR_KEY: string = 'spi-background-color-key'; - static readonly PRIMARY_TEXT_COLOR_KEY: string = - 'spi-primary-text-color-key'; - static readonly SECONDARY_TEXT_COLOR_KEY: string = - 'spi-secondary-text-color-key'; - static readonly REFRESH_INTERVAL_KEY: string = 'spi-refresh-interval-key'; - static readonly QUERY_LIMIT_KEY: string = 'spi-query-limit-key'; - - static readonly TITLE_KEY: string = 'spi-title-key'; - - private widget: DashboardWidgetSettings; - - private constructor( - widgetName: string, - widgetLabel: string, - withColors?: boolean, - withTitlePanel?: boolean, - ) { - this.widget = new DashboardWidgetSettings(); - this.widget.widgetLabel = widgetLabel; - this.widget.widgetName = widgetName; - this.widget.config = []; - if (withTitlePanel) { - this.requiredTextParameter( - WidgetConfigBuilder.TITLE_KEY, - 'Widget title', - 'The title of the widget', - ); - } - if (withColors) { - this.requiredColorParameter( - WidgetConfigBuilder.BACKGROUND_COLOR_KEY, - 'Background color', - 'The background' + ' color', - '#1B1464', - ); - this.requiredColorParameter( - WidgetConfigBuilder.PRIMARY_TEXT_COLOR_KEY, - 'Primary text color', - 'The' + ' primary text color', - '#FFFFFF', - ); - this.requiredColorParameter( - WidgetConfigBuilder.SECONDARY_TEXT_COLOR_KEY, - 'Secondary text color', - 'The' + ' secondary text' + ' color', - '#39B54A', - ); - } - this.requiredIntegerParameter( - WidgetConfigBuilder.REFRESH_INTERVAL_KEY, - 'Refresh interval [seconds]', - 'The interval in seconds in which new data should be fetched', - 5, - ); - } - - static create( - widgetName: string, - widgetLabel: string, - ): WidgetConfigBuilder { - return new WidgetConfigBuilder(widgetName, widgetLabel); - } - - static createWithSelectableColors( - widgetName: string, - widgetLabel: string, - ): WidgetConfigBuilder { - return new WidgetConfigBuilder(widgetName, widgetLabel, true); - } - - static createWithSelectableColorsAndTitlePanel( - widgetName: string, - widgetLabel: string, - ): WidgetConfigBuilder { - return new WidgetConfigBuilder(widgetName, widgetLabel, true, true); - } - - withDescription(description: string): WidgetConfigBuilder { - this.widget.widgetDescription = description; - return this; - } - - withIcon(fontAwesomeIconName: string): WidgetConfigBuilder { - this.widget.widgetIconName = fontAwesomeIconName; - return this; - } - - withNumberOfPastEvents(): WidgetConfigBuilder { - const fst: FreeTextStaticProperty = this.prepareFreeTextStaticProperty( - WidgetConfigBuilder.QUERY_LIMIT_KEY, - 'Past data', - 'The number of historic events that should be shown', - DataType.INTEGER, - ); - fst.value = '50'; - this.widget.config.push(fst); - - return this; - } - - requiredTextParameter( - id: string, - label: string, - description: string, - ): WidgetConfigBuilder { - const fst: FreeTextStaticProperty = this.prepareFreeTextStaticProperty( - id, - label, - description, - DataType.STRING, - ); - this.widget.config.push(fst); - return this; - } - - requiredColorParameter( - id: string, - label: string, - description: string, - defaultColor?: string, - ): WidgetConfigBuilder { - const csp = new ColorPickerStaticProperty(); - csp['@class'] = - 'org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty'; - csp.internalName = id; - csp.label = label; - csp.description = description; - if (defaultColor) { - csp.selectedColor = defaultColor; - } - this.widget.config.push(csp); - return this; - } - - requiredIntegerParameter( - id: string, - label: string, - description: string, - defaultValue?: number, - ): WidgetConfigBuilder { - const fst: FreeTextStaticProperty = this.prepareFreeTextStaticProperty( - id, - label, - description, - DataType.INTEGER, - ); - if (defaultValue) { - fst.value = defaultValue.toString(); - } - this.widget.config.push(fst); - return this; - } - - requiredSingleValueSelection( - id: string, - label: string, - description: string, - options: Tuple2[], - ): WidgetConfigBuilder { - const osp: OneOfStaticProperty = new OneOfStaticProperty(); - this.prepareStaticProperty( - id, - label, - description, - osp, - 'org.apache.streampipes.model.staticproperty.OneOfStaticProperty', - ); - - osp.options = []; - options.forEach(o => { - const option = new Option(); - option['@class'] = - 'org.apache.streampipes.model.staticproperty.Option'; - option.name = o.a; - option.internalName = o.b; - osp.options.push(option); - }); - this.widget.config.push(osp); - return this; - } - - requiredFloatParameter( - id: string, - label: string, - description: string, - ): WidgetConfigBuilder { - const fst: FreeTextStaticProperty = this.prepareFreeTextStaticProperty( - id, - label, - description, - DataType.FLOAT, - ); - this.widget.config.push(fst); - return this; - } - - requiredSchema( - collectedSchemaRequirements: CollectedSchemaRequirements, - ): WidgetConfigBuilder { - this.widget.requiredSchema = - collectedSchemaRequirements.getEventSchema(); - this.widget.config = this.widget.config.concat( - collectedSchemaRequirements.getRequiredMappingProperties(), - ); - - return this; - } - - prepareStaticProperty( - id: string, - label: string, - description: string, - sp: StaticProperty, - targetClass: any, - ) { - sp.internalName = id; - sp.label = label; - sp.description = description; - sp['@class'] = targetClass; - } - - prepareFreeTextStaticProperty( - id: string, - label: string, - description: string, - datatype: string, - ) { - const fst: FreeTextStaticProperty = new FreeTextStaticProperty(); - this.prepareStaticProperty( - id, - label, - description, - fst, - 'org.apache.streampipes.model.staticproperty.FreeTextStaticProperty', - ); - fst.requiredDatatype = datatype; - - return fst; - } - - build(): DashboardWidgetSettings { - return this.widget; - } -} diff --git a/ui/src/app/dashboard/registry/widget-registry.ts b/ui/src/app/dashboard/registry/widget-registry.ts deleted file mode 100644 index 6f5fce6253..0000000000 --- a/ui/src/app/dashboard/registry/widget-registry.ts +++ /dev/null @@ -1,80 +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 { AreaConfig } from '../components/widgets/area/area-config'; -import { WidgetConfig } from '../components/widgets/base/base-config'; -import { GaugeConfig } from '../components/widgets/gauge/gauge-config'; -import { HtmlConfig } from '../components/widgets/html/html-config'; -import { ImageConfig } from '../components/widgets/image/image-config'; -import { LineConfig } from '../components/widgets/line/line-config'; -import { MapConfig } from '../components/widgets/map/map-config'; -import { NumberConfig } from '../components/widgets/number/number-config'; -import { RawConfig } from '../components/widgets/raw/raw-config'; -import { TableConfig } from '../components/widgets/table/table-config'; -import { TrafficLightConfig } from '../components/widgets/trafficlight/traffic-light-config'; -import { SchemaMatch } from '../sdk/matching/schema-match'; -import { - DashboardWidgetSettings, - DataLakeMeasure, - EventSchema, -} from '@streampipes/platform-services'; -import { WordCloudConfig } from '../components/widgets/wordcloud/wordcloud-config'; -import { StatusWidgetConfig } from '../components/widgets/status/status-config'; -import { BarRaceConfig } from '../components/widgets/bar-race/bar-race-config'; -import { StackedLineChartConfig } from '../components/widgets/stacked-line-chart/stacked-line-chart-config'; - -export class WidgetRegistry { - private static availableWidgets: WidgetConfig[] = [ - new BarRaceConfig(), - new NumberConfig(), - new LineConfig(), - new TableConfig(), - new GaugeConfig(), - new ImageConfig(), - new AreaConfig(), - new MapConfig(), - new RawConfig(), - new StackedLineChartConfig(), - new HtmlConfig(), - new StatusWidgetConfig(), - new TrafficLightConfig(), - new WordCloudConfig(), - ]; - - static getAvailableWidgetTemplates(): DashboardWidgetSettings[] { - const widgetTemplates = new Array(); - this.availableWidgets.forEach(widget => - widgetTemplates.push(widget.getConfig()), - ); - return widgetTemplates; - } - - static getCompatibleWidgetTemplates(dataLakeMeasure: DataLakeMeasure) { - const inputSchema: EventSchema = dataLakeMeasure.eventSchema; - return this.getAvailableWidgetTemplates().filter(widget => - WidgetRegistry.isCompatible(widget, inputSchema), - ); - } - - static isCompatible( - widget: DashboardWidgetSettings, - inputSchema: EventSchema, - ) { - return new SchemaMatch().match(widget.requiredSchema, inputSchema); - } -} diff --git a/ui/src/app/dashboard/sdk/collected-schema-requirements.ts b/ui/src/app/dashboard/sdk/collected-schema-requirements.ts deleted file mode 100644 index 63c3fa034a..0000000000 --- a/ui/src/app/dashboard/sdk/collected-schema-requirements.ts +++ /dev/null @@ -1,42 +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 { - EventPropertyUnion, - EventSchema, - StaticPropertyUnion, -} from '@streampipes/platform-services'; - -export class CollectedSchemaRequirements { - constructor( - private requiredEventProperties: EventPropertyUnion[], - private requiredMappingProperties: StaticPropertyUnion[], - ) {} - - getEventSchema(): EventSchema { - const eventSchema = new EventSchema(); - eventSchema['@class'] = - 'org.apache.streampipes.model.schema.EventSchema'; - eventSchema.eventProperties = this.requiredEventProperties; - return eventSchema; - } - - getRequiredMappingProperties(): StaticPropertyUnion[] { - return this.requiredMappingProperties; - } -} diff --git a/ui/src/app/dashboard/sdk/ep-requirements.ts b/ui/src/app/dashboard/sdk/ep-requirements.ts deleted file mode 100644 index 58b830c43f..0000000000 --- a/ui/src/app/dashboard/sdk/ep-requirements.ts +++ /dev/null @@ -1,118 +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 { DataType } from '@streampipes/platform-services'; -import { - EventPropertyList, - EventPropertyNested, - EventPropertyPrimitive, - EventPropertyUnion, - SemanticType, -} from '@streampipes/platform-services'; - -export class EpRequirements { - private static ep(): EventPropertyPrimitive { - const ep = new EventPropertyPrimitive(); - ep['@class'] = - 'org.apache.streampipes.model.schema.EventPropertyPrimitive'; - return ep; - } - - private static listEp(): EventPropertyList { - const ep = new EventPropertyList(); - ep['@class'] = 'org.apache.streampipes.model.schema.EventPropertyList'; - return ep; - } - - private static nestedEp(): EventPropertyNested { - const ep = new EventPropertyNested(); - ep['@class'] = - 'org.apache.streampipes.model.schema.EventPropertyNested'; - return ep; - } - - static anyProperty(): EventPropertyUnion { - return EpRequirements.ep(); - } - - static imageReq(): EventPropertyUnion { - return EpRequirements.domainPropertyReq(SemanticType.IMAGE); - } - - static latitudeReq(): EventPropertyUnion { - return EpRequirements.domainPropertyReq(SemanticType.GEO_LAT); - } - - static longitudeReq(): EventPropertyUnion { - return EpRequirements.domainPropertyReq(SemanticType.GEO_LONG); - } - - static timestampReq(): EventPropertyUnion { - return EpRequirements.domainPropertyReq(SemanticType.TIMESTAMP); - } - - static numberReq(): EventPropertyUnion { - return EpRequirements.datatypeReq(SemanticType.SO_NUMBER); - } - - static stringReq(): EventPropertyUnion { - return EpRequirements.datatypeReq(DataType.STRING); - } - - static integerReq(): EventPropertyUnion { - return EpRequirements.datatypeReq(DataType.INTEGER); - } - - static listReq(): EventPropertyList { - return EpRequirements.listEp(); - } - - static nestedReq( - propertyRequirement: EventPropertyUnion, - ): EventPropertyNested { - const nestedEp: EventPropertyNested = this.nestedEp(); - - nestedEp.eventProperties = [propertyRequirement]; - - return nestedEp; - } - - static nestedListReq( - propertyRequirement: EventPropertyUnion, - ): EventPropertyList { - const nestedEp: EventPropertyNested = - this.nestedReq(propertyRequirement); - - const listEp: EventPropertyList = this.listReq(); - listEp.eventProperty = nestedEp; - - return listEp; - } - - static domainPropertyReq(semanticType: string): EventPropertyPrimitive { - const eventProperty = EpRequirements.ep(); - eventProperty.semanticType = semanticType; - return eventProperty; - } - - static datatypeReq(datatype: string): EventPropertyPrimitive { - const eventProperty = EpRequirements.ep(); - eventProperty.runtimeType = datatype; - return eventProperty; - } -} diff --git a/ui/src/app/dashboard/sdk/extractor/static-property-extractor.ts b/ui/src/app/dashboard/sdk/extractor/static-property-extractor.ts deleted file mode 100644 index 6d5eeb60df..0000000000 --- a/ui/src/app/dashboard/sdk/extractor/static-property-extractor.ts +++ /dev/null @@ -1,109 +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 { - ColorPickerStaticProperty, - EventPropertyUnion, - EventSchema, - FreeTextStaticProperty, - MappingPropertyNary, - MappingPropertyUnary, - OneOfStaticProperty, - StaticPropertyUnion, -} from '@streampipes/platform-services'; - -export class StaticPropertyExtractor { - constructor( - private inputSchema: EventSchema, - private staticProperties: StaticPropertyUnion[], - ) {} - - hasStaticProperty(internalId: string): boolean { - return this.getStaticPropertyByName(internalId) !== undefined; - } - - mappingPropertyValue(internalId: string): string { - const sp: MappingPropertyUnary = this.getStaticPropertyByName( - internalId, - ) as MappingPropertyUnary; - return this.removePrefix(sp.selectedProperty); - } - - mappingPropertyValues(internalId: string): string[] { - const sp: MappingPropertyNary = this.getStaticPropertyByName( - internalId, - ) as MappingPropertyNary; - const properties: string[] = []; - // TODO this quick-fixes a deserialization bug in Tson-LD - if (sp.selectedProperties && !Array.isArray(sp.selectedProperties)) { - const value: string = sp.selectedProperties as any; - sp.selectedProperties = [value]; - } - if (sp.selectedProperties) { - sp.selectedProperties.forEach(ep => { - properties.push(this.removePrefix(ep)); - }); - } - return properties; - } - - singleValueParameter(internalId: string): any { - const sp: FreeTextStaticProperty = this.getStaticPropertyByName( - internalId, - ) as FreeTextStaticProperty; - return sp.value; - } - - selectedColor(internalId: string): any { - const sp: ColorPickerStaticProperty = this.getStaticPropertyByName( - internalId, - ) as ColorPickerStaticProperty; - return sp.selectedColor; - } - - selectedSingleValue(internalId: string): string { - const sp: OneOfStaticProperty = this.getStaticPropertyByName( - internalId, - ) as OneOfStaticProperty; - return sp.options.find(o => o.selected).name; - } - - stringParameter(internalId: string): string { - return this.singleValueParameter(internalId) as string; - } - - integerParameter(internalId: string): number { - return this.singleValueParameter(internalId) as number; - } - - getStaticPropertyByName(internalId: string): StaticPropertyUnion { - return this.staticProperties.find(sp => sp.internalName === internalId); - } - - getEventPropertyByName(runtimeName: string): EventPropertyUnion { - return this.inputSchema.eventProperties.find( - ep => ep.runtimeName === runtimeName, - ); - } - - removePrefix(propertyValue: string) { - return propertyValue.split('::').length > 1 - ? propertyValue.split('::')[1] - : propertyValue; - } -} diff --git a/ui/src/app/dashboard/sdk/matching/datatype-match.ts b/ui/src/app/dashboard/sdk/matching/datatype-match.ts deleted file mode 100644 index 2d46b9079f..0000000000 --- a/ui/src/app/dashboard/sdk/matching/datatype-match.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { DataType, SemanticType } from '@streampipes/platform-services'; - -export class DatatypeMatch { - match(datatypeRequirement: string, datatypeOffer: string) { - if (datatypeRequirement === undefined) { - return true; - } else { - return ( - datatypeRequirement === datatypeOffer || - this.subClassOf(datatypeOffer, datatypeRequirement) - ); - } - } - - subClassOf(offer: string, requirement: string): boolean { - if (!(requirement === SemanticType.SO_NUMBER)) { - return false; - } else { - if ( - offer === DataType.INTEGER || - offer === DataType.LONG || - offer === DataType.DOUBLE || - offer === DataType.FLOAT - ) { - return true; - } - } - return false; - } -} diff --git a/ui/src/app/dashboard/sdk/matching/domain-property-match.ts b/ui/src/app/dashboard/sdk/matching/domain-property-match.ts deleted file mode 100644 index 92c9c1f5e7..0000000000 --- a/ui/src/app/dashboard/sdk/matching/domain-property-match.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. - * - */ - -export class DomainPropertyMatch { - match(domainPropertyRequirement: string, domainPropertyOffer: string) { - if ( - domainPropertyRequirement === undefined || - domainPropertyRequirement === '' - ) { - return true; - } else { - if (!domainPropertyOffer) { - return false; - } else { - return domainPropertyRequirement === domainPropertyOffer; - } - } - } -} diff --git a/ui/src/app/dashboard/sdk/matching/list-property-match.ts b/ui/src/app/dashboard/sdk/matching/list-property-match.ts deleted file mode 100644 index 4125e3052a..0000000000 --- a/ui/src/app/dashboard/sdk/matching/list-property-match.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - EventPropertyList, - EventPropertyPrimitive, -} from '@streampipes/platform-services'; -import { PrimitivePropertyMatch } from './primitive-property-match'; - -export class ListPropertyMatch { - match(requirement: EventPropertyList, offer: EventPropertyList): boolean { - return new PrimitivePropertyMatch().match( - requirement.eventProperty as EventPropertyPrimitive, - offer.eventProperty as EventPropertyPrimitive, - ); - } -} diff --git a/ui/src/app/dashboard/sdk/matching/mapping-property-generator.ts b/ui/src/app/dashboard/sdk/matching/mapping-property-generator.ts deleted file mode 100644 index d7e32aa6ea..0000000000 --- a/ui/src/app/dashboard/sdk/matching/mapping-property-generator.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { PropertyMatch } from './property-match'; -import { EventPropertyUnion } from '@streampipes/platform-services'; - -export class MappingPropertyGenerator { - private selector = 's0'; - private separator = '::'; - - constructor( - private requiredEventProperty: EventPropertyUnion, - private providedEventProperties: EventPropertyUnion[], - ) {} - - computeMatchingProperties(): string[] { - const mapsFromOptions: string[] = []; - - this.providedEventProperties.forEach(ep => { - if (new PropertyMatch().match(this.requiredEventProperty, ep)) { - mapsFromOptions.push(this.makeSelector(ep.runtimeName)); - } - }); - - return mapsFromOptions; - } - - makeSelector(runtimeName: string): string { - return this.selector + this.separator + runtimeName; - } -} diff --git a/ui/src/app/dashboard/sdk/matching/primitive-property-match.ts b/ui/src/app/dashboard/sdk/matching/primitive-property-match.ts deleted file mode 100644 index 8ecb8ebe81..0000000000 --- a/ui/src/app/dashboard/sdk/matching/primitive-property-match.ts +++ /dev/null @@ -1,40 +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 { DatatypeMatch } from './datatype-match'; -import { DomainPropertyMatch } from './domain-property-match'; -import { EventPropertyPrimitive } from '@streampipes/platform-services'; - -export class PrimitivePropertyMatch { - match(requirement: EventPropertyPrimitive, offer: EventPropertyPrimitive) { - if (requirement !== undefined) { - return ( - new DatatypeMatch().match( - requirement.runtimeType, - offer.runtimeType, - ) && - new DomainPropertyMatch().match( - requirement.semanticType, - offer.semanticType, - ) - ); - } else { - return true; - } - } -} diff --git a/ui/src/app/dashboard/sdk/matching/property-match.ts b/ui/src/app/dashboard/sdk/matching/property-match.ts deleted file mode 100644 index a9e6c043ad..0000000000 --- a/ui/src/app/dashboard/sdk/matching/property-match.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { PrimitivePropertyMatch } from './primitive-property-match'; -import { - EventPropertyList, - EventPropertyPrimitive, - EventPropertyUnion, -} from '@streampipes/platform-services'; -import { ListPropertyMatch } from './list-property-match'; - -export class PropertyMatch { - match(requirement: EventPropertyUnion, offer: EventPropertyUnion): boolean { - if ( - requirement instanceof EventPropertyPrimitive && - offer instanceof EventPropertyPrimitive - ) { - return new PrimitivePropertyMatch().match(requirement, offer); - } else if ( - requirement instanceof EventPropertyList && - offer instanceof EventPropertyList - ) { - return new ListPropertyMatch().match(requirement, offer); - } - } -} diff --git a/ui/src/app/dashboard/sdk/matching/schema-match.ts b/ui/src/app/dashboard/sdk/matching/schema-match.ts deleted file mode 100644 index c96d4c0428..0000000000 --- a/ui/src/app/dashboard/sdk/matching/schema-match.ts +++ /dev/null @@ -1,29 +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 '@streampipes/platform-services'; -import { PropertyMatch } from './property-match'; - -export class SchemaMatch { - match(requirement: EventSchema, offer: EventSchema): boolean { - return requirement.eventProperties.every(req => - offer.eventProperties.some(of => - new PropertyMatch().match(req, of), - ), - ); - } -} diff --git a/ui/src/app/dashboard/sdk/schema-requirements-builder.ts b/ui/src/app/dashboard/sdk/schema-requirements-builder.ts deleted file mode 100644 index fdeb7eeb8a..0000000000 --- a/ui/src/app/dashboard/sdk/schema-requirements-builder.ts +++ /dev/null @@ -1,102 +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 { CollectedSchemaRequirements } from './collected-schema-requirements'; -import { - EventPropertyUnion, - MappingPropertyNary, - MappingPropertyUnary, - StaticPropertyUnion, -} from '@streampipes/platform-services'; - -export class SchemaRequirementsBuilder { - private requiredEventProperties: EventPropertyUnion[]; - private staticProperties: StaticPropertyUnion[]; - - private constructor() { - this.requiredEventProperties = []; - this.staticProperties = []; - } - - static create(): SchemaRequirementsBuilder { - return new SchemaRequirementsBuilder(); - } - - requiredPropertyWithUnaryMapping( - internalId: string, - label: string, - description: string, - eventProperty: EventPropertyUnion, - ): SchemaRequirementsBuilder { - eventProperty.runtimeName = internalId; - const mp = this.makeMappingProperty( - internalId, - label, - description, - new MappingPropertyUnary(), - 'org.apache.streampipes.model.staticproperty.MappingPropertyUnary', - ); - - this.staticProperties.push(mp); - this.requiredEventProperties.push(eventProperty); - - return this; - } - - requiredPropertyWithNaryMapping( - internalId: string, - label: string, - description: string, - eventProperty: EventPropertyUnion, - ): SchemaRequirementsBuilder { - eventProperty.runtimeName = internalId; - const mp = this.makeMappingProperty( - internalId, - label, - description, - new MappingPropertyNary(), - 'org.apache.streampipes.model.staticproperty.MappingPropertyNary', - ); - - this.staticProperties.push(mp); - this.requiredEventProperties.push(eventProperty); - - return this; - } - - makeMappingProperty( - internalId: string, - label: string, - description: string, - sp: StaticPropertyUnion, - className: any, - ): StaticPropertyUnion { - sp.internalName = internalId; - sp.label = label; - sp.description = description; - sp['@class'] = className; - return sp; - } - - build() { - return new CollectedSchemaRequirements( - this.requiredEventProperties, - this.staticProperties, - ); - } -} diff --git a/ui/src/app/dashboard/services/edit-mode.service.ts b/ui/src/app/dashboard/services/edit-mode.service.ts deleted file mode 100644 index eafc66d5ae..0000000000 --- a/ui/src/app/dashboard/services/edit-mode.service.ts +++ /dev/null @@ -1,29 +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 { Subject } from 'rxjs'; -import { Injectable } from '@angular/core'; - -@Injectable({ providedIn: 'root' }) -export class EditModeService { - public editModeSubject: Subject = new Subject(); - - public notify(editMode: boolean): void { - this.editModeSubject.next(editMode); - } -} diff --git a/ui/src/app/dashboard/services/refresh-dashboard.service.ts b/ui/src/app/dashboard/services/refresh-dashboard.service.ts deleted file mode 100644 index 8506b9c51b..0000000000 --- a/ui/src/app/dashboard/services/refresh-dashboard.service.ts +++ /dev/null @@ -1,29 +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 { Injectable } from '@angular/core'; -import { Subject } from 'rxjs'; - -@Injectable({ providedIn: 'root' }) -export class RefreshDashboardService { - public refreshSubject: Subject = new Subject(); - - public notify(currentDashboard: string): void { - this.refreshSubject.next(currentDashboard); - } -} diff --git a/ui/src/app/dashboard/services/reload-pipeline.service.ts b/ui/src/app/dashboard/services/reload-pipeline.service.ts deleted file mode 100644 index b399dbf8ae..0000000000 --- a/ui/src/app/dashboard/services/reload-pipeline.service.ts +++ /dev/null @@ -1,29 +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 { Subject } from 'rxjs'; -import { Injectable } from '@angular/core'; - -@Injectable({ providedIn: 'root' }) -export class ReloadPipelineService { - public reloadPipelineSubject: Subject = new Subject(); - - public notify(): void { - this.reloadPipelineSubject.next(); - } -} diff --git a/ui/src/app/dashboard/services/resize.service.ts b/ui/src/app/dashboard/services/resize.service.ts deleted file mode 100644 index 5f42267580..0000000000 --- a/ui/src/app/dashboard/services/resize.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Subject } from 'rxjs'; -import { Injectable } from '@angular/core'; -import { GridsterInfo } from '../models/gridster-info.model'; - -@Injectable({ providedIn: 'root' }) -export class ResizeService { - public resizeSubject: Subject = new Subject(); - - public notify(info: GridsterInfo): void { - this.resizeSubject.next(info); - } -} diff --git a/ui/src/app/dashboard/models/gridster-info.model.ts b/ui/src/app/data-explorer-shared/models/gridster-info.model.ts similarity index 91% rename from ui/src/app/dashboard/models/gridster-info.model.ts rename to ui/src/app/data-explorer-shared/models/gridster-info.model.ts index 703486767e..58af6d1329 100644 --- a/ui/src/app/dashboard/models/gridster-info.model.ts +++ b/ui/src/app/data-explorer-shared/models/gridster-info.model.ts @@ -22,9 +22,3 @@ export interface GridsterInfo { gridsterItem: GridsterItem; gridsterItemComponent: GridsterItemComponent; } - -export interface WidgetInfo { - width: number; - height: number; - id: string; -} diff --git a/ui/src/app/data-explorer-shared/services/resize.service.ts b/ui/src/app/data-explorer-shared/services/resize.service.ts index 2a93c62e16..f0821b9065 100644 --- a/ui/src/app/data-explorer-shared/services/resize.service.ts +++ b/ui/src/app/data-explorer-shared/services/resize.service.ts @@ -18,7 +18,7 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; -import { GridsterInfo } from '../../dashboard/models/gridster-info.model'; +import { GridsterInfo } from '../models/gridster-info.model'; @Injectable({ providedIn: 'root' }) export class ResizeService { diff --git a/ui/src/app/data-explorer/components/widget-view/grid-view/data-explorer-dashboard-grid.component.ts b/ui/src/app/data-explorer/components/widget-view/grid-view/data-explorer-dashboard-grid.component.ts index f43c455fc7..cb37cae1b4 100644 --- a/ui/src/app/data-explorer/components/widget-view/grid-view/data-explorer-dashboard-grid.component.ts +++ b/ui/src/app/data-explorer/components/widget-view/grid-view/data-explorer-dashboard-grid.component.ts @@ -25,7 +25,7 @@ import { ViewChildren, } from '@angular/core'; import { GridsterItemComponent, GridType } from 'angular-gridster2'; -import { GridsterInfo } from '../../../../dashboard/models/gridster-info.model'; +import { GridsterInfo } from '../../../../data-explorer-shared/models/gridster-info.model'; import { IDataViewDashboardConfig } from '../../../../data-explorer-shared/models/dataview-dashboard.model'; import { ResizeService } from '../../../../data-explorer-shared/services/resize.service'; import { DataViewDataExplorerService } from '@streampipes/platform-services';