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

Refactor disable preview toggle to be only front end #2067

Merged
merged 8 commits into from
Sep 4, 2024
Merged

Conversation

SajidAlamQB
Copy link
Contributor

@SajidAlamQB SajidAlamQB commented Sep 2, 2024

Description

Related to: #2042

This ticket is to refactor the preview datasets toggle setting feature to handle logic for previews from FE instead of making BE calls.

This feature enables users to control data previews for all nodes from the settings panel of Kedro-Viz when running kedro viz locally.

After running Kedro-Viz locally, dataset previews for all nodes will be enabled by default. However, users will have the ability to enable or disable this feature from the Kedro-Viz settings panel.

Development notes

We now have a check for the dataset preview toggle in metadata.js before rendering the previews.

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

Signed-off-by: Sajid Alam <sajid_alam@mckinsey.com>
@SajidAlamQB SajidAlamQB self-assigned this Sep 2, 2024
Signed-off-by: Sajid Alam <sajid_alam@mckinsey.com>
Signed-off-by: Sajid Alam <sajid_alam@mckinsey.com>
@SajidAlamQB SajidAlamQB marked this pull request as ready for review September 2, 2024 09:18
SajidAlamQB and others added 2 commits September 3, 2024 09:56
Signed-off-by: Sajid Alam <sajid_alam@mckinsey.com>
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.

Just one comment otherwise looks good :)

SajidAlamQB and others added 2 commits September 3, 2024 11:49
Signed-off-by: Sajid Alam <sajid_alam@mckinsey.com>
@ravi-kumar-pilla
Copy link
Contributor

Hi @SajidAlamQB , Thank you for the refactor. Tested this on Gitpod and it works well.

I just have 1 question for the flag in the UI. Do we show this flag even on the hosted Kedro-Viz instance ? Like if someone does a kedro viz deploy or kedro viz build without including preview, will Kedro-Viz has the flag in settings panel ?

For me the flag does make sense in local as the user cannot disable preview on kedro viz run. So the flag is always True by default. But for the deployed version, user can control this behavior using --include-previews . The flag will not have any effect if someone did not include preview when building the viz instance. cc: @rashidakanchwala @stephkaiser

Thank you

@SajidAlamQB
Copy link
Contributor Author

For me the flag does make sense in local as the user cannot disable preview on kedro viz run. So the flag is always True by default. But for the deployed version, user can control this behavior using --include-previews . The flag will not have any effect if someone did not include preview when building the viz instance. cc: @rashidakanchwala @stephkaiser

Good spot! As it is, the flag will be shown even if the --include-previews argument isn't used, meaning the flag might not function as expected without it. I think we can fix this by conditionally displaying the flag in the settings panel only if the --include-previews argument was used during deployment. What do you think? Is there any existing flags we do this for that we can take inspiration from?

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.

Thanks @SajidAlamQB

@ravi-kumar-pilla
Copy link
Contributor

Good spot! As it is, the flag will be shown even if the --include-previews argument isn't used, meaning the flag might not function as expected without it. I think we can fix this by conditionally displaying the flag in the settings panel only if the --include-previews argument was used during deployment. What do you think? Is there any existing flags we do this for that we can take inspiration from?

One way we can do this is using the viz_metadata_file that is available in the build/deploy artifacts.

At this moment, it has timestamp and version keys. May be adding a json key like is_all_previews_enabled in this file and in the FE reading the json in deployment mode (i.e., not localhost) could be an option. But I am happy to hear from the team. Thank you

@rashidakanchwala
Copy link
Contributor

fair points, I would keep this simple for now the way it is. and wait for user to raise this if it's an issue and then try to fix it.

@SajidAlamQB SajidAlamQB merged commit 5764d09 into main Sep 4, 2024
34 checks passed
@SajidAlamQB SajidAlamQB deleted the preview-FE branch September 4, 2024 19:48
@SajidAlamQB SajidAlamQB mentioned this pull request Sep 4, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants