-
Notifications
You must be signed in to change notification settings - Fork 27
FIX: [DEV-10387] - Fix Widget delete issue #2039
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: dev
Are you sure you want to change the base?
Conversation
const rowIdx = widgetConfig.rowIdx | ||
|
||
//delete the instantiated widgets | ||
if (rows[rowIdx] && rows[rowIdx].columns && rows[rowIdx].columns.length && config.visualizations) { |
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.
can simplify this: rows[rowIdx]?.columns?.length
@@ -71,7 +72,24 @@ const Widget = ({ | |||
|
|||
const deleteWidget = () => { | |||
if (!widgetConfig) return | |||
// if last widget left in row remove whole row on delete | |||
if (widgetConfig.colIdx === 0) { |
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.
what if it's the last column but it's at index 2?
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.
@joshlacey thats not issue. it will delete only last(one) widget.
|
||
config.rows.splice(rowIdx, 1) // delete the row |
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 the functionality should be that you delete the column but leave a placeholder there, a single column so that you can still add a widget there if you want.
say for example you put a chart widget when you meant to put a table widget, it would be annoying if the row disappeared when you deleted the mistaken chart widget. you'd have to add a new row and if you have a lot of rows, move it all the way to the top.
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.
@joshlacey i tryied to leave placeholder emty then the library that is being used thinks that widget is still there and cannot move new widget on top of it.and Cailin then asked to delete whole row
|
||
config.rows.splice(rowIdx, 1) // delete the row | ||
updateConfig({ ...config, rows, visualizations: newVisualizations }) |
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.
Can you match the pattern everywhere else here and call the dispatch function directly?
[Replace With Ticket Number]
Testing Steps
Open Dashboards.

When user deletes last widget in a row (clicking inner X button) it should delete whole row.
Before: it used to delete width but row was left.
See Image:
Self Review
Screenshots (if applicable)
Additional Notes