Skip to content

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Atash3000
Copy link
Collaborator

[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:
Screenshot 2025-03-27 at 15 00 00

Self Review

  • I have added testing steps for reviewers
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests are passing

Screenshots (if applicable)

Additional Notes

@Atash3000 Atash3000 added this to the 4.25.4 milestone Mar 27, 2025
@Atash3000 Atash3000 requested review from adamdoe and joshlacey March 27, 2025 19:01
const rowIdx = widgetConfig.rowIdx

//delete the instantiated widgets
if (rows[rowIdx] && rows[rowIdx].columns && rows[rowIdx].columns.length && config.visualizations) {
Copy link
Collaborator

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) {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

@Atash3000 Atash3000 requested a review from joshlacey April 8, 2025 18:11

config.rows.splice(rowIdx, 1) // delete the row
updateConfig({ ...config, rows, visualizations: newVisualizations })
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants