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
The following commit(s) were added to refs/heads/STREAMPIPES-145 by this push:
new d0d2a73 [STREAMPIPES-145] Fix bug in pipeline modification feature
d0d2a73 is described below
commit d0d2a7358ac2abd6e738b7aa7bda5581f48580d7
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue Jul 28 20:34:17 2020 +0200
[STREAMPIPES-145] Fix bug in pipeline modification feature
---
.../confirm-dialog/confirm-dialog.component.html | 4 +-
.../pipeline-assembly.component.ts | 25 ++++---
.../components/pipeline/pipeline.component.ts | 24 ++++---
ui/src/app/editor-v2/editor.component.ts | 10 ++-
ui/src/app/editor-v2/services/editor.service.ts | 1 +
ui/src/app/editor-v2/services/jsplumb.service.ts | 10 +--
.../pipeline-overview.component.ts | 13 ++--
ui/src/app/pipelines/pipelines.component.html | 8 +--
ui/src/app/pipelines/pipelines.component.ts | 76 ++++++++++------------
9 files changed, 85 insertions(+), 86 deletions(-)
diff --git
a/ui/src/app/core-ui/dialog/confirm-dialog/confirm-dialog.component.html
b/ui/src/app/core-ui/dialog/confirm-dialog/confirm-dialog.component.html
index 47aac1c..6996cf0 100644
--- a/ui/src/app/core-ui/dialog/confirm-dialog/confirm-dialog.component.html
+++ b/ui/src/app/core-ui/dialog/confirm-dialog/confirm-dialog.component.html
@@ -4,7 +4,7 @@
<h5>{{data.subtitle}}</h5>
</div>
<div fxFlex="100" fxLayoutAlign="end center" class="footer">
- <button mat-button (click)="onCancel()">No</button>
- <button mat-button [mat-dialog-close]="true"
cdkFocusInitial>Yes</button>
+ <button mat-button (click)="onCancel()"
*ngIf="data.confirmAndCancel">{{data.cancelTitle}}</button>
+ <button mat-button [mat-dialog-close]="true"
cdkFocusInitial>{{data.okTitle}}</button>
</div>
</div>
\ No newline at end of file
diff --git
a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts
b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts
index 4bbf6c3..709d512 100644
---
a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts
+++
b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts
@@ -21,7 +21,6 @@ import {JsplumbBridge} from
"../../services/jsplumb-bridge.service";
import {PipelinePositioningService} from
"../../services/pipeline-positioning.service";
import {PipelineValidationService} from
"../../services/pipeline-validation.service";
import {JsplumbService} from "../../services/jsplumb.service";
-import {RestApi} from "../../../services/rest-api.service";
import {ShepherdService} from "../../../services/tour/shepherd.service";
import {PipelineElementConfig, PipelineElementUnion} from
"../../model/editor.model";
import {ObjectProvider} from "../../services/object-provider.service";
@@ -31,6 +30,7 @@ import {DialogService} from
"../../../core-ui/dialog/base-dialog/base-dialog.ser
import {ConfirmDialogComponent} from
"../../../core-ui/dialog/confirm-dialog/confirm-dialog.component";
import {MatDialog} from "@angular/material/dialog";
import {EditorService} from "../../services/editor.service";
+import {PipelineService} from
"../../../platform-services/apis/pipeline.service";
@Component({
@@ -65,15 +65,13 @@ export class PipelineAssemblyComponent implements OnInit {
pipelineCacheRunning: boolean = false;
pipelineCached: boolean = false;
- // Remove later
- EditorDialogManager: any;
constructor(private JsplumbBridge: JsplumbBridge,
private PipelinePositioningService: PipelinePositioningService,
private ObjectProvider: ObjectProvider,
public EditorService: EditorService,
public PipelineValidationService: PipelineValidationService,
- private RestApi: RestApi,
+ private PipelineService: PipelineService,
private JsplumbService: JsplumbService,
private ShepherdService: ShepherdService,
private dialogService: DialogService,
@@ -86,7 +84,7 @@ export class PipelineAssemblyComponent implements OnInit {
ngOnInit(): void {
if (this.currentModifiedPipelineId) {
- //this.displayPipelineById();
+ this.displayPipelineById();
} else {
this.checkAndDisplayCachedPipeline();
}
@@ -145,7 +143,10 @@ export class PipelineAssemblyComponent implements OnInit {
width: '500px',
data: {
"title": "Do you really want to delete the current pipeline?",
- "subtitle": "This cannot be undone."
+ "subtitle": "This cannot be undone.",
+ "cancelTitle": "No",
+ "okTitle": "Yes",
+ "confirmAndCancel": true
},
});
dialogRef.afterClosed().subscribe(ev => {
@@ -204,11 +205,6 @@ export class PipelineAssemblyComponent implements OnInit {
});
}
-
- openPipelineNameModal(pipeline, modificationMode) {
- this.EditorDialogManager.showSavePipelineDialog(pipeline,
modificationMode);
- }
-
checkAndDisplayCachedPipeline() {
this.EditorService.getCachedPipeline().subscribe(msg => {
if (msg) {
@@ -219,12 +215,13 @@ export class PipelineAssemblyComponent implements OnInit {
}
displayPipelineById() {
- this.RestApi.getPipelineById(this.currentModifiedPipelineId)
- .then((msg) => {
- let pipeline = msg.data;
+ this.PipelineService.getPipelineById(this.currentModifiedPipelineId)
+ .subscribe((msg) => {
+ let pipeline = msg;
this.currentPipelineName = pipeline.name;
this.currentPipelineDescription = pipeline.description;
this.rawPipelineModel =
this.JsplumbService.makeRawPipeline(pipeline, false);
+ console.log(this.rawPipelineModel);
this.displayPipelineInEditor(true);
});
};
diff --git a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
index c3ad09b..dafc62e 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
@@ -44,6 +44,8 @@ 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";
@Component({
selector: 'pipeline',
@@ -81,9 +83,7 @@ export class PipelineComponent implements OnInit {
availablePipelineElementCache: PipelineElementUnion[];
- DialogBuilder: any;
plumbReady: any;
- EditorDialogManager: any;
currentMouseOverElement: string;
currentPipelineModel: Pipeline;
idCounter: any;
@@ -97,13 +97,11 @@ export class PipelineComponent implements OnInit {
private JsplumbBridge: JsplumbBridge,
private ObjectProvider: ObjectProvider,
private EditorService: EditorService,
- //DialogBuilder,
- //EditorDialogManager,
- // TransitionService,
private ShepherdService: ShepherdService,
private PipelineValidationService: PipelineValidationService,
private RestApi: RestApi,
- private dialogService: DialogService) {
+ private dialogService: DialogService,
+ private dialog: MatDialog) {
this.plumbReady = false;
this.currentMouseOverElement = "";
this.currentPipelineModel = new Pipeline();
@@ -166,7 +164,15 @@ export class PipelineComponent implements OnInit {
}
showMixedStreamAlert() {
- this.EditorDialogManager.showMixedStreamAlert();
+ this.dialog.open(ConfirmDialogComponent, {
+ width: '500px',
+ data: {
+ "title": "Do you really want to delete the current pipeline?",
+ "subtitle": "This cannot be undone.",
+ "confirmAndCancel": false,
+ "okTitle": "Close",
+ },
+ });
}
findPipelineElementByElementId(elementId: string) {
@@ -182,7 +188,7 @@ export class PipelineComponent implements OnInit {
let pipelineElement: PipelineElementUnion =
this.findPipelineElementByElementId(pipelineElementId);
if (ui.draggable.hasClass('draggable-icon')) {
this.EditorService.makePipelineAssemblyEmpty(false);
- var pipelineElementConfig =
this.JsplumbService.createNewPipelineElementConfig(pipelineElement,
this.PipelineEditorService.getCoordinates(ui, this.currentZoomLevel), false);
+ var pipelineElementConfig =
this.JsplumbService.createNewPipelineElementConfig(pipelineElement,
this.PipelineEditorService.getCoordinates(ui, this.currentZoomLevel), false,
false);
if ((this.isStreamInPipeline() && pipelineElementConfig.type ==
'set') ||
this.isSetInPipeline() && pipelineElementConfig.type ==
'stream') {
this.showMixedStreamAlert();
@@ -227,7 +233,7 @@ export class PipelineComponent implements OnInit {
.eventGrounding
.transportProtocols[0]
.topicDefinition["@class"] ===
"org.apache.streampipes.model.grounding.WildcardTopicDefinition") {
- this.EditorDialogManager.showCustomizeStreamDialog(streamDescription);
+ //this.EditorDialogManager.showCustomizeStreamDialog(streamDescription);
}
}
diff --git a/ui/src/app/editor-v2/editor.component.ts
b/ui/src/app/editor-v2/editor.component.ts
index efcdd38..6bf1604 100644
--- a/ui/src/app/editor-v2/editor.component.ts
+++ b/ui/src/app/editor-v2/editor.component.ts
@@ -16,7 +16,7 @@
*
*/
-import {Component, OnInit} from "@angular/core";
+import {Component, Inject, OnInit} from "@angular/core";
import {EditorService} from "./services/editor.service";
import {
DataProcessorInvocation,
@@ -58,7 +58,7 @@ export class EditorComponent implements OnInit {
currentElements: Array<(SpDataStream | DataProcessorInvocation |
DataSinkInvocation)> = [];
rawPipelineModel: PipelineElementConfig[] = [];
- currentModifiedPipelineId: any;
+ currentModifiedPipelineId: string;
elementsLoaded = [false, false, false];
allElementsLoaded: boolean = false;
@@ -95,10 +95,14 @@ export class EditorComponent implements OnInit {
private pipelineElementService: PipelineElementService,
private AuthStatusService: AuthStatusService,
private dialogService: DialogService,
- private shepherdService: ShepherdService) {
+ private shepherdService: ShepherdService,
+ @Inject("$stateParams") private $stateParams) {
}
ngOnInit() {
+ if (this.$stateParams.pipeline) {
+ this.currentModifiedPipelineId = this.$stateParams.pipeline;
+ }
this.pipelineElementService.getDataProcessors().subscribe(processors
=> {
this.availableDataProcessors = processors;
this.allElements = this.allElements.concat(processors);
diff --git a/ui/src/app/editor-v2/services/editor.service.ts
b/ui/src/app/editor-v2/services/editor.service.ts
index 0b4218a..f8aa36c 100644
--- a/ui/src/app/editor-v2/services/editor.service.ts
+++ b/ui/src/app/editor-v2/services/editor.service.ts
@@ -60,6 +60,7 @@ export class EditorService {
getCachedPipeline(): Observable<PipelineElementConfig[]> {
return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipeline-cache")
.pipe(map(result => {
+ console.log(result);
let configs: PipelineElementConfig[] = result as
PipelineElementConfig[];
configs.map(config => config.payload =
this.convert(config.payload));
return configs;
diff --git a/ui/src/app/editor-v2/services/jsplumb.service.ts
b/ui/src/app/editor-v2/services/jsplumb.service.ts
index fa0c65c..6dca6b6 100644
--- a/ui/src/app/editor-v2/services/jsplumb.service.ts
+++ b/ui/src/app/editor-v2/services/jsplumb.service.ts
@@ -84,8 +84,7 @@ export class JsplumbService {
toConfig(pe, type, isPreview) {
pe.type = type;
- pe.configured = true;
- return this.createNewPipelineElementConfig(pe, {x: 100, y: 100},
isPreview);
+ return this.createNewPipelineElementConfig(pe, {x: 100, y: 100},
isPreview, true);
}
@@ -139,12 +138,13 @@ export class JsplumbService {
var x = $parentElement.position().left;
var y = $parentElement.position().top;
var coord = {'x': x + 200, 'y': y};
- return this.createNewPipelineElementConfig(json, coord, isPreview);
+ return this.createNewPipelineElementConfig(json, coord, isPreview,
false);
}
createNewPipelineElementConfig(pipelineElement: PipelineElementUnion,
coordinates,
- isPreview: boolean): PipelineElementConfig {
+ isPreview: boolean,
+ isCompleted: boolean):
PipelineElementConfig {
let displaySettings = isPreview ? 'connectable-preview' :
'connectable-editor';
let connectable = "connectable";
let pipelineElementConfig = {} as PipelineElementConfig;
@@ -154,7 +154,7 @@ export class JsplumbService {
pipelineElementConfig.settings = {connectable: connectable,
openCustomize: !(pipelineElement as any).configured,
preview: isPreview,
- completed: (pipelineElement instanceof SpDataStream || isPreview),
+ completed: (pipelineElement instanceof SpDataStream || isPreview
|| isCompleted),
disabled: false,
loadingStatus: false,
displaySettings: displaySettings,
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
index 4e74da9..6e1b4ca 100644
---
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
@@ -35,6 +35,9 @@ export class PipelineOverviewComponent implements OnInit {
filteredPipelinesAvailable: boolean = false;
+ @Input()
+ pipelineToStart: Pipeline;
+
@Output()
refreshPipelinesEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
@@ -56,13 +59,11 @@ export class PipelineOverviewComponent implements OnInit {
ngOnInit() {
this.toggleRunningOperation = this.toggleRunningOperation.bind(this);
- this.pipelines.forEach(pipeline => {
- if ((pipeline as any).immediateStart) {
- if (!pipeline.running) {
- this.pipelineOperationsService.startPipeline(pipeline._id,
this.toggleRunningOperation, this.refreshPipelinesEmitter);
- }
+ if (this.pipelineToStart) {
+ if (!this.pipelineToStart.running) {
+ this.pipelineOperationsService.startPipeline(this.pipelineToStart._id,
this.toggleRunningOperation, this.refreshPipelinesEmitter);
}
- });
+ }
}
toggleRunningOperation(currentOperation) {
diff --git a/ui/src/app/pipelines/pipelines.component.html
b/ui/src/app/pipelines/pipelines.component.html
index ed57aec..1cb7d42 100644
--- a/ui/src/app/pipelines/pipelines.component.html
+++ b/ui/src/app/pipelines/pipelines.component.html
@@ -58,16 +58,16 @@
</div>
</div>
<div class="sp-blue-border">
- <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="pipelines"
-
(refreshPipelinesEmitter)="refreshPipelines()"></pipeline-overview>
+ <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="pipelines" [pipelineToStart]="pipelineToStart"
+ (refreshPipelinesEmitter)="refreshPipelines()"
*ngIf="pipelinesReady"></pipeline-overview>
</div>
<div style="margin-top:20px;margin-bottom:20px;"></div>
<div class="assemblyOptions sp-blue-bg">
<h4>System-generated pipelines</h4>
</div>
<div class="sp-blue-border">
- <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="systemPipelines"
-
(refreshPipelinesEmitter)="refreshPipelines()"></pipeline-overview>
+ <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="systemPipelines" [pipelineToStart]="systemPipelineToStart"
+ (refreshPipelinesEmitter)="refreshPipelines()"
*ngIf="pipelinesReady"></pipeline-overview>
</div>
</div>
</div>
diff --git a/ui/src/app/pipelines/pipelines.component.ts
b/ui/src/app/pipelines/pipelines.component.ts
index 39690d3..c49423a 100644
--- a/ui/src/app/pipelines/pipelines.component.ts
+++ b/ui/src/app/pipelines/pipelines.component.ts
@@ -18,7 +18,7 @@
import * as angular from 'angular';
import * as FileSaver from 'file-saver';
-import {Component, OnInit} from "@angular/core";
+import {Component, Inject, OnInit} from "@angular/core";
import {PipelineService} from "../platform-services/apis/pipeline.service";
import {Pipeline, PipelineCategory} from '../core-model/gen/streampipes-model';
import {DialogService} from
"../core-ui/dialog/base-dialog/base-dialog.service";
@@ -27,6 +27,7 @@ import {ImportPipelineDialogComponent} from
"./dialog/import-pipeline/import-pip
import {DialogRef} from "../core-ui/dialog/base-dialog/dialog-ref";
import {StartAllPipelinesDialogComponent} from
"./dialog/start-all-pipelines/start-all-pipelines-dialog.component";
import {PipelineCategoriesDialogComponent} from
"./dialog/pipeline-categories/pipeline-categories-dialog.component";
+import {zip} from "rxjs";
declare const jsPlumb: any;
declare const require: any;
@@ -38,39 +39,34 @@ declare const require: any;
})
export class PipelinesComponent implements OnInit {
- RestApi: any;
- $mdDialog: any;
- $state: any;
- $timeout: any;
- $stateParams: any;
- ImageChecker: any;
- ElementIconText: any;
pipeline: Pipeline;
pipelines: Array<Pipeline> = [];
systemPipelines: Array<Pipeline> = [];
- pipelinShowing: any;
- pipelinePlumb: any;
- starting: any;
- stopping: any;
+ starting: boolean;
+ stopping: boolean;
pipelineCategories: Array<PipelineCategory>;
activeCategoryId: string;
- startPipelineDirectly: any;
+ pipelineIdToStart: string;
+
+ pipelineToStart: Pipeline;
+ systemPipelineToStart: Pipeline;
+
+ pipelinesReady: boolean = false;
selectedCategoryIndex: number = 0;
constructor(private pipelineService: PipelineService,
- private DialogService: DialogService) {
+ private DialogService: DialogService,
+ @Inject('$stateParams') private $stateParams) {
this.pipelineCategories = [];
this.starting = false;
this.stopping = false;
- // this.startPipelineDirectly = $stateParams.pipeline;
-
+ this.pipelineIdToStart = $stateParams.pipeline;
}
ngOnInit() {
this.getPipelineCategories();
this.getPipelines();
- this.getSystemPipelines();
}
setSelectedTab(index) {
@@ -89,27 +85,28 @@ export class PipelinesComponent implements OnInit {
getPipelines() {
this.pipelines = [];
- this.pipelineService.getOwnPipelines()
- .subscribe(pipelines => {
- this.pipelines = pipelines;
- if (this.startPipelineDirectly != "") {
- this.pipelines.forEach(pipeline => {
- if (pipeline._id == this.startPipelineDirectly) {
- (pipeline as any).immediateStart = true;
- }
- });
- this.startPipelineDirectly = "";
- }
- });
-
+ zip(this.pipelineService.getOwnPipelines(),
this.pipelineService.getSystemPipelines()).subscribe(allPipelines => {
+ this.pipelines = allPipelines[0];
+ this.systemPipelines = allPipelines[1];
+ this.checkForImmediateStart(allPipelines);
+ this.pipelinesReady = true;
+ });
};
- getSystemPipelines() {
- this.systemPipelines = [];
- this.pipelineService.getSystemPipelines()
- .subscribe(pipelines => {
- this.systemPipelines = pipelines;
- });
+ checkForImmediateStart(allPipelines: Pipeline[][]) {
+ this.pipelineToStart = undefined;
+ allPipelines.forEach((pipelines , index) => {
+ pipelines.forEach(pipeline => {
+ if (pipeline._id == this.pipelineIdToStart) {
+ if (index == 0) {
+ this.pipelineToStart = pipeline;
+ } else {
+ this.systemPipelineToStart = pipeline;
+ }
+ }
+ })
+ });
+ this.pipelineIdToStart = undefined;
}
getPipelineCategories() {
@@ -119,11 +116,6 @@ export class PipelinesComponent implements OnInit {
});
};
- isTextIconShown(element) {
- return element.iconUrl == null || element.iconUrl ==
'http://localhost:8080/img' || typeof element.iconUrl === 'undefined';
-
- };
-
activeClass(pipeline) {
return 'active-pipeline';
}
@@ -195,10 +187,8 @@ export class PipelinesComponent implements OnInit {
refreshPipelines() {
this.getPipelines();
- this.getSystemPipelines();
}
-
showPipeline(pipeline) {
pipeline.display = !pipeline.display;
}