Skip to content

Commit

Permalink
Update flowchart.py
Browse files Browse the repository at this point in the history
Signed-off-by: Sajid Alam <[email protected]>
  • Loading branch information
SajidAlamQB committed Sep 2, 2024
1 parent b85425a commit 1dbfef1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions package/kedro_viz/models/flowchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,20 @@ def set_preview(cls, _):
return None

try:
preview_data = cls.dataset.preview()
preview_type = cls.data_node.viz_metadata.get("preview_type")
preview_args = (
cls.data_node.get_preview_args() if cls.data_node.viz_metadata else None
)

# Generate preview data with or without preview_args
if preview_args:
preview_data = cls.dataset.preview(**preview_args)
else:
preview_data = cls.dataset.preview()

# Determine the preview type
preview_type = (
cls.data_node.viz_metadata.get("preview_type") if cls.data_node.viz_metadata else None
)

# Validate the format based on the preview type
if preview_type == "TablePreview":
Expand Down

0 comments on commit 1dbfef1

Please sign in to comment.