This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch STREAMPIPES-145 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 160696b6c0a2602745caf619dc9ed47128232eac Author: Philipp Zehnder <[email protected]> AuthorDate: Thu Aug 6 22:56:41 2020 +0200 Fix configuration of event format in connect --- .../connect/new-adapter/new-adapter.component.html | 19 +++++++--- .../connect/new-adapter/new-adapter.component.ts | 44 +++++++++++++--------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/ui/src/app/connect/new-adapter/new-adapter.component.html b/ui/src/app/connect/new-adapter/new-adapter.component.html index 8ff6d2f..6f286ae 100644 --- a/ui/src/app/connect/new-adapter/new-adapter.component.html +++ b/ui/src/app/connect/new-adapter/new-adapter.component.html @@ -106,11 +106,20 @@ </div> <div class="sp-blue-border padding"> <div fxFlex="100" *ngIf="adapter.formatDescription"> - <app-select-static-properties (validateEmitter)="validateFormat($event)" - [staticProperties]="adapter.formatDescription.config" class="fullWidth"> - </app-select-static-properties> - <h5 *ngIf="adapter.formatDescription.config.length === 0" style="text-align:center;">(no further - configuration needed)</h5> + <form [formGroup]="formatForm" fxFlex="100"> + <app-static-property *ngFor="let config of adapter.formatDescription.config" + [staticProperty]="config" + [staticProperties]="adapter.config" + [adapterId]="adapter.appId" + [parentForm]="formatForm" + [fieldName]="config.internalName" + (updateEmitter)="triggerUpdate($event)" + [completedStaticProperty]="completedStaticProperty"> + + </app-static-property> + <h5 *ngIf="adapter.formatDescription.config.length === 0" style="text-align:center;">(no further + configuration needed)</h5> + </form> </div> </div> </div> diff --git a/ui/src/app/connect/new-adapter/new-adapter.component.ts b/ui/src/app/connect/new-adapter/new-adapter.component.ts index d6067d7..c8fba28 100644 --- a/ui/src/app/connect/new-adapter/new-adapter.component.ts +++ b/ui/src/app/connect/new-adapter/new-adapter.component.ts @@ -16,7 +16,6 @@ * */ -///<reference path="../model/connect/AdapterDescription.ts"/> import { AfterViewInit, ChangeDetectorRef, Component, @@ -26,18 +25,9 @@ import { Output, ViewChild } from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {MatDialog} from '@angular/material/dialog'; -import {MatStepper} from '@angular/material/stepper'; -import {ShepherdService} from '../../services/tour/shepherd.service'; -import {Logger} from '../../shared/logger/default-log.service'; -import {ConnectService} from '../connect.service'; -import {TimestampPipe} from '../filter/timestamp.pipe'; -import {ConfigurationInfo} from '../model/message/ConfigurationInfo'; -import {RestService} from '../rest.service'; -import {TransformationRuleService} from '../transformation-rule.service'; -import {AdapterStartedDialog} from './component/adapter-started-dialog.component'; -import {IconService} from './icon.service'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialog } from '@angular/material/dialog'; +import { MatStepper } from '@angular/material/stepper'; import { AdapterDescription, AdapterDescriptionUnion, EventProperty, @@ -50,8 +40,17 @@ import { SpecificAdapterSetDescription, SpecificAdapterStreamDescription, TransformationRuleDescriptionUnion -} from "../../core-model/gen/streampipes-model"; -import {EventSchemaComponent} from "../schema-editor/event-schema/event-schema.component"; +} from '../../core-model/gen/streampipes-model'; +import { ShepherdService } from '../../services/tour/shepherd.service'; +import { Logger } from '../../shared/logger/default-log.service'; +import { ConnectService } from '../connect.service'; +import { TimestampPipe } from '../filter/timestamp.pipe'; +import { ConfigurationInfo } from '../model/message/ConfigurationInfo'; +import { RestService } from '../rest.service'; +import { EventSchemaComponent } from '../schema-editor/event-schema/event-schema.component'; +import { TransformationRuleService } from '../transformation-rule.service'; +import { AdapterStartedDialog } from './component/adapter-started-dialog.component'; +import { IconService } from './icon.service'; @Component({ selector: 'sp-new-adapter', @@ -118,8 +117,9 @@ export class NewAdapterComponent implements OnInit, AfterViewInit { isPreviewEnabled = false; parentForm: FormGroup; - adapterSettingsFormValid: boolean = false; - viewInitialized: boolean = false; + formatForm: FormGroup; + adapterSettingsFormValid = false; + viewInitialized = false; constructor( private logger: Logger, @@ -150,6 +150,9 @@ export class NewAdapterComponent implements OnInit, AfterViewInit { this.parentForm = this._formBuilder.group({ }); + this.formatForm = this._formBuilder.group({ + }); + this.isGenericAdapter = this.connectService.isGenericDescription(this.adapter); this.isDataSetDescription = this.connectService.isDataSetDescription(this.adapter); this.isDataStreamDescription = this.connectService.isDataStreamDescription(this.adapter); @@ -196,6 +199,10 @@ export class NewAdapterComponent implements OnInit, AfterViewInit { this.parentForm.statusChanges.subscribe((status) => { this.adapterSettingsFormValid = this.viewInitialized && this.parentForm.valid; }); + + this.formatForm.statusChanges.subscribe((status) => { + this.validateFormat(this.viewInitialized && this.formatForm.valid); + }); } ngAfterViewInit() { @@ -349,7 +356,8 @@ export class NewAdapterComponent implements OnInit, AfterViewInit { this.transformationRuleService.setOldEventSchema(this.oldEventSchema); this.transformationRuleService.setNewEventSchema(this.eventSchema); - const transformationRules: TransformationRuleDescriptionUnion[] = this.transformationRuleService.getTransformationRuleDescriptions(); + const transformationRules: TransformationRuleDescriptionUnion[] = + this.transformationRuleService.getTransformationRuleDescriptions(); this.adapter.rules = transformationRules; }
