mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Fix dashboard edit button is disabled (#2634)
* Fix dashboard edit button is disabled * Addressing comments
This commit is contained in:
parent
cb3384b3b2
commit
67a85b9831
@ -43,7 +43,6 @@ class Controls extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const dashboard = this.props.dashboard;
|
const dashboard = this.props.dashboard;
|
||||||
const canSave = dashboard.dash_save_perm;
|
|
||||||
const emailBody = `Checkout this dashboard: ${window.location.href}`;
|
const emailBody = `Checkout this dashboard: ${window.location.href}`;
|
||||||
const emailLink = 'mailto:?Subject=Superset%20Dashboard%20'
|
const emailLink = 'mailto:?Subject=Superset%20Dashboard%20'
|
||||||
+ `${dashboard.dashboard_title}&Body=${emailBody}`;
|
+ `${dashboard.dashboard_title}&Body=${emailBody}`;
|
||||||
@ -81,11 +80,16 @@ class Controls extends React.PureComponent {
|
|||||||
onChange={this.changeCss.bind(this)}
|
onChange={this.changeCss.bind(this)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
disabled={!canSave}
|
onClick={() => { window.location = emailLink; }}
|
||||||
|
>
|
||||||
|
<i className="fa fa-envelope" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
disabled={!dashboard.dash_edit_perm}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.location = `/dashboardmodelview/edit/${dashboard.id}`;
|
window.location = `/dashboardmodelview/edit/${dashboard.id}`;
|
||||||
}}
|
}}
|
||||||
tooltip="Edit this dashboard's property"
|
tooltip="Edit this dashboard's properties"
|
||||||
>
|
>
|
||||||
<i className="fa fa-edit" />
|
<i className="fa fa-edit" />
|
||||||
</Button>
|
</Button>
|
||||||
@ -93,14 +97,11 @@ class Controls extends React.PureComponent {
|
|||||||
dashboard={dashboard}
|
dashboard={dashboard}
|
||||||
css={this.state.css}
|
css={this.state.css}
|
||||||
triggerNode={
|
triggerNode={
|
||||||
<i className="fa fa-save" />
|
<Button disabled={!dashboard.dash_save_perm}>
|
||||||
|
<i className="fa fa-save" />
|
||||||
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
onClick={() => { window.location = emailLink; }}
|
|
||||||
>
|
|
||||||
<i className="fa fa-envelope" />
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,6 @@ class SaveModal extends React.PureComponent {
|
|||||||
<ModalTrigger
|
<ModalTrigger
|
||||||
ref={(modal) => { this.modal = modal; }}
|
ref={(modal) => { this.modal = modal; }}
|
||||||
triggerNode={this.props.triggerNode}
|
triggerNode={this.props.triggerNode}
|
||||||
isButton
|
|
||||||
modalTitle="Save Dashboard"
|
modalTitle="Save Dashboard"
|
||||||
modalBody={
|
modalBody={
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
|
@ -1641,14 +1641,13 @@ class Superset(BaseSupersetView):
|
|||||||
dashboard_data = dash.data
|
dashboard_data = dash.data
|
||||||
dashboard_data.update({
|
dashboard_data.update({
|
||||||
'standalone_mode': request.args.get("standalone") == "true",
|
'standalone_mode': request.args.get("standalone") == "true",
|
||||||
|
'dash_save_perm': dash_save_perm,
|
||||||
|
'dash_edit_perm': dash_edit_perm,
|
||||||
})
|
})
|
||||||
|
|
||||||
bootstrap_data = {
|
bootstrap_data = {
|
||||||
'user_id': g.user.get_id(),
|
'user_id': g.user.get_id(),
|
||||||
'dash_save_perm': dash_save_perm,
|
'dashboard_data': dashboard_data,
|
||||||
'dash_edit_perm': dash_edit_perm,
|
|
||||||
'dash_edit_perm': check_ownership(dash, raise_if_false=False),
|
|
||||||
'dashboard_data': dash.data,
|
|
||||||
'datasources': {ds.uid: ds.data for ds in datasources},
|
'datasources': {ds.uid: ds.data for ds in datasources},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user