mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 10:00:17 -04:00
* 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
43 lines
1.3 KiB
JavaScript
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;
|