chore: make TS enums strictly PascalCase (#26875)
This commit is contained in:
parent
959a5a5ad6
commit
19f8405bc0
|
|
@ -93,6 +93,17 @@ module.exports = {
|
|||
'@typescript-eslint/ban-ts-ignore': 0,
|
||||
'@typescript-eslint/ban-ts-comment': 0, // disabled temporarily
|
||||
'@typescript-eslint/ban-types': 0, // disabled temporarily
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'error',
|
||||
{
|
||||
selector: 'enum',
|
||||
format: ['PascalCase'],
|
||||
},
|
||||
{
|
||||
selector: 'enumMember',
|
||||
format: ['PascalCase'],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-empty-function': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'@typescript-eslint/no-use-before-define': 1, // disabled temporarily
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ export function ColumnTypeLabel({ type }: ColumnTypeLabelProps) {
|
|||
|
||||
if (type === '' || type === 'expression') {
|
||||
typeIcon = <FunctionSvg aria-label={t('function type icon')} />;
|
||||
} else if (type === GenericDataType.STRING) {
|
||||
} else if (type === GenericDataType.String) {
|
||||
typeIcon = <StringSvg aria-label={t('string type icon')} />;
|
||||
} else if (type === GenericDataType.NUMERIC) {
|
||||
} else if (type === GenericDataType.Numeric) {
|
||||
typeIcon = <NumSvg aria-label={t('numeric type icon')} />;
|
||||
} else if (type === GenericDataType.BOOLEAN) {
|
||||
} else if (type === GenericDataType.Boolean) {
|
||||
typeIcon = <BooleanSvg aria-label={t('boolean type icon')} />;
|
||||
} else if (type === GenericDataType.TEMPORAL) {
|
||||
} else if (type === GenericDataType.Temporal) {
|
||||
typeIcon = <ClockCircleOutlined aria-label={t('temporal type icon')} />;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export const DATASET_TIME_COLUMN_OPTION: ColumnMeta = {
|
|||
verbose_name: COLUMN_NAME_ALIASES[DTTM_ALIAS],
|
||||
column_name: DTTM_ALIAS,
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
description: t(
|
||||
'A reference to the [Time] configuration, taking granularity into account',
|
||||
),
|
||||
|
|
@ -53,12 +53,12 @@ export const QUERY_TIME_COLUMN_OPTION: QueryColumn = {
|
|||
column_name: DTTM_ALIAS,
|
||||
is_dttm: true,
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
};
|
||||
|
||||
export const QueryModeLabel = {
|
||||
[QueryMode.aggregate]: t('Aggregate'),
|
||||
[QueryMode.raw]: t('Raw records'),
|
||||
[QueryMode.Aggregate]: t('Aggregate'),
|
||||
[QueryMode.Raw]: t('Raw records'),
|
||||
};
|
||||
|
||||
export const DEFAULT_SORT_SERIES_DATA: SortSeriesData = {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const TestDataset: Dataset = {
|
|||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: 'BIGINT',
|
||||
type_generic: GenericDataType.NUMERIC,
|
||||
type_generic: GenericDataType.Numeric,
|
||||
verbose_name: null,
|
||||
warning_markdown: null,
|
||||
},
|
||||
|
|
@ -55,7 +55,7 @@ export const TestDataset: Dataset = {
|
|||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: 'VARCHAR(16)',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
verbose_name: '',
|
||||
warning_markdown: null,
|
||||
},
|
||||
|
|
@ -73,7 +73,7 @@ export const TestDataset: Dataset = {
|
|||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: 'VARCHAR(10)',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
verbose_name: null,
|
||||
warning_markdown: null,
|
||||
},
|
||||
|
|
@ -91,7 +91,7 @@ export const TestDataset: Dataset = {
|
|||
is_dttm: true,
|
||||
python_date_format: null,
|
||||
type: 'TIMESTAMP WITHOUT TIME ZONE',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
verbose_name: null,
|
||||
warning_markdown: null,
|
||||
},
|
||||
|
|
@ -109,7 +109,7 @@ export const TestDataset: Dataset = {
|
|||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: 'VARCHAR(255)',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
verbose_name: null,
|
||||
warning_markdown: null,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function isForcedCategorical(controls: ControlStateMapping): boolean {
|
|||
checkColumnType(
|
||||
getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
|
||||
controls?.datasource?.datasource,
|
||||
[GenericDataType.NUMERIC],
|
||||
[GenericDataType.Numeric],
|
||||
) && !!controls?.xAxisForceCategorical?.value
|
||||
);
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ function isSortable(controls: ControlStateMapping): boolean {
|
|||
checkColumnType(
|
||||
getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
|
||||
controls?.datasource?.datasource,
|
||||
[GenericDataType.STRING, GenericDataType.BOOLEAN],
|
||||
[GenericDataType.String, GenericDataType.Boolean],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ export const xAxisForceCategoricalControl = {
|
|||
checkColumnType(
|
||||
getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
|
||||
controls?.datasource?.datasource,
|
||||
[GenericDataType.NUMERIC],
|
||||
[GenericDataType.Numeric],
|
||||
),
|
||||
shouldMapStateToProps: () => true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -420,29 +420,29 @@ export type SectionOverrides = {
|
|||
|
||||
// Ref:
|
||||
// - superset-frontend/src/explore/components/ConditionalFormattingControl.tsx
|
||||
export enum COMPARATOR {
|
||||
NONE = 'None',
|
||||
GREATER_THAN = '>',
|
||||
LESS_THAN = '<',
|
||||
GREATER_OR_EQUAL = '≥',
|
||||
LESS_OR_EQUAL = '≤',
|
||||
EQUAL = '=',
|
||||
NOT_EQUAL = '≠',
|
||||
BETWEEN = '< x <',
|
||||
BETWEEN_OR_EQUAL = '≤ x ≤',
|
||||
BETWEEN_OR_LEFT_EQUAL = '≤ x <',
|
||||
BETWEEN_OR_RIGHT_EQUAL = '< x ≤',
|
||||
export enum Comparator {
|
||||
None = 'None',
|
||||
GreaterThan = '>',
|
||||
LessThan = '<',
|
||||
GreaterOrEqual = '≥',
|
||||
LessOrEqual = '≤',
|
||||
Equal = '=',
|
||||
NotEqual = '≠',
|
||||
Between = '< x <',
|
||||
BetweenOrEqual = '≤ x ≤',
|
||||
BetweenOrLeftEqual = '≤ x <',
|
||||
BetweenOrRightEqual = '< x ≤',
|
||||
}
|
||||
|
||||
export const MULTIPLE_VALUE_COMPARATORS = [
|
||||
COMPARATOR.BETWEEN,
|
||||
COMPARATOR.BETWEEN_OR_EQUAL,
|
||||
COMPARATOR.BETWEEN_OR_LEFT_EQUAL,
|
||||
COMPARATOR.BETWEEN_OR_RIGHT_EQUAL,
|
||||
export const MultipleValueComparators = [
|
||||
Comparator.Between,
|
||||
Comparator.BetweenOrEqual,
|
||||
Comparator.BetweenOrLeftEqual,
|
||||
Comparator.BetweenOrRightEqual,
|
||||
];
|
||||
|
||||
export type ConditionalFormattingConfig = {
|
||||
operator?: COMPARATOR;
|
||||
operator?: Comparator;
|
||||
targetValue?: number;
|
||||
targetValueLeft?: number;
|
||||
targetValueRight?: number;
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import memoizeOne from 'memoize-one';
|
|||
import { addAlpha, DataRecord } from '@superset-ui/core';
|
||||
import {
|
||||
ColorFormatters,
|
||||
COMPARATOR,
|
||||
Comparator,
|
||||
ConditionalFormattingConfig,
|
||||
MULTIPLE_VALUE_COMPARATORS,
|
||||
MultipleValueComparators,
|
||||
} from '../types';
|
||||
|
||||
export const round = (num: number, precision = 0) =>
|
||||
|
|
@ -75,20 +75,20 @@ export const getColorFunction = (
|
|||
return () => undefined;
|
||||
}
|
||||
if (
|
||||
MULTIPLE_VALUE_COMPARATORS.includes(operator) &&
|
||||
MultipleValueComparators.includes(operator) &&
|
||||
(targetValueLeft === undefined || targetValueRight === undefined)
|
||||
) {
|
||||
return () => undefined;
|
||||
}
|
||||
if (
|
||||
operator !== COMPARATOR.NONE &&
|
||||
!MULTIPLE_VALUE_COMPARATORS.includes(operator) &&
|
||||
operator !== Comparator.None &&
|
||||
!MultipleValueComparators.includes(operator) &&
|
||||
targetValue === undefined
|
||||
) {
|
||||
return () => undefined;
|
||||
}
|
||||
switch (operator) {
|
||||
case COMPARATOR.NONE:
|
||||
case Comparator.None:
|
||||
minOpacity = MIN_OPACITY_UNBOUNDED;
|
||||
comparatorFunction = (value: number, allValues: number[]) => {
|
||||
const cutoffValue = Math.min(...allValues);
|
||||
|
|
@ -98,37 +98,37 @@ export const getColorFunction = (
|
|||
: false;
|
||||
};
|
||||
break;
|
||||
case COMPARATOR.GREATER_THAN:
|
||||
case Comparator.GreaterThan:
|
||||
comparatorFunction = (value: number, allValues: number[]) =>
|
||||
value > targetValue!
|
||||
? { cutoffValue: targetValue!, extremeValue: Math.max(...allValues) }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.LESS_THAN:
|
||||
case Comparator.LessThan:
|
||||
comparatorFunction = (value: number, allValues: number[]) =>
|
||||
value < targetValue!
|
||||
? { cutoffValue: targetValue!, extremeValue: Math.min(...allValues) }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.GREATER_OR_EQUAL:
|
||||
case Comparator.GreaterOrEqual:
|
||||
comparatorFunction = (value: number, allValues: number[]) =>
|
||||
value >= targetValue!
|
||||
? { cutoffValue: targetValue!, extremeValue: Math.max(...allValues) }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.LESS_OR_EQUAL:
|
||||
case Comparator.LessOrEqual:
|
||||
comparatorFunction = (value: number, allValues: number[]) =>
|
||||
value <= targetValue!
|
||||
? { cutoffValue: targetValue!, extremeValue: Math.min(...allValues) }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.EQUAL:
|
||||
case Comparator.Equal:
|
||||
comparatorFunction = (value: number) =>
|
||||
value === targetValue!
|
||||
? { cutoffValue: targetValue!, extremeValue: targetValue! }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.NOT_EQUAL:
|
||||
case Comparator.NotEqual:
|
||||
comparatorFunction = (value: number, allValues: number[]) => {
|
||||
if (value === targetValue!) {
|
||||
return false;
|
||||
|
|
@ -144,25 +144,25 @@ export const getColorFunction = (
|
|||
};
|
||||
};
|
||||
break;
|
||||
case COMPARATOR.BETWEEN:
|
||||
case Comparator.Between:
|
||||
comparatorFunction = (value: number) =>
|
||||
value > targetValueLeft! && value < targetValueRight!
|
||||
? { cutoffValue: targetValueLeft!, extremeValue: targetValueRight! }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.BETWEEN_OR_EQUAL:
|
||||
case Comparator.BetweenOrEqual:
|
||||
comparatorFunction = (value: number) =>
|
||||
value >= targetValueLeft! && value <= targetValueRight!
|
||||
? { cutoffValue: targetValueLeft!, extremeValue: targetValueRight! }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.BETWEEN_OR_LEFT_EQUAL:
|
||||
case Comparator.BetweenOrLeftEqual:
|
||||
comparatorFunction = (value: number) =>
|
||||
value >= targetValueLeft! && value < targetValueRight!
|
||||
? { cutoffValue: targetValueLeft!, extremeValue: targetValueRight! }
|
||||
: false;
|
||||
break;
|
||||
case COMPARATOR.BETWEEN_OR_RIGHT_EQUAL:
|
||||
case Comparator.BetweenOrRightEqual:
|
||||
comparatorFunction = (value: number) =>
|
||||
value > targetValueLeft! && value <= targetValueRight!
|
||||
? { cutoffValue: targetValueLeft!, extremeValue: targetValueRight! }
|
||||
|
|
@ -197,9 +197,9 @@ export const getColorFormatters = memoizeOne(
|
|||
(acc: ColorFormatters, config: ConditionalFormattingConfig) => {
|
||||
if (
|
||||
config?.column !== undefined &&
|
||||
(config?.operator === COMPARATOR.NONE ||
|
||||
(config?.operator === Comparator.None ||
|
||||
(config?.operator !== undefined &&
|
||||
(MULTIPLE_VALUE_COMPARATORS.includes(config?.operator)
|
||||
(MultipleValueComparators.includes(config?.operator)
|
||||
? config?.targetValueLeft !== undefined &&
|
||||
config?.targetValueRight !== undefined
|
||||
: config?.targetValue !== undefined)))
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ describe('ColumnOption', () => {
|
|||
column: {
|
||||
column_name: 'foo',
|
||||
type: 'VARCHAR',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -92,11 +92,11 @@ describe('ColumnOption', () => {
|
|||
it('dttm column has correct column label if showType is true', () => {
|
||||
props.showType = true;
|
||||
props.column.expression = undefined;
|
||||
props.column.type_generic = GenericDataType.TEMPORAL;
|
||||
props.column.type_generic = GenericDataType.Temporal;
|
||||
wrapper = shallow(factory(props));
|
||||
expect(wrapper.find(ColumnTypeLabel)).toHaveLength(1);
|
||||
expect(wrapper.find(ColumnTypeLabel).props().type).toBe(
|
||||
GenericDataType.TEMPORAL,
|
||||
GenericDataType.Temporal,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { ColumnTypeLabel, ColumnTypeLabelProps } from '../../src';
|
|||
|
||||
describe('ColumnOption', () => {
|
||||
const defaultProps = {
|
||||
type: GenericDataType.STRING,
|
||||
type: GenericDataType.String,
|
||||
};
|
||||
|
||||
const props = { ...defaultProps };
|
||||
|
|
@ -40,15 +40,15 @@ describe('ColumnOption', () => {
|
|||
);
|
||||
});
|
||||
it('string type shows ABC icon', () => {
|
||||
renderColumnTypeLabel({ type: GenericDataType.STRING });
|
||||
renderColumnTypeLabel({ type: GenericDataType.String });
|
||||
expect(screen.getByLabelText('string type icon')).toBeVisible();
|
||||
});
|
||||
it('int type shows # icon', () => {
|
||||
renderColumnTypeLabel({ type: GenericDataType.NUMERIC });
|
||||
renderColumnTypeLabel({ type: GenericDataType.Numeric });
|
||||
expect(screen.getByLabelText('numeric type icon')).toBeVisible();
|
||||
});
|
||||
it('bool type shows 1|0 icon', () => {
|
||||
renderColumnTypeLabel({ type: GenericDataType.BOOLEAN });
|
||||
renderColumnTypeLabel({ type: GenericDataType.Boolean });
|
||||
expect(screen.getByLabelText('boolean type icon')).toBeVisible();
|
||||
});
|
||||
it('expression type shows function icon', () => {
|
||||
|
|
@ -60,7 +60,7 @@ describe('ColumnOption', () => {
|
|||
expect(screen.getByLabelText('unknown type icon')).toBeVisible();
|
||||
});
|
||||
it('datetime type displays', () => {
|
||||
renderColumnTypeLabel({ type: GenericDataType.TEMPORAL });
|
||||
renderColumnTypeLabel({ type: GenericDataType.Temporal });
|
||||
expect(screen.getByLabelText('temporal type icon')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,25 +21,25 @@ import { checkColumnType, TestDataset } from '../../src';
|
|||
|
||||
test('checkColumnType columns from a Dataset', () => {
|
||||
expect(
|
||||
checkColumnType('num', TestDataset, [GenericDataType.NUMERIC]),
|
||||
checkColumnType('num', TestDataset, [GenericDataType.Numeric]),
|
||||
).toEqual(true);
|
||||
expect(checkColumnType('num', TestDataset, [GenericDataType.STRING])).toEqual(
|
||||
expect(checkColumnType('num', TestDataset, [GenericDataType.String])).toEqual(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
checkColumnType('gender', TestDataset, [GenericDataType.STRING]),
|
||||
checkColumnType('gender', TestDataset, [GenericDataType.String]),
|
||||
).toEqual(true);
|
||||
expect(
|
||||
checkColumnType('gender', TestDataset, [GenericDataType.NUMERIC]),
|
||||
checkColumnType('gender', TestDataset, [GenericDataType.Numeric]),
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
test('checkColumnType from a QueryResponse', () => {
|
||||
expect(
|
||||
checkColumnType('Column 1', testQueryResponse, [GenericDataType.STRING]),
|
||||
checkColumnType('Column 1', testQueryResponse, [GenericDataType.String]),
|
||||
).toEqual(true);
|
||||
expect(
|
||||
checkColumnType('Column 1', testQueryResponse, [GenericDataType.NUMERIC]),
|
||||
checkColumnType('Column 1', testQueryResponse, [GenericDataType.Numeric]),
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -36,19 +36,19 @@ describe('columnChoices()', () => {
|
|||
{
|
||||
column_name: 'fiz',
|
||||
type: 'INT',
|
||||
type_generic: GenericDataType.NUMERIC,
|
||||
type_generic: GenericDataType.Numeric,
|
||||
},
|
||||
{
|
||||
column_name: 'about',
|
||||
verbose_name: 'right',
|
||||
type: 'VARCHAR',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
},
|
||||
{
|
||||
column_name: 'foo',
|
||||
verbose_name: undefined,
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
},
|
||||
],
|
||||
verbose_map: {},
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
import { configure } from '@superset-ui/core';
|
||||
import {
|
||||
COMPARATOR,
|
||||
Comparator,
|
||||
getOpacity,
|
||||
round,
|
||||
getColorFormatters,
|
||||
|
|
@ -60,7 +60,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction GREATER_THAN', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.GREATER_THAN,
|
||||
operator: Comparator.GreaterThan,
|
||||
targetValue: 50,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -74,7 +74,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction LESS_THAN', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.LESS_THAN,
|
||||
operator: Comparator.LessThan,
|
||||
targetValue: 100,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -88,7 +88,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction GREATER_OR_EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.GREATER_OR_EQUAL,
|
||||
operator: Comparator.GreaterOrEqual,
|
||||
targetValue: 50,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -103,7 +103,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction LESS_OR_EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.LESS_OR_EQUAL,
|
||||
operator: Comparator.LessOrEqual,
|
||||
targetValue: 100,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -118,7 +118,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.EQUAL,
|
||||
operator: Comparator.Equal,
|
||||
targetValue: 100,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -132,7 +132,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction NOT_EQUAL', () => {
|
||||
let colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.NOT_EQUAL,
|
||||
operator: Comparator.NotEqual,
|
||||
targetValue: 60,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -145,7 +145,7 @@ describe('getColorFunction()', () => {
|
|||
|
||||
colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.NOT_EQUAL,
|
||||
operator: Comparator.NotEqual,
|
||||
targetValue: 90,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -160,7 +160,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN,
|
||||
operator: Comparator.Between,
|
||||
targetValueLeft: 75,
|
||||
targetValueRight: 125,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -175,7 +175,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN_OR_EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN_OR_EQUAL,
|
||||
operator: Comparator.BetweenOrEqual,
|
||||
targetValueLeft: 50,
|
||||
targetValueRight: 100,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -191,7 +191,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN_OR_EQUAL without opacity', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN_OR_EQUAL,
|
||||
operator: Comparator.BetweenOrEqual,
|
||||
targetValueLeft: 50,
|
||||
targetValueRight: 100,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -210,7 +210,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN_OR_LEFT_EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN_OR_LEFT_EQUAL,
|
||||
operator: Comparator.BetweenOrLeftEqual,
|
||||
targetValueLeft: 50,
|
||||
targetValueRight: 100,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -225,7 +225,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN_OR_RIGHT_EQUAL', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN_OR_RIGHT_EQUAL,
|
||||
operator: Comparator.BetweenOrRightEqual,
|
||||
targetValueLeft: 50,
|
||||
targetValueRight: 100,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -240,7 +240,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction GREATER_THAN with target value undefined', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.GREATER_THAN,
|
||||
operator: Comparator.GreaterThan,
|
||||
targetValue: undefined,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
|
|
@ -254,7 +254,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN with target value left undefined', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN,
|
||||
operator: Comparator.Between,
|
||||
targetValueLeft: undefined,
|
||||
targetValueRight: 100,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -269,7 +269,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction BETWEEN with target value right undefined', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN,
|
||||
operator: Comparator.Between,
|
||||
targetValueLeft: 50,
|
||||
targetValueRight: undefined,
|
||||
colorScheme: '#FF0000',
|
||||
|
|
@ -299,7 +299,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction with operator None', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.NONE,
|
||||
operator: Comparator.None,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
},
|
||||
|
|
@ -329,7 +329,7 @@ describe('getColorFunction()', () => {
|
|||
it('getColorFunction with colorScheme undefined', () => {
|
||||
const colorFunction = getColorFunction(
|
||||
{
|
||||
operator: COMPARATOR.GREATER_THAN,
|
||||
operator: Comparator.GreaterThan,
|
||||
targetValue: 150,
|
||||
colorScheme: undefined,
|
||||
column: 'count',
|
||||
|
|
@ -345,26 +345,26 @@ describe('getColorFormatters()', () => {
|
|||
it('correct column config', () => {
|
||||
const columnConfig = [
|
||||
{
|
||||
operator: COMPARATOR.GREATER_THAN,
|
||||
operator: Comparator.GreaterThan,
|
||||
targetValue: 50,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
},
|
||||
{
|
||||
operator: COMPARATOR.LESS_THAN,
|
||||
operator: Comparator.LessThan,
|
||||
targetValue: 300,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'sum',
|
||||
},
|
||||
{
|
||||
operator: COMPARATOR.BETWEEN,
|
||||
operator: Comparator.Between,
|
||||
targetValueLeft: 75,
|
||||
targetValueRight: 125,
|
||||
colorScheme: '#FF0000',
|
||||
column: 'count',
|
||||
},
|
||||
{
|
||||
operator: COMPARATOR.GREATER_THAN,
|
||||
operator: Comparator.GreaterThan,
|
||||
targetValue: 150,
|
||||
colorScheme: '#FF0000',
|
||||
column: undefined,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ test('get temporal columns from a QueryResponse', () => {
|
|||
column_name: 'Column 2',
|
||||
is_dttm: true,
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
},
|
||||
],
|
||||
defaultTemporalColumn: 'Column 2',
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export type BuildQuery<T = any> = (
|
|||
|
||||
class ChartBuildQueryRegistry extends Registry<BuildQuery> {
|
||||
constructor() {
|
||||
super({ name: 'ChartBuildQuery', overwritePolicy: OverwritePolicy.WARN });
|
||||
super({ name: 'ChartBuildQuery', overwritePolicy: OverwritePolicy.Warn });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { ChartType } from '../models/ChartPlugin';
|
|||
|
||||
class ChartComponentRegistry extends Registry<ChartType> {
|
||||
constructor() {
|
||||
super({ name: 'ChartComponent', overwritePolicy: OverwritePolicy.WARN });
|
||||
super({ name: 'ChartComponent', overwritePolicy: OverwritePolicy.Warn });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import ChartMetadata from '../models/ChartMetadata';
|
|||
|
||||
class ChartMetadataRegistry extends Registry<ChartMetadata, ChartMetadata> {
|
||||
constructor() {
|
||||
super({ name: 'ChartMetadata', overwritePolicy: OverwritePolicy.WARN });
|
||||
super({ name: 'ChartMetadata', overwritePolicy: OverwritePolicy.Warn });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ChartTransformPropsRegistry extends Registry<TransformProps<any>> {
|
|||
constructor() {
|
||||
super({
|
||||
name: 'ChartTransformProps',
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ import { JsonObject } from '../..';
|
|||
export type HandlerFunction = (...args: unknown[]) => void;
|
||||
|
||||
export enum Behavior {
|
||||
INTERACTIVE_CHART = 'INTERACTIVE_CHART',
|
||||
NATIVE_FILTER = 'NATIVE_FILTER',
|
||||
InteractiveChart = 'INTERACTIVE_CHART',
|
||||
NativeFilter = 'NATIVE_FILTER',
|
||||
|
||||
/**
|
||||
* Include `DRILL_TO_DETAIL` behavior if plugin handles `contextmenu` event
|
||||
* when dimensions are right-clicked on.
|
||||
*/
|
||||
DRILL_TO_DETAIL = 'DRILL_TO_DETAIL',
|
||||
DRILL_BY = 'DRILL_BY',
|
||||
DrillToDetail = 'DRILL_TO_DETAIL',
|
||||
DrillBy = 'DRILL_BY',
|
||||
}
|
||||
|
||||
export interface ContextMenuFilters {
|
||||
|
|
@ -48,11 +48,11 @@ export interface ContextMenuFilters {
|
|||
}
|
||||
|
||||
export enum AppSection {
|
||||
EXPLORE = 'EXPLORE',
|
||||
DASHBOARD = 'DASHBOARD',
|
||||
FILTER_BAR = 'FILTER_BAR',
|
||||
FILTER_CONFIG_MODAL = 'FILTER_CONFIG_MODAL',
|
||||
EMBEDDED = 'EMBEDDED',
|
||||
Explore = 'EXPLORE',
|
||||
Dashboard = 'DASHBOARD',
|
||||
FilterBar = 'FILTER_BAR',
|
||||
FilterConfigModal = 'FILTER_CONFIG_MODAL',
|
||||
Embedded = 'EMBEDDED',
|
||||
}
|
||||
|
||||
export type FilterState = { value?: any; [key: string]: any };
|
||||
|
|
@ -73,31 +73,31 @@ export interface PlainObject {
|
|||
}
|
||||
|
||||
export enum ChartLabel {
|
||||
DEPRECATED = 'DEPRECATED',
|
||||
FEATURED = 'FEATURED',
|
||||
Deprecated = 'DEPRECATED',
|
||||
Featured = 'FEATURED',
|
||||
}
|
||||
|
||||
export const chartLabelExplanations: Record<ChartLabel, string> = {
|
||||
[ChartLabel.DEPRECATED]:
|
||||
[ChartLabel.Deprecated]:
|
||||
'This chart uses features or modules which are no longer actively maintained. It will eventually be replaced or removed.',
|
||||
[ChartLabel.FEATURED]:
|
||||
[ChartLabel.Featured]:
|
||||
'This chart was tested and verified, so the overall experience should be stable.',
|
||||
};
|
||||
|
||||
export const chartLabelWeight: Record<ChartLabel, { weight: number }> = {
|
||||
[ChartLabel.DEPRECATED]: {
|
||||
[ChartLabel.Deprecated]: {
|
||||
weight: -0.1,
|
||||
},
|
||||
[ChartLabel.FEATURED]: {
|
||||
[ChartLabel.Featured]: {
|
||||
weight: 0.1,
|
||||
},
|
||||
};
|
||||
|
||||
export enum AxisType {
|
||||
category = 'category',
|
||||
value = 'value',
|
||||
time = 'time',
|
||||
log = 'log',
|
||||
Category = 'category',
|
||||
Value = 'value',
|
||||
Time = 'time',
|
||||
Log = 'log',
|
||||
}
|
||||
|
||||
export interface LegendState {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class CategoricalColorScale extends ExtensibleFunction {
|
|||
this.forcedColors?.[cleanedValue] ||
|
||||
sharedColor;
|
||||
|
||||
if (isFeatureEnabled(FeatureFlag.USE_ANALAGOUS_COLORS)) {
|
||||
if (isFeatureEnabled(FeatureFlag.UseAnalagousColors)) {
|
||||
const multiple = Math.floor(
|
||||
this.domain().length / this.originColors.length,
|
||||
);
|
||||
|
|
@ -119,7 +119,7 @@ class CategoricalColorScale extends ExtensibleFunction {
|
|||
const newColor = this.scale(cleanedValue);
|
||||
if (!color) {
|
||||
color = newColor;
|
||||
if (isFeatureEnabled(FeatureFlag.AVOID_COLORS_COLLISION)) {
|
||||
if (isFeatureEnabled(FeatureFlag.AvoidColorsCollision)) {
|
||||
this.removeSharedLabelColorFromRange(sharedColorMap, cleanedValue);
|
||||
color = this.scale(cleanedValue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default class ColorSchemeRegistry<T> extends RegistryWithDefaultKey<T> {
|
|||
constructor() {
|
||||
super({
|
||||
name: 'ColorScheme',
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
setFirstItemAsDefault: true,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import { CategoricalColorNamespace } from '.';
|
|||
import { makeSingleton } from '../utils';
|
||||
|
||||
export enum SharedLabelColorSource {
|
||||
dashboard,
|
||||
explore,
|
||||
Dashboard,
|
||||
Explore,
|
||||
}
|
||||
export class SharedLabelColor {
|
||||
sliceLabelMap: Map<number, string[]>;
|
||||
|
|
@ -35,7 +35,7 @@ export class SharedLabelColor {
|
|||
// { sliceId1: [label1, label2, ...], sliceId2: [label1, label2, ...] }
|
||||
this.sliceLabelMap = new Map();
|
||||
this.colorMap = new Map();
|
||||
this.source = SharedLabelColorSource.dashboard;
|
||||
this.source = SharedLabelColorSource.Dashboard;
|
||||
}
|
||||
|
||||
updateColorMap(colorNamespace?: string, colorScheme?: string) {
|
||||
|
|
@ -59,7 +59,7 @@ export class SharedLabelColor {
|
|||
|
||||
addSlice(label: string, color: string, sliceId?: number) {
|
||||
if (
|
||||
this.source !== SharedLabelColorSource.dashboard ||
|
||||
this.source !== SharedLabelColorSource.Dashboard ||
|
||||
sliceId === undefined
|
||||
)
|
||||
return;
|
||||
|
|
@ -72,7 +72,7 @@ export class SharedLabelColor {
|
|||
}
|
||||
|
||||
removeSlice(sliceId: number) {
|
||||
if (this.source !== SharedLabelColorSource.dashboard) return;
|
||||
if (this.source !== SharedLabelColorSource.Dashboard) return;
|
||||
this.sliceLabelMap.delete(sliceId);
|
||||
const newColorMap = new Map();
|
||||
this.sliceLabelMap.forEach(labels => {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function SafeMarkdown({
|
|||
htmlSanitization = true,
|
||||
htmlSchemaOverrides = {},
|
||||
}: SafeMarkdownProps) {
|
||||
const escapeHtml = isFeatureEnabled(FeatureFlag.ESCAPE_MARKDOWN_HTML);
|
||||
const escapeHtml = isFeatureEnabled(FeatureFlag.EscapeMarkdownHtml);
|
||||
|
||||
const rehypePlugins = useMemo(() => {
|
||||
const rehypePlugins: any = [];
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
* under the License.
|
||||
*/
|
||||
export enum OverwritePolicy {
|
||||
ALLOW = 'ALLOW',
|
||||
PROHIBIT = 'PROHIBIT',
|
||||
WARN = 'WARN',
|
||||
Allow = 'ALLOW',
|
||||
Prohibit = 'PROHIBIT',
|
||||
Warn = 'WARN',
|
||||
}
|
||||
|
||||
interface ItemWithValue<T> {
|
||||
|
|
@ -89,7 +89,7 @@ export default class Registry<
|
|||
listeners: Set<Listener>;
|
||||
|
||||
constructor(config: RegistryConfig = {}) {
|
||||
const { name = '', overwritePolicy = OverwritePolicy.ALLOW } = config;
|
||||
const { name = '', overwritePolicy = OverwritePolicy.Allow } = config;
|
||||
this.name = name;
|
||||
this.overwritePolicy = overwritePolicy;
|
||||
this.items = {};
|
||||
|
|
@ -119,12 +119,12 @@ export default class Registry<
|
|||
this.has(key) &&
|
||||
(('value' in item && item.value !== value) || 'loader' in item);
|
||||
if (willOverwrite) {
|
||||
if (this.overwritePolicy === OverwritePolicy.WARN) {
|
||||
if (this.overwritePolicy === OverwritePolicy.Warn) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`Item with key "${key}" already exists. You are assigning a new value.`,
|
||||
);
|
||||
} else if (this.overwritePolicy === OverwritePolicy.PROHIBIT) {
|
||||
} else if (this.overwritePolicy === OverwritePolicy.Prohibit) {
|
||||
throw new Error(
|
||||
`Item with key "${key}" already exists. Cannot overwrite.`,
|
||||
);
|
||||
|
|
@ -145,12 +145,12 @@ export default class Registry<
|
|||
this.has(key) &&
|
||||
(('loader' in item && item.loader !== loader) || 'value' in item);
|
||||
if (willOverwrite) {
|
||||
if (this.overwritePolicy === OverwritePolicy.WARN) {
|
||||
if (this.overwritePolicy === OverwritePolicy.Warn) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`Item with key "${key}" already exists. You are assigning a new value.`,
|
||||
);
|
||||
} else if (this.overwritePolicy === OverwritePolicy.PROHIBIT) {
|
||||
} else if (this.overwritePolicy === OverwritePolicy.Prohibit) {
|
||||
throw new Error(
|
||||
`Item with key "${key}" already exists. Cannot overwrite.`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default class NumberFormatterRegistry extends RegistryWithDefaultKey<
|
|||
constructor() {
|
||||
super({
|
||||
name: 'NumberFormatter',
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
});
|
||||
|
||||
this.registerValue(
|
||||
|
|
|
|||
|
|
@ -47,25 +47,25 @@ export interface SupersetApiRequestOptions {
|
|||
*/
|
||||
export enum SupersetApiErrorType {
|
||||
// Generic unknown error
|
||||
UNKNOWN_ERROR = 'UNKNOWN_ERROR',
|
||||
UnknownError = 'UNKNOWN_ERROR',
|
||||
|
||||
// Frontend errors
|
||||
FRONTEND_CSRF_ERROR = 'FRONTEND_CSRF_ERROR',
|
||||
FRONTEND_NETWORK_ERROR = 'FRONTEND_NETWORK_ERROR',
|
||||
FRONTEND_TIMEOUT_ERROR = 'FRONTEND_TIMEOUT_ERROR',
|
||||
FrontendCsrfError = 'FRONTEND_CSRF_ERROR',
|
||||
FrontendNetworkError = 'FRONTEND_NETWORK_ERROR',
|
||||
FrontendTimeoutError = 'FRONTEND_TIMEOUT_ERROR',
|
||||
|
||||
// DB Engine errors,
|
||||
GENERIC_DB_ENGINE_ERROR = 'GENERIC_DB_ENGINE_ERROR',
|
||||
GenericDbEngineError = 'GENERIC_DB_ENGINE_ERROR',
|
||||
|
||||
// Viz errors,
|
||||
VIZ_GET_DF_ERROR = 'VIZ_GET_DF_ERROR',
|
||||
UNKNOWN_DATASOURCE_TYPE_ERROR = 'UNKNOWN_DATASOURCE_TYPE_ERROR',
|
||||
FAILED_FETCHING_DATASOURCE_INFO_ERROR = 'FAILED_FETCHING_DATASOURCE_INFO_ERROR',
|
||||
VizGetDfError = 'VIZ_GET_DF_ERROR',
|
||||
UnknownDatasourceTypeError = 'UNKNOWN_DATASOURCE_TYPE_ERROR',
|
||||
FailedFetchingDatasourceInfoError = 'FAILED_FETCHING_DATASOURCE_INFO_ERROR',
|
||||
|
||||
// Security access errors,
|
||||
TABLE_SECURITY_ACCESS_ERROR = 'TABLE_SECURITY_ACCESS_ERROR',
|
||||
DATASOURCE_SECURITY_ACCESS_ERROR = 'DATASOURCE_SECURITY_ACCESS_ERROR',
|
||||
MISSING_OWNERSHIP_ERROR = 'MISSING_OWNERSHIP_ERROR',
|
||||
TableSecurityAccessError = 'TABLE_SECURITY_ACCESS_ERROR',
|
||||
DatasourceSecurityAccessError = 'DATASOURCE_SECURITY_ACCESS_ERROR',
|
||||
MissingOwnershipError = 'MISSING_OWNERSHIP_ERROR',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -129,7 +129,7 @@ export class SupersetApiError extends Error {
|
|||
].join('\n')
|
||||
: this.stack;
|
||||
this.name = 'SupersetApiError';
|
||||
this.errorType = errorType || SupersetApiErrorType.UNKNOWN_ERROR;
|
||||
this.errorType = errorType || SupersetApiErrorType.UnknownError;
|
||||
this.extra = extra || {};
|
||||
if (link) {
|
||||
this.extra.link = link;
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ export default function extractQueryFields(
|
|||
// For charts that support both aggregate and raw records mode,
|
||||
// we store both `groupby` and `columns` in `formData`, so users can
|
||||
// switch between modes while retaining the selected options for each.
|
||||
if (queryMode === QueryMode.aggregate && normalizedKey === 'columns') {
|
||||
if (queryMode === QueryMode.Aggregate && normalizedKey === 'columns') {
|
||||
return;
|
||||
}
|
||||
|
||||
// for the same reason, ignore groupby and metrics in raw records mode
|
||||
if (
|
||||
queryMode === QueryMode.raw &&
|
||||
queryMode === QueryMode.Raw &&
|
||||
(normalizedKey === 'groupby' || normalizedKey === 'metrics')
|
||||
) {
|
||||
return;
|
||||
|
|
@ -106,7 +106,7 @@ export default function extractQueryFields(
|
|||
getColumnLabel,
|
||||
),
|
||||
metrics:
|
||||
queryMode === QueryMode.raw
|
||||
queryMode === QueryMode.Raw
|
||||
? undefined
|
||||
: removeDuplicates(metrics, getMetricLabel),
|
||||
orderby:
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ export interface NativeFilterTarget {
|
|||
}
|
||||
|
||||
export enum NativeFilterType {
|
||||
NATIVE_FILTER = 'NATIVE_FILTER',
|
||||
DIVIDER = 'DIVIDER',
|
||||
NativeFilter = 'NATIVE_FILTER',
|
||||
Divider = 'DIVIDER',
|
||||
}
|
||||
|
||||
export enum DataMaskType {
|
||||
|
|
@ -76,7 +76,7 @@ export type Filter = {
|
|||
requiredFirst?: boolean;
|
||||
tabsInScope?: string[];
|
||||
chartsInScope?: number[];
|
||||
type: typeof NativeFilterType.NATIVE_FILTER;
|
||||
type: typeof NativeFilterType.NativeFilter;
|
||||
description: string;
|
||||
};
|
||||
|
||||
|
|
@ -86,13 +86,13 @@ export type Divider = Partial<Omit<Filter, 'id' | 'type'>> & {
|
|||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
type: typeof NativeFilterType.DIVIDER;
|
||||
type: typeof NativeFilterType.Divider;
|
||||
};
|
||||
|
||||
export function isNativeFilter(
|
||||
filterElement: Filter | Divider,
|
||||
): filterElement is Filter {
|
||||
return filterElement.type === NativeFilterType.NATIVE_FILTER;
|
||||
return filterElement.type === NativeFilterType.NativeFilter;
|
||||
}
|
||||
|
||||
export function isNativeFilterWithDataMask(
|
||||
|
|
@ -107,7 +107,7 @@ export function isNativeFilterWithDataMask(
|
|||
export function isFilterDivider(
|
||||
filterElement: Filter | Divider,
|
||||
): filterElement is Divider {
|
||||
return filterElement.type === NativeFilterType.DIVIDER;
|
||||
return filterElement.type === NativeFilterType.Divider;
|
||||
}
|
||||
|
||||
export type FilterConfiguration = Array<Filter | Divider>;
|
||||
|
|
|
|||
|
|
@ -257,32 +257,32 @@ export type QueryColumn = {
|
|||
|
||||
// Possible states of a query object for processing on the server
|
||||
export enum QueryState {
|
||||
STARTED = 'started',
|
||||
STOPPED = 'stopped',
|
||||
FAILED = 'failed',
|
||||
PENDING = 'pending',
|
||||
RUNNING = 'running',
|
||||
SCHEDULED = 'scheduled',
|
||||
SUCCESS = 'success',
|
||||
FETCHING = 'fetching',
|
||||
TIMED_OUT = 'timed_out',
|
||||
Started = 'started',
|
||||
Stopped = 'stopped',
|
||||
Failed = 'failed',
|
||||
Pending = 'pending',
|
||||
Running = 'running',
|
||||
Scheduled = 'scheduled',
|
||||
Success = 'success',
|
||||
Fetching = 'fetching',
|
||||
TimedOut = 'timed_out',
|
||||
}
|
||||
|
||||
// Inidcates a Query's state is still processing
|
||||
export const runningQueryStateList: QueryState[] = [
|
||||
QueryState.RUNNING,
|
||||
QueryState.STARTED,
|
||||
QueryState.PENDING,
|
||||
QueryState.FETCHING,
|
||||
QueryState.SCHEDULED,
|
||||
QueryState.Running,
|
||||
QueryState.Started,
|
||||
QueryState.Pending,
|
||||
QueryState.Fetching,
|
||||
QueryState.Scheduled,
|
||||
];
|
||||
|
||||
// Indicates a Query's state has completed processing regardless of success / failure
|
||||
export const concludedQueryStateList: QueryState[] = [
|
||||
QueryState.STOPPED,
|
||||
QueryState.FAILED,
|
||||
QueryState.SUCCESS,
|
||||
QueryState.TIMED_OUT,
|
||||
QueryState.Stopped,
|
||||
QueryState.Failed,
|
||||
QueryState.Success,
|
||||
QueryState.TimedOut,
|
||||
];
|
||||
|
||||
export type Query = {
|
||||
|
|
@ -359,7 +359,7 @@ export const testQuery: Query = {
|
|||
isDataPreview: false,
|
||||
progress: 0,
|
||||
resultsKey: null,
|
||||
state: QueryState.SUCCESS,
|
||||
state: QueryState.Success,
|
||||
tempSchema: null,
|
||||
trackingUrl: null,
|
||||
templateParams: null,
|
||||
|
|
@ -385,19 +385,19 @@ export const testQuery: Query = {
|
|||
column_name: 'Column 1',
|
||||
type: 'STRING',
|
||||
is_dttm: false,
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 3',
|
||||
type: 'STRING',
|
||||
is_dttm: false,
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 2',
|
||||
type: 'TIMESTAMP',
|
||||
is_dttm: true,
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -409,19 +409,19 @@ export const testQueryResults = {
|
|||
{
|
||||
column_name: 'Column 1',
|
||||
type: 'STRING',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
is_dttm: false,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 3',
|
||||
type: 'STRING',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
is_dttm: false,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 2',
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
is_dttm: true,
|
||||
},
|
||||
],
|
||||
|
|
@ -433,19 +433,19 @@ export const testQueryResults = {
|
|||
{
|
||||
column_name: 'Column 1',
|
||||
type: 'STRING',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
is_dttm: false,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 3',
|
||||
type: 'STRING',
|
||||
type_generic: GenericDataType.STRING,
|
||||
type_generic: GenericDataType.String,
|
||||
is_dttm: false,
|
||||
},
|
||||
{
|
||||
column_name: 'Column 2',
|
||||
type: 'TIMESTAMP',
|
||||
type_generic: GenericDataType.TEMPORAL,
|
||||
type_generic: GenericDataType.Temporal,
|
||||
is_dttm: true,
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ export interface FormDataResidual {
|
|||
}
|
||||
|
||||
export enum QueryMode {
|
||||
aggregate = 'aggregate',
|
||||
raw = 'raw',
|
||||
Aggregate = 'aggregate',
|
||||
Raw = 'raw',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import { AnnotationData } from './AnnotationLayer';
|
|||
* Generic data types, see enum of the same name in superset/utils/core.py.
|
||||
*/
|
||||
export enum GenericDataType {
|
||||
NUMERIC = 0,
|
||||
STRING = 1,
|
||||
TEMPORAL = 2,
|
||||
BOOLEAN = 3,
|
||||
Numeric = 0,
|
||||
String = 1,
|
||||
Temporal = 2,
|
||||
Boolean = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class TimeFormatterRegistry extends RegistryWithDefaultKey<
|
|||
super({
|
||||
initialDefaultKey: TimeFormats.DATABASE_DATETIME,
|
||||
name: 'TimeFormatter',
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,41 +22,42 @@ import logger from './logging';
|
|||
// check into source control. We're hardcoding the supported flags for now.
|
||||
export enum FeatureFlag {
|
||||
// PLEASE KEEP THE LIST SORTED ALPHABETICALLY
|
||||
ALERTS_ATTACH_REPORTS = 'ALERTS_ATTACH_REPORTS',
|
||||
ALERT_REPORTS = 'ALERT_REPORTS',
|
||||
ALLOW_FULL_CSV_EXPORT = 'ALLOW_FULL_CSV_EXPORT',
|
||||
AVOID_COLORS_COLLISION = 'AVOID_COLORS_COLLISION',
|
||||
CHART_PLUGINS_EXPERIMENTAL = 'CHART_PLUGINS_EXPERIMENTAL',
|
||||
CONFIRM_DASHBOARD_DIFF = 'CONFIRM_DASHBOARD_DIFF',
|
||||
AlertsAttachReports = 'ALERTS_ATTACH_REPORTS',
|
||||
AlertReports = 'ALERT_REPORTS',
|
||||
AllowFullCsvExport = 'ALLOW_FULL_CSV_EXPORT',
|
||||
AvoidColorsCollision = 'AVOID_COLORS_COLLISION',
|
||||
ChartPluginsExperimental = 'ChartPluginsExperimental',
|
||||
ConfirmDashboardDiff = 'CONFIRM_DASHBOARD_DIFF',
|
||||
/** @deprecated */
|
||||
DASHBOARD_CROSS_FILTERS = 'DASHBOARD_CROSS_FILTERS',
|
||||
DASHBOARD_VIRTUALIZATION = 'DASHBOARD_VIRTUALIZATION',
|
||||
DASHBOARD_RBAC = 'DASHBOARD_RBAC',
|
||||
DATAPANEL_CLOSED_BY_DEFAULT = 'DATAPANEL_CLOSED_BY_DEFAULT',
|
||||
DISABLE_LEGACY_DATASOURCE_EDITOR = 'DISABLE_LEGACY_DATASOURCE_EDITOR',
|
||||
DRILL_TO_DETAIL = 'DRILL_TO_DETAIL',
|
||||
DRILL_BY = 'DRILL_BY',
|
||||
DYNAMIC_PLUGINS = 'DYNAMIC_PLUGINS',
|
||||
EMBEDDABLE_CHARTS = 'EMBEDDABLE_CHARTS',
|
||||
EMBEDDED_SUPERSET = 'EMBEDDED_SUPERSET',
|
||||
ENABLE_ADVANCED_DATA_TYPES = 'ENABLE_ADVANCED_DATA_TYPES',
|
||||
DashboardCrossFilters = 'DASHBOARD_CROSS_FILTERS',
|
||||
DashboardVirtualization = 'DASHBOARD_VIRTUALIZATION',
|
||||
DashboardRbac = 'DASHBOARD_RBAC',
|
||||
DatapanelClosedByDefault = 'DATAPANEL_CLOSED_BY_DEFAULT',
|
||||
DisableLegacyDatasourceEditor = 'DISABLE_LEGACY_DATASOURCE_EDITOR',
|
||||
DrillToDetail = 'DRILL_TO_DETAIL',
|
||||
DrillBy = 'DRILL_BY',
|
||||
DynamicPlugins = 'DYNAMIC_PLUGINS',
|
||||
EmbeddableCharts = 'EMBEDDABLE_CHARTS',
|
||||
EmbeddedSuperset = 'EMBEDDED_SUPERSET',
|
||||
EnableAdvancedDataTypes = 'ENABLE_ADVANCED_DATA_TYPES',
|
||||
/** @deprecated */
|
||||
ENABLE_JAVASCRIPT_CONTROLS = 'ENABLE_JAVASCRIPT_CONTROLS',
|
||||
ENABLE_TEMPLATE_PROCESSING = 'ENABLE_TEMPLATE_PROCESSING',
|
||||
ESCAPE_MARKDOWN_HTML = 'ESCAPE_MARKDOWN_HTML',
|
||||
ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST',
|
||||
GLOBAL_ASYNC_QUERIES = 'GLOBAL_ASYNC_QUERIES',
|
||||
HORIZONTAL_FILTER_BAR = 'HORIZONTAL_FILTER_BAR',
|
||||
LISTVIEWS_DEFAULT_CARD_VIEW = 'LISTVIEWS_DEFAULT_CARD_VIEW',
|
||||
SCHEDULED_QUERIES = 'SCHEDULED_QUERIES',
|
||||
SHARE_QUERIES_VIA_KV_STORE = 'SHARE_QUERIES_VIA_KV_STORE',
|
||||
SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE',
|
||||
SQL_VALIDATORS_BY_ENGINE = 'SQL_VALIDATORS_BY_ENGINE',
|
||||
SSH_TUNNELING = 'SSH_TUNNELING',
|
||||
TAGGING_SYSTEM = 'TAGGING_SYSTEM',
|
||||
THUMBNAILS = 'THUMBNAILS',
|
||||
USE_ANALAGOUS_COLORS = 'USE_ANALAGOUS_COLORS',
|
||||
EnableJavascriptControls = 'ENABLE_JAVASCRIPT_CONTROLS',
|
||||
EnableTemplateProcessing = 'ENABLE_TEMPLATE_PROCESSING',
|
||||
EscapeMarkdownHtml = 'ESCAPE_MARKDOWN_HTML',
|
||||
EstimateQueryCost = 'ESTIMATE_QUERY_COST',
|
||||
GlobalAsyncQueries = 'GLOBAL_ASYNC_QUERIES',
|
||||
HorizontalFilterBar = 'HORIZONTAL_FILTER_BAR',
|
||||
ListviewsDefaultCardView = 'LISTVIEWS_DEFAULT_CARD_VIEW',
|
||||
ScheduledQueries = 'SCHEDULED_QUERIES',
|
||||
ShareQueriesViaKvStore = 'SHARE_QUERIES_VIA_KV_STORE',
|
||||
SqllabBackendPersistence = 'SQLLAB_BACKEND_PERSISTENCE',
|
||||
SqlValidatorsByEngine = 'SQL_VALIDATORS_BY_ENGINE',
|
||||
SshTunneling = 'SSH_TUNNELING',
|
||||
TaggingSystem = 'TAGGING_SYSTEM',
|
||||
Thumbnails = 'THUMBNAILS',
|
||||
UseAnalagousColors = 'USE_ANALAGOUS_COLORS',
|
||||
}
|
||||
|
||||
export type ScheduleQueriesProps = {
|
||||
JSONSCHEMA: {
|
||||
[key: string]: string;
|
||||
|
|
@ -69,9 +70,9 @@ export type ScheduleQueriesProps = {
|
|||
};
|
||||
};
|
||||
export type FeatureFlagMap = {
|
||||
[key in Exclude<FeatureFlag, FeatureFlag.SCHEDULED_QUERIES>]?: boolean;
|
||||
[key in Exclude<FeatureFlag, FeatureFlag.ScheduledQueries>]?: boolean;
|
||||
} & {
|
||||
SCHEDULED_QUERIES?: ScheduleQueriesProps;
|
||||
ScheduledQueries?: ScheduleQueriesProps;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const RAW_DATASOURCE = {
|
|||
|
||||
const QUERY_DATA = { data: {} };
|
||||
const QUERIES_DATA = [QUERY_DATA];
|
||||
const BEHAVIORS = [Behavior.NATIVE_FILTER, Behavior.INTERACTIVE_CHART];
|
||||
const BEHAVIORS = [Behavior.NativeFilter, Behavior.InteractiveChart];
|
||||
|
||||
describe('ChartProps', () => {
|
||||
it('exists', () => {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ describe('CategoricalColorScale', () => {
|
|||
});
|
||||
it('recycles colors when number of items exceed available colors', () => {
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.USE_ANALAGOUS_COLORS]: false,
|
||||
[FeatureFlag.UseAnalagousColors]: false,
|
||||
};
|
||||
const colorSet: { [key: string]: number } = {};
|
||||
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
|
||||
|
|
@ -109,7 +109,7 @@ describe('CategoricalColorScale', () => {
|
|||
});
|
||||
it('get analogous colors when number of items exceed available colors', () => {
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.USE_ANALAGOUS_COLORS]: true,
|
||||
[FeatureFlag.UseAnalagousColors]: true,
|
||||
};
|
||||
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
|
||||
scale.getColor('pig');
|
||||
|
|
@ -123,7 +123,7 @@ describe('CategoricalColorScale', () => {
|
|||
|
||||
it('should remove shared color from range if avoid colors collision enabled', () => {
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.AVOID_COLORS_COLLISION]: true,
|
||||
[FeatureFlag.AvoidColorsCollision]: true,
|
||||
};
|
||||
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
|
||||
const color1 = scale.getColor('a', 1);
|
||||
|
|
@ -136,7 +136,7 @@ describe('CategoricalColorScale', () => {
|
|||
expect(scale.range()).toHaveLength(1);
|
||||
});
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.AVOID_COLORS_COLLISION]: false,
|
||||
[FeatureFlag.AvoidColorsCollision]: false,
|
||||
};
|
||||
});
|
||||
describe('.setColor(value, forcedColor)', () => {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ describe('SharedLabelColor', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
getSharedLabelColor().source = SharedLabelColorSource.dashboard;
|
||||
getSharedLabelColor().source = SharedLabelColorSource.Dashboard;
|
||||
getSharedLabelColor().clear();
|
||||
});
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ describe('SharedLabelColor', () => {
|
|||
|
||||
it('should do nothing when source is not dashboard', () => {
|
||||
const sharedLabelColor = getSharedLabelColor();
|
||||
sharedLabelColor.source = SharedLabelColorSource.explore;
|
||||
sharedLabelColor.source = SharedLabelColorSource.Explore;
|
||||
sharedLabelColor.addSlice('a', 'red');
|
||||
expect(Object.fromEntries(sharedLabelColor.sliceLabelMap)).toEqual({});
|
||||
});
|
||||
|
|
@ -127,7 +127,7 @@ describe('SharedLabelColor', () => {
|
|||
it('should do nothing when source is not dashboard', () => {
|
||||
const sharedLabelColor = getSharedLabelColor();
|
||||
sharedLabelColor.addSlice('a', 'red', 1);
|
||||
sharedLabelColor.source = SharedLabelColorSource.explore;
|
||||
sharedLabelColor.source = SharedLabelColorSource.Explore;
|
||||
sharedLabelColor.removeSlice(1);
|
||||
expect(sharedLabelColor.sliceLabelMap.has(1)).toEqual(true);
|
||||
});
|
||||
|
|
@ -151,7 +151,7 @@ describe('SharedLabelColor', () => {
|
|||
|
||||
it('should use recycle colors', () => {
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.USE_ANALAGOUS_COLORS]: false,
|
||||
[FeatureFlag.UseAnalagousColors]: false,
|
||||
};
|
||||
const sharedLabelColor = getSharedLabelColor();
|
||||
sharedLabelColor.addSlice('a', 'red', 1);
|
||||
|
|
@ -166,7 +166,7 @@ describe('SharedLabelColor', () => {
|
|||
|
||||
it('should use analagous colors', () => {
|
||||
window.featureFlags = {
|
||||
[FeatureFlag.USE_ANALAGOUS_COLORS]: true,
|
||||
[FeatureFlag.UseAnalagousColors]: true,
|
||||
};
|
||||
const sharedLabelColor = getSharedLabelColor();
|
||||
sharedLabelColor.addSlice('a', 'red', 1);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export const NUM_METRIC: AdhocMetric = {
|
|||
column: {
|
||||
id: 336,
|
||||
type: 'BIGINT',
|
||||
type_generic: GenericDataType.NUMERIC,
|
||||
type_generic: GenericDataType.Numeric,
|
||||
column_name: 'num',
|
||||
verbose_name: null,
|
||||
description: null,
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ describe('Registry', () => {
|
|||
it('warns when overwrite', () => {
|
||||
const restoreConsole = mockConsole();
|
||||
const registry = new Registry({
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
});
|
||||
registry.registerValue('a', 'testValue');
|
||||
expect(() => registry.registerValue('a', 'testValue2')).not.toThrow();
|
||||
|
|
@ -349,7 +349,7 @@ describe('Registry', () => {
|
|||
it('warns when overwrite', () => {
|
||||
const restoreConsole = mockConsole();
|
||||
const registry = new Registry({
|
||||
overwritePolicy: OverwritePolicy.WARN,
|
||||
overwritePolicy: OverwritePolicy.Warn,
|
||||
});
|
||||
registry.registerLoader('a', () => 'testValue');
|
||||
expect(() =>
|
||||
|
|
@ -365,7 +365,7 @@ describe('Registry', () => {
|
|||
describe('.registerValue(key, value)', () => {
|
||||
it('throws error when overwrite', () => {
|
||||
const registry = new Registry({
|
||||
overwritePolicy: OverwritePolicy.PROHIBIT,
|
||||
overwritePolicy: OverwritePolicy.Prohibit,
|
||||
});
|
||||
registry.registerValue('a', 'testValue');
|
||||
expect(() => registry.registerValue('a', 'testValue2')).toThrow();
|
||||
|
|
@ -374,7 +374,7 @@ describe('Registry', () => {
|
|||
describe('.registerLoader(key, loader)', () => {
|
||||
it('warns when overwrite', () => {
|
||||
const registry = new Registry({
|
||||
overwritePolicy: OverwritePolicy.PROHIBIT,
|
||||
overwritePolicy: OverwritePolicy.Prohibit,
|
||||
});
|
||||
registry.registerLoader('a', () => 'testValue');
|
||||
expect(() =>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ describe('handleError()', () => {
|
|||
const mockError = {
|
||||
error: {
|
||||
message: 'Request timeout',
|
||||
error_type: SupersetApiErrorType.FRONTEND_TIMEOUT_ERROR,
|
||||
error_type: SupersetApiErrorType.FrontendTimeoutError,
|
||||
},
|
||||
};
|
||||
await testHandleError(mockError, {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ describe('extractQueryFields', () => {
|
|||
columns: ['a'],
|
||||
groupby: ['b'],
|
||||
metric: ['m'],
|
||||
query_mode: QueryMode.raw,
|
||||
query_mode: QueryMode.Raw,
|
||||
}),
|
||||
).toEqual({
|
||||
columns: ['a'],
|
||||
|
|
@ -139,7 +139,7 @@ describe('extractQueryFields', () => {
|
|||
columns: ['a'],
|
||||
groupby: [],
|
||||
metric: ['m'],
|
||||
query_mode: QueryMode.aggregate,
|
||||
query_mode: QueryMode.Aggregate,
|
||||
}),
|
||||
).toEqual({
|
||||
metrics: ['m'],
|
||||
|
|
@ -151,7 +151,7 @@ describe('extractQueryFields', () => {
|
|||
columns: ['a'],
|
||||
groupby: ['b'],
|
||||
metric: ['m'],
|
||||
query_mode: QueryMode.aggregate,
|
||||
query_mode: QueryMode.Aggregate,
|
||||
}),
|
||||
).toEqual({
|
||||
metrics: ['m'],
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const filter: Filter = {
|
|||
filterType: 'filter_type',
|
||||
targets: [{}],
|
||||
controlValues: {},
|
||||
type: NativeFilterType.NATIVE_FILTER,
|
||||
type: NativeFilterType.NativeFilter,
|
||||
description: 'Filter description.',
|
||||
};
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ const filterWithDataMask: FilterWithDataMask = {
|
|||
|
||||
const filterDivider: Divider = {
|
||||
id: 'divider_id',
|
||||
type: NativeFilterType.DIVIDER,
|
||||
type: NativeFilterType.Divider,
|
||||
title: 'Divider title',
|
||||
description: 'Divider description.',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ it('returns false and raises console error if feature flags have not been initia
|
|||
Object.defineProperty(window, 'featureFlags', {
|
||||
value: undefined,
|
||||
});
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DRILL_BY)).toEqual(false);
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DrillBy)).toEqual(false);
|
||||
expect(uiCore.logging.error).toHaveBeenCalled();
|
||||
expect(logging).toHaveBeenCalledWith('Failed to query feature flag DRILL_BY');
|
||||
});
|
||||
|
|
@ -60,7 +60,7 @@ it('returns false for unset feature flag', () => {
|
|||
Object.defineProperty(window, 'featureFlags', {
|
||||
value: {},
|
||||
});
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DRILL_BY)).toEqual(false);
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DrillBy)).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns true for set feature flag', () => {
|
||||
|
|
@ -69,5 +69,5 @@ it('returns true for set feature flag', () => {
|
|||
DRILL_BY: true,
|
||||
},
|
||||
});
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DRILL_BY)).toEqual(true);
|
||||
expect(uiCore.isFeatureEnabled(uiCore.FeatureFlag.DrillBy)).toEqual(true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ export const basicFormData: TableChartFormData = {
|
|||
export const basicData: Partial<ChartDataResponseResult> = {
|
||||
colnames: ['name', 'sum__num', 'MAX(ds)', 'Abc.com'],
|
||||
coltypes: [
|
||||
GenericDataType.STRING,
|
||||
GenericDataType.NUMERIC,
|
||||
GenericDataType.TEMPORAL,
|
||||
GenericDataType.STRING,
|
||||
GenericDataType.String,
|
||||
GenericDataType.Numeric,
|
||||
GenericDataType.Temporal,
|
||||
GenericDataType.String,
|
||||
],
|
||||
data: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@ export default function transformProps(chartProps) {
|
|||
currencyFormat,
|
||||
);
|
||||
const xAxisFormatter =
|
||||
coltypes[0] === GenericDataType.TEMPORAL
|
||||
coltypes[0] === GenericDataType.Temporal
|
||||
? getTimeFormatter(timeFormat)
|
||||
: String;
|
||||
const yAxisFormatter =
|
||||
coltypes[1] === GenericDataType.TEMPORAL
|
||||
coltypes[1] === GenericDataType.Temporal
|
||||
? getTimeFormatter(timeFormat)
|
||||
: String;
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ function WorldMap(element, props) {
|
|||
|
||||
let processedData;
|
||||
let colorScale;
|
||||
if (colorBy === ColorBy.country) {
|
||||
if (colorBy === ColorBy.Country) {
|
||||
colorScale = CategoricalColorNamespace.getScale(colorScheme);
|
||||
|
||||
processedData = filteredData.map(d => ({
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ const config: ControlPanelConfig = {
|
|||
config: {
|
||||
type: 'RadioButtonControl',
|
||||
label: t('Color by'),
|
||||
default: ColorBy.metric,
|
||||
default: ColorBy.Metric,
|
||||
options: [
|
||||
[ColorBy.metric, t('Metric')],
|
||||
[ColorBy.country, t('Country')],
|
||||
[ColorBy.Metric, t('Metric')],
|
||||
[ColorBy.Country, t('Country')],
|
||||
],
|
||||
description: t(
|
||||
'Choose whether a country should be shaded by the metric, or assigned a color based on a categorical color palette',
|
||||
|
|
@ -148,12 +148,12 @@ const config: ControlPanelConfig = {
|
|||
linear_color_scheme: {
|
||||
label: t('Country Color Scheme'),
|
||||
visibility: ({ controls }) =>
|
||||
Boolean(controls?.color_by.value === ColorBy.metric),
|
||||
Boolean(controls?.color_by.value === ColorBy.Metric),
|
||||
},
|
||||
color_scheme: {
|
||||
label: t('Country Color Scheme'),
|
||||
visibility: ({ controls }) =>
|
||||
Boolean(controls?.color_by.value === ColorBy.country),
|
||||
Boolean(controls?.color_by.value === ColorBy.Country),
|
||||
},
|
||||
},
|
||||
formDataOverrides: formData => ({
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ const metadata = new ChartMetadata({
|
|||
thumbnail,
|
||||
useLegacyApi: true,
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@
|
|||
*/
|
||||
|
||||
export enum ColorBy {
|
||||
metric = 'metric',
|
||||
country = 'country',
|
||||
Metric = 'metric',
|
||||
Country = 'country',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ function jsFunctionControl(
|
|||
{extraDescr}
|
||||
</div>
|
||||
),
|
||||
warning: !isFeatureEnabled(FeatureFlag.ENABLE_JAVASCRIPT_CONTROLS)
|
||||
warning: !isFeatureEnabled(FeatureFlag.EnableJavascriptControls)
|
||||
? t(
|
||||
'This functionality is disabled in your environment for security reasons.',
|
||||
)
|
||||
: null,
|
||||
readOnly: !isFeatureEnabled(FeatureFlag.ENABLE_JAVASCRIPT_CONTROLS),
|
||||
readOnly: !isFeatureEnabled(FeatureFlag.EnableJavascriptControls),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const metadata = new ChartMetadata({
|
|||
{ url: example3, caption: t('Video game consoles') },
|
||||
{ url: example4, caption: t('Vehicle Types') },
|
||||
],
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Area Chart (legacy)'),
|
||||
supportedAnnotationTypes: [ANNOTATION_TYPES.INTERVAL, ANNOTATION_TYPES.EVENT],
|
||||
tags: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const metadata = new ChartMetadata({
|
|||
'Visualize how a metric changes over time using bars. Add a group by column to visualize group level metrics and how they change over time.',
|
||||
),
|
||||
exampleGallery: [{ url: example1 }, { url: example2 }, { url: example3 }],
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Time-series Bar Chart (legacy)'),
|
||||
supportedAnnotationTypes: [ANNOTATION_TYPES.INTERVAL, ANNOTATION_TYPES.EVENT],
|
||||
tags: [
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const metadata = new ChartMetadata({
|
|||
'Visualizes a metric across three dimensions of data in a single chart (X axis, Y axis, and bubble size). Bubbles from the same group can be showcased using bubble color.',
|
||||
),
|
||||
exampleGallery: [{ url: example }],
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Bubble Chart (legacy)'),
|
||||
tags: [
|
||||
t('Multi-Dimensions'),
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const metadata = new ChartMetadata({
|
|||
{ url: example2, caption: 'Grouped style' },
|
||||
{ url: example3 },
|
||||
],
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Bar Chart (legacy)'),
|
||||
tags: [
|
||||
t('Additive'),
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const metadata = new ChartMetadata({
|
|||
{ url: example2 },
|
||||
{ url: battery, caption: t('Battery level over time') },
|
||||
],
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Line Chart (legacy)'),
|
||||
supportedAnnotationTypes: [
|
||||
ANNOTATION_TYPES.TIME_SERIES,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import controlPanel from './controlPanel';
|
|||
const metadata = new ChartMetadata({
|
||||
credits: ['http://nvd3.org'],
|
||||
description: '',
|
||||
label: ChartLabel.DEPRECATED,
|
||||
label: ChartLabel.Deprecated,
|
||||
name: t('Pie Chart (legacy)'),
|
||||
thumbnail,
|
||||
useLegacyApi: true,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ export default {
|
|||
? colnames
|
||||
.filter(
|
||||
(colname: string, index: number) =>
|
||||
coltypes[index] === GenericDataType.NUMERIC,
|
||||
coltypes[index] === GenericDataType.Numeric,
|
||||
)
|
||||
.map(colname => ({
|
||||
value: colname,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ const metadata = {
|
|||
t('Description'),
|
||||
],
|
||||
thumbnail,
|
||||
behaviors: [Behavior.DRILL_TO_DETAIL],
|
||||
behaviors: [Behavior.DrillToDetail],
|
||||
};
|
||||
|
||||
export default class BigNumberTotalChartPlugin extends EchartsChartPlugin<
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ export default function transformProps(
|
|||
);
|
||||
|
||||
const headerFormatter =
|
||||
coltypes[0] === GenericDataType.TEMPORAL ||
|
||||
coltypes[0] === GenericDataType.STRING ||
|
||||
coltypes[0] === GenericDataType.Temporal ||
|
||||
coltypes[0] === GenericDataType.String ||
|
||||
forceTimestampFormatting
|
||||
? formatTime
|
||||
: numberFormatter;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const metadata = {
|
|||
t('Trend'),
|
||||
],
|
||||
thumbnail,
|
||||
behaviors: [Behavior.DRILL_TO_DETAIL],
|
||||
behaviors: [Behavior.DrillToDetail],
|
||||
};
|
||||
|
||||
export default class BigNumberWithTrendlineChartPlugin extends EchartsChartPlugin<
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ export default function transformProps(
|
|||
);
|
||||
|
||||
const headerFormatter =
|
||||
metricColtype === GenericDataType.TEMPORAL ||
|
||||
metricColtype === GenericDataType.STRING ||
|
||||
metricColtype === GenericDataType.Temporal ||
|
||||
metricColtype === GenericDataType.String ||
|
||||
forceTimestampFormatting
|
||||
? formatTime
|
||||
: numberFormatter;
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ export default class EchartsBoxPlotChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsBoxPlot'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Distribution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default class EchartsBubbleChartPlugin extends ChartPlugin<
|
|||
controlPanel,
|
||||
loadChart: () => import('./EchartsBubble'),
|
||||
metadata: new ChartMetadata({
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
behaviors: [Behavior.InteractiveChart],
|
||||
category: t('Correlation'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: t(
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ export default function transformProps(chartProps: EchartsBubbleChartProps) {
|
|||
convertInteger(xAxisTitleMargin),
|
||||
);
|
||||
|
||||
const xAxisType = logXAxis ? AxisType.log : AxisType.value;
|
||||
const xAxisType = logXAxis ? AxisType.Log : AxisType.Value;
|
||||
const echartOptions: EChartsCoreOption = {
|
||||
series,
|
||||
xAxis: {
|
||||
|
|
@ -196,7 +196,7 @@ export default function transformProps(chartProps: EchartsBubbleChartProps) {
|
|||
nameGap: convertInteger(yAxisTitleMargin),
|
||||
min: yAxisMin,
|
||||
max: yAxisMax,
|
||||
type: logYAxis ? AxisType.log : AxisType.value,
|
||||
type: logYAxis ? AxisType.Log : AxisType.Value,
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
|
|
|
|||
|
|
@ -82,11 +82,14 @@ const config: ControlPanelConfig = {
|
|||
'Display percents in the label and tooltip as the percent of the total value, from the first step of the funnel, or from the previous step in the funnel.',
|
||||
),
|
||||
choices: [
|
||||
[PercentCalcType.FIRST_STEP, t('Calculate from first step')],
|
||||
[PercentCalcType.PREV_STEP, t('Calculate from previous step')],
|
||||
[PercentCalcType.TOTAL, t('Percent of total')],
|
||||
[PercentCalcType.FirstStep, t('Calculate from first step')],
|
||||
[
|
||||
PercentCalcType.PreviousStep,
|
||||
t('Calculate from previous step'),
|
||||
],
|
||||
[PercentCalcType.Total, t('Percent of total')],
|
||||
],
|
||||
default: PercentCalcType.FIRST_STEP,
|
||||
default: PercentCalcType.FirstStep,
|
||||
renderTrigger: true,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ export default class EchartsFunnelChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsFunnel'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('KPI'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export function formatFunnelLabel({
|
|||
params,
|
||||
labelType,
|
||||
numberFormatter,
|
||||
percentCalculationType = PercentCalcType.FIRST_STEP,
|
||||
percentCalculationType = PercentCalcType.FirstStep,
|
||||
sanitizeName = false,
|
||||
}: {
|
||||
params: Pick<CallbackDataParams, 'name' | 'value' | 'percent' | 'data'>;
|
||||
|
|
@ -72,9 +72,9 @@ export function formatFunnelLabel({
|
|||
};
|
||||
let percent;
|
||||
|
||||
if (percentCalculationType === PercentCalcType.TOTAL) {
|
||||
if (percentCalculationType === PercentCalcType.Total) {
|
||||
percent = (totalPercent ?? 0) / 100;
|
||||
} else if (percentCalculationType === PercentCalcType.PREV_STEP) {
|
||||
} else if (percentCalculationType === PercentCalcType.PreviousStep) {
|
||||
percent = prevStepPercent ?? 0;
|
||||
} else {
|
||||
percent = firstStepPercent ?? 0;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export type FunnelChartTransformedProps =
|
|||
ContextMenuTransformedProps;
|
||||
|
||||
export enum PercentCalcType {
|
||||
TOTAL = 'total',
|
||||
PREV_STEP = 'prev_step',
|
||||
FIRST_STEP = 'first_step',
|
||||
Total = 'total',
|
||||
PreviousStep = 'prev_step',
|
||||
FirstStep = 'first_step',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ export default class EchartsGaugeChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsGauge'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('KPI'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ export default class EchartsGraphChartPlugin extends EchartsChartPlugin {
|
|||
],
|
||||
thumbnail,
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
},
|
||||
transformProps,
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ export default function EchartsMixedTimeseries({
|
|||
...(eventParams.name ? [eventParams.name] : []),
|
||||
...(isFirst ? labelMap : labelMapB)[eventParams.seriesName],
|
||||
];
|
||||
if (data && xAxis.type === AxisType.time) {
|
||||
if (data && xAxis.type === AxisType.Time) {
|
||||
drillToDetailFilters.push({
|
||||
col:
|
||||
xAxis.label === DTTM_ALIAS
|
||||
|
|
@ -155,7 +155,7 @@ export default function EchartsMixedTimeseries({
|
|||
});
|
||||
}
|
||||
[
|
||||
...(data && xAxis.type === AxisType.category ? [xAxis.label] : []),
|
||||
...(data && xAxis.type === AxisType.Category ? [xAxis.label] : []),
|
||||
...(isFirst ? formData.groupby : formData.groupbyB),
|
||||
].forEach((dimension, i) =>
|
||||
drillToDetailFilters.push({
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsMixedTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import { invert } from 'lodash';
|
||||
import {
|
||||
AnnotationLayer,
|
||||
AxisType,
|
||||
buildCustomFormatters,
|
||||
CategoricalColorNamespace,
|
||||
CurrencyFormatter,
|
||||
|
|
@ -460,11 +461,11 @@ export default function transformProps(
|
|||
}
|
||||
|
||||
const tooltipFormatter =
|
||||
xAxisDataType === GenericDataType.TEMPORAL
|
||||
xAxisDataType === GenericDataType.Temporal
|
||||
? getTooltipTimeFormatter(tooltipTimeFormat)
|
||||
: String;
|
||||
const xAxisFormatter =
|
||||
xAxisDataType === GenericDataType.TEMPORAL
|
||||
xAxisDataType === GenericDataType.Temporal
|
||||
? getXAxisFormatter(xAxisTimeFormat)
|
||||
: String;
|
||||
|
||||
|
|
@ -503,7 +504,7 @@ export default function transformProps(
|
|||
},
|
||||
minorTick: { show: minorTicks },
|
||||
minInterval:
|
||||
xAxisType === 'time' && timeGrainSqla
|
||||
xAxisType === AxisType.Time && timeGrainSqla
|
||||
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
|
||||
: 0,
|
||||
...getMinAndMaxFromBounds(
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ export default class EchartsPieChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsPie'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Part of a Whole'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ const config: ControlPanelConfig = {
|
|||
description: t('Further customize how to display each metric'),
|
||||
renderTrigger: true,
|
||||
configFormLayout: {
|
||||
[GenericDataType.NUMERIC]: [[radarMetricMaxValue]],
|
||||
[GenericDataType.Numeric]: [[radarMetricMaxValue]],
|
||||
},
|
||||
shouldMapStateToProps() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ export default class EchartsRadarChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsRadar'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Ranking'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ export default class EchartsSunburstChartPlugin extends EchartsChartPlugin {
|
|||
loadChart: () => import('./EchartsSunburst'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Part of a Whole'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ export default class EchartsAreaChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ export default function EchartsTimeseries({
|
|||
...(eventParams.name ? [eventParams.name] : []),
|
||||
...(labelMap[seriesName] ?? []),
|
||||
];
|
||||
if (data && xAxis.type === AxisType.time) {
|
||||
if (data && xAxis.type === AxisType.Time) {
|
||||
drillToDetailFilters.push({
|
||||
col:
|
||||
// if the xAxis is '__timestamp', granularity_sqla will be the column of filter
|
||||
|
|
@ -187,7 +187,7 @@ export default function EchartsTimeseries({
|
|||
});
|
||||
}
|
||||
[
|
||||
...(xAxis.type === AxisType.category && data ? [xAxis.label] : []),
|
||||
...(xAxis.type === AxisType.Category && data ? [xAxis.label] : []),
|
||||
...formData.groupby,
|
||||
].forEach((dimension, i) =>
|
||||
drillToDetailFilters.push({
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ const {
|
|||
function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
|
||||
const isXAxis = axis === 'x';
|
||||
const isVertical = (controls: ControlStateMapping) =>
|
||||
Boolean(controls?.orientation.value === OrientationType.vertical);
|
||||
Boolean(controls?.orientation.value === OrientationType.Vertical);
|
||||
const isHorizontal = (controls: ControlStateMapping) =>
|
||||
Boolean(controls?.orientation.value === OrientationType.horizontal);
|
||||
Boolean(controls?.orientation.value === OrientationType.Horizontal);
|
||||
return [
|
||||
[
|
||||
{
|
||||
|
|
@ -148,9 +148,9 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
|
|||
function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] {
|
||||
const isXAxis = axis === 'x';
|
||||
const isVertical = (controls: ControlStateMapping) =>
|
||||
Boolean(controls?.orientation.value === OrientationType.vertical);
|
||||
Boolean(controls?.orientation.value === OrientationType.Vertical);
|
||||
const isHorizontal = (controls: ControlStateMapping) =>
|
||||
Boolean(controls?.orientation.value === OrientationType.horizontal);
|
||||
Boolean(controls?.orientation.value === OrientationType.Horizontal);
|
||||
return [
|
||||
[
|
||||
{
|
||||
|
|
@ -272,8 +272,8 @@ const config: ControlPanelConfig = {
|
|||
label: t('Bar orientation'),
|
||||
default: orientation,
|
||||
options: [
|
||||
[OrientationType.vertical, t('Vertical')],
|
||||
[OrientationType.horizontal, t('Horizontal')],
|
||||
[OrientationType.Vertical, t('Vertical')],
|
||||
[OrientationType.Horizontal, t('Horizontal')],
|
||||
],
|
||||
description: t('Orientation of bar chart'),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ export default class EchartsTimeseriesBarChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('../../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ export default class EchartsTimeseriesLineChartPlugin extends EchartsChartPlugin
|
|||
loadChart: () => import('../../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ export default class EchartsTimeseriesScatterChartPlugin extends EchartsChartPlu
|
|||
loadChart: () => import('../../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends EchartsChart
|
|||
loadChart: () => import('../../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ export default class EchartsTimeseriesStepChartPlugin extends EchartsChartPlugin
|
|||
loadChart: () => import('../EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
|
|||
showValue: false,
|
||||
onlyTotal: false,
|
||||
percentageThreshold: 0,
|
||||
orientation: OrientationType.vertical,
|
||||
orientation: OrientationType.Vertical,
|
||||
sort_series_type: 'sum',
|
||||
sort_series_ascending: false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsTimeseries'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ export default function transformProps(
|
|||
) {
|
||||
xAxisLabel = verboseMap[xAxisLabel];
|
||||
}
|
||||
const isHorizontal = orientation === OrientationType.horizontal;
|
||||
const isHorizontal = orientation === OrientationType.Horizontal;
|
||||
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
|
||||
rebasedData,
|
||||
{
|
||||
|
|
@ -410,11 +410,11 @@ export default function transformProps(
|
|||
}
|
||||
|
||||
const tooltipFormatter =
|
||||
xAxisDataType === GenericDataType.TEMPORAL
|
||||
xAxisDataType === GenericDataType.Temporal
|
||||
? getTooltipTimeFormatter(tooltipTimeFormat)
|
||||
: String;
|
||||
const xAxisFormatter =
|
||||
xAxisDataType === GenericDataType.TEMPORAL
|
||||
xAxisDataType === GenericDataType.Temporal
|
||||
? getXAxisFormatter(xAxisTimeFormat)
|
||||
: String;
|
||||
|
||||
|
|
@ -461,7 +461,7 @@ export default function transformProps(
|
|||
},
|
||||
minorTick: { show: minorTicks },
|
||||
minInterval:
|
||||
xAxisType === AxisType.time && timeGrainSqla
|
||||
xAxisType === AxisType.Time && timeGrainSqla
|
||||
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
|
||||
: 0,
|
||||
...getMinAndMaxFromBounds(
|
||||
|
|
@ -475,7 +475,7 @@ export default function transformProps(
|
|||
|
||||
let yAxis: any = {
|
||||
...defaultYAxis,
|
||||
type: logAxis ? AxisType.log : AxisType.value,
|
||||
type: logAxis ? AxisType.Log : AxisType.Value,
|
||||
min: yAxisMin,
|
||||
max: yAxisMax,
|
||||
minorTick: { show: minorTicks },
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ import {
|
|||
} from '../types';
|
||||
|
||||
export enum OrientationType {
|
||||
vertical = 'vertical',
|
||||
horizontal = 'horizontal',
|
||||
Vertical = 'vertical',
|
||||
Horizontal = 'horizontal',
|
||||
}
|
||||
|
||||
export enum EchartsTimeseriesSeriesType {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ export default class EchartsTreemapChartPlugin extends EchartsChartPlugin<
|
|||
loadChart: () => import('./EchartsTreemap'),
|
||||
metadata: {
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Part of a Whole'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default class EchartsWaterfallChartPlugin extends ChartPlugin<
|
|||
controlPanel,
|
||||
loadChart: () => import('./EchartsWaterfall'),
|
||||
metadata: new ChartMetadata({
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
behaviors: [Behavior.InteractiveChart],
|
||||
credits: ['https://echarts.apache.org'],
|
||||
category: t('Evolution'),
|
||||
description: t(
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ export default function transformProps(
|
|||
if (value === TOTAL_MARK) {
|
||||
return TOTAL_MARK;
|
||||
}
|
||||
if (coltypeMapping[xAxisColumns[index]] === GenericDataType.TEMPORAL) {
|
||||
if (coltypeMapping[xAxisColumns[index]] === GenericDataType.Temporal) {
|
||||
if (typeof value === 'string') {
|
||||
return getTimeFormatter(xAxisTimeFormat)(Number.parseInt(value, 10));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ import {
|
|||
AnnotationLayer,
|
||||
AnnotationOpacity,
|
||||
AnnotationType,
|
||||
AxisType,
|
||||
DataRecord,
|
||||
evalExpression,
|
||||
FormulaAnnotationLayer,
|
||||
isRecordAnnotationResult,
|
||||
isTableAnnotationLayer,
|
||||
isTimeseriesAnnotationResult,
|
||||
AxisType,
|
||||
} from '@superset-ui/core';
|
||||
import { EchartsTimeseriesChartProps } from '../types';
|
||||
import { EchartsMixedTimeseriesProps } from '../MixedTimeseries/types';
|
||||
|
|
@ -46,7 +46,7 @@ export function evalFormula(
|
|||
|
||||
return data.map(row => {
|
||||
let value = row[xAxis];
|
||||
if (xAxisType === 'time') {
|
||||
if (xAxisType === AxisType.Time) {
|
||||
value = new Date(value as string).getTime();
|
||||
}
|
||||
return [value, evalExpression(expression, (value || 0) as number)];
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ export function formatSeriesName(
|
|||
if (typeof name === 'boolean') {
|
||||
return name.toString();
|
||||
}
|
||||
if (name instanceof Date || coltype === GenericDataType.TEMPORAL) {
|
||||
if (name instanceof Date || coltype === GenericDataType.Temporal) {
|
||||
const normalizedName =
|
||||
typeof name === 'string' ? normalizeTimestamp(name) : name;
|
||||
const d =
|
||||
|
|
@ -535,15 +535,15 @@ export function getAxisType(
|
|||
dataType?: GenericDataType,
|
||||
): AxisType {
|
||||
if (forceCategorical) {
|
||||
return AxisType.category;
|
||||
return AxisType.Category;
|
||||
}
|
||||
if (dataType === GenericDataType.TEMPORAL) {
|
||||
return AxisType.time;
|
||||
if (dataType === GenericDataType.Temporal) {
|
||||
return AxisType.Time;
|
||||
}
|
||||
if (dataType === GenericDataType.NUMERIC && !stack) {
|
||||
return AxisType.value;
|
||||
if (dataType === GenericDataType.Numeric && !stack) {
|
||||
return AxisType.Value;
|
||||
}
|
||||
return AxisType.category;
|
||||
return AxisType.Category;
|
||||
}
|
||||
|
||||
export function getOverMaxHiddenFormatter(
|
||||
|
|
@ -585,7 +585,7 @@ export function getMinAndMaxFromBounds(
|
|||
max?: number,
|
||||
seriesType?: EchartsTimeseriesSeriesType,
|
||||
): BoundsType | {} {
|
||||
if (axisType === AxisType.value && truncateAxis) {
|
||||
if (axisType === AxisType.Value && truncateAxis) {
|
||||
const ret: BoundsType = {};
|
||||
if (seriesType === EchartsTimeseriesSeriesType.Bar) {
|
||||
ret.scale = true;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Key,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('My Label');
|
||||
expect(
|
||||
|
|
@ -101,7 +101,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Value,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('1.23k');
|
||||
expect(
|
||||
|
|
@ -109,7 +109,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Percent,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('12.34%');
|
||||
expect(
|
||||
|
|
@ -117,7 +117,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Percent,
|
||||
percentCalculationType: PercentCalcType.FIRST_STEP,
|
||||
percentCalculationType: PercentCalcType.FirstStep,
|
||||
}),
|
||||
).toEqual('50.00%');
|
||||
expect(
|
||||
|
|
@ -125,7 +125,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Percent,
|
||||
percentCalculationType: PercentCalcType.PREV_STEP,
|
||||
percentCalculationType: PercentCalcType.PreviousStep,
|
||||
}),
|
||||
).toEqual('85.00%');
|
||||
expect(
|
||||
|
|
@ -133,7 +133,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.KeyValue,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('My Label: 1.23k');
|
||||
expect(
|
||||
|
|
@ -141,7 +141,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.KeyPercent,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('My Label: 12.34%');
|
||||
expect(
|
||||
|
|
@ -149,7 +149,7 @@ describe('formatFunnelLabel', () => {
|
|||
params,
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.KeyValuePercent,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('My Label: 1.23k (12.34%)');
|
||||
expect(
|
||||
|
|
@ -157,7 +157,7 @@ describe('formatFunnelLabel', () => {
|
|||
params: { ...params, name: '<NULL>' },
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Key,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
}),
|
||||
).toEqual('<NULL>');
|
||||
expect(
|
||||
|
|
@ -165,7 +165,7 @@ describe('formatFunnelLabel', () => {
|
|||
params: { ...params, name: '<NULL>' },
|
||||
numberFormatter,
|
||||
labelType: EchartsFunnelLabelTypeType.Key,
|
||||
percentCalculationType: PercentCalcType.TOTAL,
|
||||
percentCalculationType: PercentCalcType.Total,
|
||||
sanitizeName: true,
|
||||
}),
|
||||
).toEqual('<NULL>');
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ describe('evalFormula', () => {
|
|||
{ __timestamp: 10 },
|
||||
];
|
||||
|
||||
expect(evalFormula(layer, data, '__timestamp', AxisType.time)).toEqual([
|
||||
expect(evalFormula(layer, data, '__timestamp', AxisType.Time)).toEqual([
|
||||
[0, 1],
|
||||
[10, 11],
|
||||
]);
|
||||
|
|
@ -178,7 +178,7 @@ describe('evalFormula', () => {
|
|||
{ ...layer, value: 'y = x* 2 -1' },
|
||||
data,
|
||||
'__timestamp',
|
||||
AxisType.time,
|
||||
AxisType.Time,
|
||||
),
|
||||
).toEqual([
|
||||
[0, -1],
|
||||
|
|
@ -194,7 +194,7 @@ describe('evalFormula', () => {
|
|||
{ ...layer, value: 'y = 1000' },
|
||||
data,
|
||||
'gender',
|
||||
AxisType.category,
|
||||
AxisType.Category,
|
||||
),
|
||||
).toEqual([
|
||||
['boy', 1000],
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ describe('formatSeriesName', () => {
|
|||
expect(
|
||||
formatSeriesName('1995-01-01 00:00:00.000000', {
|
||||
timeFormatter: annualTimeFormatter,
|
||||
coltype: GenericDataType.TEMPORAL,
|
||||
coltype: GenericDataType.Temporal,
|
||||
}),
|
||||
).toEqual('1995');
|
||||
});
|
||||
|
|
@ -911,33 +911,33 @@ test('calculateLowerLogTick', () => {
|
|||
});
|
||||
|
||||
test('getAxisType without forced categorical', () => {
|
||||
expect(getAxisType(false, false, GenericDataType.TEMPORAL)).toEqual(
|
||||
AxisType.time,
|
||||
expect(getAxisType(false, false, GenericDataType.Temporal)).toEqual(
|
||||
AxisType.Time,
|
||||
);
|
||||
expect(getAxisType(false, false, GenericDataType.NUMERIC)).toEqual(
|
||||
AxisType.value,
|
||||
expect(getAxisType(false, false, GenericDataType.Numeric)).toEqual(
|
||||
AxisType.Value,
|
||||
);
|
||||
expect(getAxisType(true, false, GenericDataType.NUMERIC)).toEqual(
|
||||
AxisType.category,
|
||||
expect(getAxisType(true, false, GenericDataType.Numeric)).toEqual(
|
||||
AxisType.Category,
|
||||
);
|
||||
expect(getAxisType(false, false, GenericDataType.BOOLEAN)).toEqual(
|
||||
AxisType.category,
|
||||
expect(getAxisType(false, false, GenericDataType.Boolean)).toEqual(
|
||||
AxisType.Category,
|
||||
);
|
||||
expect(getAxisType(false, false, GenericDataType.STRING)).toEqual(
|
||||
AxisType.category,
|
||||
expect(getAxisType(false, false, GenericDataType.String)).toEqual(
|
||||
AxisType.Category,
|
||||
);
|
||||
});
|
||||
|
||||
test('getAxisType with forced categorical', () => {
|
||||
expect(getAxisType(false, true, GenericDataType.NUMERIC)).toEqual(
|
||||
AxisType.category,
|
||||
expect(getAxisType(false, true, GenericDataType.Numeric)).toEqual(
|
||||
AxisType.Category,
|
||||
);
|
||||
});
|
||||
|
||||
test('getMinAndMaxFromBounds returns empty object when not truncating', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
false,
|
||||
10,
|
||||
100,
|
||||
|
|
@ -949,7 +949,7 @@ test('getMinAndMaxFromBounds returns empty object when not truncating', () => {
|
|||
test('getMinAndMaxFromBounds returns empty object for categorical axis', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.category,
|
||||
AxisType.Category,
|
||||
false,
|
||||
10,
|
||||
100,
|
||||
|
|
@ -961,7 +961,7 @@ test('getMinAndMaxFromBounds returns empty object for categorical axis', () => {
|
|||
test('getMinAndMaxFromBounds returns empty object for time axis', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.time,
|
||||
AxisType.Time,
|
||||
false,
|
||||
10,
|
||||
100,
|
||||
|
|
@ -973,7 +973,7 @@ test('getMinAndMaxFromBounds returns empty object for time axis', () => {
|
|||
test('getMinAndMaxFromBounds returns dataMin/dataMax for non-bar charts', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
|
|
@ -988,7 +988,7 @@ test('getMinAndMaxFromBounds returns dataMin/dataMax for non-bar charts', () =>
|
|||
test('getMinAndMaxFromBounds returns bound without scale for non-bar charts', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
true,
|
||||
10,
|
||||
undefined,
|
||||
|
|
@ -1003,7 +1003,7 @@ test('getMinAndMaxFromBounds returns bound without scale for non-bar charts', ()
|
|||
test('getMinAndMaxFromBounds returns scale when truncating without bounds', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
|
|
@ -1015,7 +1015,7 @@ test('getMinAndMaxFromBounds returns scale when truncating without bounds', () =
|
|||
test('getMinAndMaxFromBounds returns automatic upper bound when truncating', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
true,
|
||||
10,
|
||||
undefined,
|
||||
|
|
@ -1030,7 +1030,7 @@ test('getMinAndMaxFromBounds returns automatic upper bound when truncating', ()
|
|||
test('getMinAndMaxFromBounds returns automatic lower bound when truncating', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(
|
||||
AxisType.value,
|
||||
AxisType.Value,
|
||||
true,
|
||||
undefined,
|
||||
100,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ const queryMode: ControlConfig<'RadioButtonControl'> = {
|
|||
label: t('Query mode'),
|
||||
default: null,
|
||||
options: [
|
||||
[QueryMode.aggregate, QueryModeLabel[QueryMode.aggregate]],
|
||||
[QueryMode.raw, QueryModeLabel[QueryMode.raw]],
|
||||
[QueryMode.Aggregate, QueryModeLabel[QueryMode.Aggregate]],
|
||||
[QueryMode.Raw, QueryModeLabel[QueryMode.Raw]],
|
||||
],
|
||||
mapStateToProps: ({ controls }) => ({ value: getQueryMode(controls) }),
|
||||
rerender: ['all_columns', 'groupby', 'metrics', 'percent_metrics'],
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ import {
|
|||
|
||||
export function getQueryMode(controls: ControlStateMapping): QueryMode {
|
||||
const mode = controls?.query_mode?.value;
|
||||
if (mode === QueryMode.aggregate || mode === QueryMode.raw) {
|
||||
if (mode === QueryMode.Aggregate || mode === QueryMode.Raw) {
|
||||
return mode as QueryMode;
|
||||
}
|
||||
const rawColumns = controls?.all_columns?.value as
|
||||
| QueryFormColumn[]
|
||||
| undefined;
|
||||
const hasRawColumns = rawColumns && rawColumns.length > 0;
|
||||
return hasRawColumns ? QueryMode.raw : QueryMode.aggregate;
|
||||
return hasRawColumns ? QueryMode.Raw : QueryMode.Aggregate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -47,8 +47,8 @@ export function isQueryMode(mode: QueryMode) {
|
|||
getQueryMode(controls) === mode;
|
||||
}
|
||||
|
||||
export const isAggMode = isQueryMode(QueryMode.aggregate);
|
||||
export const isRawMode = isQueryMode(QueryMode.raw);
|
||||
export const isAggMode = isQueryMode(QueryMode.Aggregate);
|
||||
export const isRawMode = isQueryMode(QueryMode.Raw);
|
||||
|
||||
export const validateAggControlValues = (
|
||||
controls: ControlStateMapping,
|
||||
|
|
|
|||
|
|
@ -439,8 +439,8 @@ export default function PivotTableChart(props: PivotTableProps) {
|
|||
rowSubTotals,
|
||||
highlightHeaderCellsOnHover:
|
||||
emitCrossFilters ||
|
||||
isFeatureEnabled(FeatureFlag.DRILL_BY) ||
|
||||
isFeatureEnabled(FeatureFlag.DRILL_TO_DETAIL),
|
||||
isFeatureEnabled(FeatureFlag.DrillBy) ||
|
||||
isFeatureEnabled(FeatureFlag.DrillToDetail),
|
||||
highlightedHeaderCells: selectedFilters,
|
||||
omittedHighlightHeaderGroups: [METRIC_KEY],
|
||||
cellColorFormatters: { [METRIC_KEY]: metricColorFormatters },
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ export default class PivotTableChartPlugin extends ChartPlugin<
|
|||
constructor() {
|
||||
const metadata = new ChartMetadata({
|
||||
behaviors: [
|
||||
Behavior.INTERACTIVE_CHART,
|
||||
Behavior.DRILL_TO_DETAIL,
|
||||
Behavior.DRILL_BY,
|
||||
Behavior.InteractiveChart,
|
||||
Behavior.DrillToDetail,
|
||||
Behavior.DrillBy,
|
||||
],
|
||||
category: t('Table'),
|
||||
description: t(
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
|
|||
const dateFormatters = colnames
|
||||
.filter(
|
||||
(colname: string, index: number) =>
|
||||
coltypes[index] === GenericDataType.TEMPORAL,
|
||||
coltypes[index] === GenericDataType.Temporal,
|
||||
)
|
||||
.reduce(
|
||||
(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue