Skip to content

Commit 9035a49

Browse files
authored
Chore: Export closestIdx function from @grafana/data (#76176)
* export calculateFieldDisplayName function * export closestIdx function * Use getFieldDisplayName
1 parent 8d9ef71 commit 9035a49

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/grafana-data/src/dataframe/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export * from './ArrayDataFrame';
88
export * from './DataFrameJSON';
99
export * from './frameComparisons';
1010
export { anySeriesWithTimeField, isTimeSeriesFrame, isTimeSeriesFrames } from './utils';
11-
export { StreamingDataFrame, StreamingFrameAction, type StreamingFrameOptions } from './StreamingDataFrame';
11+
export { StreamingDataFrame, StreamingFrameAction, type StreamingFrameOptions, closestIdx } from './StreamingDataFrame';

public/app/features/live/data/amendTimeSeries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { closestIdx } from '@grafana/data/src/dataframe/StreamingDataFrame';
1+
import { closestIdx } from '@grafana/data';
22

33
export type Table = [times: number[], ...values: any[][]];
44

public/app/plugins/datasource/prometheus/result_transformer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import {
1414
FieldType,
1515
formatLabels,
1616
getDisplayProcessor,
17+
getFieldDisplayName,
1718
Labels,
19+
renderLegendFormat,
1820
ScopedVars,
1921
TIME_SERIES_TIME_FIELD_NAME,
2022
TIME_SERIES_VALUE_FIELD_NAME,
21-
renderLegendFormat,
2223
} from '@grafana/data';
23-
import { calculateFieldDisplayName } from '@grafana/data/src/field/fieldState';
2424
import { config, FetchResponse, getDataSourceSrv, getTemplateSrv } from '@grafana/runtime';
2525

2626
import {
@@ -79,7 +79,7 @@ export function transformV2(
7979
f.fields.forEach((field) => {
8080
if (field.labels?.__name__ && field.labels?.__name__ === field.name) {
8181
const fieldCopy = { ...field, name: TIME_SERIES_VALUE_FIELD_NAME };
82-
field.config.displayNameFromDS = calculateFieldDisplayName(fieldCopy, f, response.data);
82+
field.config.displayNameFromDS = getFieldDisplayName(fieldCopy, f, response.data);
8383
}
8484
});
8585
}

0 commit comments

Comments
 (0)