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/01/07 13:23:47 UTC

[incubator-streampipes] branch dev updated (26c6169 -> 5c4b903)

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

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


    from 26c6169  [hotfix] Properly select transport format based on priority
     new 8023e47  [hotfix] Fix button style in start all pipelines dialog
     new 7260134  [STREAMPIPES-503] Add slide toggle static property
     new 5c4b903  [hotfix] Add option to hide internal Kafka topics to Kafka adapter

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../constants/GlobalStreamPipesConstants.java      |  2 +
 .../iiot/protocol/stream/KafkaProtocol.java        | 10 +++++
 .../strings.en                                     |  5 ++-
 .../pe/shared/config/kafka/KafkaConnectUtils.java  |  9 ++++
 ...rnative.java => SlideToggleStaticProperty.java} | 52 +++++++++++-----------
 .../model/staticproperty/StaticProperty.java       |  1 +
 .../model/staticproperty/StaticPropertyType.java   |  1 +
 .../staticproperty/StaticPropertyVisitor.java      |  2 +
 .../org/apache/streampipes/model/util/Cloner.java  |  2 +
 .../template/PipelineElementTemplateVisitor.java   | 11 +++++
 .../streampipes/manager/util/TopicGenerator.java   |  3 +-
 .../resource/management/secret/SecretVisitor.java  |  5 +++
 ...AbstractConfigurablePipelineElementBuilder.java | 21 +++++++++
 .../sdk/extractor/AbstractParameterExtractor.java  |  7 +--
 ui/src/app/core-model/gen/streampipes-model.ts     | 45 +++++++++++++------
 ui/src/app/core-ui/core-ui.module.ts               |  5 +++
 .../static-property.component.html                 | 10 +++++
 .../static-properties/static-property.component.ts |  6 ++-
 .../static-slide-toggle.component.html}            | 16 ++++---
 .../static-slide-toggle.component.scss             |  0
 .../static-slide-toggle.component.ts}              | 49 ++++++++------------
 .../start-all-pipelines-dialog.component.html      |  4 +-
 22 files changed, 183 insertions(+), 83 deletions(-)
 copy streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/{StaticPropertyAlternative.java => SlideToggleStaticProperty.java} (54%)
 copy ui/src/app/{dashboard/components/widgets/image/image-widget.component.html => core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.html} (68%)
 create mode 100644 ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.scss
 copy ui/src/app/core-ui/static-properties/{static-collection/static-collection.component.ts => static-slide-toggle/static-slide-toggle.component.ts} (52%)

[incubator-streampipes] 02/03: [STREAMPIPES-503] Add slide toggle static property

Posted by ri...@apache.org.
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

commit 7260134fb9badcff1f682fdaf95cf6b3d12a4df4
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Fri Jan 7 14:22:53 2022 +0100

    [STREAMPIPES-503] Add slide toggle static property
---
 .../constants/GlobalStreamPipesConstants.java      |  2 +
 .../staticproperty/SlideToggleStaticProperty.java  | 65 ++++++++++++++++++++++
 .../model/staticproperty/StaticProperty.java       |  1 +
 .../model/staticproperty/StaticPropertyType.java   |  1 +
 .../staticproperty/StaticPropertyVisitor.java      |  2 +
 .../org/apache/streampipes/model/util/Cloner.java  |  2 +
 .../template/PipelineElementTemplateVisitor.java   | 11 ++++
 .../streampipes/manager/util/TopicGenerator.java   |  3 +-
 .../resource/management/secret/SecretVisitor.java  |  5 ++
 ...AbstractConfigurablePipelineElementBuilder.java | 21 +++++++
 .../sdk/extractor/AbstractParameterExtractor.java  |  7 ++-
 ui/src/app/core-model/gen/streampipes-model.ts     | 45 ++++++++++-----
 ui/src/app/core-ui/core-ui.module.ts               |  5 ++
 .../static-property.component.html                 | 10 ++++
 .../static-properties/static-property.component.ts |  6 +-
 .../static-slide-toggle.component.html             | 30 ++++++++++
 .../static-slide-toggle.component.scss             |  0
 .../static-slide-toggle.component.ts               | 53 ++++++++++++++++++
 18 files changed, 251 insertions(+), 18 deletions(-)

diff --git a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/GlobalStreamPipesConstants.java b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/GlobalStreamPipesConstants.java
index c706245..70bca02 100644
--- a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/GlobalStreamPipesConstants.java
+++ b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/GlobalStreamPipesConstants.java
@@ -24,4 +24,6 @@ public class GlobalStreamPipesConstants {
 
   public static final String CONNECT_MASTER_SOURCES_ENDPOINT = "/streampipes-backend/api/v2/connect/master/sources/";
 
+  public static final String INTERNAL_TOPIC_PREFIX = "org-apache-streampipes-internal-";
+
 }
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/SlideToggleStaticProperty.java b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/SlideToggleStaticProperty.java
new file mode 100644
index 0000000..89c1644
--- /dev/null
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/SlideToggleStaticProperty.java
@@ -0,0 +1,65 @@
+/*
+ * 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.staticproperty;
+
+public class SlideToggleStaticProperty extends StaticProperty {
+
+  private boolean selected;
+  private boolean defaultValue;
+
+  public SlideToggleStaticProperty() {
+    super();
+  }
+
+  public SlideToggleStaticProperty(String internalName,
+                                   String label,
+                                   String description,
+                                   boolean defaultValue) {
+    super(StaticPropertyType.SlideToggleStaticProperty, internalName, label, description);
+    this.defaultValue = defaultValue;
+  }
+
+  public SlideToggleStaticProperty(SlideToggleStaticProperty other) {
+    super(other);
+    this.selected = other.isSelected();
+    this.defaultValue = other.isDefaultValue();
+  }
+
+
+  @Override
+  public void accept(StaticPropertyVisitor visitor) {
+    visitor.visit(this);
+  }
+
+  public boolean isSelected() {
+    return selected;
+  }
+
+  public void setSelected(boolean selected) {
+    this.selected = selected;
+  }
+
+  public boolean isDefaultValue() {
+    return defaultValue;
+  }
+
+  public void setDefaultValue(boolean defaultValue) {
+    this.defaultValue = defaultValue;
+  }
+}
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticProperty.java b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticProperty.java
index 8e8f79b..e4584a6 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticProperty.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticProperty.java
@@ -40,6 +40,7 @@ import org.apache.streampipes.model.shared.annotation.TsModel;
         @JsonSubTypes.Type(StaticPropertyAlternative.class),
         @JsonSubTypes.Type(StaticPropertyAlternatives.class),
         @JsonSubTypes.Type(StaticPropertyGroup.class),
+        @JsonSubTypes.Type(SlideToggleStaticProperty.class)
 })
 @TsModel
 public abstract class StaticProperty extends UnnamedStreamPipesEntity {
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyType.java b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyType.java
index b9e760b..0b3247b 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyType.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyType.java
@@ -35,6 +35,7 @@ public enum StaticPropertyType {
     StaticPropertyAlternatives,
     StaticPropertyAlternative,
     SecretStaticProperty,
+    SlideToggleStaticProperty,
     CodeInputStaticProperty;
 
 }
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyVisitor.java b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyVisitor.java
index 41b0a85..3de8909 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyVisitor.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/StaticPropertyVisitor.java
@@ -50,4 +50,6 @@ public interface StaticPropertyVisitor {
   void visit(StaticPropertyGroup staticPropertyGroup);
 
   void visit(RemoteOneOfStaticProperty remoteOneOfStaticProperty);
+
+  void visit(SlideToggleStaticProperty slideToggleStaticProperty);
 }
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java b/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
index 680d5bc..8c785f6 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
@@ -115,6 +115,8 @@ public class Cloner {
       return new CodeInputStaticProperty((CodeInputStaticProperty) o);
     } else if (o instanceof ColorPickerStaticProperty) {
       return new ColorPickerStaticProperty((ColorPickerStaticProperty) o);
+    } else if (o instanceof SlideToggleStaticProperty) {
+      return new SlideToggleStaticProperty((SlideToggleStaticProperty) o);
     } else {
       return new StaticPropertyAlternative((StaticPropertyAlternative) o);
     }
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/template/PipelineElementTemplateVisitor.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/template/PipelineElementTemplateVisitor.java
index 1cd97d1..591bba2 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/template/PipelineElementTemplateVisitor.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/template/PipelineElementTemplateVisitor.java
@@ -159,6 +159,13 @@ public class PipelineElementTemplateVisitor implements StaticPropertyVisitor {
 
   }
 
+  @Override
+  public void visit(SlideToggleStaticProperty slideToggleStaticProperty) {
+    if (hasKey(slideToggleStaticProperty)) {
+      slideToggleStaticProperty.setSelected(getAsBoolean(slideToggleStaticProperty));
+    }
+  }
+
   private Object getValue(StaticProperty sp) {
     return ((Map<String, Object>) configs.get(sp.getInternalName())).get("value");
   }
@@ -171,6 +178,10 @@ public class PipelineElementTemplateVisitor implements StaticPropertyVisitor {
     return configs.get(sp.getInternalName()).toString();
   }
 
+  private boolean getAsBoolean(StaticProperty sp) {
+    return Boolean.parseBoolean(configs.get(sp.getInternalName()).toString());
+  }
+
   private Map<String, Object> getAsMap(StaticProperty sp) {
     return (Map<String, Object>) configs.get(sp.getInternalName());
   }
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/util/TopicGenerator.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/util/TopicGenerator.java
index 0b0c0db..1c13d6d 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/util/TopicGenerator.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/util/TopicGenerator.java
@@ -19,6 +19,7 @@
 package org.apache.streampipes.manager.util;
 
 import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.streampipes.commons.constants.GlobalStreamPipesConstants;
 
 public class TopicGenerator {
 
@@ -27,6 +28,6 @@ public class TopicGenerator {
   }
 
   public static String generateInternalPipelineElementTopic(String appendix) {
-    return "org-apache-streampipes-internal-" + appendix;
+    return GlobalStreamPipesConstants.INTERNAL_TOPIC_PREFIX + appendix;
   }
 }
diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/secret/SecretVisitor.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/secret/SecretVisitor.java
index a783fc9..478fb62 100644
--- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/secret/SecretVisitor.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/secret/SecretVisitor.java
@@ -112,4 +112,9 @@ public class SecretVisitor implements StaticPropertyVisitor {
   public void visit(RemoteOneOfStaticProperty remoteOneOfStaticProperty) {
 
   }
+
+  @Override
+  public void visit(SlideToggleStaticProperty slideToggleStaticProperty) {
+    // Do nothing
+  }
 }
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
index 0a00967..8310d20 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
@@ -172,6 +172,27 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
   }
 
   /**
+   * Assigns a new required slide toggle for a true/false selection
+   * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
+   *              user-friendly manner.
+   * @param defaultValue The toggle's default value
+   * @return this
+   */
+  public BU requiredSlideToggle(Label label, boolean defaultValue) {
+    SlideToggleStaticProperty slideToggle = new SlideToggleStaticProperty(
+            label.getInternalId(),
+            label.getLabel(),
+            label.getDescription(),
+            defaultValue);
+
+    slideToggle.setSelected(defaultValue);
+
+    this.staticProperties.add(slideToggle);
+
+    return me();
+  }
+
+  /**
    * Assigns a new code block parameter (without a specific language) which is required
    * by the processing element.
    * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
index 89f155d..17191da 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
@@ -19,10 +19,7 @@
 package org.apache.streampipes.sdk.extractor;
 
 import com.github.drapostolos.typeparser.TypeParser;
-import org.apache.commons.codec.Charsets;
-import org.apache.http.client.fluent.Request;
 import org.apache.streampipes.commons.exceptions.SpRuntimeException;
-import org.apache.streampipes.config.backend.BackendConfig;
 import org.apache.streampipes.model.SpDataStream;
 import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
 import org.apache.streampipes.model.constants.PropertySelectorConstants;
@@ -100,6 +97,10 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
             .getValue());
   }
 
+  public boolean slideToggleValue(String internalName) {
+    return (getStaticPropertyByName(internalName, SlideToggleStaticProperty.class)).isSelected();
+  }
+
   public String codeblockValue(String internalName) {
     return getStaticPropertyByName(internalName,CodeInputStaticProperty.class).getValue();
   }
diff --git a/ui/src/app/core-model/gen/streampipes-model.ts b/ui/src/app/core-model/gen/streampipes-model.ts
index 1f2b259..f2eb41d 100644
--- a/ui/src/app/core-model/gen/streampipes-model.ts
+++ b/ui/src/app/core-model/gen/streampipes-model.ts
@@ -18,10 +18,10 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 2.27.744 on 2021-11-08 19:04:54.
+// Generated using typescript-generator version 2.27.744 on 2022-01-06 22:53:01.
 
 export class AbstractStreamPipesEntity {
-  "@class": "org.apache.streampipes.model.base.AbstractStreamPipesEntity" | "org.apache.streampipes.model.base.NamedStreamPipesEntity" | "org.apache.streampipes.model.connect.adapter.AdapterDescription" | "org.apache.streampipes.model.connect.adapter.AdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.AdapterStream [...]
+  "@class": "org.apache.streampipes.model.base.AbstractStreamPipesEntity" | "org.apache.streampipes.model.base.NamedStreamPipesEntity" | "org.apache.streampipes.model.connect.adapter.AdapterDescription" | "org.apache.streampipes.model.connect.adapter.AdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.AdapterStream [...]
   elementId: string;
 
   static fromData(data: AbstractStreamPipesEntity, target?: AbstractStreamPipesEntity): AbstractStreamPipesEntity {
@@ -36,7 +36,7 @@ export class AbstractStreamPipesEntity {
 }
 
 export class UnnamedStreamPipesEntity extends AbstractStreamPipesEntity {
-  "@class": "org.apache.streampipes.model.base.UnnamedStreamPipesEntity" | "org.apache.streampipes.model.connect.guess.GuessSchema" | "org.apache.streampipes.model.connect.rules.TransformationRuleDescription" | "org.apache.streampipes.model.connect.rules.value.ValueTransformationRuleDescription" | "org.apache.streampipes.model.connect.rules.value.AddTimestampRuleDescription" | "org.apache.streampipes.model.connect.rules.value.AddValueTransformationRuleDescription" | "org.apache.streampip [...]
+  "@class": "org.apache.streampipes.model.base.UnnamedStreamPipesEntity" | "org.apache.streampipes.model.connect.guess.GuessSchema" | "org.apache.streampipes.model.connect.rules.TransformationRuleDescription" | "org.apache.streampipes.model.connect.rules.value.ValueTransformationRuleDescription" | "org.apache.streampipes.model.connect.rules.value.AddTimestampRuleDescription" | "org.apache.streampipes.model.connect.rules.value.AddValueTransformationRuleDescription" | "org.apache.streampip [...]
 
   static fromData(data: UnnamedStreamPipesEntity, target?: UnnamedStreamPipesEntity): UnnamedStreamPipesEntity {
     if (!data) {
@@ -193,8 +193,8 @@ export class AdapterDescription extends NamedStreamPipesEntity {
     instance.correspondingServiceGroup = data.correspondingServiceGroup;
     instance.correspondingDataStreamElementId = data.correspondingDataStreamElementId;
     instance.streamRules = __getCopyArrayFn(__identity<any>())(data.streamRules);
-    instance.schemaRules = __getCopyArrayFn(__identity<any>())(data.schemaRules);
     instance.valueRules = __getCopyArrayFn(__identity<any>())(data.valueRules);
+    instance.schemaRules = __getCopyArrayFn(__identity<any>())(data.schemaRules);
     return instance;
   }
 
@@ -395,7 +395,7 @@ export class AddValueTransformationRuleDescription extends ValueTransformationRu
 }
 
 export class StaticProperty extends UnnamedStreamPipesEntity {
-  "@class": "org.apache.streampipes.model.staticproperty.StaticProperty" | "org.apache.streampipes.model.staticproperty.CodeInputStaticProperty" | "org.apache.streampipes.model.staticproperty.CollectionStaticProperty" | "org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty" | "org.apache.streampipes.model.staticproperty.DomainStaticProperty" | "org.apache.streampipes.model.staticproperty.FileStaticProperty" | "org.apache.streampipes.model.staticproperty.FreeTextStaticPro [...]
+  "@class": "org.apache.streampipes.model.staticproperty.StaticProperty" | "org.apache.streampipes.model.staticproperty.CodeInputStaticProperty" | "org.apache.streampipes.model.staticproperty.CollectionStaticProperty" | "org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty" | "org.apache.streampipes.model.staticproperty.DomainStaticProperty" | "org.apache.streampipes.model.staticproperty.FileStaticProperty" | "org.apache.streampipes.model.staticproperty.FreeTextStaticPro [...]
   description: string;
   index: number;
   internalName: string;
@@ -459,6 +459,8 @@ export class StaticProperty extends UnnamedStreamPipesEntity {
         return StaticPropertyAlternatives.fromData(data);
       case "org.apache.streampipes.model.staticproperty.StaticPropertyGroup":
         return StaticPropertyGroup.fromData(data);
+      case "org.apache.streampipes.model.staticproperty.SlideToggleStaticProperty":
+        return SlideToggleStaticProperty.fromData(data);
     }
   }
 }
@@ -1647,9 +1649,9 @@ export class GenericAdapterSetDescription extends AdapterSetDescription implemen
     }
     const instance = target || new GenericAdapterSetDescription();
     super.fromData(data, instance);
-    instance.eventSchema = EventSchema.fromData(data.eventSchema);
-    instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
     instance.formatDescription = FormatDescription.fromData(data.formatDescription);
+    instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
+    instance.eventSchema = EventSchema.fromData(data.eventSchema);
     return instance;
   }
 }
@@ -1666,9 +1668,9 @@ export class GenericAdapterStreamDescription extends AdapterStreamDescription im
     }
     const instance = target || new GenericAdapterStreamDescription();
     super.fromData(data, instance);
-    instance.eventSchema = EventSchema.fromData(data.eventSchema);
-    instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
     instance.formatDescription = FormatDescription.fromData(data.formatDescription);
+    instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
+    instance.eventSchema = EventSchema.fromData(data.eventSchema);
     return instance;
   }
 }
@@ -2438,8 +2440,8 @@ export class PipelineTemplateDescription extends NamedStreamPipesEntity {
     super.fromData(data, instance);
     instance.boundTo = __getCopyArrayFn(BoundPipelineElement.fromData)(data.boundTo);
     instance.pipelineTemplateDescription = data.pipelineTemplateDescription;
-    instance.pipelineTemplateId = data.pipelineTemplateId;
     instance.pipelineTemplateName = data.pipelineTemplateName;
+    instance.pipelineTemplateId = data.pipelineTemplateId;
     return instance;
   }
 }
@@ -2744,6 +2746,23 @@ export class SimpleTopicDefinition extends TopicDefinition {
   }
 }
 
+export class SlideToggleStaticProperty extends StaticProperty {
+  "@class": "org.apache.streampipes.model.staticproperty.SlideToggleStaticProperty";
+  defaultValue: boolean;
+  selected: boolean;
+
+  static fromData(data: SlideToggleStaticProperty, target?: SlideToggleStaticProperty): SlideToggleStaticProperty {
+    if (!data) {
+      return data;
+    }
+    const instance = target || new SlideToggleStaticProperty();
+    super.fromData(data, instance);
+    instance.selected = data.selected;
+    instance.defaultValue = data.defaultValue;
+    return instance;
+  }
+}
+
 export class SpDataStream extends NamedStreamPipesEntity {
   "@class": "org.apache.streampipes.model.SpDataStream" | "org.apache.streampipes.model.SpDataSet";
   category: string[];
@@ -2806,8 +2825,8 @@ export class SpDataSet extends SpDataStream {
     instance.datasetInvocationId = data.datasetInvocationId;
     instance.correspondingPipeline = data.correspondingPipeline;
     instance.selectedEndpointUrl = data.selectedEndpointUrl;
-    instance.actualTopicName = data.actualTopicName;
     instance.brokerHostname = data.brokerHostname;
+    instance.actualTopicName = data.actualTopicName;
     return instance;
   }
 }
@@ -3130,9 +3149,9 @@ export type SelectionStaticPropertyUnion = AnyStaticProperty | OneOfStaticProper
 
 export type SpDataStreamUnion = SpDataStream | SpDataSet;
 
-export type StaticPropertyType = "AnyStaticProperty" | "CollectionStaticProperty" | "ColorPickerStaticProperty" | "DomainStaticProperty" | "FreeTextStaticProperty" | "FileStaticProperty" | "MappingPropertyUnary" | "MappingPropertyNary" | "MatchingStaticProperty" | "OneOfStaticProperty" | "RuntimeResolvableAnyStaticProperty" | "RuntimeResolvableOneOfStaticProperty" | "StaticPropertyGroup" | "StaticPropertyAlternatives" | "StaticPropertyAlternative" | "SecretStaticProperty" | "CodeInputSta [...]
+export type StaticPropertyType = "AnyStaticProperty" | "CollectionStaticProperty" | "ColorPickerStaticProperty" | "DomainStaticProperty" | "FreeTextStaticProperty" | "FileStaticProperty" | "MappingPropertyUnary" | "MappingPropertyNary" | "MatchingStaticProperty" | "OneOfStaticProperty" | "RuntimeResolvableAnyStaticProperty" | "RuntimeResolvableOneOfStaticProperty" | "StaticPropertyGroup" | "StaticPropertyAlternatives" | "StaticPropertyAlternative" | "SecretStaticProperty" | "SlideToggleS [...]
 
-export type StaticPropertyUnion = AnyStaticProperty | CodeInputStaticProperty | CollectionStaticProperty | ColorPickerStaticProperty | DomainStaticProperty | FileStaticProperty | FreeTextStaticProperty | MappingPropertyUnary | MappingPropertyNary | MatchingStaticProperty | OneOfStaticProperty | RuntimeResolvableAnyStaticProperty | RuntimeResolvableOneOfStaticProperty | SecretStaticProperty | StaticPropertyAlternative | StaticPropertyAlternatives | StaticPropertyGroup;
+export type StaticPropertyUnion = AnyStaticProperty | CodeInputStaticProperty | CollectionStaticProperty | ColorPickerStaticProperty | DomainStaticProperty | FileStaticProperty | FreeTextStaticProperty | MappingPropertyUnary | MappingPropertyNary | MatchingStaticProperty | OneOfStaticProperty | RuntimeResolvableAnyStaticProperty | RuntimeResolvableOneOfStaticProperty | SecretStaticProperty | StaticPropertyAlternative | StaticPropertyAlternatives | StaticPropertyGroup | SlideToggleStaticP [...]
 
 export type StreamTransformationRuleDescriptionUnion = EventRateTransformationRuleDescription | RemoveDuplicatesTransformationRuleDescription;
 
diff --git a/ui/src/app/core-ui/core-ui.module.ts b/ui/src/app/core-ui/core-ui.module.ts
index 82fe6c7..beba7dd 100644
--- a/ui/src/app/core-ui/core-ui.module.ts
+++ b/ui/src/app/core-ui/core-ui.module.ts
@@ -81,6 +81,8 @@ import { AddToCollectionComponent } from './static-properties/static-collection/
 import { PipelineStartedStatusComponent } from './pipeline/pipeline-started-status/pipeline-started-status.component';
 import { SplitSectionComponent } from './split-section/split-section.component';
 import { ObjectPermissionDialogComponent } from './object-permission-dialog/object-permission-dialog.component';
+import { StaticSlideToggleComponent } from './static-properties/static-slide-toggle/static-slide-toggle.component';
+import { MatSlideToggleModule } from '@angular/material/slide-toggle';
 
 @NgModule({
   imports: [
@@ -100,6 +102,7 @@ import { ObjectPermissionDialogComponent } from './object-permission-dialog/obje
     NgxChartsModule,
     PlotlyViaWindowModule,
     MatSliderModule,
+    MatSlideToggleModule,
     MatChipsModule,
     PortalModule,
     OverlayModule,
@@ -136,6 +139,7 @@ import { ObjectPermissionDialogComponent } from './object-permission-dialog/obje
     StaticOneOfInputComponent,
     StaticRuntimeResolvableAnyInputComponent,
     StaticRuntimeResolvableOneOfInputComponent,
+    StaticSlideToggleComponent,
     StatusWidgetComponent,
     LabelListItemComponent,
     ErrorHintComponent,
@@ -178,6 +182,7 @@ import { ObjectPermissionDialogComponent } from './object-permission-dialog/obje
     StaticOneOfInputComponent,
     StaticRuntimeResolvableAnyInputComponent,
     StaticRuntimeResolvableOneOfInputComponent,
+    StaticSlideToggleComponent,
     ImageViewerComponent,
     StatusWidgetComponent,
     BarchartWidgetComponent,
diff --git a/ui/src/app/core-ui/static-properties/static-property.component.html b/ui/src/app/core-ui/static-properties/static-property.component.html
index 2547720..65b9b67 100644
--- a/ui/src/app/core-ui/static-properties/static-property.component.html
+++ b/ui/src/app/core-ui/static-properties/static-property.component.html
@@ -144,6 +144,16 @@
                                   [staticProperty]="staticProperty" class="test fullWidth"
                                   (updateEmitter)="emitUpdate($event)">
             </sp-static-collection>
+
+            <sp-static-slide-toggle *ngIf="isSlideToggleStaticProperty(staticProperty)"
+                                    [adapterId]="adapterId"
+                                    [parentForm]="parentForm"
+                                    [fieldName]="fieldName"
+                                    [displayRecommended]="displayRecommended"
+                                    [staticProperty]="staticProperty" class="test fullWidth"
+                                    (updateEmitter)="emitUpdate($event)">
+
+            </sp-static-slide-toggle>
         </div>
     </div>
     <mat-divider></mat-divider>
diff --git a/ui/src/app/core-ui/static-properties/static-property.component.ts b/ui/src/app/core-ui/static-properties/static-property.component.ts
index a727822..6ba0b8c 100644
--- a/ui/src/app/core-ui/static-properties/static-property.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-property.component.ts
@@ -35,7 +35,7 @@ import {
   OneOfStaticProperty,
   RuntimeResolvableAnyStaticProperty,
   RuntimeResolvableOneOfStaticProperty,
-  SecretStaticProperty,
+  SecretStaticProperty, SlideToggleStaticProperty,
   StaticProperty,
   StaticPropertyAlternatives,
   StaticPropertyGroup
@@ -159,6 +159,10 @@ export class StaticPropertyComponent implements OnInit {
     return val instanceof CollectionStaticProperty;
   }
 
+  isSlideToggleStaticProperty(val) {
+    return val instanceof SlideToggleStaticProperty;
+  }
+
   valueChange(hasInput) {
     //this.staticProperty.isValid = hasInput;
     this.validateEmitter.emit();
diff --git a/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.html b/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.html
new file mode 100644
index 0000000..60a7c78
--- /dev/null
+++ b/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.html
@@ -0,0 +1,30 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<div [formGroup]="parentForm" id="formWrapper" fxFlex="100" fxLayout="column">
+    <div fxFlex="100" fxLayout="row">
+        <mat-slide-toggle
+                fxFlex
+                formControlName="{{fieldName}}"
+                color="accent"
+                required
+                [attr.data-cy]="fieldName">
+            {{staticProperty.description}}
+        </mat-slide-toggle>
+    </div>
+</div>
diff --git a/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.scss b/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.ts b/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.ts
new file mode 100644
index 0000000..57877f9
--- /dev/null
+++ b/ui/src/app/core-ui/static-properties/static-slide-toggle/static-slide-toggle.component.ts
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { AfterViewInit, Component, OnInit } from '@angular/core';
+import { ConfigurationInfo } from '../../../connect/model/ConfigurationInfo';
+import { SlideToggleStaticProperty } from '../../../core-model/gen/streampipes-model';
+import { AbstractValidatedStaticPropertyRenderer } from '../base/abstract-validated-static-property';
+import { Validators } from '@angular/forms';
+
+@Component({
+  selector: 'sp-static-slide-toggle',
+  templateUrl: './static-slide-toggle.component.html',
+  styleUrls: ['./static-slide-toggle.component.scss']
+})
+export class StaticSlideToggleComponent
+  extends AbstractValidatedStaticPropertyRenderer<SlideToggleStaticProperty> implements OnInit {
+
+
+  ngOnInit(): void {
+    this.addValidator(this.staticProperty.selected, Validators.required);
+    this.enableValidators();
+  }
+
+  emitUpdate() {
+    this.updateEmitter.emit(new ConfigurationInfo(
+      this.staticProperty.internalName, true));
+  }
+
+  onStatusChange(status: any) {
+  }
+
+  onValueChange(value: any) {
+    this.staticProperty.selected = value;
+    this.emitUpdate();
+  }
+
+
+}

[incubator-streampipes] 03/03: [hotfix] Add option to hide internal Kafka topics to Kafka adapter

Posted by ri...@apache.org.
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

commit 5c4b903824e79a570b7854f8085c34fd98e3c4a2
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Fri Jan 7 14:23:35 2022 +0100

    [hotfix] Add option to hide internal Kafka topics to Kafka adapter
---
 .../connect/iiot/protocol/stream/KafkaProtocol.java            | 10 ++++++++++
 .../strings.en                                                 |  5 ++++-
 .../streampipes/pe/shared/config/kafka/KafkaConnectUtils.java  |  9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/KafkaProtocol.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/KafkaProtocol.java
index 3b2d561..b198664 100644
--- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/KafkaProtocol.java
+++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/KafkaProtocol.java
@@ -26,6 +26,7 @@ import org.apache.kafka.common.config.SaslConfigs;
 import org.apache.kafka.common.security.auth.SecurityProtocol;
 import org.apache.kafka.common.serialization.LongDeserializer;
 import org.apache.kafka.common.serialization.StringDeserializer;
+import org.apache.streampipes.commons.constants.GlobalStreamPipesConstants;
 import org.apache.streampipes.commons.exceptions.SpRuntimeException;
 import org.apache.streampipes.connect.SendToPipeline;
 import org.apache.streampipes.connect.adapter.model.generic.Protocol;
@@ -93,6 +94,7 @@ public class KafkaProtocol extends BrokerProtocol implements ResolvesContainerPr
                         KafkaConnectUtils.getAlternativesOne(), KafkaConnectUtils.getAlternativesTwo())
                 .requiredTextParameter(KafkaConnectUtils.getHostLabel())
                 .requiredIntegerParameter(KafkaConnectUtils.getPortLabel())
+                .requiredSlideToggle(KafkaConnectUtils.getHideInternalTopicsLabel(), true)
                 .requiredSingleValueSelectionFromContainer(KafkaConnectUtils.getTopicLabel(), Arrays.asList(
                         KafkaConnectUtils.getHostKey(),
                         KafkaConnectUtils.getPortKey()))
@@ -240,6 +242,7 @@ public class KafkaProtocol extends BrokerProtocol implements ResolvesContainerPr
         String kafkaHost = extractor.singleValueParameter(KafkaConnectUtils.getHostKey(), String.class);
         Integer kafkaPort = extractor.singleValueParameter(KafkaConnectUtils.getPortKey(), Integer.class);
         String authenticationMode = extractor.selectedAlternativeInternalId(KafkaConnectUtils.getAccessModeKey());
+        boolean hideInternalTopics = extractor.slideToggleValue(KafkaConnectUtils.getHideInternalTopicsKey());
         boolean useAuthentication = authenticationMode.equals(KafkaConnectUtils.getSaslAccessKey());
 
         String kafkaAddress = kafkaHost + ":" + kafkaPort;
@@ -261,6 +264,13 @@ public class KafkaProtocol extends BrokerProtocol implements ResolvesContainerPr
         KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props);
         Set<String> topics = consumer.listTopics().keySet();
         consumer.close();
+
+        if (hideInternalTopics) {
+            topics = topics
+                    .stream()
+                    .filter(t -> !t.startsWith(GlobalStreamPipesConstants.INTERNAL_TOPIC_PREFIX))
+                    .collect(Collectors.toSet());
+        }
         return topics.stream().map(Option::new).collect(Collectors.toList());
     }
 
diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.kafka/strings.en b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.kafka/strings.en
index 80b7a60..d41f01c 100644
--- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.kafka/strings.en
+++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.kafka/strings.en
@@ -26,4 +26,7 @@ username.title=Username
 username.description=
 
 password.title=Password
-password.description=
\ No newline at end of file
+password.description=
+
+hide-internal-topics.title=Hide internal topics
+hide-internal-topics.description=Do not show topics that are only used internally
diff --git a/streampipes-extensions/streampipes-pipeline-elements-shared/src/main/java/org/apache/streampipes/pe/shared/config/kafka/KafkaConnectUtils.java b/streampipes-extensions/streampipes-pipeline-elements-shared/src/main/java/org/apache/streampipes/pe/shared/config/kafka/KafkaConnectUtils.java
index 3c9dde1..4238fae 100644
--- a/streampipes-extensions/streampipes-pipeline-elements-shared/src/main/java/org/apache/streampipes/pe/shared/config/kafka/KafkaConnectUtils.java
+++ b/streampipes-extensions/streampipes-pipeline-elements-shared/src/main/java/org/apache/streampipes/pe/shared/config/kafka/KafkaConnectUtils.java
@@ -35,6 +35,7 @@ public class KafkaConnectUtils {
     private static final String USERNAME_ACCESS = "username-alternative";
     private static final String USERNAME_GROUP = "username-group";
     private static final String USERNAME_KEY = "username";
+    private static final String HIDE_INTERNAL_TOPICS = "hide-internal-topics";
 
     public static String getUsernameKey() {
         return USERNAME_KEY;
@@ -54,6 +55,14 @@ public class KafkaConnectUtils {
         return Labels.withId(TOPIC_KEY);
     }
 
+    public static Label getHideInternalTopicsLabel() {
+        return Labels.withId(HIDE_INTERNAL_TOPICS);
+    }
+
+    public static String getHideInternalTopicsKey() {
+        return HIDE_INTERNAL_TOPICS;
+    }
+
     public static Label getHostLabel() {
         return Labels.withId(HOST_KEY);
     }

[incubator-streampipes] 01/03: [hotfix] Fix button style in start all pipelines dialog

Posted by ri...@apache.org.
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

commit 8023e479a6aa9840bf945b19d839a00e68e00498
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Thu Jan 6 22:20:43 2022 +0100

    [hotfix] Fix button style in start all pipelines dialog
---
 .../start-all-pipelines/start-all-pipelines-dialog.component.html     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
index dddba60..f9abd57 100644
--- a/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
+++ b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
@@ -42,8 +42,8 @@
         <button mat-button mat-raised-button class="mat-basic" (click)="close(false)" style="margin-right:10px;">
             Cancel
         </button>
-        <button mat-button mat-raised-button color="primary" [disabled]="installationRunning" (click)="next()">
+        <button mat-button mat-raised-button color="accent" [disabled]="installationRunning" (click)="next()">
             {{nextButton}}
         </button>
     </div>
-</div>
\ No newline at end of file
+</div>