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:49 UTC
[incubator-streampipes] 02/03: [STREAMPIPES-503] Add slide toggle static property
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();
+ }
+
+
+}