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 2020/09/02 13:29:33 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-215] Properly filter pipeline element types in icon stand

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 8028baa  [STREAMPIPES-215] Properly filter pipeline element types in icon stand
     new 9683528  Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
8028baa is described below

commit 8028baa3bdb27f25e457b0632a67d3300eb5140f
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Wed Sep 2 15:27:30 2020 +0200

    [STREAMPIPES-215] Properly filter pipeline element types in icon stand
---
 .../pipeline-element-icon-stand.component.ts       | 13 +++++++---
 ui/src/app/editor/constants/editor.constants.ts    |  2 +-
 ui/src/app/editor/editor.component.ts              | 29 ++++++++++++++--------
 ui/src/app/editor/model/editor.model.ts            | 20 +++++++++++++--
 ui/src/app/editor/utils/editor.utils.ts            |  6 ++++-
 5 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
index 16604e6..44d0962 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
@@ -18,7 +18,11 @@
 
 import {Component, Input, OnInit,} from "@angular/core";
 import {RestApi} from "../../../services/rest-api.service";
-import {PipelineElementType, PipelineElementUnion} from "../../model/editor.model";
+import {
+    PipelineElementIdentifier,
+    PipelineElementType,
+    PipelineElementUnion
+} from "../../model/editor.model";
 import {PipelineElementTypeUtils} from "../../utils/editor.utils";
 import {EditorService} from "../../services/editor.service";
 import {zip} from "rxjs";
@@ -125,13 +129,14 @@ export class PipelineElementIconStandComponent implements OnInit {
     }
 
     @Input()
-    set activeType(value: PipelineElementType) {
-        this._activeType = value;
+    set activeType(value: PipelineElementIdentifier) {
+        let activeType = PipelineElementTypeUtils.fromClassName(value);
+        this._activeType = activeType;
         if (this.allCategories.length > 0) {
             this.currentCategories = this.allCategories[this._activeType];
             this.selectedOptions = [...this.currentCategories];
         }
-        this.activeCssClass = this.makeActiveCssClass(value);
+        this.activeCssClass = this.makeActiveCssClass(activeType);
         setTimeout(() => {
             this.makeDraggable();
         })
diff --git a/ui/src/app/editor/constants/editor.constants.ts b/ui/src/app/editor/constants/editor.constants.ts
index 8b5fc20..947423e 100644
--- a/ui/src/app/editor/constants/editor.constants.ts
+++ b/ui/src/app/editor/constants/editor.constants.ts
@@ -21,5 +21,5 @@ export class EditorConstants {
   static readonly DATA_STREAM_IDENTIFIER = "org.apache.streampipes.model.SpDataStream";
   static readonly DATA_SET_IDENTIFIER = "org.apache.streampipes.model.SpDataSet";
   static readonly DATA_PROCESSOR_IDENTIFIER = "org.apache.streampipes.model.graph.DataProcessorInvocation";
-  static readonly DATA_SINK_IDENTIFIER = "org.apache.streampipes.model.graph.DataSinkInvoation";
+  static readonly DATA_SINK_IDENTIFIER = "org.apache.streampipes.model.graph.DataSinkInvocation";
 }
\ No newline at end of file
diff --git a/ui/src/app/editor/editor.component.ts b/ui/src/app/editor/editor.component.ts
index e8408cb..412043a 100644
--- a/ui/src/app/editor/editor.component.ts
+++ b/ui/src/app/editor/editor.component.ts
@@ -27,9 +27,9 @@ import {
 } from "../core-model/gen/streampipes-model";
 import {PipelineElementService} from "../platform-services/apis/pipeline-element.service";
 import {
-  PipelineElementConfig,
-  PipelineElementType,
-  PipelineElementUnion
+    PipelineElementConfig, PipelineElementIdentifier,
+    PipelineElementType,
+    PipelineElementUnion, TabsModel
 } from "./model/editor.model";
 import {PipelineElementTypeUtils} from "./utils/editor.utils";
 import {AuthStatusService} from "../services/auth-status.service";
@@ -39,6 +39,7 @@ import {DialogService} from "../core-ui/dialog/base-dialog/base-dialog.service";
 import {MissingElementsForTutorialComponent} from "./dialog/missing-elements-for-tutorial/missing-elements-for-tutorial.component";
 import {ShepherdService} from "../services/tour/shepherd.service";
 import {ActivatedRoute} from "@angular/router";
+import {EditorConstants} from "./constants/editor.constants";
 
 @Component({
     selector: 'editor',
@@ -48,7 +49,8 @@ import {ActivatedRoute} from "@angular/router";
 export class EditorComponent implements OnInit {
 
     selectedIndex: number = 1;
-    activeType: PipelineElementType = PipelineElementType.DataStream;
+    activeType: PipelineElementIdentifier = EditorConstants.DATA_STREAM_IDENTIFIER;
+    activeShorthand: string;
 
     availableDataSets: SpDataSet[] = [];
     availableDataStreams: SpDataStream[] = [];
@@ -73,22 +75,26 @@ export class EditorComponent implements OnInit {
 
     isTutorialOpen: boolean = false;
 
-    tabs = [
+    tabs: TabsModel[] = [
         {
             title: 'Data Sets',
-            type: PipelineElementType.DataSet
+            type: EditorConstants.DATA_SET_IDENTIFIER,
+            shorthand: "set"
         },
         {
             title: 'Data Streams',
-            type: PipelineElementType.DataStream
+            type: EditorConstants.DATA_STREAM_IDENTIFIER,
+            shorthand: "stream"
         },
         {
             title: 'Data Processors',
-            type: PipelineElementType.DataProcessor
+            type: EditorConstants.DATA_PROCESSOR_IDENTIFIER,
+            shorthand: "sepa"
         },
         {
             title: 'Data Sinks',
-            type: PipelineElementType.DataSink
+            type: EditorConstants.DATA_SINK_IDENTIFIER,
+            shorthand: "action"
         }
     ];
 
@@ -173,12 +179,13 @@ export class EditorComponent implements OnInit {
     selectPipelineElements(index : number) {
         this.selectedIndex = index;
         this.activeType = this.tabs[index].type;
+        this.activeShorthand = this.tabs[index].shorthand;
         this.currentElements = this.allElements
-            .filter(pe => pe instanceof PipelineElementTypeUtils.toType(this.activeType))
+            .filter(pe => pe["@class"] === this.activeType)
             .sort((a, b) => {
                 return a.name.localeCompare(b.name);
             });
-        this.shepherdService.trigger("select-" +PipelineElementTypeUtils.toCssShortHand(this.activeType));
+        this.shepherdService.trigger("select-" +this.activeShorthand);
     }
 
     toggleEditorStand() {
diff --git a/ui/src/app/editor/model/editor.model.ts b/ui/src/app/editor/model/editor.model.ts
index fdaf26f..692d7c3 100644
--- a/ui/src/app/editor/model/editor.model.ts
+++ b/ui/src/app/editor/model/editor.model.ts
@@ -23,6 +23,7 @@ import {
   SpDataStream
 } from "../../core-model/gen/streampipes-model";
 import {InjectionToken} from "@angular/core";
+import {EditorConstants} from "../constants/editor.constants";
 
 export type PipelineElementHolder = {
   [key: string]: Array<PipelineElementUnion>;
@@ -60,8 +61,23 @@ export enum PipelineElementType {
   DataSink
 }
 
-export type PipelineElementUnion = SpDataSet | SpDataStream | DataProcessorInvocation | DataSinkInvocation;
+export interface TabsModel {
+  title: string,
+  type: PipelineElementIdentifier,
+  shorthand: string
+}
+
+export type PipelineElementUnion =
+    SpDataSet
+    | SpDataStream
+    | DataProcessorInvocation
+    | DataSinkInvocation;
 
 export type InvocablePipelineElementUnion = DataProcessorInvocation | DataSinkInvocation;
 
-export const PIPELINE_ELEMENT_TOKEN = new InjectionToken<{}>('pipelineElement');
\ No newline at end of file
+export const PIPELINE_ELEMENT_TOKEN = new InjectionToken<{}>('pipelineElement');
+
+export type PipelineElementIdentifier = "org.apache.streampipes.model.SpDataStream"
+    | "org.apache.streampipes.model.SpDataSet"
+    | "org.apache.streampipes.model.graph.DataProcessorInvocation"
+    | "org.apache.streampipes.model.graph.DataSinkInvocation";
\ No newline at end of file
diff --git a/ui/src/app/editor/utils/editor.utils.ts b/ui/src/app/editor/utils/editor.utils.ts
index cae04e5..0176449 100644
--- a/ui/src/app/editor/utils/editor.utils.ts
+++ b/ui/src/app/editor/utils/editor.utils.ts
@@ -17,7 +17,11 @@
  */
 
 import {EditorConstants} from "../constants/editor.constants";
-import {PipelineElementType, PipelineElementUnion} from "../model/editor.model";
+import {
+  PipelineElementIdentifier,
+  PipelineElementType,
+  PipelineElementUnion
+} from "../model/editor.model";
 import {
   DataProcessorInvocation,
   DataSinkInvocation,