You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/07/31 21:20:30 UTC

[incubator-streampipes] 04/06: [STREAMPIPES-545] Support data source links

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

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

commit bfa035132ec3cf41359d2f7b5c65a15bb8e7b046
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Jul 31 11:21:51 2022 +0200

    [STREAMPIPES-545] Support data source links
---
 .../setup/tasks/CreateAssetLinkTypeTask.java       |  4 ++--
 .../edit-asset-link-dialog.component.html          | 12 +++++++++++
 .../edit-asset-link-dialog.component.ts            | 24 ++++++++++++++++++----
 ui/src/scss/_variables.scss                        |  3 ++-
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/tasks/CreateAssetLinkTypeTask.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/tasks/CreateAssetLinkTypeTask.java
index 46bdc13bf..a16f86291 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/tasks/CreateAssetLinkTypeTask.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/tasks/CreateAssetLinkTypeTask.java
@@ -34,9 +34,9 @@ public class CreateAssetLinkTypeTask implements InstallationTask {
     new AssetLinkType("data-view", "Data View", "var(--color-data-view)", "search", "data-view", List.of("dataexplorer"), true),
     new AssetLinkType("dashboard", "Dashboard", "var(--color-dashboard)", "insert_chart", "dashboard", List.of("dashboard"), true),
     new AssetLinkType("adapter", "Adapter", "var(--color-adapter)", "power", "adapter", List.of("connect"), true),
-    new AssetLinkType("data-source", "Data Source", "var(--color-data-source)", "", "data-source", List.of(), false),
+    new AssetLinkType("data-source", "Data Source", "var(--color-data-source)", "dataset", "data-source", List.of(), false),
     new AssetLinkType("pipeline", "Pipeline", "var(--color-pipeline)", "play_arrow", "pipeline", List.of("pipeline", "details"), true),
-    new AssetLinkType("measurement", "Data Lake Storage", "var(--color-measurement)", "", "measurement", List.of(), false)
+    new AssetLinkType("measurement", "Data Lake Storage", "var(--color-measurement)", "folder", "measurement", List.of(), false)
   );
 
   @Override
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
index 8e1c77df1..b723edd0e 100644
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
+++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
@@ -41,6 +41,18 @@
                     </mat-select>
                 </mat-form-field>
             </div>
+            <div *ngIf="selectedLinkType.linkQueryHint === 'data-source'" fxLayout="column" class="link-configuration">
+                <mat-form-field color="accent" fxFlex="100">
+                    <mat-label>Data Source</mat-label>
+                    <mat-select (selectionChange)="changeLabel($event.value.elementId, $event.value.name, $event.value)"
+                                [(value)]="currentResource"
+                                fxFlex
+                                required>
+                        <mat-option *ngFor="let source of dataSources"
+                                    [value]="source">{{source.name}}</mat-option>
+                    </mat-select>
+                </mat-form-field>
+            </div>
             <div *ngIf="selectedLinkType.linkQueryHint === 'dashboard'" fxLayout="column" class="link-configuration">
                 <mat-form-field color="accent" fxFlex="100">
                     <mat-label>Dashboards</mat-label>
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 ff14435ad..ee42b9f4f 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
@@ -32,6 +32,11 @@ import {
 import { FormGroup } from '@angular/forms';
 import { zip } from 'rxjs';
 import { MatSelectChange } from '@angular/material/select';
+import {
+  AdapterDescriptionUnion,
+  SpDataStream
+} from '../../../../../projects/streampipes/platform-services/src/lib/model/gen/streampipes-model';
+import { PipelineElementService } from '../../../../../projects/streampipes/platform-services/src/lib/apis/pipeline-element.service';
 
 @Component({
   selector: 'sp-edit-asset-link-dialog-component',
@@ -58,6 +63,8 @@ export class EditAssetLinkDialogComponent implements OnInit {
   dataViews: Dashboard[];
   dashboards: Dashboard[];
   dataLakeMeasures: DataLakeMeasure[];
+  dataSources: SpDataStream[];
+  adapters: AdapterDescriptionUnion[];
 
   allResources: any[] = [];
   currentResource: any;
@@ -69,7 +76,8 @@ export class EditAssetLinkDialogComponent implements OnInit {
               private pipelineService: PipelineService,
               private dataViewService: DataViewDataExplorerService,
               private dashboardService: DashboardService,
-              private dataLakeService: DatalakeRestService) {
+              private dataLakeService: DatalakeRestService,
+              private pipelineElementService: PipelineElementService) {
   }
 
   ngOnInit(): void {
@@ -96,13 +104,21 @@ export class EditAssetLinkDialogComponent implements OnInit {
       this.pipelineService.getOwnPipelines(),
       this.dataViewService.getDataViews(),
       this.dashboardService.getDashboards(),
+      this.pipelineElementService.getDataStreams(),
       this.dataLakeService.getAllMeasurementSeries()).subscribe(response => {
       this.pipelines = response[0];
       this.dataViews = response[1];
       this.dashboards = response[2];
-      this.dataLakeMeasures = response[3];
-
-      this.allResources = [...this.pipelines, ...this.dataViews, ...this.dashboards, ...this.dataLakeMeasures];
+      this.dataSources = response[3];
+      this.dataLakeMeasures = response[4];
+
+      this.allResources = [
+        ...this.pipelines,
+        ...this.dataViews,
+        ...this.dashboards,
+        ...this.dataSources,
+        ...this.dataLakeMeasures
+      ];
       if (!this.createMode) {
         this.currentResource = this.allResources.find(r => r._id === this.clonedAssetLink.resourceId ||
           r.elementId === this.clonedAssetLink.resourceId);
diff --git a/ui/src/scss/_variables.scss b/ui/src/scss/_variables.scss
index 4ede67f5c..190b27ac2 100644
--- a/ui/src/scss/_variables.scss
+++ b/ui/src/scss/_variables.scss
@@ -34,7 +34,8 @@ body {
   --color-data-view: rgb(122, 206, 227);
   --color-dashboard: rgb(76, 115, 164);
   --color-adapter: rgb(182, 140, 97);
-  --color-stream: $sp-color-stream;
+  --color-data-source: #ffa23b;
   --color-pipeline: rgb(102, 185, 114);
+  --color-measurement: rgb(39, 164, 155);
 
 }