From 0cd5f79e3652f9481a7224d35c9fae77d1e84445 Mon Sep 17 00:00:00 2001 From: asalem Date: Tue, 11 Feb 2020 13:50:20 -0800 Subject: [PATCH 1/2] fix(ui): fixed false success message that stemmed from error-swolling throughout post process --- ui/src/cells/actions/thunks.ts | 4 ++-- ui/src/dataExplorer/components/SaveAsCellForm.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/cells/actions/thunks.ts b/ui/src/cells/actions/thunks.ts index a30cf5f43e1..5876a3aa75d 100644 --- a/ui/src/cells/actions/thunks.ts +++ b/ui/src/cells/actions/thunks.ts @@ -99,7 +99,6 @@ export const createCellWithView = ( // Create the cell const cellResp = await api.postDashboardsCell({dashboardID, data: cell}) - if (cellResp.status !== 201) { throw new Error(cellResp.data.message) } @@ -123,8 +122,9 @@ export const createCellWithView = ( dispatch(setView(cellID, RemoteDataState.Done, normView)) dispatch(setCell(cellID, RemoteDataState.Done, normCell)) - } catch { + } catch (err) { notify(copy.cellAddFailed()) + throw err } } diff --git a/ui/src/dataExplorer/components/SaveAsCellForm.tsx b/ui/src/dataExplorer/components/SaveAsCellForm.tsx index b4186bd3768..76c02a6a6aa 100644 --- a/ui/src/dataExplorer/components/SaveAsCellForm.tsx +++ b/ui/src/dataExplorer/components/SaveAsCellForm.tsx @@ -209,7 +209,6 @@ class SaveAsCellForm extends PureComponent { } const resp = await postDashboard({data: newDashboard}) - if (resp.status !== 201) { throw new Error(resp.data.message) } @@ -217,6 +216,7 @@ class SaveAsCellForm extends PureComponent { onCreateCellWithView(resp.data.id, view) } catch (error) { console.error(error) + throw error } } From d6c81b8a9cce3556fff11659893a4aa060682783 Mon Sep 17 00:00:00 2001 From: asalem Date: Tue, 11 Feb 2020 13:56:11 -0800 Subject: [PATCH 2/2] chore(ui): updated changelog with changes --- CHANGELOG.md | 1 + ui/src/cells/actions/thunks.ts | 1 + ui/src/dataExplorer/components/SaveAsCellForm.tsx | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc6076524c0..8fd3ad72a97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ 1. [16733](https://github.com/influxdata/influxdb/pull/16733): Fix notification rule renaming panics from UI 1. [16769](https://github.com/influxdata/influxdb/pull/16769): Fix the tooltip for stacked line graphs +1. [16825](https://github.com/influxdata/influxdb/pull/16825): Fixed false success notification for read-only users creating dashboards ## v2.0.0-beta.2 [2020-01-24] diff --git a/ui/src/cells/actions/thunks.ts b/ui/src/cells/actions/thunks.ts index 5876a3aa75d..69e28cfd2a8 100644 --- a/ui/src/cells/actions/thunks.ts +++ b/ui/src/cells/actions/thunks.ts @@ -99,6 +99,7 @@ export const createCellWithView = ( // Create the cell const cellResp = await api.postDashboardsCell({dashboardID, data: cell}) + if (cellResp.status !== 201) { throw new Error(cellResp.data.message) } diff --git a/ui/src/dataExplorer/components/SaveAsCellForm.tsx b/ui/src/dataExplorer/components/SaveAsCellForm.tsx index 76c02a6a6aa..c402fa3bd52 100644 --- a/ui/src/dataExplorer/components/SaveAsCellForm.tsx +++ b/ui/src/dataExplorer/components/SaveAsCellForm.tsx @@ -209,6 +209,7 @@ class SaveAsCellForm extends PureComponent { } const resp = await postDashboard({data: newDashboard}) + if (resp.status !== 201) { throw new Error(resp.data.message) }