mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Journeys] Add dashboard delete to dashboards listing (#148267)
## Summary Adds a few more user flows to dashboard listing journeys. Partially address https://github.com/elastic/kibana/issues/145627 ### Checklist Delete any items that are not applicable to this PR. - ~~[ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~~ - ~~[ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials~~ - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - ~~[ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/))~~ - ~~[ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~~ - ~~[ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~~ - ~~[ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~~ - ~~[ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~~ ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
2adf37b203
commit
c5291d1b07
3 changed files with 42 additions and 13 deletions
|
@ -25,7 +25,7 @@ import type { SavedObjectsFindOptionsReference, SimpleSavedObject } from '@kbn/c
|
|||
import { TableListView, type UserContentCommonSchema } from '@kbn/content-management-table-list';
|
||||
|
||||
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
|
||||
import { SAVED_OBJECT_LOADED_TIME } from '../../dashboard_constants';
|
||||
import { SAVED_OBJECT_DELETE_TIME, SAVED_OBJECT_LOADED_TIME } from '../../dashboard_constants';
|
||||
|
||||
import {
|
||||
getDashboardBreadcrumb,
|
||||
|
@ -292,7 +292,7 @@ export const DashboardListing = ({
|
|||
eventName: SAVED_OBJECT_LOADED_TIME,
|
||||
duration: searchDuration,
|
||||
meta: {
|
||||
saved_object_type: 'dashboard',
|
||||
saved_object_type: DASHBOARD_SAVED_OBJECT_TYPE,
|
||||
},
|
||||
});
|
||||
return {
|
||||
|
@ -306,16 +306,31 @@ export const DashboardListing = ({
|
|||
|
||||
const deleteItems = useCallback(
|
||||
async (dashboardsToDelete: Array<{ id: string }>) => {
|
||||
await Promise.all(
|
||||
dashboardsToDelete.map(({ id }) => {
|
||||
dashboardSessionStorage.clearState(id);
|
||||
return savedObjectsClient.delete(DASHBOARD_SAVED_OBJECT_TYPE, id);
|
||||
})
|
||||
).catch((error) => {
|
||||
try {
|
||||
const deleteStartTime = window.performance.now();
|
||||
|
||||
await Promise.all(
|
||||
dashboardsToDelete.map(({ id }) => {
|
||||
dashboardSessionStorage.clearState(id);
|
||||
return savedObjectsClient.delete(DASHBOARD_SAVED_OBJECT_TYPE, id);
|
||||
})
|
||||
);
|
||||
|
||||
const deleteDuration = window.performance.now() - deleteStartTime;
|
||||
reportPerformanceMetricEvent(pluginServices.getServices().analytics, {
|
||||
eventName: SAVED_OBJECT_DELETE_TIME,
|
||||
duration: deleteDuration,
|
||||
meta: {
|
||||
saved_object_type: DASHBOARD_SAVED_OBJECT_TYPE,
|
||||
total: dashboardsToDelete.length,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
toasts.addError(error, {
|
||||
title: dashboardListingErrorStrings.getErrorDeletingDashboardToast(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setUnsavedDashboardIds(dashboardSessionStorage.getDashboardIdsWithUnsavedChanges());
|
||||
},
|
||||
[savedObjectsClient, dashboardSessionStorage, toasts]
|
||||
|
|
|
@ -43,6 +43,7 @@ export function createDashboardListingFilterUrl(filter: string | undefined) {
|
|||
// ------------------------------------------------------------------
|
||||
export const DASHBOARD_LOADED_EVENT = 'dashboard_loaded';
|
||||
export const SAVED_OBJECT_LOADED_TIME = 'saved_object_loaded_time';
|
||||
export const SAVED_OBJECT_DELETE_TIME = 'saved_object_delete_time';
|
||||
export const DASHBOARD_UI_METRIC_ID = 'dashboard';
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
|
|
@ -13,7 +13,20 @@ export const journey = new Journey({
|
|||
'x-pack/performance/kbn_archives/flights_no_map_dashboard',
|
||||
'x-pack/performance/kbn_archives/logs_no_map_dashboard',
|
||||
],
|
||||
}).step('Go to Dashboards Page', async ({ page, kbnUrl }) => {
|
||||
await page.goto(kbnUrl.get(`/app/dashboards`));
|
||||
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
|
||||
});
|
||||
})
|
||||
.step('Go to Dashboards Page', async ({ page, kbnUrl }) => {
|
||||
await page.goto(kbnUrl.get(`/app/dashboards`));
|
||||
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
|
||||
})
|
||||
.step('Search dashboards page', async ({ page, inputDelays }) => {
|
||||
await page.type('[data-test-subj="tableListSearchBox"]', 'Web', {
|
||||
delay: inputDelays.TYPING,
|
||||
});
|
||||
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
|
||||
})
|
||||
.step('Delete dashboard', async ({ page, log }) => {
|
||||
await page.click('[data-test-subj="checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b"]');
|
||||
await page.click('[data-test-subj="deleteSelectedItems"]');
|
||||
await page.click('[data-test-subj="confirmModalConfirmButton"]');
|
||||
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue