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

Document Kedro-Viz React component usage #1745

Closed
1 task done
datajoely opened this issue Feb 12, 2024 · 12 comments
Closed
1 task done

Document Kedro-Viz React component usage #1745

datajoely opened this issue Feb 12, 2024 · 12 comments
Assignees
Labels
Documentation Issue: Feature Request Quick Win Low/Medium priorities but quick to do

Comments

@datajoely
Copy link
Contributor

Description

Is your feature request related to a problem? A clear and concise description of what the problem is: "I'm always frustrated when ..."

The usage of Kedro Viz as a react component is not present in the docs.

The only way for a user to discover this functionality is by trawling through issues:
#1351
#1293

This is a powerful feature we should enable more users to take advantage of.

Context

Why is this change important to you? How would you use it? How can it benefit other users?

I was looking into how to do this and couldn't find examples in the docs

Possible Implementation

(Optional) Suggest an idea for implementing the addition or change.

Possible Alternatives

(Optional) Describe any alternative solutions or features you've considered.

N/A

Checklist

  • Include labels so that we can categorise your feature request
@astrojuanlu
Copy link
Member

I've been thinking about this for a while, 100 % agreed with documenting what we already have at the very least 👍🏽

@tynandebold
Copy link
Member

tynandebold commented Feb 12, 2024

It exists in the README here: https://github.com/kedro-org/kedro-viz?tab=readme-ov-file#standalone-react-component-usage

If a user is looking for how to use it like this we should send them here until it's added to the docs.

Edit: this part is important, too.

@rashidakanchwala rashidakanchwala moved this to Inbox in Kedro-Viz Mar 11, 2024
@rashidakanchwala rashidakanchwala added the Quick Win Low/Medium priorities but quick to do label Mar 11, 2024
@rashidakanchwala
Copy link
Contributor

Also maybe documenting how to use graph component e.g. the way layer team did.

@astrojuanlu
Copy link
Member

The current docs https://github.com/kedro-org/kedro-viz?tab=readme-ov-file#standalone-react-component-usage are unclear:

kedro-viz/README.md

Lines 254 to 258 in 2a6cff7

The JSON can be obtained by running:
```bash
kedro viz run --save-file=filename
```

but then if I do that, here's what I get:

exportation/api/
├── main
├── nodes
│   ├── 23c94afb
│   ├── 28754fab
│   ├── 2ab3579f
│   ├── 329e963c
│   ├── 369acf98
│   ├── 493ad53a
│   ├── 4ca0be7b
│   ├── 7b2c6e04
│   ├── 81b5866f
│   ├── 872981f9
│   ├── 93d834e1
│   ├── 966b9734
│   ├── 97202ac0
│   ├── 9ca016a8
│   ├── 9e16ddd2
│   ├── a9506115
│   ├── aadc655d
│   ├── ab512939
│   ├── acdb05cf
│   ├── aed46479
│   ├── c071dac9
│   ├── c1311718
│   ├── cae2d1c7
│   ├── d75ec4b0
│   ├── f1d596c2
│   └── f6d9538c
└── pipelines
    ├── __default__
    ├── data_processing
    ├── data_science
    └── reporting

3 directories, 31 files

where's the JSON? What am I supposed to do with this?

@astrojuanlu
Copy link
Member

From #1850:

I don't have a great view on how well this works. But I think it's just a case of passing the right JSON to the object.

  • Is the JSON schema defined anywhere?
  • If new JSON is provided does it trigger a full refresh?
    • Is there a way to do a graceful addition/removal?

@rashidakanchwala rashidakanchwala moved this from Backlog to Todo in Kedro-Viz Apr 15, 2024
@astrojuanlu astrojuanlu moved this from Todo to In Progress in Kedro-Viz Jun 4, 2024
@jitu5
Copy link
Contributor

jitu5 commented Jun 13, 2024

Had a discussion with @astrojuanlu and @stephkaiser on Kedro-Viz as react component.

The discussion happens mainly around feature request from @datajoely (Managed analytics), what is missing from Kedro-Viz react component and what can be scoped under this ticket.

The major feature request from Managed analytics:

  1. Disabling some components of kedro-Viz
    a. Global toolbar
    b. Primary toolbar (need options to turn off each icon like layer, label)
    c. User onboarding workflow
    d. Need preview mode (only flowchart)
    e. When a user clicks on a node, send the metadata of the associated node to the caller/user of the viz component. The user can then display this metadata according to their needs.

  2. Some of the existing props is not working
    a. display.sidebar(It only minimizes the sidebar/primaryToolbar but does not hide it.)

  3. Need styling option to add custom theme
    a. overwrite the style of flowchart like bg, node, links etc

  4. Missing documentation on how to use props React component

  5. Need API to do node filtering at FE

Out of the above we mainly discuss 1.d, 1.e, 3 & 4 point. for the point 1.e and 3 needs more discussion and can be handle separately later. For now under this ticket I am focusing on documenting on what we have and exploring preview mode(flowchart only).

@jitu5
Copy link
Contributor

jitu5 commented Jun 13, 2024

@datajoely
Below is the example of kedro-Viz as react component with all possible pros

  <KedroViz
    data={data}
    display={{
      globalToolbar: false,
      miniMap: false,
      expandAllPipelines: false,
      sidebar: false,
    }}
    visible={{
      labelBtn: false,
      layerBtn: false,
      exportBtn: false,
      pipelineBtn: false,
      sidebar: false,
    }}
    theme="dark"
  /> 

I show in management-console code how you are using props, but for now if you follow props structure as mentioned above it should solve your disabling viz components problem like global toolbar & user onboarding workflow. the only component left which is not part of current props is primaryToolbar. For this ticket I will explore more about primaryToolbar.

Screenshot 2024-06-13 at 6 12 31 p m

@datajoely
Copy link
Contributor Author

Great!

@astrojuanlu
Copy link
Member

xref #1943

@astrojuanlu
Copy link
Member

Expected outcomes of this ticket:

image

@jitu5 jitu5 moved this from In Progress to In Review in Kedro-Viz Jul 10, 2024
@astrojuanlu astrojuanlu mentioned this issue Jul 10, 2024
5 tasks
@jitu5 jitu5 moved this from In Review to Done in Kedro-Viz Jul 22, 2024
@rashidakanchwala
Copy link
Contributor

Closing this as done

@astrojuanlu
Copy link
Member

Fixed in #1992

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment