This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch STREAMPIPES-145 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit dcfeeccf70177c1bb6098a1b837f0b27869944fb Author: Dominik Riemer <[email protected]> AuthorDate: Fri Jul 17 22:54:37 2020 +0200 [STREAMPIPES-145] Migrate recommended filter --- ui/src/app/connect/connect.module.ts | 3 ++ .../base/abstract-static-property.ts | 3 ++ .../display-recommended.pipe.ts} | 56 +++++++++------------- .../static-alternatives.component.html | 7 ++- .../static-group/static-group.component.html | 8 +++- .../static-mapping-nary.component.html | 7 +-- .../static-mapping-unary.component.html | 2 +- .../static-property.component.html | 28 +++++++---- .../static-properties/static-property.component.ts | 3 ++ .../dialog/customize/customize.component.html | 2 + .../dialog/customize/customize.component.ts | 2 +- 11 files changed, 69 insertions(+), 52 deletions(-) diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts index 969dbbf..a8ae2f2 100644 --- a/ui/src/app/connect/connect.module.ts +++ b/ui/src/app/connect/connect.module.ts @@ -97,6 +97,7 @@ import { PipelineElementRuntimeInfoComponent } from './new-adapter/component/run import { EventPropertyRowComponent } from './schema-editor/event-property-row/event-property-row.component'; import { EventSchemaPreviewComponent } from './schema-editor/event-schema-preview/event-schema-preview.component'; import { StaticColorPickerComponent } from './static-properties/static-color-picker/static-color-picker.component'; +import {DisplayRecommendedPipe} from "./static-properties/filter/display-recommended.pipe"; @NgModule({ @@ -142,6 +143,7 @@ import { StaticColorPickerComponent } from './static-properties/static-color-pic StaticFileInputComponent, StaticMappingNaryComponent, StaticMappingUnaryComponent, + DisplayRecommendedPipe, TimestampPipe, StaticAnyInput, FormatListComponent, @@ -176,6 +178,7 @@ import { StaticColorPickerComponent } from './static-properties/static-color-pic IconService, ShepherdService, UnitProviderService, + DisplayRecommendedPipe, TimestampPipe, FileRestService, StaticFileRestService, diff --git a/ui/src/app/connect/static-properties/base/abstract-static-property.ts b/ui/src/app/connect/static-properties/base/abstract-static-property.ts index 6c0d25f..e5f2923 100644 --- a/ui/src/app/connect/static-properties/base/abstract-static-property.ts +++ b/ui/src/app/connect/static-properties/base/abstract-static-property.ts @@ -45,6 +45,9 @@ export abstract class AbstractStaticPropertyRenderer<T extends StaticProperty> { @Input() fieldName: string; + @Input() + displayRecommended: boolean; + @Output() updateEmitter: EventEmitter<ConfigurationInfo> = new EventEmitter(); diff --git a/ui/src/app/connect/static-properties/base/abstract-static-property.ts b/ui/src/app/connect/static-properties/filter/display-recommended.pipe.ts similarity index 50% copy from ui/src/app/connect/static-properties/base/abstract-static-property.ts copy to ui/src/app/connect/static-properties/filter/display-recommended.pipe.ts index 6c0d25f..0834937 100644 --- a/ui/src/app/connect/static-properties/base/abstract-static-property.ts +++ b/ui/src/app/connect/static-properties/filter/display-recommended.pipe.ts @@ -16,40 +16,30 @@ * */ -import { - EventSchema, - StaticProperty, - StaticPropertyUnion -} from "../../../core-model/gen/streampipes-model"; -import {EventEmitter, Input, Output} from "@angular/core"; -import {FormGroup} from "@angular/forms"; -import {ConfigurationInfo} from "../../model/message/ConfigurationInfo"; - -export abstract class AbstractStaticPropertyRenderer<T extends StaticProperty> { - - @Input() - staticProperty: T; - - @Input() - staticProperties: Array<StaticPropertyUnion>; - - @Input() - eventSchemas: EventSchema[]; - - @Input() - adapterId: string; - - @Input() - parentForm: FormGroup; - - @Input() - fieldName: string; - - @Output() updateEmitter: EventEmitter<ConfigurationInfo> = new EventEmitter(); - +import {Pipe, PipeTransform} from "@angular/core"; +import * as angular from "angular"; +import {EventPropertyUnion} from "../../../core-model/gen/streampipes-model"; + +@Pipe({name: 'displayRecommendedPipe'}) +export class DisplayRecommendedPipe implements PipeTransform { + transform(properties: EventPropertyUnion[], propertyScope: string, displayRecommended: boolean): any { + var result = []; + if (!displayRecommended) { + return properties; + } else { + if (propertyScope === undefined || propertyScope === "NONE") { + return properties; + } else { + properties.forEach(property => { + if (property.propertyScope === undefined || property.propertyScope === propertyScope) { + result.push(property); + } + }); + } + return result; + } + } - constructor() { - } } \ No newline at end of file diff --git a/ui/src/app/connect/static-properties/static-alternatives/static-alternatives.component.html b/ui/src/app/connect/static-properties/static-alternatives/static-alternatives.component.html index 66d019a..4d0778c 100644 --- a/ui/src/app/connect/static-properties/static-alternatives/static-alternatives.component.html +++ b/ui/src/app/connect/static-properties/static-alternatives/static-alternatives.component.html @@ -50,8 +50,11 @@ <div class="sp-blue-border" style="padding-top: 0px; padding-bottom: 0px; padding-left: 10px; padding-right: 10px"> - <app-static-property [adapterId]="adapterId" [eventSchemas]="eventSchemas" - [staticProperty]="alternative.staticProperty" (validateEmitter)="valueChange($event)" + <app-static-property [adapterId]="adapterId" + [eventSchemas]="eventSchemas" + [staticProperty]="alternative.staticProperty" + [displayRecommended]="displayRecommended" + (validateEmitter)="valueChange($event)" class="test fullWidth"> </app-static-property> </div> diff --git a/ui/src/app/connect/static-properties/static-group/static-group.component.html b/ui/src/app/connect/static-properties/static-group/static-group.component.html index 161646b..fbd0375 100644 --- a/ui/src/app/connect/static-properties/static-group/static-group.component.html +++ b/ui/src/app/connect/static-properties/static-group/static-group.component.html @@ -18,8 +18,12 @@ <div *ngIf="!staticProperty.horizontalRendering" class="padding" fxLayout="column"> <app-static-property *ngFor="let property of staticProperty.staticProperties" - [adapterId]="adapterId" [staticProperties]="staticProperties" [eventSchema]="eventSchema" - [staticProperty]="property" (validateEmitter)="valueChange($event)" class="test fullWidth"> + [adapterId]="adapterId" + [staticProperties]="staticProperties" + [eventSchemas]="eventSchemas" + [staticProperty]="property" + [displayRecommended]="displayRecommended" + (validateEmitter)="valueChange($event)" class="test fullWidth"> </app-static-property> </div> diff --git a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.html b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.html index 697f00a..cf3e607 100644 --- a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.html +++ b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.html @@ -18,17 +18,14 @@ <div id="formWrapper" fxFlex="100" fxLayout="column"> <div fxFlex="100" fxLayoutAlign="start center"> - <div>{{staticProperty.label}}: - <mat-hint class="description">{{staticProperty.description}}</mat-hint> - </div> <button mat-button mat-raised-button color="primary" class="small-button" (click)="selectAll()" style="margin-right:10px;margin-left:10px;">Select all </button> <button mat-button mat-raised-button class="mat-basic small-button" (click)="selectNone()">Select none</button> </div> - <div fxFlex="100" fxLayout="row"> - <mat-checkbox *ngFor="let property of availableProperties" [(ngModel)]="property['checked']" + <div fxFlex="100" fxLayout="column" style="margin-top:10px;"> + <mat-checkbox *ngFor="let property of availableProperties | displayRecommendedPipe: staticProperty.propertyScope: displayRecommended" [(ngModel)]="property['checked']" (change)="selectOption(property, $event)" style="margin-left: 10px;"> {{property.runtimeName}} diff --git a/ui/src/app/connect/static-properties/static-mapping-unary/static-mapping-unary.component.html b/ui/src/app/connect/static-properties/static-mapping-unary/static-mapping-unary.component.html index 84daa0b..3075fcf 100644 --- a/ui/src/app/connect/static-properties/static-mapping-unary/static-mapping-unary.component.html +++ b/ui/src/app/connect/static-properties/static-mapping-unary/static-mapping-unary.component.html @@ -21,7 +21,7 @@ <mat-form-field class="example-full-width"> <!--<mat-form-field class="example-full-width">--> <mat-select formControlName="{{staticProperty.internalName}}" [placeholder]="staticProperty.label"> - <mat-option *ngFor="let property of availableProperties " [value]="property.propertySelector"> + <mat-option *ngFor="let property of availableProperties | displayRecommendedPipe: staticProperty.propertyScope: displayRecommended" [value]="property.propertySelector"> {{property.runtimeName}} </mat-option> </mat-select> diff --git a/ui/src/app/connect/static-properties/static-property.component.html b/ui/src/app/connect/static-properties/static-property.component.html index eb68701..b96e235 100644 --- a/ui/src/app/connect/static-properties/static-property.component.html +++ b/ui/src/app/connect/static-properties/static-property.component.html @@ -71,34 +71,46 @@ <app-static-any-input *ngIf="isAnyStaticProperty(staticProperty) && !isRuntimeResolvableAnyStaticProperty(staticProperty)" - (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"></app-static-any-input> + (inputEmitter)="valueChange($event)" + [staticProperty]="staticProperty"></app-static-any-input> <app-static-one-of-input *ngIf="isOneOfStaticProperty(staticProperty) && !isRuntimeResolvableOneOfStaticProperty(staticProperty)" - (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"> + (inputEmitter)="valueChange($event)" + [staticProperty]="staticProperty"> </app-static-one-of-input> <app-static-mapping-unary *ngIf="isMappingPropertyUnary(staticProperty)" [eventSchemas]="eventSchemas" [staticProperty]="staticProperty" + [displayRecommended]="displayRecommended" [parentForm]="parentForm" [fieldName]="fieldName" (inputEmitter)="valueChange($event)"> </app-static-mapping-unary> - <app-static-mapping-nary *ngIf="isMappingNaryProperty(staticProperty)" [eventSchemas]="eventSchemas" - (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"> + <app-static-mapping-nary *ngIf="isMappingNaryProperty(staticProperty)" + [eventSchemas]="eventSchemas" + [staticProperty]="staticProperty" + [displayRecommended]="displayRecommended" + (inputEmitter)="valueChange($event)"> </app-static-mapping-nary> <app-static-alternatives *ngIf="isAlternativesStaticProperty(staticProperty)" - [adapterId]="adapterId" [eventSchemas]="eventSchemas" - [staticProperty]="staticProperty" class="test fullWidth" + [adapterId]="adapterId" + [eventSchemas]="eventSchemas" + [staticProperty]="staticProperty" + [displayRecommended]="displayRecommended" + class="test fullWidth" (inputEmitter)="valueChange($event)"> </app-static-alternatives> <app-static-group *ngIf="isGroupStaticProperty(staticProperty)" - [adapterId]="adapterId" [eventSchemas]="eventSchemas" - [staticProperty]="staticProperty" class="test fullWidth" + [adapterId]="adapterId" + [eventSchemas]="eventSchemas" + [staticProperty]="staticProperty" + [displayRecommended]="displayRecommended" + class="test fullWidth" (inputEmitter)="valueChange($event)"> </app-static-group> diff --git a/ui/src/app/connect/static-properties/static-property.component.ts b/ui/src/app/connect/static-properties/static-property.component.ts index a538ae5..1c37dd9 100644 --- a/ui/src/app/connect/static-properties/static-property.component.ts +++ b/ui/src/app/connect/static-properties/static-property.component.ts @@ -76,6 +76,9 @@ export class StaticPropertyComponent implements OnInit { @Input() fieldName: string; + @Input() + displayRecommended: boolean; + constructor( private logger: Logger, public xsService: xsService, diff --git a/ui/src/app/editor-v2/dialog/customize/customize.component.html b/ui/src/app/editor-v2/dialog/customize/customize.component.html index 2418a4c..a811fa3 100644 --- a/ui/src/app/editor-v2/dialog/customize/customize.component.html +++ b/ui/src/app/editor-v2/dialog/customize/customize.component.html @@ -25,6 +25,7 @@ [disabled]="!pipelineElement.payload.includesAssets"> Show documentation </mat-slide-toggle> + <span> </span> <mat-slide-toggle [(ngModel)]="displayRecommended" aria-label="Switch 1"> Show only recommended settings </mat-slide-toggle> @@ -46,6 +47,7 @@ <form [formGroup]="parentForm" fxFlex="100"> <app-static-property *ngFor="let config of cachedPipelineElement.staticProperties" [staticProperty]="config" + [displayRecommended]="displayRecommended" [staticProperties]="cachedPipelineElement.staticProperties" [eventSchemas]="eventSchemas" [parentForm]="parentForm" diff --git a/ui/src/app/editor-v2/dialog/customize/customize.component.ts b/ui/src/app/editor-v2/dialog/customize/customize.component.ts index 5939c28..42e1c2a 100644 --- a/ui/src/app/editor-v2/dialog/customize/customize.component.ts +++ b/ui/src/app/editor-v2/dialog/customize/customize.component.ts @@ -46,7 +46,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit { cachedPipelineElement: InvocablePipelineElementUnion; eventSchemas: EventSchema[] = []; - displayRecommended: boolean; + displayRecommended: boolean = true; showDocumentation: boolean = false; selectedElement: any;
