You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2020/01/16 05:34:41 UTC

[incubator-superset] branch master updated: fix empty slug breaking url (#8974)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e67190  fix empty slug breaking url (#8974)
7e67190 is described below

commit 7e6719050bb22d860d78a0864134ff9380d28246
Author: David Aaron Suddjian <18...@users.noreply.github.com>
AuthorDate: Wed Jan 15 21:34:23 2020 -0800

    fix empty slug breaking url (#8974)
---
 superset/assets/src/dashboard/components/Header.jsx          | 12 +++++++-----
 superset/assets/src/dashboard/components/PropertiesModal.jsx | 10 +++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/superset/assets/src/dashboard/components/Header.jsx b/superset/assets/src/dashboard/components/Header.jsx
index 489d16c..4542f9a 100644
--- a/superset/assets/src/dashboard/components/Header.jsx
+++ b/superset/assets/src/dashboard/components/Header.jsx
@@ -431,11 +431,13 @@ class Header extends React.PureComponent {
                   metadata: JSON.parse(updates.jsonMetadata),
                 });
                 this.props.dashboardTitleChanged(updates.title);
-                history.pushState(
-                  { event: 'dashboard_properties_changed' },
-                  '',
-                  `/superset/dashboard/${updates.slug}/`,
-                );
+                if (updates.slug) {
+                  history.pushState(
+                    { event: 'dashboard_properties_changed' },
+                    '',
+                    `/superset/dashboard/${updates.slug}/`,
+                  );
+                }
               }}
             />
           )}
diff --git a/superset/assets/src/dashboard/components/PropertiesModal.jsx b/superset/assets/src/dashboard/components/PropertiesModal.jsx
index 916bdea..9b2fffe 100644
--- a/superset/assets/src/dashboard/components/PropertiesModal.jsx
+++ b/superset/assets/src/dashboard/components/PropertiesModal.jsx
@@ -52,10 +52,10 @@ class PropertiesModal extends React.PureComponent {
     this.state = {
       errors: [],
       values: {
-        dashboard_title: this.props.dashboardTitle,
-        slug: this.props.dashboardInfo.slug,
-        owners: this.props.owners || [],
-        json_metadata: JSON.stringify(this.props.dashboardInfo.metadata),
+        dashboard_title: props.dashboardTitle,
+        slug: props.dashboardInfo.slug,
+        owners: props.owners || [],
+        json_metadata: JSON.stringify(props.dashboardInfo.metadata),
       },
       isOwnersLoaded: false,
       userOptions: null,
@@ -189,7 +189,7 @@ class PropertiesModal extends React.PureComponent {
                   name="slug"
                   type="text"
                   bsSize="sm"
-                  value={values.slug}
+                  value={values.slug || ''}
                   onChange={this.onChange}
                 />
                 <p className="help-block">