mirror of https://github.com/apache/superset.git
parent
8532e6d9e1
commit
2a587f6cb1
|
@ -78,7 +78,7 @@ describe('SelectControl', () => {
|
||||||
onChange: sinon.spy(),
|
onChange: sinon.spy(),
|
||||||
};
|
};
|
||||||
wrapper.setProps(selectAllProps);
|
wrapper.setProps(selectAllProps);
|
||||||
wrapper.instance().onChange([{ meta: true, value: 'Select All' }]);
|
wrapper.instance().onChange([{ meta: true, value: 'Select all' }]);
|
||||||
expect(selectAllProps.onChange.calledWith(expectedValues)).toBe(true);
|
expect(selectAllProps.onChange.calledWith(expectedValues)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ describe('SelectControl', () => {
|
||||||
expect(wrapper.instance().optionsRemaining()).toEqual(2);
|
expect(wrapper.instance().optionsRemaining()).toEqual(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('with Select All', () => {
|
describe('with Select all', () => {
|
||||||
it('does not count it', () => {
|
it('does not count it', () => {
|
||||||
const props = { ...defaultProps, multi: true, allowAll: true };
|
const props = { ...defaultProps, multi: true, allowAll: true };
|
||||||
const wrapper = mount(<SelectControl {...props} />);
|
const wrapper = mount(<SelectControl {...props} />);
|
||||||
|
@ -234,9 +234,9 @@ describe('SelectControl', () => {
|
||||||
};
|
};
|
||||||
wrapper.setProps(selectAllProps);
|
wrapper.setProps(selectAllProps);
|
||||||
expect(wrapper.instance().getOptions(selectAllProps)).toContainEqual({
|
expect(wrapper.instance().getOptions(selectAllProps)).toContainEqual({
|
||||||
label: 'Select All',
|
label: 'Select all',
|
||||||
meta: true,
|
meta: true,
|
||||||
value: 'Select All',
|
value: 'Select all',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function AdvancedFrame(props: FrameComponentProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="section-title">{t('Configure Advanced Time Range')}</div>
|
<div className="section-title">{t('Configure advanced time range')}</div>
|
||||||
<div className="control-label">{t('START')}</div>
|
<div className="control-label">{t('START')}</div>
|
||||||
<Input
|
<Input
|
||||||
key="since"
|
key="since"
|
||||||
|
|
|
@ -118,7 +118,7 @@ export function CustomFrame(props: FrameComponentProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div data-test="custom-frame">
|
<div data-test="custom-frame">
|
||||||
<div className="section-title">{t('Configure Custom Time Range')}</div>
|
<div className="section-title">{t('Configure custom time range')}</div>
|
||||||
<Row gutter={24}>
|
<Row gutter={24}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<div className="control-label">{t('START')}</div>
|
<div className="control-label">{t('START')}</div>
|
||||||
|
@ -226,7 +226,7 @@ export function CustomFrame(props: FrameComponentProps) {
|
||||||
</Row>
|
</Row>
|
||||||
{sinceMode === 'relative' && untilMode === 'relative' && (
|
{sinceMode === 'relative' && untilMode === 'relative' && (
|
||||||
<div className="control-anchor-to">
|
<div className="control-anchor-to">
|
||||||
<div className="control-label">{t('ANCHOR TO')}</div>
|
<div className="control-label">{t('Anchor to')}</div>
|
||||||
<Row align="middle">
|
<Row align="middle">
|
||||||
<Col>
|
<Col>
|
||||||
<Radio.Group
|
<Radio.Group
|
||||||
|
|
|
@ -181,7 +181,7 @@ export default class FilterBoxItemControl extends React.Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<FormRow
|
<FormRow
|
||||||
label={t('Sort Metric')}
|
label={t('Sort metric')}
|
||||||
tooltip={t('Metric to sort the results by')}
|
tooltip={t('Metric to sort the results by')}
|
||||||
control={
|
control={
|
||||||
<SelectControl
|
<SelectControl
|
||||||
|
@ -201,7 +201,7 @@ export default class FilterBoxItemControl extends React.Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<FormRow
|
<FormRow
|
||||||
label={t('Sort Ascending')}
|
label={t('Sort ascending')}
|
||||||
tooltip={t('Check for sorting ascending')}
|
tooltip={t('Check for sorting ascending')}
|
||||||
isCheckbox
|
isCheckbox
|
||||||
control={
|
control={
|
||||||
|
@ -212,7 +212,7 @@ export default class FilterBoxItemControl extends React.Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<FormRow
|
<FormRow
|
||||||
label={t('Allow Multiple Selections')}
|
label={t('Allow multiple selections')}
|
||||||
isCheckbox
|
isCheckbox
|
||||||
tooltip={t(
|
tooltip={t(
|
||||||
'Multiple selections allowed, otherwise filter ' +
|
'Multiple selections allowed, otherwise filter ' +
|
||||||
|
@ -228,7 +228,7 @@ export default class FilterBoxItemControl extends React.Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<FormRow
|
<FormRow
|
||||||
label={t('Search All Filter Options')}
|
label={t('Search all filter options')}
|
||||||
tooltip={t(
|
tooltip={t(
|
||||||
'By default, each filter loads at most 1000 choices at the initial page load. ' +
|
'By default, each filter loads at most 1000 choices at the initial page load. ' +
|
||||||
'Check this box if you have more than 1000 filter values and want to enable dynamically ' +
|
'Check this box if you have more than 1000 filter values and want to enable dynamically ' +
|
||||||
|
@ -278,7 +278,7 @@ export default class FilterBoxItemControl extends React.Component {
|
||||||
trigger="click"
|
trigger="click"
|
||||||
placement="right"
|
placement="right"
|
||||||
content={this.renderPopover()}
|
content={this.renderPopover()}
|
||||||
title={t('Filter Configuration')}
|
title={t('Filter configuration')}
|
||||||
>
|
>
|
||||||
<InfoTooltipWithTrigger
|
<InfoTooltipWithTrigger
|
||||||
icon="edit"
|
icon="edit"
|
||||||
|
|
|
@ -184,7 +184,7 @@ export default class SelectControl extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
isMetaSelectAllOption(o) {
|
isMetaSelectAllOption(o) {
|
||||||
return o.meta && o.meta === true && o.label === 'Select All';
|
return o.meta && o.meta === true && o.label === 'Select all';
|
||||||
}
|
}
|
||||||
|
|
||||||
optionsIncludesSelectAll(o) {
|
optionsIncludesSelectAll(o) {
|
||||||
|
@ -205,8 +205,8 @@ export default class SelectControl extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
createMetaSelectAllOption() {
|
createMetaSelectAllOption() {
|
||||||
const option = { label: 'Select All', meta: true };
|
const option = { label: 'Select all', meta: true };
|
||||||
option[this.props.valueKey] = 'Select All';
|
option[this.props.valueKey] = 'Select all';
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ const propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
label: t('Time Series Columns'),
|
label: t('Time series columns'),
|
||||||
tooltip: '',
|
tooltip: '',
|
||||||
colType: '',
|
colType: '',
|
||||||
width: '',
|
width: '',
|
||||||
|
@ -65,14 +65,14 @@ const comparisonTypeOptions = [
|
||||||
{ value: 'value', label: 'Actual value' },
|
{ value: 'value', label: 'Actual value' },
|
||||||
{ value: 'diff', label: 'Difference' },
|
{ value: 'diff', label: 'Difference' },
|
||||||
{ value: 'perc', label: 'Percentage' },
|
{ value: 'perc', label: 'Percentage' },
|
||||||
{ value: 'perc_change', label: 'Percentage Change' },
|
{ value: 'perc_change', label: 'Percentage change' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const colTypeOptions = [
|
const colTypeOptions = [
|
||||||
{ value: 'time', label: 'Time Comparison' },
|
{ value: 'time', label: 'Time comparison' },
|
||||||
{ value: 'contrib', label: 'Contribution' },
|
{ value: 'contrib', label: 'Contribution' },
|
||||||
{ value: 'spark', label: 'Sparkline' },
|
{ value: 'spark', label: 'Sparkline' },
|
||||||
{ value: 'avg', label: 'Period Average' },
|
{ value: 'avg', label: 'Period average' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default class TimeSeriesColumnControl extends React.Component {
|
export default class TimeSeriesColumnControl extends React.Component {
|
||||||
|
@ -209,7 +209,7 @@ export default class TimeSeriesColumnControl extends React.Component {
|
||||||
)}
|
)}
|
||||||
{['time', 'avg'].indexOf(this.state.colType) >= 0 &&
|
{['time', 'avg'].indexOf(this.state.colType) >= 0 &&
|
||||||
this.formRow(
|
this.formRow(
|
||||||
'Time Lag',
|
'Time lag',
|
||||||
'Number of periods to compare against',
|
'Number of periods to compare against',
|
||||||
'time-lag',
|
'time-lag',
|
||||||
<FormControl
|
<FormControl
|
||||||
|
@ -221,7 +221,7 @@ export default class TimeSeriesColumnControl extends React.Component {
|
||||||
)}
|
)}
|
||||||
{['spark'].indexOf(this.state.colType) >= 0 &&
|
{['spark'].indexOf(this.state.colType) >= 0 &&
|
||||||
this.formRow(
|
this.formRow(
|
||||||
'Time Ratio',
|
'Time ratio',
|
||||||
'Number of periods to ratio against',
|
'Number of periods to ratio against',
|
||||||
'time-ratio',
|
'time-ratio',
|
||||||
<FormControl
|
<FormControl
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default {
|
||||||
name: 'markup_type',
|
name: 'markup_type',
|
||||||
config: {
|
config: {
|
||||||
type: 'SelectControl',
|
type: 'SelectControl',
|
||||||
label: t('Markup Type'),
|
label: t('Markup type'),
|
||||||
clearable: false,
|
clearable: false,
|
||||||
choices: formatSelectOptions(['markdown', 'html']),
|
choices: formatSelectOptions(['markdown', 'html']),
|
||||||
default: 'markdown',
|
default: 'markdown',
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default {
|
||||||
name: 'column_collection',
|
name: 'column_collection',
|
||||||
config: {
|
config: {
|
||||||
type: 'CollectionControl',
|
type: 'CollectionControl',
|
||||||
label: t('Time Series Columns'),
|
label: t('Time series columns'),
|
||||||
validators: [validateNonEmpty],
|
validators: [validateNonEmpty],
|
||||||
controlName: 'TimeSeriesColumnControl',
|
controlName: 'TimeSeriesColumnControl',
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const druidTimeSeries = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const datasourceAndVizType = {
|
export const datasourceAndVizType = {
|
||||||
label: t('Chart Type'),
|
label: t('Chart type'),
|
||||||
expanded: true,
|
expanded: true,
|
||||||
controlSetRows: [
|
controlSetRows: [
|
||||||
['datasource'],
|
['datasource'],
|
||||||
|
@ -56,7 +56,7 @@ export const datasourceAndVizType = {
|
||||||
name: 'url_params',
|
name: 'url_params',
|
||||||
config: {
|
config: {
|
||||||
type: 'HiddenControl',
|
type: 'HiddenControl',
|
||||||
label: t('URL Parameters'),
|
label: t('URL parameters'),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
description: t('Extra parameters for use in jinja templated queries'),
|
description: t('Extra parameters for use in jinja templated queries'),
|
||||||
},
|
},
|
||||||
|
@ -75,7 +75,7 @@ export const datasourceAndVizType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const colorScheme = {
|
export const colorScheme = {
|
||||||
label: t('Color Scheme'),
|
label: t('Color scheme'),
|
||||||
controlSetRows: [['color_scheme', 'label_colors']],
|
controlSetRows: [['color_scheme', 'label_colors']],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ export const sqlaTimeSeries = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const annotations = {
|
export const annotations = {
|
||||||
label: t('Annotations and Layers'),
|
label: t('Annotations and layers'),
|
||||||
tabOverride: 'data',
|
tabOverride: 'data',
|
||||||
expanded: true,
|
expanded: true,
|
||||||
controlSetRows: [
|
controlSetRows: [
|
||||||
|
@ -98,7 +98,7 @@ export const annotations = {
|
||||||
type: 'AnnotationLayerControl',
|
type: 'AnnotationLayerControl',
|
||||||
label: '',
|
label: '',
|
||||||
default: [],
|
default: [],
|
||||||
description: 'Annotation Layers',
|
description: 'Annotation layers',
|
||||||
renderTrigger: true,
|
renderTrigger: true,
|
||||||
tabOverride: 'data',
|
tabOverride: 'data',
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ export const NVD3TimeSeries = [
|
||||||
name: 'order_desc',
|
name: 'order_desc',
|
||||||
config: {
|
config: {
|
||||||
type: 'CheckboxControl',
|
type: 'CheckboxControl',
|
||||||
label: t('Sort Descending'),
|
label: t('Sort descending'),
|
||||||
default: true,
|
default: true,
|
||||||
description: t('Whether to sort descending or ascending'),
|
description: t('Whether to sort descending or ascending'),
|
||||||
},
|
},
|
||||||
|
@ -140,7 +140,7 @@ export const NVD3TimeSeries = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Advanced Analytics'),
|
label: t('Advanced analytics'),
|
||||||
tabOverride: 'data',
|
tabOverride: 'data',
|
||||||
description: t(
|
description: t(
|
||||||
'This section contains options ' +
|
'This section contains options ' +
|
||||||
|
@ -148,13 +148,13 @@ export const NVD3TimeSeries = [
|
||||||
'of query results',
|
'of query results',
|
||||||
),
|
),
|
||||||
controlSetRows: [
|
controlSetRows: [
|
||||||
[<h1 className="section-header">{t('Rolling Window')}</h1>],
|
[<h1 className="section-header">{t('Rolling window')}</h1>],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'rolling_type',
|
name: 'rolling_type',
|
||||||
config: {
|
config: {
|
||||||
type: 'SelectControl',
|
type: 'SelectControl',
|
||||||
label: t('Rolling Function'),
|
label: t('Rolling function'),
|
||||||
default: 'None',
|
default: 'None',
|
||||||
choices: formatSelectOptions([
|
choices: formatSelectOptions([
|
||||||
'None',
|
'None',
|
||||||
|
@ -185,7 +185,7 @@ export const NVD3TimeSeries = [
|
||||||
name: 'min_periods',
|
name: 'min_periods',
|
||||||
config: {
|
config: {
|
||||||
type: 'TextControl',
|
type: 'TextControl',
|
||||||
label: t('Min Periods'),
|
label: t('Min periods'),
|
||||||
isInt: true,
|
isInt: true,
|
||||||
description: t(
|
description: t(
|
||||||
'The minimum number of rolling periods required to show ' +
|
'The minimum number of rolling periods required to show ' +
|
||||||
|
@ -197,7 +197,7 @@ export const NVD3TimeSeries = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[<h1 className="section-header">{t('Time Comparison')}</h1>],
|
[<h1 className="section-header">{t('Time comparison')}</h1>],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'time_compare',
|
name: 'time_compare',
|
||||||
|
@ -205,7 +205,7 @@ export const NVD3TimeSeries = [
|
||||||
type: 'SelectControl',
|
type: 'SelectControl',
|
||||||
multi: true,
|
multi: true,
|
||||||
freeForm: true,
|
freeForm: true,
|
||||||
label: t('Time Shift'),
|
label: t('Time shift'),
|
||||||
choices: formatSelectOptions([
|
choices: formatSelectOptions([
|
||||||
'1 day',
|
'1 day',
|
||||||
'1 week',
|
'1 week',
|
||||||
|
@ -231,7 +231,7 @@ export const NVD3TimeSeries = [
|
||||||
label: t('Calculation type'),
|
label: t('Calculation type'),
|
||||||
default: 'values',
|
default: 'values',
|
||||||
choices: [
|
choices: [
|
||||||
['values', 'Actual Values'],
|
['values', 'Actual values'],
|
||||||
['absolute', 'Absolute difference'],
|
['absolute', 'Absolute difference'],
|
||||||
['percentage', 'Percentage change'],
|
['percentage', 'Percentage change'],
|
||||||
['ratio', 'Ratio'],
|
['ratio', 'Ratio'],
|
||||||
|
@ -244,7 +244,7 @@ export const NVD3TimeSeries = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[<h1 className="section-header">{t('Python Functions')}</h1>],
|
[<h1 className="section-header">{t('Python functions')}</h1>],
|
||||||
// eslint-disable-next-line jsx-a11y/heading-has-content
|
// eslint-disable-next-line jsx-a11y/heading-has-content
|
||||||
[<h2 className="section-header">pandas.resample</h2>],
|
[<h2 className="section-header">pandas.resample</h2>],
|
||||||
[
|
[
|
||||||
|
|
|
@ -25,8 +25,8 @@ import thumbnail from './images/thumbnail.png';
|
||||||
export default class AntdRangeFilterPlugin extends ChartPlugin {
|
export default class AntdRangeFilterPlugin extends ChartPlugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
const metadata = new ChartMetadata({
|
const metadata = new ChartMetadata({
|
||||||
name: t('Range Filter Plugin'),
|
name: t('Range filter plugin'),
|
||||||
description: 'Range Filter Plugin using AntD',
|
description: 'Range filter plugin using AntD',
|
||||||
isNativeFilter: true,
|
isNativeFilter: true,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,7 +44,7 @@ const config: ControlPanelConfig = {
|
||||||
name: 'multiSelect',
|
name: 'multiSelect',
|
||||||
config: {
|
config: {
|
||||||
type: 'CheckboxControl',
|
type: 'CheckboxControl',
|
||||||
label: t('Multiple Select'),
|
label: t('Multiple select'),
|
||||||
default: multiSelect,
|
default: multiSelect,
|
||||||
description: t('Allow selecting multiple values'),
|
description: t('Allow selecting multiple values'),
|
||||||
},
|
},
|
||||||
|
@ -55,7 +55,7 @@ const config: ControlPanelConfig = {
|
||||||
name: 'enableEmptyFilter',
|
name: 'enableEmptyFilter',
|
||||||
config: {
|
config: {
|
||||||
type: 'CheckboxControl',
|
type: 'CheckboxControl',
|
||||||
label: t('Enable Empty Filter'),
|
label: t('Enable empty filter'),
|
||||||
default: enableEmptyFilter,
|
default: enableEmptyFilter,
|
||||||
description: t(
|
description: t(
|
||||||
'When selection is empty, should an always false filter event be emitted',
|
'When selection is empty, should an always false filter event be emitted',
|
||||||
|
@ -68,7 +68,7 @@ const config: ControlPanelConfig = {
|
||||||
name: 'inverseSelection',
|
name: 'inverseSelection',
|
||||||
config: {
|
config: {
|
||||||
type: 'CheckboxControl',
|
type: 'CheckboxControl',
|
||||||
label: t('Inverse Selection'),
|
label: t('Inverse selection'),
|
||||||
default: inverseSelection,
|
default: inverseSelection,
|
||||||
description: t('Exclude selected values'),
|
description: t('Exclude selected values'),
|
||||||
},
|
},
|
||||||
|
@ -79,7 +79,7 @@ const config: ControlPanelConfig = {
|
||||||
name: 'showSearch',
|
name: 'showSearch',
|
||||||
config: {
|
config: {
|
||||||
type: 'CheckboxControl',
|
type: 'CheckboxControl',
|
||||||
label: t('Search Field'),
|
label: t('Search field'),
|
||||||
default: showSearch,
|
default: showSearch,
|
||||||
description: t('Allow typing search terms'),
|
description: t('Allow typing search terms'),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue