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

[FIX] Dashboard list integrated delete #3796

Conversation

pjfitzgibbons
Copy link
Contributor

@pjfitzgibbons pjfitzgibbons commented Apr 6, 2023

Description

Fix delete on Dashboard items with Integrated Providers feature

Issues Resolved

resolves #3795

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov-commenter
Copy link

codecov-commenter commented Apr 7, 2023

Codecov Report

Merging #3796 (815b4a9) into main (8b0587e) will increase coverage by 0.00%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main    #3796   +/-   ##
=======================================
  Coverage   66.46%   66.46%           
=======================================
  Files        3226     3226           
  Lines       62012    62012           
  Branches     9588     9588           
=======================================
+ Hits        41215    41219    +4     
+ Misses      18497    18494    -3     
+ Partials     2300     2299    -1     
Flag Coverage Δ
Linux 66.41% <ø> (+<0.01%) ⬆️
Windows 66.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/plugins/dashboard/public/plugin.tsx 0.00% <ø> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@joshuarrrr
Copy link
Member

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

@pjfitzgibbons For a bug fix like this, I'd expect a regression test case. Is the deletion case covered by any of the functional or unit tests? If you have a screencast that shows bulk and individual delete operations working, that's always helpful too.

Otherwise just some minor questions about the implementation choices and nature of the bug.

src/plugins/dashboard/public/plugin.tsx Show resolved Hide resolved
src/plugins/dashboard/public/application/legacy_app.js Outdated Show resolved Hide resolved
@joshuarrrr
Copy link
Member

@pjfitzgibbons Just checking in on this - code freeze is Monday, so we'd like to be able to merge before then.

@joshuarrrr joshuarrrr self-assigned this Apr 13, 2023
@pjfitzgibbons
Copy link
Contributor Author

@pjfitzgibbons For a bug fix like this, I'd expect a regression test case. Is the deletion case covered by any of the functional or unit tests? If you have a screencast that shows bulk and individual delete operations working, that's always helpful too.

Otherwise just some minor questions about the implementation choices and nature of the bug.

Existing test cases should cover. There are delete cases, no-error means refactor has not changed behaviour.

Do we have test cases that specifically cover "optional" plugin-available APIs ?

Signed-off-by: Peter Fitzgibbons <[email protected]>
@pjfitzgibbons pjfitzgibbons force-pushed the dashboard-list-integrated-delete branch from ae6d708 to 164f022 Compare April 13, 2023 22:49
@pjfitzgibbons
Copy link
Contributor Author

@pjfitzgibbons One of the commits is missing the sign-off for DCO: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3796/checks?check_run_id=12607666399

Fixed. (squashed the branch)

@abbyhu2000
Copy link
Member

abbyhu2000 commented Apr 14, 2023

Ran the code and functionality looks good with deleting the dashboards. Have not tried deleting with the new dashboard list functionality with other plugins.

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

@pjfitzgibbons This looks good - if you can add the suggested error toast, we should be ready to go.

src/plugins/dashboard/public/application/legacy_app.js Outdated Show resolved Hide resolved
src/plugins/dashboard/public/application/legacy_app.js Outdated Show resolved Hide resolved
@joshuarrrr
Copy link
Member

Existing test cases should cover. There are delete cases, no-error means refactor has not changed behaviour.

Do we have test cases that specifically cover "optional" plugin-available APIs ?

So this bug was only for deleting objects that used the new interface (deleting legacy dashboards worked fine)? If that's the case, then yeah, we'd want to update our test cases to include mock non-dashboard objects that use the new interface that validates those functionalities.

@joshuarrrr
Copy link
Member

(current test failures can be ignored)

CHANGELOG.md Outdated Show resolved Hide resolved
@abbyhu2000
Copy link
Member

Also need to be rebased to fix the link and cypress tests and the merge conflicts. @pjfitzgibbons

@joshuarrrr
Copy link
Member

@abbyhu2000 See #3796 (comment) - those failures are unrelated. But given the changelog conflict, I'll resolve and restart the automation.

@joshuarrrr joshuarrrr added Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry backport 2.x labels Apr 17, 2023
@kavilla
Copy link
Member

kavilla commented Apr 17, 2023

@pjfitzgibbons, attempting to recreate the error on main with and without an extra plugin registering but not able to recreate it.

Are you still seeing this issue? What was the error from the toast?

@joshuarrrr
Copy link
Member

@pjfitzgibbons, attempting to recreate the error on main with and without an extra plugin registering but not able to recreate it.

Are you still seeing this issue? What was the error from the toast?

I believe deleting existing dashboard items worked fine - so you'd need to have a non-dashboard item registered to be able to delete and see the error, which is what I suggested in terms of test expansion.

@joshuarrrr
Copy link
Member

All checks passed.

@pjfitzgibbons
Copy link
Contributor Author

I'll look at testing tomorrow.

Comment on lines +174 to +184
return Promise.all(
ids.map(({ id, appId }) => {
return deps.savedObjectsClient.delete(appId, id);
})
).catch((error) => {
deps.toastNotifications.addError(error, {
title: i18n.translate('dashboard.dashboardListingDeleteErrorTitle', {
defaultMessage: 'Error deleting dashboard',
}),
});
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand this correctly, we fire off a bunch of delete requests in parallel and if one fails we show an error that there was a problem deleting the "dashboard" but in reality, we have deleted some stuff. This doesn't sound like good UX.

Copy link
Member

Choose a reason for hiding this comment

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

I think we want to go with consistent UX (so that the same component on dashboard and visualize behaves the same) first, and then we can improve the existing UX in a follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

@@ -171,7 +170,18 @@ export function initDashboardApp(app, deps) {
history.push(deps.addBasePath(viewUrl));
};
$scope.delete = (dashboards) => {
return service.delete(dashboards.map((d) => d.id));
const ids = dashboards.map((d) => ({ id: d.id, appId: d.appId }));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why this map is not combined with the map inside the all?

@ashwin-pc ashwin-pc merged commit 9d27023 into opensearch-project:main Apr 18, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 18, 2023
* [FIx] Dashboard-List Integrated Delete

Signed-off-by: Peter Fitzgibbons <[email protected]>

* Add toast notification on deletion error

Signed-off-by: Josh Romero <[email protected]>

* add toast notification dependency

Signed-off-by: Josh Romero <[email protected]>

---------

Signed-off-by: Peter Fitzgibbons <[email protected]>
Signed-off-by: Josh Romero <[email protected]>
Co-authored-by: Peter Fitzgibbons <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
(cherry picked from commit 9d27023)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this pull request Apr 18, 2023
* [FIx] Dashboard-List Integrated Delete



* Add toast notification on deletion error



* add toast notification dependency



---------





(cherry picked from commit 9d27023)

Signed-off-by: Peter Fitzgibbons <[email protected]>
Signed-off-by: Josh Romero <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Fitzgibbons <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x first-time-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Delete Dashboard not working after Integrated Plugin feature
7 participants