Skip to content

Enhance frontend dashboard UX and backend SDK with improved error handling and type hints #699

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HariharanBalakrishnan22

name: Pull Request
about: Create a pull request to contribute to the project
title: 'This PR improves the developer and user experience in Preswald apps across both frontend and backend layers.
'
labels: ''
assignees: ''

Related Issue
Also github issue Fix #698

Description of Changes
This pull request introduces UX and SDK improvements that enhance the developer and user experience.

  • Frontend (Dashboard.jsx):

    • Added safer checks for components.rows being undefined or empty
    • Improved messaging for when the dashboard is empty or misconfigured
    • Provides user-friendly suggestions to troubleshoot query results
  • Backend SDK (interfaces/):

    • Added type hints to connect(), query(), and get_df() functions
    • Enhanced docstrings and in-code documentation
    • Improved error logging and safe fallback returns

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • New example
  • Test improvement

Testing

  • Verified changes visually by running the dashboard and testing invalid query states
  • Simulated empty components state and observed fallback messaging
  • Reviewed logs for clearer error reporting

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run my code against examples and ensured no errors
  • Any dependent changes have been merged and published in downstream modules

@HariharanBalakrishnan22
Copy link
Author

Hi team!
While working on the Preswald assessment and exploring the codebase, I came across a few developer-facing and UI improvements that I thought could help new users.
This PR includes type-safe enhancements in the SDK, safer UI error handling, and more helpful messaging for empty or misconfigured dashboards.
Happy to iterate or split things out further. Appreciate all the great work you’re doing on Preswald!

df_result = service.data_manager.query(sql, source_name)
elapsed_time = time.time() - start_time

Choose a reason for hiding this comment

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

This should probably be removed since its not used

return (
<div className="dashboard-loading-container">
<LoadingState

Choose a reason for hiding this comment

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

Doesn't seem wise to remove loadingstate component

customText={!components ? 'Loading components' : 'Invalid components data'}
/>
<div className="dashboard-empty">
<p className="dashboard-empty-text">

Choose a reason for hiding this comment

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

I think the existing loadingstate component is good

if (components.rows.length === 0) {
return (
<div className="dashboard-empty">
<p className="dashboard-empty-text">No components to display</p>
<p className="dashboard-empty-text">
No components to display. Try running a query or verifying your configuration settings.

Choose a reason for hiding this comment

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

Not sure if this messaging is right

logger.info(f"Successfully queried data source: {source_name}")
return df_result
except Exception as e:
logger.error(f"Error querying data source: {e}")
return None

Choose a reason for hiding this comment

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

imo, should error out instead of returning None

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.

Slider widget does not trigger updates unless explicitly reloaded each time
2 participants