Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/slicing pipeline #1980

Closed
wants to merge 0 commits into from

Conversation

Huongg
Copy link
Contributor

@Huongg Huongg commented Jul 11, 2024

Description

Fixes #1974,

User Story: As a Kedro user, I want to preview which nodes are included in my selection for slicing so that I can understand what my slice will be before creating a new slice

Development notes

This is a feature branch, and won't merge to main until all the other functionalities are merged and ready.

Architecture diagram as below:

Ideation session_ pipeline slicing and filtering - Data flow between Flowchart and draw and node-list

QA notes

When testing on your machine locally, or through gitpod, please note that this PR only covers the functionalities below:

  • Chart Highlighting: The two nodes selected with Shift held should be highlighted with a darker blue background, and any nodes in between should be highlighted with a lighter blue background.
  • Nodes List Highlighting: The nodes list on the left-hand side should also highlight all the nodes included in the newly selected pipeline.
  • Call to Action: A button at the bottom should display the number of nodes selected and include a "Slice" button.
  • Outside Click: Clicking outside the selection will un-select all the nodes, and go back to the default/previous page. This includes clicking on any other nodes outside the sliced pipeline

Pending design tasks that are waiting for @stephkaiser . Please ignore them when you review the PR

  • Node List Highlighting: the issue happens when the node list is currently highlighting, and you try to hover on other node. The hover style will cover the highlighting style
Screenshot 2024-07-16 at 10 38 25
  • The slice button icon

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

@Huongg Huongg self-assigned this Jul 11, 2024
@Huongg Huongg marked this pull request as ready for review July 16, 2024 09:48
@Huongg Huongg changed the title [DRAFT] Feature/slicing pipeline Feature/slicing pipeline Jul 16, 2024
@@ -136,6 +150,16 @@ export const drawNodes = function (changed) {
focusMode,
hoveredFocusMode,
} = this.props;
const { filteredPipelineState } = this.state;

const fromToFilteredPipeline = createNodeStateMap(nodes, [
Copy link
Contributor

@rashidakanchwala rashidakanchwala Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these names are a bit confusing. I cannot come up with better names but below is the best I could.
I am also ok if we stick to these names but lets leave a comment on top to define what they do

// Map the state of nodes selected by the user (from and to nodes)
const selectedNodesState = createNodeStateMap(nodes, [
  filteredPipelineState.from,
  filteredPipelineState.to,
]);

// Map the state of nodes that fall within the range between the selected nodes
const nodesInRangeState = createNodeStateMap(
  nodes,
  filteredPipelineState.range
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me have a think, I'll come back to you on this

* @param {Array} values - Array of values to check against node IDs.
* @returns {Object} An object mapping node IDs to booleans.
*/
function createNodeStateMap(nodes, values) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@@ -90,6 +102,34 @@ export class FlowChart extends Component {

componentDidUpdate(prevProps) {
this.update(prevProps);

const isFilteredPipelineChanged =
Copy link
Contributor

@rashidakanchwala rashidakanchwala Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add this code logic to update(prevProps = {}) in line 138?

and then do if changed(filteredPipeline) { } like the rest

src/actions/slice.js Outdated Show resolved Hide resolved
.eslintrc.json Outdated Show resolved Hide resolved
src/components/flowchart/flowchart.js Outdated Show resolved Hide resolved
src/components/flowchart/flowchart.js Outdated Show resolved Hide resolved
@jitu5
Copy link
Contributor

jitu5 commented Jul 26, 2024

@Huongg I observed few things when testing locally.

  • I can selected to same level nodes, Is it expected in this PR and we will handle this in separate PR?
Screenshot 2024-07-26 at 4 56 51 p m
  • Not sure about expected behaviour, If I try to hide the visibility of currently highlighted nodes from node list, it does work so we might need to disable visibility button of highlighted nodes?

@Huongg
Copy link
Contributor Author

Huongg commented Jul 26, 2024

@Huongg I observed few things when testing locally.

  • I can selected to same level nodes, Is it expected in this PR and we will handle this in separate PR?
Screenshot 2024-07-26 at 4 56 51 p m * Not sure about expected behaviour, If I try to hide the visibility of currently highlighted nodes from node list, it does work so we might need to disable visibility button of highlighted nodes?

Hi @jitu5 this is expected, it's the same behaviour from framework side. I've checked with @noklam and he confirmed it. So when user slices 2 nodes not linked to each other, this is what will be shown on the chart

@ravi-kumar-pilla
Copy link
Contributor

Hi @Huongg , This looks great. I have few questions, which I am not sure if it is by design -

  1. Should the from node be always on an upper level compared to to node ? i.e., in our demo_project can I select from as split_data and to as companies ?
  2. When I select a modular_pipeline using shift it gets expanded but none of the nodes are selected. Is it by design that shift only works with nodes ?

Thank you


export const RESET_SLICE_PIPELINE = 'RESET_SLICE_PIPELINE';

export const resetSlicePipeline = () => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] - just to have an opposite for applySlice

export const resetSlice = () => ({
type: RESET_SLICE,
slice: { from: null, to: null },
});

) =>
arrayToObject(nodeIDs, (id) => {
let isDisabledViaModularPipeline =
disabledModularPipeline[nodeModularPipelines[id]];

let isDisabledViaFilters = false;
if (slicedPipeline.length > 0 && isSliceApplied) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (slicedPipeline.length > 0 && isSliceApplied) {
if (isSliceApplied && slicedPipeline.length > 0) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please let me know what happens if getNodeDisabled returns True/False and how can a node be disabled via a slice ? Is this used for a sliced view ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey i dont think getNodeDisabled would return true or false, it will return an object with IDs and its value, eg:

{
  1e3cc50a :false
  3b199c6b: false
  3fb71518: true
}

so if its false, the node/element on the chart will be faded out. So any nodes in slicedPipeline will have the value of true, and the rest will be false. Does it make sense?

@Huongg
Copy link
Contributor Author

Huongg commented Jul 31, 2024

Hi @Huongg , This looks great. I have few questions, which I am not sure if it is by design -

  1. Should the from node be always on an upper level compared to to node ? i.e., in our demo_project can I select from as split_data and to as companies ?
  2. When I select a modular_pipeline using shift it gets expanded but none of the nodes are selected. Is it by design that shift only works with nodes ?

Thank you

hey @ravi-kumar-pilla,

first point is covered in this user story 1973, we're going to explore changing the order in the command line and let the user selects the bottom node to top node.

for second point, currently it's only working with node and dataset in the MVP 1 i think, we can certainly explore the modular_pipeline but will need to check with the framework team to see if this is something would work in framework too

@Huongg Huongg mentioned this pull request Aug 12, 2024
16 tasks
@@ -0,0 +1,27 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be in components folder not flowchart folder.

Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look's great @Huongg . I have created #2037 and #2038 as I found a few design inconsistencies when reviweing the PR (not related to slicing but from before) and we can work on it eventually.

@ravi-kumar-pilla
Copy link
Contributor

Awesome feature for Viz and looking forward to the release. Thank you @Huongg .... looks great !! 💯

@ravi-kumar-pilla ravi-kumar-pilla self-requested a review August 14, 2024 17:19
Copy link
Contributor

@jitu5 jitu5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some point we discussed during the review process like click on action bar event and slicing during embedded mode. May be we can improvise on it later but for this PR Great work @Huongg !!

@Huongg Huongg changed the base branch from main to demo-slicing-pipeline-final August 14, 2024 19:09
@Huongg Huongg requested a review from astrojuanlu as a code owner August 14, 2024 19:09
@Huongg Huongg closed this Aug 14, 2024
@Huongg Huongg force-pushed the feature/slicing-pipeline branch from 3b8e628 to 13f1d95 Compare August 14, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants