-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Conversation
There was a problem hiding this 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.
import { | ||
Dropdown, | ||
Menu as AntdMenu, | ||
Menu, | ||
Switch, | ||
Input, | ||
} from 'src/common/components'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geido Dropdown UI is changed
There was a problem hiding this comment.
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
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
<Menu onClick={this.handleMenuClick} style={{ width: 176 }}> | ||
<Menu.Item style={{ display: 'flex', justifyContent: 'space-between' }}> |
There was a problem hiding this comment.
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
I am now running the CI. WE should spin up a test env as soon as it passes |
There was a problem hiding this 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.
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 |
SUMMARY
Migrated SqlEditor to TypeScript to apply direction outlined in #18100 .
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION