Files
redash/client/app/visualizations/pivot/Editor.jsx
Arik Fraimovich 56d3be2248 Prettier all the Javascript code & GitHub Action (#4433)
* Prettier all the JS files

* Add GitHub Action to autoformat code pushed to master

* Fix eslint violation due to formatting.

* Remove GitHub actions for styling

* Add restyled.io config
2019-12-11 17:05:38 +02:00

43 lines
1.3 KiB
JavaScript

import { merge } from "lodash";
import React from "react";
import { Section, Switch } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations";
export default function Editor({ options, onOptionsChange }) {
const updateOptions = updates => {
onOptionsChange(merge({}, options, updates));
};
return (
<React.Fragment>
<Section>
<Switch
data-test="PivotEditor.HideControls"
id="pivot-show-controls"
defaultChecked={!options.controls.enabled}
onChange={enabled => updateOptions({ controls: { enabled: !enabled } })}>
Show Pivot Controls
</Switch>
</Section>
<Section>
<Switch
id="pivot-show-row-totals"
defaultChecked={options.rendererOptions.table.rowTotals}
onChange={rowTotals => updateOptions({ rendererOptions: { table: { rowTotals } } })}>
Show Row Totals
</Switch>
</Section>
<Section>
<Switch
id="pivot-show-column-totals"
defaultChecked={options.rendererOptions.table.colTotals}
onChange={colTotals => updateOptions({ rendererOptions: { table: { colTotals } } })}>
Show Column Totals
</Switch>
</Section>
</React.Fragment>
);
}
Editor.propTypes = EditorPropTypes;