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: migrate SqlEditor component to FC & tsx #18148

Closed
wants to merge 10 commits into from
Closed

refactor: migrate SqlEditor component to FC & tsx #18148

wants to merge 10 commits into from

Conversation

EugeneTorap
Copy link
Contributor

SUMMARY

Migrated SqlEditor to TypeScript to apply direction outlined in #18100 .

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: Migrate components to TypeScript #18100
  • 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

@EugeneTorap
Copy link
Contributor Author

@ad-m @eschutho I have a issue with <Menu onClick={this.handleMenuClick} style={{ width: 176 }}>
SqlEditor class component doesn't have handleMenuClick. What should I do?

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

Hey @EugeneTorap thanks for the work that you put into this! Please find below some initial comments from a first look.

Comment on lines +30 to +36
import {
Dropdown,
Menu as AntdMenu,
Menu,
Switch,
Input,
} from 'src/common/components';
Copy link
Member

Choose a reason for hiding this comment

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

The components Dropdown and Switch are available in the src/components directory. I think we should prefer those to keep consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
@geido Dropdown UI is changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I should revert these changes

Comment on lines 101 to 113
actions: object;
database?: DatabaseObject;
latestQuery?: Query;
tables: any[];
editorQueries: QueryEditor[];
dataPreviewQueries: object[];
queryEditorId: string;
hideLeftBar?: boolean;
defaultQueryLimit: number;
maxRow: number;
displayLimit: number;
saveQueryWarning?: string;
scheduleQueryWarning?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Do you think that for actions tables dataPreviewQueries we can be a little more specific for their types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better do in next PR

Copy link
Contributor Author

@EugeneTorap EugeneTorap Jan 24, 2022

Choose a reason for hiding this comment

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

@geido Do we have interface for all sqlLab actions & dataPreviewQueries?

Copy link
Member

Choose a reason for hiding this comment

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

@EugeneTorap if you can't find any reference in the code, we probably don't have but I am happy to do that in a related PR!

const sqlEditorRef = useRef(null);
const northPaneRef = useRef(null);

useState(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that you wanted to use useState here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This useState for UNSAFE_componentWillMount replacement

Comment on lines 516 to 517
<Menu onClick={this.handleMenuClick} style={{ width: 176 }}>
<Menu.Item style={{ display: 'flex', justifyContent: 'space-between' }}>
Copy link
Member

Choose a reason for hiding this comment

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

We should use emotion for styling both Menu and Menu.Item and avoid inline styles wherever possible

@geido
Copy link
Member

geido commented Jan 31, 2022

I am now running the CI. WE should spin up a test env as soon as it passes

Copy link
Member

@lyndsiWilliams lyndsiWilliams left a comment

Choose a reason for hiding this comment

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

Please fix the broken frontend tests.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 16, 2022
@stale stale bot closed this Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants