From 51de66b99dd291a819207794b366eb11eeeffed2 Mon Sep 17 00:00:00 2001 From: CTomlyn Date: Tue, 3 Dec 2024 14:11:52 -0800 Subject: [PATCH] #2254 setPipelineFlow cannot work when only primary_pipeline changed Signed-off-by: CTomlyn --- .../common-canvas/src/common-canvas/canvas-controller.js | 2 +- .../common-canvas/src/object-model/object-model.js | 7 ++++++- .../src/object-model/redux/reducers/breadcrumbs.js | 9 +++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/canvas_modules/common-canvas/src/common-canvas/canvas-controller.js b/canvas_modules/common-canvas/src/common-canvas/canvas-controller.js index 592d876140..e2acd94172 100644 --- a/canvas_modules/common-canvas/src/common-canvas/canvas-controller.js +++ b/canvas_modules/common-canvas/src/common-canvas/canvas-controller.js @@ -1737,7 +1737,7 @@ export default class CanvasController { this.editActionHandler(data); } - // Returns the supernode speified in the bradcrumb provided. + // Returns the supernode speified in the breadcrumb provided. getSupernodeFromBreadcrumb(breadcrumb) { if (breadcrumb.supernodeParentPipelineId) { const apiPipeline = this.objectModel.getAPIPipeline(breadcrumb.supernodeParentPipelineId); diff --git a/canvas_modules/common-canvas/src/object-model/object-model.js b/canvas_modules/common-canvas/src/object-model/object-model.js index 1349995ffb..ce74c3d092 100644 --- a/canvas_modules/common-canvas/src/object-model/object-model.js +++ b/canvas_modules/common-canvas/src/object-model/object-model.js @@ -433,7 +433,8 @@ export default class ObjectModel { this.executeWithSelectionChange(this.store.dispatch, { type: "SET_CANVAS_INFO", canvasInfo: canvasInfo, - canvasInfoIdChanged: this.hasCanvasInfoIdChanged(canvasInfo) + canvasInfoIdChanged: this.hasCanvasInfoIdChanged(canvasInfo), + primaryPipelineIdChanged: this.hasPrimaryPipelineIdChanged(canvasInfo) }); } @@ -1047,6 +1048,10 @@ export default class ObjectModel { return canvasInfo.id !== this.getCanvasInfo().id; } + hasPrimaryPipelineIdChanged(canvasInfo) { + return canvasInfo.primary_pipeline !== this.getCanvasInfo().primary_pipeline; + } + setSubdueStyle(newStyle) { this.store.dispatch({ type: "SET_SUBDUE_STYLE", data: { subdueStyle: newStyle } }); } diff --git a/canvas_modules/common-canvas/src/object-model/redux/reducers/breadcrumbs.js b/canvas_modules/common-canvas/src/object-model/redux/reducers/breadcrumbs.js index e64b9a165a..7ca5dd05b0 100644 --- a/canvas_modules/common-canvas/src/object-model/redux/reducers/breadcrumbs.js +++ b/canvas_modules/common-canvas/src/object-model/redux/reducers/breadcrumbs.js @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 Elyra Authors + * Copyright 2017-2024 Elyra Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,11 @@ export default (state = [], action) => { case "SET_CANVAS_INFO": { // In some instances, with an external object model, the same canvas may // be set multiple times. Consequently, we only reset the breadcrumbs if - // we're given a completely new canvas or the current breadcrumb does not - // reference a pipeline Id in the incoming pipelineFlow, which might happen - // if the pipeline has been removed. + // we're given a completely new canvas OR the primary pipeline ID has changed + // OR the current breadcrumb does not reference a pipeline Id in the incoming + // pipelineFlow, which might happen if the pipeline has been removed. if (action.canvasInfoIdChanged || + action.primaryPipelineIdChanged || !isCurrentBreadcrumbInPipelineFlow(state, action.canvasInfo)) { return [{ pipelineId: action.canvasInfo.primary_pipeline, pipelineFlowId: action.canvasInfo.id }]; }