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

feat(sqllab): improve table metadata UI #32051

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Jan 30, 2025

SUMMARY

In the case of the treeview for #31591, I discovered that if the number of tables is enormous, it causes performance issues. Therefore, this commit extracted only the modified table preview UI portion by replacing it to output the metadata of the initially selected table. (preview will be the subset of nested tabs under table preview tab)

In this change, the preview query is no longer executed automatically. Instead, it is set to execute the preview when the tab is clicked for verification. Additionally, it has been expanded to allow additional table-related information tabs through extensions, beyond just table columns and index information.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screenshot 2025-01-30 at 11 46 55 AM

After:

Screenshot 2025-01-30 at 11 47 06 AM

Screenshot 2025-01-30 at 12 55 19 PM

TESTING INSTRUCTIONS

Go to SQL Lab and select table schema options

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added change:frontend Requires changing the frontend sqllab Namespace | Anything related to the SQL Lab labels Jan 30, 2025
@github-actions github-actions bot added packages and removed sqllab Namespace | Anything related to the SQL Lab change:frontend Requires changing the frontend labels Jan 30, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Functionality Incorrect South Pane Tab Activation ▹ view
Functionality Incomplete table object in removal function ▹ view
Readability and Maintainability Unclear CSS Selector Exclusion ▹ view
Functionality Breaking Change: Columns Property Now Required ▹ view

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

Comment on lines +37 to 41
columns: {
name: string;
type: string;
longType: string;
}[];
Copy link

Choose a reason for hiding this comment

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

Breaking Change: Columns Property Now Required category Functionality

Tell me more
What is the issue?

The columns property has been changed from optional (columns?) to required (columns), which could cause runtime errors for existing data that might not have the columns property defined.

Why this matters

Existing table schemas in the system that don't have the columns property will now fail type checking and could cause the application to crash when attempting to access this required property.

Suggested change ∙ Feature Preview

Keep the columns property optional to maintain backward compatibility:

columns?: {
          name: string;
          type: string;
          longType: string;
        }[];

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

Comment on lines 119 to 131
const removeTable = useCallback(
(tableId, action) => {
if (action === 'remove') {
const table = {
id: tableId,
initialized: true,
queryEditorId,
};
dispatch(removeTables([table]));
}
},
[dispatch, queryEditorId],
);

This comment was marked as resolved.

@@ -47,7 +47,7 @@ const SqlLabStyles = styled.div`
left: 0;
padding: 0 ${theme.gridUnit * 2}px;
pre {
pre:not(.code) {
Copy link

Choose a reason for hiding this comment

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

Unclear CSS Selector Exclusion category Readability and Maintainability

Tell me more
What is the issue?

The CSS selector .code is used in a negation without context or explanation for why certain pre elements should be excluded.

Why this matters

Without understanding which pre elements have the .code class and why they need different styling, future maintainers might accidentally break the styling when modifying the codebase.

Suggested change ∙ Feature Preview

Add a comment explaining which pre elements have the .code class and why they need different styling:

/* Exclude pre elements with .code class which are used for syntax highlighting */
pre:not(.code) {

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

}
// for new table, associate Id of query for data preview
at.dataPreviewQueryId = null;
let newState = addToArr(state, 'tables', at, Boolean(action.prepend));
newState.activeSouthPaneTab = at.id;
Copy link

Choose a reason for hiding this comment

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

Incorrect South Pane Tab Activation category Functionality

Tell me more
What is the issue?

The MERGE_TABLE action unconditionally sets activeSouthPaneTab for new tables, even when the table is not expanded.

Why this matters

This could cause unexpected tab switching in the south pane when tables are added but not meant to be immediately viewed, disrupting user workflow.

Suggested change ∙ Feature Preview

Only set the active tab when the table is expanded:

let newState = addToArr(state, 'tables', at, Boolean(action.prepend));
if (at.expanded) {
  newState.activeSouthPaneTab = at.id;
}

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

@justinpark
Copy link
Member Author

/testenv up

@michael-s-molina michael-s-molina merged commit c590e90 into apache:master Jan 31, 2025
48 checks passed
sfirke pushed a commit to sfirke/superset that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants