mirror of
https://github.com/apache/superset.git
synced 2026-06-01 05:39:17 +00:00
chore: Removes src/modules top folder (#25005)
This commit is contained in:
committed by
GitHub
parent
bc1c5c2f84
commit
2eb0a255d9
@@ -32,10 +32,13 @@ import {
|
||||
getColumnLabel,
|
||||
withTheme,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
import SelectControl from 'src/explore/components/controls/SelectControl';
|
||||
import TextControl from 'src/explore/components/controls/TextControl';
|
||||
import CheckboxControl from 'src/explore/components/controls/CheckboxControl';
|
||||
import PopoverSection from 'src/components/PopoverSection';
|
||||
import ControlHeader from 'src/explore/components/ControlHeader';
|
||||
import { EmptyStateSmall } from 'src/components/EmptyState';
|
||||
import { FILTER_OPTIONS_LIMIT } from 'src/explore/constants';
|
||||
import {
|
||||
ANNOTATION_SOURCE_TYPES,
|
||||
ANNOTATION_TYPES,
|
||||
@@ -43,11 +46,7 @@ import {
|
||||
DEFAULT_ANNOTATION_TYPE,
|
||||
requiresQuery,
|
||||
ANNOTATION_SOURCE_TYPES_METADATA,
|
||||
} from 'src/modules/AnnotationTypes';
|
||||
import PopoverSection from 'src/components/PopoverSection';
|
||||
import ControlHeader from 'src/explore/components/ControlHeader';
|
||||
import { EmptyStateSmall } from 'src/components/EmptyState';
|
||||
import { FILTER_OPTIONS_LIMIT } from 'src/explore/constants';
|
||||
} from './AnnotationTypes';
|
||||
|
||||
const AUTOMATIC_COLOR = '';
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import { getChartMetadataRegistry, ChartMetadata } from '@superset-ui/core';
|
||||
import fetchMock from 'fetch-mock';
|
||||
import setupColors from 'src/setup/setupColors';
|
||||
import { ANNOTATION_TYPES_METADATA } from 'src/modules/AnnotationTypes';
|
||||
import { ANNOTATION_TYPES_METADATA } from './AnnotationTypes';
|
||||
import AnnotationLayer from './AnnotationLayer';
|
||||
|
||||
const defaultProps = {
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
|
||||
function extractTypes(metadata) {
|
||||
return Object.keys(metadata).reduce((prev, key) => {
|
||||
const result = prev;
|
||||
result[key] = key;
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
export const ANNOTATION_TYPES_METADATA = {
|
||||
FORMULA: {
|
||||
value: 'FORMULA',
|
||||
label: t('Formula'),
|
||||
},
|
||||
EVENT: {
|
||||
value: 'EVENT',
|
||||
label: t('Event'),
|
||||
supportNativeSource: true,
|
||||
},
|
||||
INTERVAL: {
|
||||
value: 'INTERVAL',
|
||||
label: t('Interval'),
|
||||
supportNativeSource: true,
|
||||
},
|
||||
TIME_SERIES: {
|
||||
value: 'TIME_SERIES',
|
||||
label: t('Time series'),
|
||||
},
|
||||
};
|
||||
|
||||
export const ANNOTATION_TYPES = extractTypes(ANNOTATION_TYPES_METADATA);
|
||||
|
||||
export const DEFAULT_ANNOTATION_TYPE = ANNOTATION_TYPES.FORMULA;
|
||||
|
||||
export const ANNOTATION_SOURCE_TYPES_METADATA = {
|
||||
NATIVE: {
|
||||
value: 'NATIVE',
|
||||
label: 'Superset annotation',
|
||||
},
|
||||
};
|
||||
|
||||
export const ANNOTATION_SOURCE_TYPES = extractTypes(
|
||||
ANNOTATION_SOURCE_TYPES_METADATA,
|
||||
);
|
||||
|
||||
export function requiresQuery(annotationSourceType) {
|
||||
return !!annotationSourceType;
|
||||
}
|
||||
|
||||
const NATIVE_COLUMN_NAMES = {
|
||||
timeColumn: 'start_dttm',
|
||||
intervalEndColumn: 'end_dttm',
|
||||
titleColumn: 'short_descr',
|
||||
descriptionColumns: ['long_descr'],
|
||||
};
|
||||
|
||||
export function applyNativeColumns(annotation) {
|
||||
if (annotation.sourceType === ANNOTATION_SOURCE_TYPES.NATIVE) {
|
||||
return { ...annotation, ...NATIVE_COLUMN_NAMES };
|
||||
}
|
||||
return annotation;
|
||||
}
|
||||
Reference in New Issue
Block a user