From 17834a37586fc14367838d25512a3f73dabbcdf6 Mon Sep 17 00:00:00 2001 From: Nikola Gigic Date: Mon, 11 Jan 2021 18:58:28 +0100 Subject: [PATCH 1/3] Fix SaveModal select value --- superset-frontend/src/explore/components/SaveModal.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index dab88f2925713..a36587fbd8a89 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -29,7 +29,7 @@ import { connect } from 'react-redux'; // Session storage key for recent dashboard const SK_DASHBOARD_ID = 'save_chart_recent_dashboard'; -const SELECT_PLACEHOLDER = t('**Select** a dashboard OR **create** a new one'); +const SELECT_PLACEHOLDER = t('Select dashboard'); type SaveModalProps = { can_overwrite?: boolean; @@ -152,6 +152,8 @@ class SaveModal extends React.Component { } render() { + const selectValue = + this.state.newDashboardName || this.state.saveToDashboardId || null; return ( { creatable onChange={this.onDashboardSelectChange} autoSize={false} - value={{ - value: - this.state.saveToDashboardId || this.state.newDashboardName, - }} + value={selectValue ? { value: selectValue } : null} placeholder={ // Using markdown to allow for good i18n Date: Mon, 11 Jan 2021 19:15:32 +0100 Subject: [PATCH 2/3] var name change and null --- superset-frontend/src/explore/components/SaveModal.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index a36587fbd8a89..04355fa013764 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -152,8 +152,8 @@ class SaveModal extends React.Component { } render() { - const selectValue = - this.state.newDashboardName || this.state.saveToDashboardId || null; + const dashboardSelectValue = + this.state.newDashboardName || this.state.saveToDashboardId; return ( { creatable onChange={this.onDashboardSelectChange} autoSize={false} - value={selectValue ? { value: selectValue } : null} + value={ + dashboardSelectValue ? { value: dashboardSelectValue } : null + } placeholder={ // Using markdown to allow for good i18n Date: Mon, 18 Jan 2021 17:55:13 +0100 Subject: [PATCH 3/3] Address Comments --- .../src/explore/components/SaveModal.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index 04355fa013764..34395449f377a 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -29,7 +29,7 @@ import { connect } from 'react-redux'; // Session storage key for recent dashboard const SK_DASHBOARD_ID = 'save_chart_recent_dashboard'; -const SELECT_PLACEHOLDER = t('Select dashboard'); +const SELECT_PLACEHOLDER = t('**Select** a dashboard OR **create** a new one'); type SaveModalProps = { can_overwrite?: boolean; @@ -153,7 +153,10 @@ class SaveModal extends React.Component { render() { const dashboardSelectValue = - this.state.newDashboardName || this.state.saveToDashboardId; + this.state.saveToDashboardId || this.state.newDashboardName; + const valueObj = dashboardSelectValue + ? { value: dashboardSelectValue } + : null; return ( {