{panel && isPanelJSON && canEdit && (
)}
{show === ShowContent.DataFrames && dashboard !== undefined && (
)}
{({ height }) => (
100}
value={text || ''}
readOnly={!isPanelJSON}
onBlur={setText}
/>
)}
);
}
async function getJSONObject(show: ShowContent, panel?: PanelModel, data?: PanelData) {
if (show === ShowContent.PanelData) {
reportPanelInspectInteraction(InspectTab.JSON, 'panelData');
return data;
}
if (show === ShowContent.DataFrames) {
reportPanelInspectInteraction(InspectTab.JSON, 'dataFrame');
let d = data;
// do not include transforms and
if (panel && data?.state === LoadingState.Done) {
d = await firstValueFrom(
panel.getQueryRunner().getData({
withFieldConfig: false,
withTransforms: false,
})
);
}
return getPanelDataFrames(d);
}
if (show === ShowContent.PanelJSON && panel) {
reportPanelInspectInteraction(InspectTab.JSON, 'panelJSON');
return panel!.getSaveModel();
}
return { note: t('dashboard.inspect-json.unknown', 'Unknown Object: {{show}}', { show }) };
}