diff --git a/packages/grafana-data/src/dataframe/FieldCache.ts b/packages/grafana-data/src/dataframe/FieldCache.ts index 9653be2426d..35afccae347 100644 --- a/packages/grafana-data/src/dataframe/FieldCache.ts +++ b/packages/grafana-data/src/dataframe/FieldCache.ts @@ -1,4 +1,6 @@ -import { Field, DataFrame, FieldType, guessFieldTypeForField } from '../index'; +import { DataFrame, Field, FieldType } from '../types/dataFrame'; + +import { guessFieldTypeForField } from './processDataFrame'; export interface FieldWithIndex extends Field { index: number; diff --git a/packages/grafana-data/src/dataframe/StreamingDataFrame.test.ts b/packages/grafana-data/src/dataframe/StreamingDataFrame.test.ts index de79e81491b..cf8ad95d08e 100644 --- a/packages/grafana-data/src/dataframe/StreamingDataFrame.test.ts +++ b/packages/grafana-data/src/dataframe/StreamingDataFrame.test.ts @@ -1,5 +1,8 @@ -import { DataFrame, DataFrameJSON, FieldType, getFieldDisplayName, reduceField, ReducerID } from '..'; +import { getFieldDisplayName } from '../field/fieldState'; +import { reduceField, ReducerID } from '../transformations/fieldReducer'; +import { FieldType, DataFrame } from '../types'; +import { DataFrameJSON } from './DataFrameJSON'; import { closestIdx, getStreamingFrameOptions, diff --git a/packages/grafana-data/src/dataframe/StreamingDataFrame.ts b/packages/grafana-data/src/dataframe/StreamingDataFrame.ts index b39b7ab15a1..f029bc54f4a 100644 --- a/packages/grafana-data/src/dataframe/StreamingDataFrame.ts +++ b/packages/grafana-data/src/dataframe/StreamingDataFrame.ts @@ -1,16 +1,12 @@ import { AlignedData } from 'uplot'; -import { DataFrame, Field, FieldDTO, FieldType, Labels, parseLabels, QueryResultMeta } from '..'; import { join } from '../transformations/transformers/joinDataFrames'; +import { FieldDTO, QueryResultMeta, DataFrame, Field, FieldType, Labels } from '../types'; +import { parseLabels } from '../utils/labels'; import { renderLegendFormat } from '../utils/legend'; -import { - DataFrameJSON, - decodeFieldValueEntities, - FieldSchema, - guessFieldTypeFromValue, - toFilteredDataFrameDTO, -} from '.'; +import { DataFrameJSON, decodeFieldValueEntities, FieldSchema } from './DataFrameJSON'; +import { guessFieldTypeFromValue, toFilteredDataFrameDTO } from './processDataFrame'; /** * Indicate if the frame is appened or replace diff --git a/packages/grafana-data/src/dataframe/index.ts b/packages/grafana-data/src/dataframe/index.ts deleted file mode 100644 index 3e14458a1f0..00000000000 --- a/packages/grafana-data/src/dataframe/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from './DataFrameView'; -export * from './FieldCache'; -export * from './MutableDataFrame'; -export * from './processDataFrame'; -export * from './dimensions'; -export * from './ArrayDataFrame'; -export * from './DataFrameJSON'; -export * from './frameComparisons'; -export { - anySeriesWithTimeField, - hasTimeField, - isTimeSeriesFrame, - isTimeSeriesFrames, - isTimeSeriesField, - getRowUniqueId, - addRow, -} from './utils'; -export { StreamingDataFrame, StreamingFrameAction, type StreamingFrameOptions, closestIdx } from './StreamingDataFrame'; diff --git a/packages/grafana-data/src/dataframe/processDataFrame.test.ts b/packages/grafana-data/src/dataframe/processDataFrame.test.ts index 7dad218b969..2c0cd824dfd 100644 --- a/packages/grafana-data/src/dataframe/processDataFrame.test.ts +++ b/packages/grafana-data/src/dataframe/processDataFrame.test.ts @@ -4,6 +4,7 @@ import { DataFrameDTO, Field, FieldType, TableData, TimeSeries } from '../types/ import { ArrayDataFrame } from './ArrayDataFrame'; import { createDataFrame, + getFieldTypeFromValue, guessFieldTypeForField, guessFieldTypeFromValue, guessFieldTypes, @@ -15,8 +16,6 @@ import { toLegacyResponseData, } from './processDataFrame'; -import { getFieldTypeFromValue } from '.'; - describe('toDataFrame', () => { it('converts timeseries to series', () => { const input1 = { diff --git a/packages/grafana-data/src/field/fieldColor.ts b/packages/grafana-data/src/field/fieldColor.ts index 29bbc1f8011..2336dbb868f 100644 --- a/packages/grafana-data/src/field/fieldColor.ts +++ b/packages/grafana-data/src/field/fieldColor.ts @@ -6,8 +6,7 @@ import { colorManipulator } from '../themes'; import { GrafanaTheme2 } from '../themes/types'; import { reduceField } from '../transformations/fieldReducer'; import { FALLBACK_COLOR, Field, FieldColorModeId, Threshold } from '../types'; -import { RegistryItem } from '../utils'; -import { Registry } from '../utils/Registry'; +import { Registry, RegistryItem } from '../utils/Registry'; import { getScaleCalculator, ColorScaleValue } from './scale'; import { fallBackThreshold } from './thresholds'; diff --git a/packages/grafana-data/src/field/fieldDisplay.ts b/packages/grafana-data/src/field/fieldDisplay.ts index ff33188eff3..11bc62e0116 100644 --- a/packages/grafana-data/src/field/fieldDisplay.ts +++ b/packages/grafana-data/src/field/fieldDisplay.ts @@ -3,8 +3,8 @@ import { isEmpty } from 'lodash'; import { DataFrameView } from '../dataframe/DataFrameView'; import { getTimeField } from '../dataframe/processDataFrame'; import { GrafanaTheme2 } from '../themes'; -import { getFieldMatcher } from '../transformations'; import { reduceField, ReducerID } from '../transformations/fieldReducer'; +import { getFieldMatcher } from '../transformations/matchers'; import { FieldMatcherID } from '../transformations/matchers/ids'; import { DataFrame, diff --git a/packages/grafana-data/src/field/fieldOverrides.test.ts b/packages/grafana-data/src/field/fieldOverrides.test.ts index 95d8f9fd9c1..6268bfc591d 100644 --- a/packages/grafana-data/src/field/fieldOverrides.test.ts +++ b/packages/grafana-data/src/field/fieldOverrides.test.ts @@ -1,7 +1,8 @@ -import { ArrayDataFrame, createDataFrame, toDataFrame } from '../dataframe'; +import { ArrayDataFrame } from '../dataframe/ArrayDataFrame'; +import { createDataFrame, toDataFrame } from '../dataframe/processDataFrame'; import { rangeUtil } from '../datetime'; import { createTheme } from '../themes'; -import { FieldMatcherID } from '../transformations'; +import { FieldMatcherID } from '../transformations/matchers/ids'; import { DataFrame, Field, @@ -15,7 +16,8 @@ import { ScopedVars, ThresholdsMode, } from '../types'; -import { locationUtil, Registry } from '../utils'; +import { Registry } from '../utils/Registry'; +import { locationUtil } from '../utils/location'; import { mockStandardProperties } from '../utils/tests/mockStandardProperties'; import { FieldConfigOptionsRegistry } from './FieldConfigOptionsRegistry'; diff --git a/packages/grafana-data/src/field/fieldOverrides.ts b/packages/grafana-data/src/field/fieldOverrides.ts index e0cdf966f06..8b170606507 100644 --- a/packages/grafana-data/src/field/fieldOverrides.ts +++ b/packages/grafana-data/src/field/fieldOverrides.ts @@ -4,11 +4,13 @@ import usePrevious from 'react-use/lib/usePrevious'; import { VariableFormatID } from '@grafana/schema'; -import { compareArrayValues, compareDataFrameStructures, guessFieldTypeForField } from '../dataframe'; +import { compareArrayValues, compareDataFrameStructures } from '../dataframe/frameComparisons'; +import { guessFieldTypeForField } from '../dataframe/processDataFrame'; import { PanelPlugin } from '../panel/PanelPlugin'; import { GrafanaTheme2 } from '../themes'; import { asHexString } from '../themes/colorManipulator'; -import { fieldMatchers, reduceField, ReducerID } from '../transformations'; +import { ReducerID, reduceField } from '../transformations/fieldReducer'; +import { fieldMatchers } from '../transformations/matchers'; import { ApplyFieldOverrideOptions, DataContextScopedVar, @@ -35,8 +37,8 @@ import { ValueLinkConfig, } from '../types'; import { FieldMatcher } from '../types/transformations'; -import { locationUtil } from '../utils'; import { mapInternalLinkToExplore } from '../utils/dataLinks'; +import { locationUtil } from '../utils/location'; import { FieldConfigOptionsRegistry } from './FieldConfigOptionsRegistry'; import { getDisplayProcessor, getRawDisplayProcessor } from './displayProcessor'; diff --git a/packages/grafana-data/src/field/fieldState.test.ts b/packages/grafana-data/src/field/fieldState.test.ts index 33275a58ceb..3e1ef1ac9db 100644 --- a/packages/grafana-data/src/field/fieldState.test.ts +++ b/packages/grafana-data/src/field/fieldState.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../dataframe'; +import { toDataFrame } from '../dataframe/processDataFrame'; import { DataFrame, TIME_SERIES_VALUE_FIELD_NAME, FieldType, TIME_SERIES_TIME_FIELD_NAME } from '../types'; import { getFieldDisplayName, getFrameDisplayName } from './fieldState'; diff --git a/packages/grafana-data/src/field/fieldState.ts b/packages/grafana-data/src/field/fieldState.ts index 065960148e0..be225d2f0b0 100644 --- a/packages/grafana-data/src/field/fieldState.ts +++ b/packages/grafana-data/src/field/fieldState.ts @@ -1,4 +1,4 @@ -import { getFieldMatcher } from '../transformations'; +import { getFieldMatcher } from '../transformations/matchers'; import { DataFrame, Field, diff --git a/packages/grafana-data/src/field/getFieldDisplayValuesProxy.test.tsx b/packages/grafana-data/src/field/getFieldDisplayValuesProxy.test.tsx index b17ceef4cb6..ceab04f404b 100644 --- a/packages/grafana-data/src/field/getFieldDisplayValuesProxy.test.tsx +++ b/packages/grafana-data/src/field/getFieldDisplayValuesProxy.test.tsx @@ -1,4 +1,4 @@ -import { createDataFrame, toDataFrame } from '../dataframe'; +import { createDataFrame, toDataFrame } from '../dataframe/processDataFrame'; import { createTheme } from '../themes'; import { applyFieldOverrides } from './fieldOverrides'; diff --git a/packages/grafana-data/src/field/getFieldDisplayValuesProxy.ts b/packages/grafana-data/src/field/getFieldDisplayValuesProxy.ts index 73686e7643f..49c56d59891 100644 --- a/packages/grafana-data/src/field/getFieldDisplayValuesProxy.ts +++ b/packages/grafana-data/src/field/getFieldDisplayValuesProxy.ts @@ -1,7 +1,7 @@ import { toNumber } from 'lodash'; import { DataFrame, DisplayValue, TimeZone } from '../types'; -import { formattedValueToString } from '../valueFormats'; +import { formattedValueToString } from '../valueFormats/valueFormats'; import { getDisplayProcessor } from './displayProcessor'; diff --git a/packages/grafana-data/src/field/index.ts b/packages/grafana-data/src/field/index.ts deleted file mode 100644 index e7b483bdd88..00000000000 --- a/packages/grafana-data/src/field/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from './fieldDisplay'; -export * from './displayProcessor'; -export * from './standardFieldConfigEditorRegistry'; -export * from './overrides/processors'; - -export { - getFieldColorModeForField, - getFieldColorMode, - fieldColorModeRegistry, - type FieldColorMode, - getFieldSeriesColor, -} from './fieldColor'; -export { FieldConfigOptionsRegistry } from './FieldConfigOptionsRegistry'; -export { sortThresholds, getActiveThreshold } from './thresholds'; -export { applyFieldOverrides, validateFieldConfig, applyRawFieldOverrides, useFieldOverrides } from './fieldOverrides'; -export { getFieldDisplayValuesProxy } from './getFieldDisplayValuesProxy'; -export { getFieldDisplayName, getFrameDisplayName, cacheFieldDisplayNames, getUniqueFieldName } from './fieldState'; -export { getScaleCalculator, getFieldConfigWithMinMax, getMinMaxAndDelta } from './scale'; diff --git a/packages/grafana-data/src/geo/layer.ts b/packages/grafana-data/src/geo/layer.ts index bb65b01dcb3..e034fdb1cf5 100644 --- a/packages/grafana-data/src/geo/layer.ts +++ b/packages/grafana-data/src/geo/layer.ts @@ -8,7 +8,7 @@ import { EventBus } from '../events'; import { StandardEditorContext } from '../field/standardFieldConfigEditorRegistry'; import { GrafanaTheme2 } from '../themes'; import { PanelData } from '../types'; -import { PanelOptionsEditorBuilder } from '../utils'; +import { PanelOptionsEditorBuilder } from '../utils/OptionsUIBuilders'; import { RegistryItemWithOptions } from '../utils/Registry'; /** diff --git a/packages/grafana-data/src/index.ts b/packages/grafana-data/src/index.ts index d0f7dc5015d..1ed254b828c 100644 --- a/packages/grafana-data/src/index.ts +++ b/packages/grafana-data/src/index.ts @@ -3,20 +3,298 @@ * * @packageDocumentation */ -export * from './utils'; + export * from './types'; -export * from './dataframe'; -export * from './transformations'; export * from './datetime'; export * from './text'; -export * from './valueFormats'; -export * from './field'; export * from './events'; export * from './themes'; export * from './monaco'; export * from './geo/layer'; export * from './query'; export { amendTable, trimTable, type Table } from './table/amendTimeSeries'; + +// DataFrames +export { DataFrameView } from './dataframe/DataFrameView'; +export { type FieldWithIndex, FieldCache } from './dataframe/FieldCache'; +export { type MutableField, MISSING_VALUE, MutableDataFrame } from './dataframe/MutableDataFrame'; +export { + guessFieldTypeFromNameAndValue, + getFieldTypeFromValue, + guessFieldTypeFromValue, + guessFieldTypeForField, + guessFieldTypes, + isTableData, + isDataFrame, + isDataFrameWithValue, + toDataFrame, + toLegacyResponseData, + sortDataFrame, + reverseDataFrame, + getDataFrameRow, + toDataFrameDTO, + toFilteredDataFrameDTO, + getTimeField, + getProcessedDataFrames, + preProcessPanelData, + type PartialDataFrame, + createDataFrame, +} from './dataframe/processDataFrame'; + +export { + type Dimension, + type Dimensions, + createDimension, + getColumnsFromDimension, + getColumnFromDimension, + getValueFromDimension, + getAllValuesFromDimension, + getDimensionByName, +} from './dataframe/dimensions'; + +export { + anySeriesWithTimeField, + hasTimeField, + isTimeSeriesFrame, + isTimeSeriesFrames, + isTimeSeriesField, + getRowUniqueId, + addRow, +} from './dataframe/utils'; +export { + StreamingDataFrame, + StreamingFrameAction, + type StreamingFrameOptions, + closestIdx, +} from './dataframe/StreamingDataFrame'; + +export { ArrayDataFrame, arrayToDataFrame } from './dataframe/ArrayDataFrame'; + +export { + type DataFrameJSON, + type DataFrameData, + type DataFrameSchema, + type FieldSchema, + type FieldValueEntityLookup, + decodeFieldValueEntities, + decodeFieldValueEnums, + dataFrameFromJSON, + dataFrameToJSON, +} from './dataframe/DataFrameJSON'; + +export { compareDataFrameStructures, compareArrayValues, shallowCompare } from './dataframe/frameComparisons'; + +// Field + +export { + getFieldColorModeForField, + getFieldColorMode, + fieldColorModeRegistry, + type FieldColorMode, + getFieldSeriesColor, +} from './field/fieldColor'; +export { FieldConfigOptionsRegistry } from './field/FieldConfigOptionsRegistry'; +export { sortThresholds, getActiveThreshold } from './field/thresholds'; +export { + applyFieldOverrides, + validateFieldConfig, + applyRawFieldOverrides, + useFieldOverrides, +} from './field/fieldOverrides'; +export { getFieldDisplayValuesProxy } from './field/getFieldDisplayValuesProxy'; +export { + getFieldDisplayName, + getFrameDisplayName, + cacheFieldDisplayNames, + getUniqueFieldName, +} from './field/fieldState'; +export { getScaleCalculator, getFieldConfigWithMinMax, getMinMaxAndDelta } from './field/scale'; + +export { + type ReduceDataOptions, + VAR_SERIES_NAME, + VAR_FIELD_NAME, + VAR_FIELD_LABELS, + VAR_CALC, + VAR_CELL_PREFIX, + type FieldSparkline, + type FieldDisplay, + type GetFieldDisplayValuesOptions, + DEFAULT_FIELD_DISPLAY_VALUES_LIMIT, + getFieldDisplayValues, + hasLinks, + getDisplayValueAlignmentFactors, + fixCellTemplateExpressions, +} from './field/fieldDisplay'; + +export { getDisplayProcessor, getRawDisplayProcessor } from './field/displayProcessor'; + +export { + type StandardEditorContext, + type StandardEditorProps, + type StandardEditorsRegistryItem, + standardFieldConfigEditorRegistry, + standardEditorsRegistry, +} from './field/standardFieldConfigEditorRegistry'; + +export { + identityOverrideProcessor, + numberOverrideProcessor, + displayNameOverrideProcessor, + type NumberFieldConfigSettings, + type SliderFieldConfigSettings, + type DataLinksFieldConfigSettings, + type ValueMappingFieldConfigSettings, + type SelectFieldConfigSettings, + type StringFieldConfigSettings, + type ThresholdsFieldConfigSettings, + type UnitFieldConfigSettings, + type FieldColorConfigSettings, + type StatsPickerConfigSettings, + type FieldNamePickerConfigSettings, + dataLinksOverrideProcessor, + valueMappingsOverrideProcessor, + selectOverrideProcessor, + stringOverrideProcessor, + thresholdsOverrideProcessor, + unitOverrideProcessor, + booleanOverrideProcessor, + FieldNamePickerBaseNameMode, +} from './field/overrides/processors'; + +// Utils + +export { PanelOptionsEditorBuilder, FieldConfigEditorBuilder } from './utils/OptionsUIBuilders'; +export { getFlotPairs, getFlotPairsConstant } from './utils/flotPairs'; +export { locationUtil } from './utils/location'; +export { urlUtil, type UrlQueryMap, type UrlQueryValue, serializeStateToUrlParam, toURLRange } from './utils/url'; +export { DataLinkBuiltInVars, mapInternalLinkToExplore } from './utils/dataLinks'; +export { DocsId } from './utils/docs'; +export { makeClassES5Compatible } from './utils/makeClassES5Compatible'; +export { anyToNumber } from './utils/anyToNumber'; +export { withLoadingIndicator, type WithLoadingIndicatorOptions } from './utils/withLoadingIndicator'; +export { convertOldAngularValueMappings, LegacyMappingType } from './utils/valueMappings'; +export { containsSearchFilter, type SearchFilterOptions, getSearchFilterScopedVar } from './utils/variables'; +export { renderLegendFormat } from './utils/legend'; +export { matchPluginId } from './utils/matchPluginId'; + +export { type RegistryItem, type RegistryItemWithOptions, Registry } from './utils/Registry'; +export { + getDataSourceRef, + isDataSourceRef, + getDataSourceUID, + onUpdateDatasourceOption, + onUpdateDatasourceJsonDataOption, + onUpdateDatasourceSecureJsonDataOption, + onUpdateDatasourceJsonDataOptionSelect, + onUpdateDatasourceJsonDataOptionChecked, + onUpdateDatasourceSecureJsonDataOptionSelect, + onUpdateDatasourceResetOption, + updateDatasourcePluginOption, + updateDatasourcePluginJsonDataOption, + updateDatasourcePluginSecureJsonDataOption, + updateDatasourcePluginResetOption, +} from './utils/datasource'; + +export { deprecationWarning } from './utils/deprecationWarning'; + +export { + CSVHeaderStyle, + type CSVConfig, + type CSVParseCallbacks, + type CSVOptions, + readCSV, + CSVReader, + toCSV, +} from './utils/csv'; + +export { parseLabels, findCommonLabels, findUniqueLabels, matchAllLabels, formatLabels } from './utils/labels'; +export { roundDecimals, guessDecimals } from './utils/numbers'; +export { objRemoveUndefined, isEmptyObject } from './utils/object'; +export { classicColors } from './utils/namedColorsPalette'; +export { getSeriesTimeStep, hasMsResolution } from './utils/series'; +export { BinaryOperationID, type BinaryOperation, binaryOperators } from './utils/binaryOperators'; +export { UnaryOperationID, type UnaryOperation, unaryOperators } from './utils/unaryOperators'; +export { NodeGraphDataFrameFieldNames } from './utils/nodeGraph'; +export { toOption } from './utils/selectUtils'; +export * as arrayUtils from './utils/arrayUtils'; +export { store } from './utils/store'; +export { LocalStorageValueProvider } from './utils/LocalStorageValueProvider'; + +// Tranformations + +export { standardTransformers } from './transformations/transformers'; +export { + fieldMatchers, + frameMatchers, + valueMatchers, + getFieldMatcher, + getFrameMatchers, + getValueMatcher, +} from './transformations/matchers'; +export { type FieldValueMatcherConfig } from './transformations/matchers/fieldValueMatcher'; + +export { DataTransformerID } from './transformations/transformers/ids'; +export { MatcherID, FieldMatcherID, FrameMatcherID, ValueMatcherID } from './transformations/matchers/ids'; + +export { + ReducerID, + isReducerID, + type FieldReducerInfo, + reduceField, + fieldReducers, + defaultCalcs, + doStandardCalcs, +} from './transformations/fieldReducer'; + +export { transformDataFrame } from './transformations/transformDataFrame'; +export { + type TransformerRegistryItem, + type TransformerUIProps, + TransformerCategory, + standardTransformersRegistry, +} from './transformations/standardTransformersRegistry'; +export { + type RegexpOrNamesMatcherOptions, + type ByNamesMatcherOptions, + ByNamesMatcherMode, +} from './transformations/matchers/nameMatcher'; +export type { RenameByRegexTransformerOptions } from './transformations/transformers/renameByRegex'; +/** @deprecated -- will be removed in future versions */ +export { + joinDataFrames as outerJoinDataFrames, + isLikelyAscendingVector, +} from './transformations/transformers/joinDataFrames'; +export * from './transformations/transformers/histogram'; +export { ensureTimeField } from './transformations/transformers/convertFieldType'; + +// Required for Sparklines util to work in @grafana/data, but ideally kept internal +export { applyNullInsertThreshold } from './transformations/transformers/nulls/nullInsertThreshold'; +export { nullToValue } from './transformations/transformers/nulls/nullToValue'; + +// ValueFormats + +export { + type FormattedValue, + type ValueFormatter, + type ValueFormat, + type ValueFormatCategory, + type ValueFormatterIndex, + formattedValueToString, + toFixed, + toFixedScaled, + toFixedUnit, + isBooleanUnit, + booleanValueFormatter, + scaledUnits, + locale, + simpleCountUnit, + stringFormater, + getValueFormat, + getValueFormatterIndex, + getValueFormats, +} from './valueFormats/valueFormats'; + export { type ValueMatcherOptions, type BasicValueMatcherOptions, @@ -49,7 +327,7 @@ export { getLinksSupplier } from './field/fieldOverrides'; export { CircularVector } from './vector/CircularVector'; export { vectorator } from './vector/FunctionalVector'; export { ArrayVector } from './vector/ArrayVector'; -export * from './dataframe/CircularDataFrame'; +export { CircularDataFrame } from './dataframe/CircularDataFrame'; export { type CurrentUser, userHasPermission, diff --git a/packages/grafana-data/src/panel/PanelPlugin.test.tsx b/packages/grafana-data/src/panel/PanelPlugin.test.tsx index 35ef52186ab..eab21a06f42 100644 --- a/packages/grafana-data/src/panel/PanelPlugin.test.tsx +++ b/packages/grafana-data/src/panel/PanelPlugin.test.tsx @@ -1,11 +1,11 @@ -import { PanelOptionsEditorBuilder } from '..'; +import { identityOverrideProcessor } from '../field/overrides/processors'; import { - identityOverrideProcessor, - standardEditorsRegistry, StandardEditorsRegistryItem, + standardEditorsRegistry, standardFieldConfigEditorRegistry, -} from '../field'; +} from '../field/standardFieldConfigEditorRegistry'; import { FieldConfigProperty, FieldConfigPropertyItem } from '../types'; +import { PanelOptionsEditorBuilder } from '../utils/OptionsUIBuilders'; import { PanelPlugin } from './PanelPlugin'; diff --git a/packages/grafana-data/src/panel/PanelPlugin.ts b/packages/grafana-data/src/panel/PanelPlugin.ts index 587181015a2..8d21b9b77b5 100644 --- a/packages/grafana-data/src/panel/PanelPlugin.ts +++ b/packages/grafana-data/src/panel/PanelPlugin.ts @@ -1,7 +1,8 @@ import { set } from 'lodash'; import { ComponentClass, ComponentType } from 'react'; -import { FieldConfigOptionsRegistry, StandardEditorContext } from '../field'; +import { FieldConfigOptionsRegistry } from '../field/FieldConfigOptionsRegistry'; +import { StandardEditorContext } from '../field/standardFieldConfigEditorRegistry'; import { FieldConfigProperty, FieldConfigSource, @@ -14,8 +15,8 @@ import { PanelTypeChangedHandler, VisualizationSuggestionsSupplier, } from '../types'; -import { deprecationWarning } from '../utils'; import { FieldConfigEditorBuilder, PanelOptionsEditorBuilder } from '../utils/OptionsUIBuilders'; +import { deprecationWarning } from '../utils/deprecationWarning'; import { createFieldConfigRegistry } from './registryFactories'; diff --git a/packages/grafana-data/src/transformations/index.ts b/packages/grafana-data/src/transformations/index.ts deleted file mode 100644 index 3d3afdebfbe..00000000000 --- a/packages/grafana-data/src/transformations/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -export * from './matchers/ids'; -export * from './transformers/ids'; -export * from './matchers'; -export { standardTransformers } from './transformers'; -export * from './fieldReducer'; -export { transformDataFrame } from './transformDataFrame'; -export { - type TransformerRegistryItem, - type TransformerUIProps, - TransformerCategory, - standardTransformersRegistry, -} from './standardTransformersRegistry'; -export { - type RegexpOrNamesMatcherOptions, - type ByNamesMatcherOptions, - ByNamesMatcherMode, -} from './matchers/nameMatcher'; -export type { RenameByRegexTransformerOptions } from './transformers/renameByRegex'; -/** @deprecated -- will be removed in future versions */ -export { joinDataFrames as outerJoinDataFrames, isLikelyAscendingVector } from './transformers/joinDataFrames'; -export * from './transformers/histogram'; -export { ensureTimeField } from './transformers/convertFieldType'; - -// Required for Sparklines util to work in @grafana/data, but ideally kept internal -export { applyNullInsertThreshold } from './transformers/nulls/nullInsertThreshold'; -export { nullToValue } from './transformers/nulls/nullToValue'; diff --git a/packages/grafana-data/src/transformations/matchers.ts b/packages/grafana-data/src/transformations/matchers.ts index 21ec33dda24..3db5e446747 100644 --- a/packages/grafana-data/src/transformations/matchers.ts +++ b/packages/grafana-data/src/transformations/matchers.ts @@ -23,8 +23,6 @@ import { getRangeValueMatchers } from './matchers/valueMatchers/rangeMatchers'; import { getRegexValueMatcher } from './matchers/valueMatchers/regexMatchers'; import { getSubstringValueMatchers } from './matchers/valueMatchers/substringMatchers'; -export { type FieldValueMatcherConfig } from './matchers/fieldValueMatcher'; - /** * Registry that contains all of the built in field matchers. * @public diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.test.ts index 2aba608f15d..b1ab6c4a9cc 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.test.ts index ce2c0702190..0e3a569d03f 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.test.ts index 7c20d917890..595380f2649 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.test.ts index 710ed507721..71853292382 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.test.ts index 379a6cf13a3..fbdc89caefc 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/matchers/valueMatchers/substringMatchers.test.ts b/packages/grafana-data/src/transformations/matchers/valueMatchers/substringMatchers.test.ts index 207bb44e699..2460c1a35d2 100644 --- a/packages/grafana-data/src/transformations/matchers/valueMatchers/substringMatchers.test.ts +++ b/packages/grafana-data/src/transformations/matchers/valueMatchers/substringMatchers.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../../dataframe'; +import { toDataFrame } from '../../../dataframe/processDataFrame'; import { DataFrame } from '../../../types/dataFrame'; import { getValueMatcher } from '../../matchers'; import { ValueMatcherID } from '../ids'; diff --git a/packages/grafana-data/src/transformations/transformers/calculateField.test.ts b/packages/grafana-data/src/transformations/transformers/calculateField.test.ts index 5ed845178ed..7e2db7468d9 100644 --- a/packages/grafana-data/src/transformations/transformers/calculateField.test.ts +++ b/packages/grafana-data/src/transformations/transformers/calculateField.test.ts @@ -1,9 +1,10 @@ -import { DataFrameView } from '../../dataframe'; +import { DataFrameView } from '../../dataframe/DataFrameView'; import { toDataFrame } from '../../dataframe/processDataFrame'; import { DataTransformContext, ScopedVars } from '../../types'; import { FieldType } from '../../types/dataFrame'; -import { BinaryOperationID, UnaryOperationID } from '../../utils'; +import { BinaryOperationID } from '../../utils/binaryOperators'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; +import { UnaryOperationID } from '../../utils/unaryOperators'; import { ReducerID } from '../fieldReducer'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/calculateField.ts b/packages/grafana-data/src/transformations/transformers/calculateField.ts index b50f1bcac2d..72c4f62c519 100644 --- a/packages/grafana-data/src/transformations/transformers/calculateField.ts +++ b/packages/grafana-data/src/transformations/transformers/calculateField.ts @@ -2,7 +2,7 @@ import { defaults } from 'lodash'; import { map } from 'rxjs/operators'; import { getTimeField } from '../../dataframe/processDataFrame'; -import { getFieldDisplayName } from '../../field'; +import { getFieldDisplayName } from '../../field/fieldState'; import { DataFrame, DataTransformerInfo, Field, FieldType, NullValueMode } from '../../types'; import { BinaryOperationID, binaryOperators } from '../../utils/binaryOperators'; import { UnaryOperationID, unaryOperators } from '../../utils/unaryOperators'; diff --git a/packages/grafana-data/src/transformations/transformers/formatTime.ts b/packages/grafana-data/src/transformations/transformers/formatTime.ts index 62314055dc3..f11c434a5fa 100644 --- a/packages/grafana-data/src/transformations/transformers/formatTime.ts +++ b/packages/grafana-data/src/transformations/transformers/formatTime.ts @@ -2,7 +2,7 @@ import { map } from 'rxjs/operators'; import { TimeZone } from '@grafana/schema'; -import { cacheFieldDisplayNames } from '../../field'; +import { cacheFieldDisplayNames } from '../../field/fieldState'; import { DataFrame, TransformationApplicabilityLevels } from '../../types'; import { DataTransformContext, DataTransformerInfo } from '../../types/transformations'; diff --git a/packages/grafana-data/src/transformations/transformers/groupingToMatrix.test.ts b/packages/grafana-data/src/transformations/transformers/groupingToMatrix.test.ts index 81a8c670931..97270e24e89 100644 --- a/packages/grafana-data/src/transformations/transformers/groupingToMatrix.test.ts +++ b/packages/grafana-data/src/transformations/transformers/groupingToMatrix.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { DataTransformerConfig, FieldType, Field, SpecialValue } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/histogram.ts b/packages/grafana-data/src/transformations/transformers/histogram.ts index 39d54ffeda9..217caec18cb 100644 --- a/packages/grafana-data/src/transformations/transformers/histogram.ts +++ b/packages/grafana-data/src/transformations/transformers/histogram.ts @@ -1,10 +1,10 @@ import { map } from 'rxjs/operators'; -import { getDisplayProcessor } from '../../field'; +import { getDisplayProcessor } from '../../field/displayProcessor'; import { createTheme, GrafanaTheme2 } from '../../themes'; import { DataFrameType, DataTransformContext, SynchronousDataTransformerInfo } from '../../types'; import { DataFrame, Field, FieldConfig, FieldType } from '../../types/dataFrame'; -import { roundDecimals } from '../../utils'; +import { roundDecimals } from '../../utils/numbers'; import { DataTransformerID } from './ids'; import { AlignedData, join } from './joinDataFrames'; diff --git a/packages/grafana-data/src/transformations/transformers/joinByField.test.ts b/packages/grafana-data/src/transformations/transformers/joinByField.test.ts index 88fe528d0a7..3673b82e050 100644 --- a/packages/grafana-data/src/transformations/transformers/joinByField.test.ts +++ b/packages/grafana-data/src/transformations/transformers/joinByField.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { FieldType, DataTransformerConfig } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/joinDataFrames.test.ts b/packages/grafana-data/src/transformations/transformers/joinDataFrames.test.ts index bd2ee76dacd..976ea8fd731 100644 --- a/packages/grafana-data/src/transformations/transformers/joinDataFrames.test.ts +++ b/packages/grafana-data/src/transformations/transformers/joinDataFrames.test.ts @@ -1,5 +1,5 @@ import { toDataFrame } from '../../dataframe/processDataFrame'; -import { getFieldDisplayName } from '../../field'; +import { getFieldDisplayName } from '../../field/fieldState'; import { DataFrame, FieldType } from '../../types/dataFrame'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { fieldMatchers } from '../matchers'; diff --git a/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts b/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts index 76857a564ba..21a780aae77 100644 --- a/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts +++ b/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts @@ -1,4 +1,4 @@ -import { getTimeField, sortDataFrame } from '../../dataframe'; +import { getTimeField, sortDataFrame } from '../../dataframe/processDataFrame'; import { DataFrame, Field, FieldMatcher, FieldType, TIME_SERIES_VALUE_FIELD_NAME } from '../../types'; import { fieldMatchers } from '../matchers'; import { FieldMatcherID } from '../matchers/ids'; diff --git a/packages/grafana-data/src/transformations/transformers/labelsToFields.test.ts b/packages/grafana-data/src/transformations/transformers/labelsToFields.test.ts index 1b97aa6a812..e9061bdc248 100644 --- a/packages/grafana-data/src/transformations/transformers/labelsToFields.test.ts +++ b/packages/grafana-data/src/transformations/transformers/labelsToFields.test.ts @@ -1,6 +1,6 @@ import { Subscription } from 'rxjs'; -import { toDataFrame, toDataFrameDTO } from '../../dataframe'; +import { toDataFrame, toDataFrameDTO } from '../../dataframe/processDataFrame'; import { DataFrame, DataTransformerConfig, FieldDTO, FieldType } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/labelsToFields.ts b/packages/grafana-data/src/transformations/transformers/labelsToFields.ts index aee79fbbb86..c21a0ec2abd 100644 --- a/packages/grafana-data/src/transformations/transformers/labelsToFields.ts +++ b/packages/grafana-data/src/transformations/transformers/labelsToFields.ts @@ -1,6 +1,6 @@ import { map } from 'rxjs/operators'; -import { getFieldDisplayName } from '../..'; +import { getFieldDisplayName } from '../../field/fieldState'; import { DataFrame, Field, FieldType, SynchronousDataTransformerInfo } from '../../types'; import { DataTransformerID } from './ids'; diff --git a/packages/grafana-data/src/transformations/transformers/merge.test.ts b/packages/grafana-data/src/transformations/transformers/merge.test.ts index e837a98b086..35306cfebfd 100644 --- a/packages/grafana-data/src/transformations/transformers/merge.test.ts +++ b/packages/grafana-data/src/transformations/transformers/merge.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { DataTransformerConfig, DisplayProcessor, Field, FieldType } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/merge.ts b/packages/grafana-data/src/transformations/transformers/merge.ts index 4c783acf42c..6bdd9d94af9 100644 --- a/packages/grafana-data/src/transformations/transformers/merge.ts +++ b/packages/grafana-data/src/transformations/transformers/merge.ts @@ -1,7 +1,7 @@ import { omit } from 'lodash'; import { map } from 'rxjs/operators'; -import { MutableDataFrame } from '../../dataframe'; +import { MutableDataFrame } from '../../dataframe/MutableDataFrame'; import { DataFrame, Field } from '../../types/dataFrame'; import { DataTransformerInfo, TransformationApplicabilityLevels } from '../../types/transformations'; diff --git a/packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.test.ts b/packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.test.ts index 7a2ceb15e8d..b6b7e20f3f2 100644 --- a/packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.test.ts +++ b/packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.test.ts @@ -1,4 +1,5 @@ -import { FieldType, createDataFrame } from '@grafana/data'; +import { createDataFrame } from '../../../dataframe/processDataFrame'; +import { FieldType } from '../../../types'; import { applyNullInsertThreshold } from './nullInsertThreshold'; diff --git a/packages/grafana-data/src/transformations/transformers/nulls/nullToValue.test.ts b/packages/grafana-data/src/transformations/transformers/nulls/nullToValue.test.ts index e14f64e1710..ac24f194954 100644 --- a/packages/grafana-data/src/transformations/transformers/nulls/nullToValue.test.ts +++ b/packages/grafana-data/src/transformations/transformers/nulls/nullToValue.test.ts @@ -1,4 +1,5 @@ -import { FieldType, createDataFrame } from '@grafana/data'; +import { createDataFrame } from '../../../dataframe/processDataFrame'; +import { FieldType } from '../../../types'; import { applyNullInsertThreshold } from './nullInsertThreshold'; import { nullToValue } from './nullToValue'; diff --git a/packages/grafana-data/src/transformations/transformers/order.test.ts b/packages/grafana-data/src/transformations/transformers/order.test.ts index f123469c7da..447823c8b07 100644 --- a/packages/grafana-data/src/transformations/transformers/order.test.ts +++ b/packages/grafana-data/src/transformations/transformers/order.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { FieldType, DataTransformerConfig } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/organize.test.ts b/packages/grafana-data/src/transformations/transformers/organize.test.ts index 34a73672dc6..ce5eb838a56 100644 --- a/packages/grafana-data/src/transformations/transformers/organize.test.ts +++ b/packages/grafana-data/src/transformations/transformers/organize.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { FieldType, DataTransformerConfig } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/reduce.test.ts b/packages/grafana-data/src/transformations/transformers/reduce.test.ts index 3cb46763a54..45c1648223e 100644 --- a/packages/grafana-data/src/transformations/transformers/reduce.test.ts +++ b/packages/grafana-data/src/transformations/transformers/reduce.test.ts @@ -1,4 +1,4 @@ -import { DataFrameView } from '../../dataframe'; +import { DataFrameView } from '../../dataframe/DataFrameView'; import { toDataFrame } from '../../dataframe/processDataFrame'; import { DataTransformerConfig, Field, FieldType } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; diff --git a/packages/grafana-data/src/transformations/transformers/reduce.ts b/packages/grafana-data/src/transformations/transformers/reduce.ts index 79587beb103..22b19705a65 100644 --- a/packages/grafana-data/src/transformations/transformers/reduce.ts +++ b/packages/grafana-data/src/transformations/transformers/reduce.ts @@ -1,7 +1,7 @@ import { map } from 'rxjs/operators'; import { guessFieldTypeForField } from '../../dataframe/processDataFrame'; -import { getFieldDisplayName } from '../../field'; +import { getFieldDisplayName } from '../../field/fieldState'; import { KeyValue } from '../../types/data'; import { DataFrame, Field, FieldType } from '../../types/dataFrame'; import { DataTransformerInfo, FieldMatcher, MatcherConfig } from '../../types/transformations'; diff --git a/packages/grafana-data/src/transformations/transformers/rename.test.ts b/packages/grafana-data/src/transformations/transformers/rename.test.ts index ca9f379dcb9..75e1ad9bc52 100644 --- a/packages/grafana-data/src/transformations/transformers/rename.test.ts +++ b/packages/grafana-data/src/transformations/transformers/rename.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { FieldType, DataTransformerConfig } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/renameByRegex.test.ts b/packages/grafana-data/src/transformations/transformers/renameByRegex.test.ts index 26e5b438d49..36629c57081 100644 --- a/packages/grafana-data/src/transformations/transformers/renameByRegex.test.ts +++ b/packages/grafana-data/src/transformations/transformers/renameByRegex.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { FieldType, DataTransformerConfig } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/seriesToRows.test.ts b/packages/grafana-data/src/transformations/transformers/seriesToRows.test.ts index 23f6de76225..617af200c82 100644 --- a/packages/grafana-data/src/transformations/transformers/seriesToRows.test.ts +++ b/packages/grafana-data/src/transformations/transformers/seriesToRows.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../../dataframe'; +import { toDataFrame } from '../../dataframe/processDataFrame'; import { DataTransformerConfig, Field, FieldType } from '../../types'; import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry'; import { transformDataFrame } from '../transformDataFrame'; diff --git a/packages/grafana-data/src/transformations/transformers/seriesToRows.ts b/packages/grafana-data/src/transformations/transformers/seriesToRows.ts index cf0793ef7d0..bec6c6939c9 100644 --- a/packages/grafana-data/src/transformations/transformers/seriesToRows.ts +++ b/packages/grafana-data/src/transformations/transformers/seriesToRows.ts @@ -1,7 +1,8 @@ import { omit } from 'lodash'; import { map } from 'rxjs/operators'; -import { MutableDataFrame, sortDataFrame } from '../../dataframe'; +import { MutableDataFrame } from '../../dataframe/MutableDataFrame'; +import { sortDataFrame } from '../../dataframe/processDataFrame'; import { isTimeSeriesFrames } from '../../dataframe/utils'; import { getFrameDisplayName } from '../../field/fieldState'; import { diff --git a/packages/grafana-data/src/transformations/transformers/sortBy.ts b/packages/grafana-data/src/transformations/transformers/sortBy.ts index 58315815621..ce323c1e095 100644 --- a/packages/grafana-data/src/transformations/transformers/sortBy.ts +++ b/packages/grafana-data/src/transformations/transformers/sortBy.ts @@ -1,7 +1,7 @@ import { map } from 'rxjs/operators'; -import { sortDataFrame } from '../../dataframe'; -import { getFieldDisplayName } from '../../field'; +import { sortDataFrame } from '../../dataframe/processDataFrame'; +import { getFieldDisplayName } from '../../field/fieldState'; import { DataFrame } from '../../types'; import { DataTransformContext, DataTransformerInfo } from '../../types/transformations'; diff --git a/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts b/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts index b5a0e74f34f..54b80c62dec 100644 --- a/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts +++ b/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts @@ -2,10 +2,10 @@ import { ComponentType } from 'react'; import { NumberFieldConfigSettings, - SliderFieldConfigSettings, SelectFieldConfigSettings, + SliderFieldConfigSettings, StringFieldConfigSettings, -} from '../field'; +} from '../field/overrides/processors'; import { RegistryItem, Registry } from '../utils/Registry'; import { OptionEditorConfig } from './options'; diff --git a/packages/grafana-data/src/types/displayValue.ts b/packages/grafana-data/src/types/displayValue.ts index 845b4bce482..05742e44ca3 100644 --- a/packages/grafana-data/src/types/displayValue.ts +++ b/packages/grafana-data/src/types/displayValue.ts @@ -1,4 +1,4 @@ -import { FormattedValue } from '../valueFormats'; +import { FormattedValue } from '../valueFormats/valueFormats'; export type DisplayProcessor = (value: unknown, decimals?: DecimalCount) => DisplayValue; diff --git a/packages/grafana-data/src/types/fieldOverrides.ts b/packages/grafana-data/src/types/fieldOverrides.ts index 1ca74a3be06..975c2dd729a 100644 --- a/packages/grafana-data/src/types/fieldOverrides.ts +++ b/packages/grafana-data/src/types/fieldOverrides.ts @@ -1,6 +1,7 @@ import { ComponentType } from 'react'; -import { StandardEditorProps, FieldConfigOptionsRegistry, StandardEditorContext } from '../field'; +import { FieldConfigOptionsRegistry } from '../field/FieldConfigOptionsRegistry'; +import { StandardEditorContext, StandardEditorProps } from '../field/standardFieldConfigEditorRegistry'; import { GrafanaTheme2 } from '../themes'; import { MatcherConfig, diff --git a/packages/grafana-data/src/types/panel.ts b/packages/grafana-data/src/types/panel.ts index 00baaae7686..48e01ec0d74 100644 --- a/packages/grafana-data/src/types/panel.ts +++ b/packages/grafana-data/src/types/panel.ts @@ -1,8 +1,8 @@ import { defaultsDeep } from 'lodash'; import { EventBus } from '../events'; -import { StandardEditorProps } from '../field'; -import { Registry } from '../utils'; +import { StandardEditorProps } from '../field/standardFieldConfigEditorRegistry'; +import { Registry } from '../utils/Registry'; import { OptionsEditorItem } from './OptionsUIRegistryBuilder'; import { ScopedVars } from './ScopedVars'; diff --git a/packages/grafana-data/src/utils/OptionsUIBuilders.ts b/packages/grafana-data/src/utils/OptionsUIBuilders.ts index 87c70303ac9..0d5a8bb1751 100644 --- a/packages/grafana-data/src/utils/OptionsUIBuilders.ts +++ b/packages/grafana-data/src/utils/OptionsUIBuilders.ts @@ -1,22 +1,24 @@ import { set, cloneDeep } from 'lodash'; import { + FieldNamePickerConfigSettings, + NumberFieldConfigSettings, + SelectFieldConfigSettings, + SliderFieldConfigSettings, + StringFieldConfigSettings, + UnitFieldConfigSettings, + booleanOverrideProcessor, + identityOverrideProcessor, numberOverrideProcessor, selectOverrideProcessor, stringOverrideProcessor, - booleanOverrideProcessor, - standardEditorsRegistry, - SelectFieldConfigSettings, - StandardEditorProps, - StringFieldConfigSettings, - NumberFieldConfigSettings, - SliderFieldConfigSettings, - identityOverrideProcessor, - UnitFieldConfigSettings, unitOverrideProcessor, - FieldNamePickerConfigSettings, +} from '../field/overrides/processors'; +import { StandardEditorContext, -} from '../field'; + StandardEditorProps, + standardEditorsRegistry, +} from '../field/standardFieldConfigEditorRegistry'; import { PanelOptionsSupplier } from '../panel/PanelPlugin'; import { isObject } from '../types'; import { OptionsEditorItem, OptionsUIRegistryBuilder } from '../types/OptionsUIRegistryBuilder'; diff --git a/packages/grafana-data/src/utils/Registry.test.ts b/packages/grafana-data/src/utils/Registry.test.ts index b1d30bb6bf7..60a4c3027b3 100644 --- a/packages/grafana-data/src/utils/Registry.test.ts +++ b/packages/grafana-data/src/utils/Registry.test.ts @@ -1,4 +1,4 @@ -import { FieldReducerInfo, fieldReducers, ReducerID } from '../transformations'; +import { fieldReducers, FieldReducerInfo, ReducerID } from '../transformations/fieldReducer'; import { Registry } from './Registry'; diff --git a/packages/grafana-data/src/utils/csv.test.ts b/packages/grafana-data/src/utils/csv.test.ts index 183459812ff..b157d40cb4c 100644 --- a/packages/grafana-data/src/utils/csv.test.ts +++ b/packages/grafana-data/src/utils/csv.test.ts @@ -1,9 +1,9 @@ // Test with local CSV files import fs from 'fs'; -import { MutableDataFrame } from '../dataframe'; +import { MutableDataFrame } from '../dataframe/MutableDataFrame'; import { getDataFrameRow, toDataFrameDTO } from '../dataframe/processDataFrame'; -import { getDisplayProcessor } from '../field'; +import { getDisplayProcessor } from '../field/displayProcessor'; import { createTheme } from '../themes'; import { CSVHeaderStyle, readCSV, toCSV } from './csv'; diff --git a/packages/grafana-data/src/utils/csv.ts b/packages/grafana-data/src/utils/csv.ts index 61328d51fd1..d8d4e33d242 100644 --- a/packages/grafana-data/src/utils/csv.ts +++ b/packages/grafana-data/src/utils/csv.ts @@ -5,9 +5,9 @@ import Papa, { ParseConfig, Parser, ParseResult } from 'papaparse'; // Types import { MutableDataFrame } from '../dataframe/MutableDataFrame'; import { guessFieldTypeFromValue } from '../dataframe/processDataFrame'; -import { getFieldDisplayName } from '../field'; +import { getFieldDisplayName } from '../field/fieldState'; import { DataFrame, Field, FieldConfig, FieldType } from '../types'; -import { formattedValueToString } from '../valueFormats'; +import { formattedValueToString } from '../valueFormats/valueFormats'; export enum CSVHeaderStyle { full, diff --git a/packages/grafana-data/src/utils/flotPairs.test.ts b/packages/grafana-data/src/utils/flotPairs.test.ts index a17de17b971..67b3ba11aa6 100644 --- a/packages/grafana-data/src/utils/flotPairs.test.ts +++ b/packages/grafana-data/src/utils/flotPairs.test.ts @@ -1,4 +1,4 @@ -import { createDataFrame } from '../dataframe'; +import { createDataFrame } from '../dataframe/processDataFrame'; import { dateTime } from '../datetime/moment_wrapper'; import { TimeRange } from '../types/time'; diff --git a/packages/grafana-data/src/utils/index.ts b/packages/grafana-data/src/utils/index.ts deleted file mode 100644 index 0bece5b8160..00000000000 --- a/packages/grafana-data/src/utils/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as arrayUtils from './arrayUtils'; - -export * from './Registry'; -export * from './datasource'; -export * from './deprecationWarning'; -export * from './csv'; -export * from './labels'; -export * from './numbers'; -export * from './object'; -export * from './namedColorsPalette'; -export * from './series'; -export * from './binaryOperators'; -export * from './unaryOperators'; -export * from './nodeGraph'; -export * from './selectUtils'; -export * from './store'; -export * from './LocalStorageValueProvider'; -export { PanelOptionsEditorBuilder, FieldConfigEditorBuilder } from './OptionsUIBuilders'; -export { arrayUtils }; -export { getFlotPairs, getFlotPairsConstant } from './flotPairs'; -export { locationUtil } from './location'; -export { urlUtil, type UrlQueryMap, type UrlQueryValue, serializeStateToUrlParam, toURLRange } from './url'; -export { DataLinkBuiltInVars, mapInternalLinkToExplore } from './dataLinks'; -export { DocsId } from './docs'; -export { makeClassES5Compatible } from './makeClassES5Compatible'; -export { anyToNumber } from './anyToNumber'; -export { withLoadingIndicator, type WithLoadingIndicatorOptions } from './withLoadingIndicator'; -export { convertOldAngularValueMappings, LegacyMappingType } from './valueMappings'; -export { containsSearchFilter, type SearchFilterOptions, getSearchFilterScopedVar } from './variables'; -export { renderLegendFormat } from './legend'; -export { matchPluginId } from './matchPluginId'; diff --git a/packages/grafana-data/src/utils/tests/mockStandardProperties.ts b/packages/grafana-data/src/utils/tests/mockStandardProperties.ts index 5858cd0a51f..ef52b7f255e 100644 --- a/packages/grafana-data/src/utils/tests/mockStandardProperties.ts +++ b/packages/grafana-data/src/utils/tests/mockStandardProperties.ts @@ -1,4 +1,4 @@ -import { displayNameOverrideProcessor, identityOverrideProcessor } from '../../field'; +import { displayNameOverrideProcessor, identityOverrideProcessor } from '../../field/overrides/processors'; import { ThresholdsMode } from '../../types'; export const mockStandardProperties = () => { diff --git a/packages/grafana-data/src/utils/tests/mockTransformationsRegistry.ts b/packages/grafana-data/src/utils/tests/mockTransformationsRegistry.ts index 51aeb74eafa..0d502a641f8 100644 --- a/packages/grafana-data/src/utils/tests/mockTransformationsRegistry.ts +++ b/packages/grafana-data/src/utils/tests/mockTransformationsRegistry.ts @@ -1,4 +1,4 @@ -import { standardTransformersRegistry } from '../../transformations'; +import { standardTransformersRegistry } from '../../transformations/standardTransformersRegistry'; import { DataTransformerInfo } from '../../types'; export const mockTransformationsRegistry = (transformers: DataTransformerInfo[]) => { diff --git a/packages/grafana-data/src/utils/valueMappings.ts b/packages/grafana-data/src/utils/valueMappings.ts index b6a6c4b7499..352699259ee 100644 --- a/packages/grafana-data/src/utils/valueMappings.ts +++ b/packages/grafana-data/src/utils/valueMappings.ts @@ -1,4 +1,4 @@ -import { getActiveThreshold } from '../field'; +import { getActiveThreshold } from '../field/thresholds'; import { stringToJsRegex } from '../text/string'; import { MappingType, diff --git a/packages/grafana-data/src/valueFormats/index.ts b/packages/grafana-data/src/valueFormats/index.ts deleted file mode 100644 index c76a4438e41..00000000000 --- a/packages/grafana-data/src/valueFormats/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './valueFormats';