mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 19:00:09 -04:00
* getredash/redash#4565 Change visualizations import to be static * Move visualizations-related components to own folder
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/prop-types";
|
|
|
|
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;
|