Add maximize and minimize feature to charts (#9210)

* Add maximize and minimize feature to charts

* Fixed lint issues

* Update superset-frontend/src/dashboard/components/SliceHeaderControls.jsx

Add translation function

Co-Authored-By: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* Remove resizeEvent property, change condition to use the nextProps

* Minor changes, improve source code

* Fixed lint issues

* Remove unnecessary resizeEvent props

* Move inline style to css class style

* Minor fixes, improvements css

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
This commit is contained in:
oashton
2020-06-26 11:12:53 -05:00
committed by GitHub
parent df71fac1e0
commit d8314eeb0d
5 changed files with 61 additions and 10 deletions

View File

@@ -41,6 +41,7 @@ const propTypes = {
height: PropTypes.number.isRequired,
updateSliceName: PropTypes.func.isRequired,
isComponentVisible: PropTypes.bool,
handleToggleFullSize: PropTypes.func.isRequired,
// from redux
chart: chartPropShape.isRequired,
@@ -117,6 +118,12 @@ class Chart extends React.Component {
return true;
}
if (nextProps.isFullSize !== this.props.isFullSize) {
clearTimeout(this.resizeTimeout);
this.resizeTimeout = setTimeout(this.resize, RESIZE_TIMEOUT);
return false;
}
for (let i = 0; i < SHOULD_UPDATE_ON_PROP_CHANGES.length; i += 1) {
const prop = SHOULD_UPDATE_ON_PROP_CHANGES[i];
if (nextProps[prop] !== this.props[prop]) {
@@ -238,6 +245,8 @@ class Chart extends React.Component {
supersetCanCSV,
sliceCanEdit,
addDangerToast,
handleToggleFullSize,
isFullSize,
} = this.props;
const { width } = this.state;
@@ -283,6 +292,8 @@ class Chart extends React.Component {
dashboardId={dashboardId}
filters={filters}
addDangerToast={addDangerToast}
handleToggleFullSize={handleToggleFullSize}
isFullSize={isFullSize}
/>
{/*