From a158db6d4c1f89885f1070d3473552218c933662 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 14 Jan 2021 14:26:26 -0500 Subject: [PATCH] fix(dashboards) Add a confirm step to deletion Add a confirmation to dashboard deletion. I needed a ?. in getSeriesSelection() to work around undefined sneaking in during tests. --- .../sentry/app/components/charts/utils.tsx | 2 +- .../app/views/dashboardsV2/controls.tsx | 16 +++--- .../spec/views/dashboardsV2/detail.spec.jsx | 49 +++++++++++-------- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/sentry/static/sentry/app/components/charts/utils.tsx b/src/sentry/static/sentry/app/components/charts/utils.tsx index 91a42ac93cfd89..07125f87b87e85 100644 --- a/src/sentry/static/sentry/app/components/charts/utils.tsx +++ b/src/sentry/static/sentry/app/components/charts/utils.tsx @@ -128,7 +128,7 @@ export function getSeriesSelection( location: Location, parameter = 'unselectedSeries' ): EChartOption.Legend['selected'] { - const unselectedSeries = decodeList(location.query[parameter]) ?? []; + const unselectedSeries = decodeList(location?.query[parameter]) ?? []; return unselectedSeries.reduce((selection, series) => { selection[series] = false; return selection; diff --git a/src/sentry/static/sentry/app/views/dashboardsV2/controls.tsx b/src/sentry/static/sentry/app/views/dashboardsV2/controls.tsx index af69d0858c0884..b84cba6ecb097d 100644 --- a/src/sentry/static/sentry/app/views/dashboardsV2/controls.tsx +++ b/src/sentry/static/sentry/app/views/dashboardsV2/controls.tsx @@ -4,6 +4,7 @@ import styled from '@emotion/styled'; import Button from 'app/components/button'; import ButtonBar from 'app/components/buttonBar'; +import Confirm from 'app/components/confirm'; import SelectControl from 'app/components/forms/selectControl'; import {IconAdd, IconEdit} from 'app/icons'; import {t} from 'app/locale'; @@ -58,16 +59,15 @@ class Controls extends React.Component { return ( {cancelButton} - + +