mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
* Split OrganizationSettings page into components * Update change handling: use objects instead of string keys, move some logic to more appropriate place * Convert OrganizationSettings page to functional component and refine code a bit * Add some extension points * Improve onChange handler Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com> Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import React from "react";
|
|
import { SettingsEditorPropTypes, SettingsEditorDefaultProps } from "../prop-types";
|
|
import Form from "antd/lib/form";
|
|
import Select from "antd/lib/select";
|
|
import DynamicComponent from "@/components/DynamicComponent";
|
|
import { clientConfig } from "@/services/auth";
|
|
|
|
export default function FormatSettings(props) {
|
|
const { values, onChange } = props;
|
|
|
|
return (
|
|
<DynamicComponent name="OrganizationSettings.FormatSettings" {...props}>
|
|
<Form.Item label="Date Format">
|
|
<Select
|
|
value={values.date_format}
|
|
onChange={value => onChange({ date_format: value })}
|
|
data-test="DateFormatSelect">
|
|
{clientConfig.dateFormatList.map(dateFormat => (
|
|
<Select.Option key={dateFormat}>{dateFormat}</Select.Option>
|
|
))}
|
|
</Select>
|
|
</Form.Item>
|
|
<Form.Item label="Time Format">
|
|
<Select
|
|
value={values.time_format}
|
|
onChange={value => onChange({ time_format: value })}
|
|
data-test="TimeFormatSelect">
|
|
{clientConfig.timeFormatList.map(timeFormat => (
|
|
<Select.Option key={timeFormat}>{timeFormat}</Select.Option>
|
|
))}
|
|
</Select>
|
|
</Form.Item>
|
|
</DynamicComponent>
|
|
);
|
|
}
|
|
|
|
FormatSettings.propTypes = SettingsEditorPropTypes;
|
|
|
|
FormatSettings.defaultProps = SettingsEditorDefaultProps;
|