();
-
constructor() {
super();
}
@@ -41,7 +39,7 @@ export class StaticMappingUnaryComponent
if (!this.staticProperty.selectedProperty) {
this.staticProperty.selectedProperty =
this.availableProperties[0].propertySelector;
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
this.addValidator(
this.staticProperty.selectedProperty,
@@ -54,6 +52,6 @@ export class StaticMappingUnaryComponent
onValueChange(value: any) {
this.staticProperty.selectedProperty = value;
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
}
diff --git a/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.ts b/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.ts
index 1d1b835b98..f05537f9a3 100644
--- a/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.ts
@@ -52,7 +52,7 @@ export class StaticOneOfInputComponent
).elementId;
}
this.inputEmitter.emit(true);
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
this.parentForm.updateValueAndValidity();
}
@@ -71,6 +71,6 @@ export class StaticOneOfInputComponent
option => option.elementId === id,
).selected = true;
this.inputEmitter.emit(true);
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
}
diff --git a/ui/src/app/core-ui/static-properties/static-property-util.service.ts b/ui/src/app/core-ui/static-properties/static-property-util.service.ts
index b85882cd26..533cff0256 100644
--- a/ui/src/app/core-ui/static-properties/static-property-util.service.ts
+++ b/ui/src/app/core-ui/static-properties/static-property-util.service.ts
@@ -37,11 +37,53 @@ import {
StaticPropertyGroup,
} from '@streampipes/platform-services';
import { IdGeneratorService } from '../../core-services/id-generator/id-generator.service';
+import { ConfigurationInfo } from '../../connect/model/ConfigurationInfo';
@Injectable({ providedIn: 'root' })
export class StaticPropertyUtilService {
constructor(private idGeneratorService: IdGeneratorService) {}
+ public initializeCompletedConfigurations(
+ configs: StaticProperty[],
+ ): ConfigurationInfo[] {
+ return configs
+ .filter(config => !config.optional)
+ .map(config => {
+ return {
+ staticPropertyInternalName: config.internalName,
+ configured: false,
+ };
+ });
+ }
+
+ public allDependenciesSatisfied(
+ dependsOn: string[],
+ completedConfigs: ConfigurationInfo[],
+ ) {
+ if (dependsOn?.length > 0) {
+ return dependsOn.every(dependency =>
+ completedConfigs.some(
+ config =>
+ config.staticPropertyInternalName === dependency &&
+ config.configured,
+ ),
+ );
+ } else {
+ return true;
+ }
+ }
+
+ public updateCompletedConfiguration(
+ completedConfig: ConfigurationInfo,
+ completedConfigs: ConfigurationInfo[],
+ ) {
+ completedConfigs.find(
+ c =>
+ c.staticPropertyInternalName ===
+ completedConfig.staticPropertyInternalName,
+ ).configured = completedConfig.configured;
+ }
+
public clone(val: StaticProperty) {
let clone;
const id = this.idGeneratorService.generatePrefixedId();
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 3f43c9bd03..fe6c2bfc68 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
@@ -37,78 +37,96 @@
@@ -127,8 +148,10 @@
isOneOfStaticProperty(staticProperty) &&
!isRuntimeResolvableOneOfStaticProperty(staticProperty)
"
- (inputEmitter)="valueChange($event)"
- (updateEmitter)="emitUpdate($event)"
+ (completedConfigurationsEmitter)="
+ completedConfigurationsEmitter.emit($event)
+ "
+ [completedConfigurations]="completedConfigurations"
[parentForm]="parentForm"
[staticProperty]="staticProperty"
>
@@ -136,30 +159,38 @@
@@ -178,6 +207,10 @@
isGroupStaticProperty(staticProperty) &&
!isRuntimeResolvableGroupStaticProperty(staticProperty)
"
+ (completedConfigurationsEmitter)="
+ completedConfigurationsEmitter.emit($event)
+ "
+ [completedConfigurations]="completedConfigurations"
[adapterId]="adapterId"
[deploymentConfiguration]="deploymentConfiguration"
[eventSchemas]="eventSchemas"
@@ -187,12 +220,15 @@
[staticProperties]="staticProperties"
[displayRecommended]="displayRecommended"
class="test fullWidth"
- (updateEmitter)="emitUpdate($event)"
>
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 ef3ddc98eb..5d4248d13d 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
@@ -59,18 +59,9 @@ export class StaticPropertyComponent implements OnInit {
@Input()
adapterId: string;
- @Output()
- validateEmitter: EventEmitter = new EventEmitter();
-
- @Output()
- updateEmitter: EventEmitter = new EventEmitter();
-
@Input()
eventSchemas: EventSchema[];
- @Input()
- completedStaticProperty: ConfigurationInfo;
-
@Input()
parentForm: UntypedFormGroup;
@@ -86,6 +77,13 @@ export class StaticPropertyComponent implements OnInit {
@Input()
deploymentConfiguration: ExtensionDeploymentConfiguration;
+ @Input()
+ completedConfigurations: ConfigurationInfo[];
+
+ @Output()
+ completedConfigurationsEmitter: EventEmitter =
+ new EventEmitter();
+
showLabel = true;
@Input()
@@ -167,12 +165,4 @@ export class StaticPropertyComponent implements OnInit {
isTreeInputStaticProperty(val) {
return val instanceof RuntimeResolvableTreeInputStaticProperty;
}
-
- valueChange(hasInput) {
- this.validateEmitter.emit();
- }
-
- emitUpdate(configurationInfo: ConfigurationInfo) {
- this.updateEmitter.emit(configurationInfo);
- }
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
index 6d84538535..7b210ff517 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
@@ -51,7 +51,7 @@ export class StaticRuntimeResolvableAnyInputComponent
selectAll(select: boolean): void {
this.staticProperty.options.forEach(o => (o.selected = select));
this.selectedOptions = select ? this.staticProperty.options : [];
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
onSelectionChange(): void {
@@ -61,7 +61,7 @@ export class StaticRuntimeResolvableAnyInputComponent
}
checkEmitUpdate(): void {
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
afterOptionsLoaded(staticProperty: RuntimeResolvableAnyStaticProperty) {
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
index 936c1c0232..ec8fef59b3 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
@@ -52,7 +52,7 @@ export class StaticRuntimeResolvableGroupComponent
if (this.staticProperty.staticProperties.length === 0) {
this.loadOptionsFromRestApi();
}
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
afterErrorReceived() {}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/base-runtime-resolvable-input.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/base-runtime-resolvable-input.ts
index 19e9a9cda6..564f2c2d06 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/base-runtime-resolvable-input.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/base-runtime-resolvable-input.ts
@@ -47,34 +47,18 @@ export abstract class BaseRuntimeResolvableInput<
extends AbstractStaticPropertyRenderer
implements OnChanges
{
- @Input()
- completedStaticProperty: ConfigurationInfo;
-
@Input() deploymentConfiguration: ExtensionDeploymentConfiguration;
showOptions = false;
loading = false;
error = false;
errorMessage: SpLogMessage;
- dependentStaticProperties: Map = new Map<
- string,
- boolean
- >();
constructor(private runtimeResolvableService: RuntimeResolvableService) {
super();
}
- onInit() {
- if (
- this.staticProperty.dependsOn &&
- this.staticProperty.dependsOn.length > 0
- ) {
- this.staticProperty.dependsOn.forEach(dp => {
- this.dependentStaticProperties.set(dp, false);
- });
- }
- }
+ onInit() {}
loadOptionsFromRestApi(node?: TreeInputNode) {
const resolvableOptionsParameterRequest = new RuntimeOptionsRequest();
@@ -137,31 +121,14 @@ export abstract class BaseRuntimeResolvableInput<
}
ngOnChanges(changes: SimpleChanges): void {
- if (changes['completedStaticProperty']) {
+ if (changes['completedConfigurations']) {
if (
- this.completedStaticProperty !== undefined &&
- !(
- this.completedStaticProperty.staticPropertyInternalName ===
- this.staticProperty.internalName
+ this.staticPropertyUtils.allDependenciesSatisfied(
+ this.staticProperty.dependsOn,
+ this.completedConfigurations,
)
) {
- if (
- this.dependentStaticProperties.has(
- this.completedStaticProperty.staticPropertyInternalName,
- )
- ) {
- this.dependentStaticProperties.set(
- this.completedStaticProperty.staticPropertyInternalName,
- this.completedStaticProperty.configured,
- );
- }
- if (
- Array.from(this.dependentStaticProperties.values()).every(
- v => v === true,
- )
- ) {
- this.loadOptionsFromRestApi();
- }
+ this.loadOptionsFromRestApi();
}
}
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
index 88f4dd40b1..eb6ffcc10c 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
@@ -54,7 +54,6 @@ export class StaticRuntimeResolvableOneOfInputComponent
this.staticProperty.options.length > 0
) {
this.staticProperty.options[0].selected = true;
- this.emitUpdate(true);
}
}
@@ -66,7 +65,7 @@ export class StaticRuntimeResolvableOneOfInputComponent
option => option.elementId === id,
).selected = true;
this.performValidation();
- this.emitUpdate(true);
+ this.applyCompletedConfiguration(true);
}
parse(
diff --git a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
index 2caa19c70d..f085755c3e 100644
--- a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
@@ -36,25 +36,19 @@ export class StaticSecretInputComponent
super();
}
- @Output() updateEmitter: EventEmitter =
- new EventEmitter();
-
ngOnInit() {
this.addValidator(this.staticProperty.value, Validators.required);
this.enableValidators();
}
emitUpdate() {
- this.updateEmitter.emit(
- new ConfigurationInfo(
- this.staticProperty.internalName,
+ this.applyCompletedConfiguration(
+ this.staticPropertyUtil.asFreeTextStaticProperty(
+ this.staticProperty,
+ ).value &&
this.staticPropertyUtil.asFreeTextStaticProperty(
this.staticProperty,
- ).value &&
- this.staticPropertyUtil.asFreeTextStaticProperty(
- this.staticProperty,
- ).value !== '',
- ),
+ ).value !== '',
);
}
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
index e74274ae7f..0b0dccee23 100644
--- 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
@@ -37,9 +37,7 @@ export class StaticSlideToggleComponent
}
emitUpdate() {
- this.updateEmitter.emit(
- new ConfigurationInfo(this.staticProperty.internalName, true),
- );
+ this.applyCompletedConfiguration(true);
}
onStatusChange(status: any) {}
diff --git a/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts b/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
index c7c1a4bfe7..8823d519b3 100644
--- a/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
+++ b/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
@@ -83,7 +83,11 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit {
this.dataExplorerService.getAllPersistedDataStreams(),
this.datalakeRestService.getAllMeasurementSeries(),
).subscribe(response => {
- this.availablePipelines = response[0];
+ this.availablePipelines = response[0].filter(
+ p =>
+ response[1].find(m => m.measureName === p.measureName) !==
+ undefined,
+ );
this.availableMeasurements = response[1];
// replace pipeline event schemas. Reason: Available measures do not contain field for timestamp
diff --git a/ui/src/app/editor/dialog/customize/customize.component.html b/ui/src/app/editor/dialog/customize/customize.component.html
index 151d88217c..4bd6f2936a 100644
--- a/ui/src/app/editor/dialog/customize/customize.component.html
+++ b/ui/src/app/editor/dialog/customize/customize.component.html
@@ -93,12 +93,11 @@
[eventSchemas]="eventSchemas"
[parentForm]="parentForm"
[fieldName]="config.internalName"
- [completedStaticProperty]="
- completedStaticProperty
+ [completedConfigurations]="
+ completedConfigurations
"
- (updateEmitter)="triggerUpdate($event)"
- (validateEmitter)="
- validConfiguration($event)
+ (completedConfigurationsEmitter)="
+ updateCompletedConfiguration($event)
"
>
diff --git a/ui/src/app/editor/dialog/customize/customize.component.ts b/ui/src/app/editor/dialog/customize/customize.component.ts
index ae2d73e9ea..5b45b9383f 100644
--- a/ui/src/app/editor/dialog/customize/customize.component.ts
+++ b/ui/src/app/editor/dialog/customize/customize.component.ts
@@ -42,6 +42,7 @@ import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { ShepherdService } from '../../../services/tour/shepherd.service';
import { ConfigurationInfo } from '../../../connect/model/ConfigurationInfo';
import { PipelineStyleService } from '../../services/pipeline-style.service';
+import { StaticPropertyUtilService } from '../../../core-ui/static-properties/static-property-util.service';
@Component({
selector: 'sp-customize-pipeline-element',
@@ -60,13 +61,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
_showDocumentation = false;
selection: any;
- matchingSelectionLeft: any;
- matchingSelectionRight: any;
invalid: any;
- helpDialogVisible: any;
- validationErrors: any;
-
- sourceEndpoint: any;
sepa: any;
parentForm: UntypedFormGroup;
@@ -82,6 +77,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
templateMode = false;
template: PipelineElementTemplate;
templateConfigs: Map[] = [];
+ completedConfigurations: ConfigurationInfo[] = [];
constructor(
private dialogRef: DialogRef,
@@ -91,6 +87,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
private changeDetectorRef: ChangeDetectorRef,
private pipelineElementTemplateService: PipelineElementTemplateService,
private pipelineStyleService: PipelineStyleService,
+ private staticPropertyUtils: StaticPropertyUtilService,
) {}
ngOnInit(): void {
@@ -98,6 +95,10 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
this.cachedPipelineElement = this.jsPlumbService.clone(
this.pipelineElement.payload,
) as InvocablePipelineElementUnion;
+ this.completedConfigurations =
+ this.staticPropertyUtils.initializeCompletedConfigurations(
+ this.cachedPipelineElement.staticProperties,
+ );
this.isDataProcessor =
this.cachedPipelineElement instanceof DataProcessorInvocation;
this.cachedPipelineElement.inputStreams.forEach(is => {
@@ -147,8 +148,6 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
this.dialogRef.close(this.pipelineElement);
}
- validConfiguration(event: any) {}
-
set showDocumentation(value: boolean) {
if (value) {
this.dialogRef.changeDialogSize({ width: '90vw' });
@@ -174,6 +173,14 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
this.completedStaticProperty = { ...configurationInfo };
}
+ updateCompletedConfiguration(configurationInfo: ConfigurationInfo) {
+ this.staticPropertyUtils.updateCompletedConfiguration(
+ configurationInfo,
+ this.completedConfigurations,
+ );
+ this.completedConfigurations = [...this.completedConfigurations];
+ }
+
triggerTemplateMode() {
this.template = new PipelineElementTemplate();
this.templateMode = true;