User can turn off download - export csv from a dashboard (#6821)
* User can turn off download - export csv from a dashboard * Revert changes in the backendSync * Fix space error in the MenuItem Export CSV
This commit is contained in:
parent
f760ba8d4c
commit
4a3009406a
|
|
@ -58,6 +58,7 @@ describe('Chart', () => {
|
|||
editMode: false,
|
||||
isExpanded: false,
|
||||
supersetCanExplore: false,
|
||||
supersetCanCSV: false,
|
||||
sliceCanEdit: false,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ const propTypes = {
|
|||
annotationError: PropTypes.object,
|
||||
sliceName: PropTypes.string,
|
||||
supersetCanExplore: PropTypes.bool,
|
||||
supersetCanCSV: PropTypes.bool,
|
||||
sliceCanEdit: PropTypes.bool,
|
||||
};
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ const defaultProps = {
|
|||
isExpanded: false,
|
||||
sliceName: '',
|
||||
supersetCanExplore: false,
|
||||
supersetCanCSV: false,
|
||||
sliceCanEdit: false,
|
||||
};
|
||||
|
||||
|
|
@ -82,6 +84,7 @@ class SliceHeader extends React.PureComponent {
|
|||
innerRef,
|
||||
sliceName,
|
||||
supersetCanExplore,
|
||||
supersetCanCSV,
|
||||
sliceCanEdit,
|
||||
editMode,
|
||||
updateSliceName,
|
||||
|
|
@ -133,6 +136,7 @@ class SliceHeader extends React.PureComponent {
|
|||
exploreChart={exploreChart}
|
||||
exportCSV={exportCSV}
|
||||
supersetCanExplore={supersetCanExplore}
|
||||
supersetCanCSV={supersetCanCSV}
|
||||
sliceCanEdit={sliceCanEdit}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const propTypes = {
|
|||
cachedDttm: PropTypes.string,
|
||||
updatedDttm: PropTypes.number,
|
||||
supersetCanExplore: PropTypes.bool,
|
||||
supersetCanCSV: PropTypes.bool,
|
||||
sliceCanEdit: PropTypes.bool,
|
||||
toggleExpandSlice: PropTypes.func,
|
||||
forceRefresh: PropTypes.func,
|
||||
|
|
@ -46,6 +47,7 @@ const defaultProps = {
|
|||
isCached: false,
|
||||
isExpanded: false,
|
||||
supersetCanExplore: false,
|
||||
supersetCanCSV: false,
|
||||
sliceCanEdit: false,
|
||||
};
|
||||
|
||||
|
|
@ -134,7 +136,9 @@ class SliceHeaderControls extends React.PureComponent {
|
|||
</MenuItem>
|
||||
)}
|
||||
|
||||
<MenuItem onClick={this.exportCSV}>{t('Export CSV')}</MenuItem>
|
||||
{this.props.supersetCanCSV && (
|
||||
<MenuItem onClick={this.exportCSV}>{t('Export CSV')}</MenuItem>
|
||||
)}
|
||||
|
||||
{this.props.supersetCanExplore && (
|
||||
<MenuItem onClick={this.exploreChart}>
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ const propTypes = {
|
|||
isExpanded: PropTypes.bool.isRequired,
|
||||
isCached: PropTypes.bool,
|
||||
supersetCanExplore: PropTypes.bool.isRequired,
|
||||
supersetCanCSV: PropTypes.bool.isRequired,
|
||||
sliceCanEdit: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
|
|
@ -195,6 +196,7 @@ class Chart extends React.Component {
|
|||
toggleExpandSlice,
|
||||
timeout,
|
||||
supersetCanExplore,
|
||||
supersetCanCSV,
|
||||
sliceCanEdit,
|
||||
} = this.props;
|
||||
|
||||
|
|
@ -229,6 +231,7 @@ class Chart extends React.Component {
|
|||
updateSliceName={updateSliceName}
|
||||
sliceName={sliceName}
|
||||
supersetCanExplore={supersetCanExplore}
|
||||
supersetCanCSV={supersetCanCSV}
|
||||
sliceCanEdit={sliceCanEdit}
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ function mapStateToProps(
|
|||
editMode: dashboardState.editMode,
|
||||
isExpanded: !!dashboardState.expandedSlices[id],
|
||||
supersetCanExplore: !!dashboardInfo.superset_can_explore,
|
||||
supersetCanCSV: !!dashboardInfo.superset_can_csv,
|
||||
sliceCanEdit: !!dashboardInfo.slice_can_edit,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ export default function(bootstrapData) {
|
|||
dash_edit_perm: dashboard.dash_edit_perm,
|
||||
dash_save_perm: dashboard.dash_save_perm,
|
||||
superset_can_explore: dashboard.superset_can_explore,
|
||||
superset_can_csv: dashboard.superset_can_csv,
|
||||
slice_can_edit: dashboard.slice_can_edit,
|
||||
common: {
|
||||
flash_messages: common.flash_messages,
|
||||
|
|
|
|||
|
|
@ -2175,6 +2175,7 @@ class Superset(BaseSupersetView):
|
|||
security_manager.can_access('can_save_dash', 'Superset')
|
||||
dash_save_perm = security_manager.can_access('can_save_dash', 'Superset')
|
||||
superset_can_explore = security_manager.can_access('can_explore', 'Superset')
|
||||
superset_can_csv = security_manager.can_access('can_csv', 'Superset')
|
||||
slice_can_edit = security_manager.can_access('can_edit', 'SliceModelView')
|
||||
|
||||
standalone_mode = request.args.get('standalone') == 'true'
|
||||
|
|
@ -2196,6 +2197,7 @@ class Superset(BaseSupersetView):
|
|||
'dash_save_perm': dash_save_perm,
|
||||
'dash_edit_perm': dash_edit_perm,
|
||||
'superset_can_explore': superset_can_explore,
|
||||
'superset_can_csv': superset_can_csv,
|
||||
'slice_can_edit': slice_can_edit,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue