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

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[FIx] Dashboard-List Integrated Delete
Signed-off-by: Peter Fitzgibbons <pjfitz@amazon.com>
Peter Fitzgibbons committed Apr 13, 2023
commit 164f022f1e19d024b0f5a7248fe90f733871cb0d
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570))
- [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640))
- [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698))
- [Dashboard] Fix Dashboard-Delete from Dashboards / Dashboards (broken by #3090) ([#3796](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3796))
joshuarrrr marked this conversation as resolved.
Show resolved Hide resolved
- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816))

### 🚞 Infrastructure
8 changes: 6 additions & 2 deletions src/plugins/dashboard/public/application/legacy_app.js
Original file line number Diff line number Diff line change
@@ -114,7 +114,6 @@ export function initDashboardApp(app, deps) {
deps.core.chrome.docTitle.change(
i18n.translate('dashboard.dashboardPageTitle', { defaultMessage: 'Dashboards' })
);
const service = deps.savedDashboards;
const dashboardConfig = deps.dashboardConfig;

// syncs `_g` portion of url with query services
@@ -171,7 +170,12 @@ 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?

return Promise.all(
ids.map(({ id, appId }) => {
return deps.savedObjectsClient.delete(appId, id);
})
);
joshuarrrr marked this conversation as resolved.
Show resolved Hide resolved
joshuarrrr marked this conversation as resolved.
Show resolved Hide resolved
};
$scope.hideWriteControls = dashboardConfig.getHideWriteControls();
$scope.initialFilter = parse(history.location.search).filter || EMPTY_FILTER;
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
@@ -344,7 +344,7 @@ export class DashboardPlugin
registerDashboardProvider({
savedObjectsType: 'dashboard',
savedObjectsName: 'Dashboard',
appId: 'dashboards',
appId: 'dashboard',
joshuarrrr marked this conversation as resolved.
Show resolved Hide resolved
viewUrlPathFn: (obj) => `#/view/${obj.id}`,
editUrlPathFn: (obj) => `/view/${obj.id}?_a=(viewMode:edit)`,
createUrl: core.http.basePath.prepend('/app/dashboards#/create'),