fix empty slug breaking url (#8974)

This commit is contained in:
David Aaron Suddjian
2020-01-15 21:34:23 -08:00
committed by Maxime Beauchemin
parent ff9bc74c86
commit 7e6719050b
2 changed files with 12 additions and 10 deletions

View File

@@ -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}/`,
);
}
}}
/>
)}

View File

@@ -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">