-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Related to #83652
As explained in this comment, we have this buildTabularInspectorData function lingering around the data plugin. Currently it is only used by esaggs, specifically in the request handler which updates the inspector adapters with the request/response data so that it appears in the inspector view.
This was originally in place to support inspector in expressions, but at this point we can probably get rid of it. Rather, we should update buildTabularInspectorData to work with the new shared Datatable format. Then individual chart functions can log the final data to inspector (as further modifications could be happening after esaggs):
import { Datatable } from 'src/plugins/expressions/common';
import { TabularData } from 'src/plugins/inspector/common';
buildTabularInspectorData: (data: Datatable) => Promise<TabularData>This could be exposed on the data plugin's runtime contract -- (probably on the search service? since we will likely move the inspector data updates to SearchSource) -- so that it can already know about filters & field formats. Usage would look something like:
if (inspectorAdapters.data) {
inspectorAdapters.data.setTabularLoader(
() =>
await data.search.buildTabularInspectorData(myChartDatatable),
{ returnsFormattedValues: true }
);
}If we needed the ability to have the helper return unformatted values, we could add an option:
if (inspectorAdapters.data) {
inspectorAdapters.data.setTabularLoader(
() =>
await data.search.buildTabularInspectorData(myChartDatatable, { formatValues: false }),
{ returnsFormattedValues: false }
);
}Tasks:
- Refactor
buildTabularInspectorDatato handle the newDatatableformat and expose fromdataplugin contract - Update the corresponding data inspector view so that the UI works with the new output of
buildTabularInspectorData - Remove the call to
inspectorAdapters.data.setTabularLoaderfromesaggsand add it to each chart function instead - Keep an eye out to make sure no circular dependencies are introduced (
datadepends onexpressionsandinspector, andexpressionsalso depends oninspector)