-
Notifications
You must be signed in to change notification settings - Fork 280
feat: update delete cell confirmation popup #1179
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
base: master
Are you sure you want to change the base?
feat: update delete cell confirmation popup #1179
Conversation
* feat: update delete cell confirmation popup * fix: Remove extra space if cell doesn't have a name * fix: Extract DataDocDeletePreview as a separate component Co-authored-by: Dave Bauman <[email protected]>
| } | ||
| }; | ||
| if (shouldConfirm) { | ||
| let cellName = ''; |
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 part is same as
cellName = ` ${cell.meta.title ?? ''}`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.
Structured this part in this way to avoid the below linting error.
Property 'title' does not exist on type 'IDataQueryCellMeta | IDataCellMetaBase | IDataChartCellMeta'.
Property 'title' does not exist on type 'IDataCellMetaBase'.
| export const DataDocDeletePreview: React.FunctionComponent<IProps> = ({ | ||
| cell, | ||
| }) => { | ||
| const [query, setQuery] = useState<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.
why do you need query as a state? vs
const query = cell.context as string
| cell: IDataCell; | ||
| } | ||
|
|
||
| export const DataDocDeletePreview: React.FunctionComponent<IProps> = ({ |
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.
probably don't need another component for this
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.
Responding to this and the previous comment, the separate component was added because without it CodeMirror wouldn't show the query contents when the delete confirmation first loaded. The fix we found was to force it to rerender by changing the state variable with useEffect, which isn't possible without a separate component.
This adds more detail to the delete datadoc cell confirmation page to help users check which cell will be deleted. The confirmation page new details include the type of cell (text/query/chart), the name of the cell if it exists, and a query cell preview for query datadoc cells. This cell preview is uneditable, and shows a scroll bar for longer queries.
Currently the cell preview has a known issue where queries less than 10 lines will overlap with the query line count, depicted in the below screenshot. We were unable to fix this overlap, but otherwise the cell preview works as expected.