This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch STREAMPIPES-494 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 69e7e81bd2fa8e07e09014d8251177a1f2098286 Author: Dominik Riemer <[email protected]> AuthorDate: Wed Jan 5 17:05:27 2022 +0100 [STREAMPIPES-494] Remove restricted edit mode --- .../pipeline-element-options.component.ts | 6 +-- .../components/pipeline/pipeline.component.ts | 23 +++++----- .../dialog/customize/customize.component.html | 16 +------ .../editor/dialog/customize/customize.component.ts | 49 ++++++++++------------ 4 files changed, 36 insertions(+), 58 deletions(-) diff --git a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts index 1d131a0..c49156c 100644 --- a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts +++ b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts @@ -73,7 +73,7 @@ export class PipelineElementOptionsComponent implements OnInit, OnDestroy { delete: EventEmitter<PipelineElementConfig> = new EventEmitter<PipelineElementConfig>(); @Output() - customize: EventEmitter<Tuple2<Boolean, PipelineElementConfig>> = new EventEmitter<Tuple2<Boolean, PipelineElementConfig>>(); + customize: EventEmitter<PipelineElementConfig> = new EventEmitter<PipelineElementConfig>(); pipelineElementConfiguredObservable: Subscription; @@ -116,9 +116,7 @@ export class PipelineElementOptionsComponent implements OnInit, OnDestroy { } customizeElement(pipelineElement: PipelineElementConfig) { - const restrictedEditMode = ! (this.isRootElement()); - const customizeInfo = {a: restrictedEditMode, b: pipelineElement} as Tuple2<Boolean, PipelineElementConfig>; - this.customize.emit(customizeInfo); + this.customize.emit(pipelineElement); } openHelpDialog() { diff --git a/ui/src/app/editor/components/pipeline/pipeline.component.ts b/ui/src/app/editor/components/pipeline/pipeline.component.ts index 1fef527..e24c7ea 100644 --- a/ui/src/app/editor/components/pipeline/pipeline.component.ts +++ b/ui/src/app/editor/components/pipeline/pipeline.component.ts @@ -38,9 +38,7 @@ import { CustomizeComponent } from '../../dialog/customize/customize.component'; import { PanelType } from '../../../core-ui/dialog/base-dialog/base-dialog.model'; import { DialogService } from '../../../core-ui/dialog/base-dialog/base-dialog.service'; import { EditorService } from '../../services/editor.service'; -import { MatchingResultMessage } from '../../../core-model/gen/streampipes-model-client'; import { MatchingErrorComponent } from '../../dialog/matching-error/matching-error.component'; -import { Tuple2 } from '../../../core-model/base/Tuple2'; import { ConfirmDialogComponent } from '../../../core-ui/dialog/confirm-dialog/confirm-dialog.component'; import { MatDialog } from '@angular/material/dialog'; import { forkJoin } from 'rxjs'; @@ -342,7 +340,7 @@ export class PipelineComponent implements OnInit, OnDestroy { if (this.jsplumbService.isFullyConnected(pe, this.preview)) { const payload = pe.payload as InvocablePipelineElementUnion; if ((payload.staticProperties && payload.staticProperties.length > 0) || this.isCustomOutput(pe)) { - this.showCustomizeDialog({a: false, b: pe}); + this.showCustomizeDialog(pe); } else { (pe.payload as InvocablePipelineElementUnion).configured = true; pe.settings.completed = true; @@ -453,27 +451,26 @@ export class PipelineComponent implements OnInit, OnDestroy { }); } - showCustomizeDialog(pipelineElementInfo: Tuple2<boolean, PipelineElementConfig>) { + showCustomizeDialog(pipelineElementConfig: PipelineElementConfig) { const dialogRef = this.dialogService.open(CustomizeComponent, { panelType: PanelType.SLIDE_IN_PANEL, - title: 'Customize ' + pipelineElementInfo.b.payload.name, + title: 'Customize ' + pipelineElementConfig.payload.name, width: '50vw', data: { - 'pipelineElement': pipelineElementInfo.b, - 'restrictedEditMode': pipelineElementInfo.a + 'pipelineElement': pipelineElementConfig, } }); dialogRef.afterClosed().subscribe(c => { if (c) { - pipelineElementInfo.b.settings.openCustomize = false; - (pipelineElementInfo.b.payload as InvocablePipelineElementUnion).configured = true; - if (!(pipelineElementInfo.b.payload instanceof DataSinkInvocation)) { - this.JsplumbBridge.activateEndpoint('out-' + pipelineElementInfo.b.payload.dom, pipelineElementInfo.b.settings.completed); + pipelineElementConfig.settings.openCustomize = false; + (pipelineElementConfig.payload as InvocablePipelineElementUnion).configured = true; + if (!(pipelineElementConfig.payload instanceof DataSinkInvocation)) { + this.JsplumbBridge.activateEndpoint('out-' + pipelineElementConfig.payload.dom, pipelineElementConfig.settings.completed); } - this.JsplumbBridge.getSourceEndpoint(pipelineElementInfo.b.payload.dom).toggleType('token'); + this.JsplumbBridge.getSourceEndpoint(pipelineElementConfig.payload.dom).toggleType('token'); this.triggerPipelineCacheUpdate(); - this.announceConfiguredElement(pipelineElementInfo.b); + this.announceConfiguredElement(pipelineElementConfig); if (this.previewModeActive) { this.deletePipelineElementPreview(true); } diff --git a/ui/src/app/editor/dialog/customize/customize.component.html b/ui/src/app/editor/dialog/customize/customize.component.html index 7ca6c12..78c8589 100644 --- a/ui/src/app/editor/dialog/customize/customize.component.html +++ b/ui/src/app/editor/dialog/customize/customize.component.html @@ -46,19 +46,6 @@ <div fxFlex="100" fxLayout="row"> <div fxFlex="{{_showDocumentation ? 50: 100}}"> <div fxLayout="column" *ngIf="!templateMode"> - <div fxLayout="row" *ngIf="restrictedEditMode"> - <div fxLayout="column"> - <div fxLayout="column" class="customize-item-main-help" - style="border: 2px solid #ffc400"> - <div class="customize-item-title-help" style="background: #ffc400;" fxFlex="100" - fxLayout="row"> - You can only modify things that don't affect your pipeline structure. To fully - modify this element, make sure that it doesn't connect to any successors (remove - outgoing connectors). - </div> - </div> - </div> - </div> <div fxFlex="100" fxLayout="column" class="customize-section p-15"> <form [formGroup]="parentForm" fxFlex="100"> <app-static-property *ngFor="let config of cachedPipelineElement.staticProperties" @@ -78,8 +65,7 @@ *ngFor="let outputStrategy of cachedPipelineElement.outputStrategies" [parentForm]="parentForm" [outputStrategy]="outputStrategy" - [selectedElement]="cachedPipelineElement" - [restrictedEditMode]="restrictedEditMode"> + [selectedElement]="cachedPipelineElement"> </output-strategy> </div> </form> diff --git a/ui/src/app/editor/dialog/customize/customize.component.ts b/ui/src/app/editor/dialog/customize/customize.component.ts index fc9c60c..11fd154 100644 --- a/ui/src/app/editor/dialog/customize/customize.component.ts +++ b/ui/src/app/editor/dialog/customize/customize.component.ts @@ -23,19 +23,19 @@ import { Input, OnInit, ViewEncapsulation -} from "@angular/core"; -import {InvocablePipelineElementUnion, PipelineElementConfig} from "../../model/editor.model"; -import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref"; -import {JsplumbService} from "../../services/jsplumb.service"; +} from '@angular/core'; +import { InvocablePipelineElementUnion, PipelineElementConfig } from '../../model/editor.model'; +import { DialogRef } from '../../../core-ui/dialog/base-dialog/dialog-ref'; +import { JsplumbService } from '../../services/jsplumb.service'; import { DataProcessorInvocation, EventSchema, PipelineElementTemplate, PipelineElementTemplateConfig -} from "../../../core-model/gen/streampipes-model"; -import {FormBuilder, FormGroup} from "@angular/forms"; -import {ShepherdService} from "../../../services/tour/shepherd.service"; -import {ConfigurationInfo} from "../../../connect/model/ConfigurationInfo"; -import {PipelineElementTemplateService} from "../../../platform-services/apis/pipeline-element-template.service"; +} from '../../../core-model/gen/streampipes-model'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { ShepherdService } from '../../../services/tour/shepherd.service'; +import { ConfigurationInfo } from '../../../connect/model/ConfigurationInfo'; +import { PipelineElementTemplateService } from '../../../platform-services/apis/pipeline-element-template.service'; @Component({ selector: 'customize-pipeline-element', @@ -48,14 +48,11 @@ export class CustomizeComponent implements OnInit, AfterViewInit { @Input() pipelineElement: PipelineElementConfig; - @Input() - restrictedEditMode: boolean; - cachedPipelineElement: InvocablePipelineElementUnion; eventSchemas: EventSchema[] = []; - displayRecommended: boolean = true; - _showDocumentation: boolean = false; + displayRecommended = true; + _showDocumentation = false; selection: any; matchingSelectionLeft: any; @@ -71,15 +68,15 @@ export class CustomizeComponent implements OnInit, AfterViewInit { parentForm: FormGroup; formValid: boolean; - viewInitialized: boolean = false; + viewInitialized = false; - isDataProcessor: boolean = false; + isDataProcessor = false; originalDialogWidth: string | number; completedStaticProperty: ConfigurationInfo; - availableTemplates: Array<PipelineElementTemplate>; + availableTemplates: PipelineElementTemplate[]; selectedTemplate: any = false; - templateMode: boolean = false; + templateMode = false; template: PipelineElementTemplate; templateConfigs: Map<string, any> = new Map(); @@ -108,9 +105,9 @@ export class CustomizeComponent implements OnInit, AfterViewInit { this.parentForm.statusChanges.subscribe((status) => { this.formValid = this.viewInitialized && this.parentForm.valid; - }) + }); if (this.ShepherdService.isTourActive()) { - this.ShepherdService.trigger("customize-" + this.pipelineElement.type); + this.ShepherdService.trigger('customize-' + this.pipelineElement.type); } this.loadPipelineElementTemplates(); } @@ -132,7 +129,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit { this.pipelineElement.settings.completed = true; this.pipelineElement.payload.configured = true; if (this.ShepherdService.isTourActive()) { - this.ShepherdService.trigger("save-" + this.pipelineElement.type); + this.ShepherdService.trigger('save-' + this.pipelineElement.type); } this.dialogRef.close(this.pipelineElement); } @@ -143,9 +140,9 @@ export class CustomizeComponent implements OnInit, AfterViewInit { set showDocumentation(value: boolean) { if (value) { - this.dialogRef.changeDialogSize({width: "90vw"}) + this.dialogRef.changeDialogSize({width: '90vw'}); } else { - this.dialogRef.changeDialogSize({width: this.originalDialogWidth}) + this.dialogRef.changeDialogSize({width: this.originalDialogWidth}); } this._showDocumentation = value; } @@ -178,7 +175,7 @@ export class CustomizeComponent implements OnInit, AfterViewInit { } convert(templateConfigs: Map<string, any>): any { - let configs: { [index: string]: PipelineElementTemplateConfig } = {}; + const configs: { [index: string]: PipelineElementTemplateConfig } = {}; templateConfigs.forEach((value, key) => { configs[key] = new PipelineElementTemplateConfig(); configs[key].editable = value.editable; @@ -201,11 +198,11 @@ export class CustomizeComponent implements OnInit, AfterViewInit { if (this.cachedPipelineElement instanceof DataProcessorInvocation) { this.pipelineElementTemplateService.getConfiguredDataProcessorForTemplate(event.value._id, this.cachedPipelineElement).subscribe(pe => { this.cachedPipelineElement = pe as InvocablePipelineElementUnion; - }) + }); } else { this.pipelineElementTemplateService.getConfiguredDataSinkForTemplate(event.value._id, this.cachedPipelineElement).subscribe(pe => { this.cachedPipelineElement = pe as InvocablePipelineElementUnion; - }) + }); } }
