Annotations: Avoid crash when listing panels (that are rows) (#66869)

This commit is contained in:
Adela Almasan 2023-04-21 15:50:45 -05:00 committed by GitHub
parent faad4b92ad
commit b992bdb62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,6 +142,10 @@ export const AnnotationSettingsEdit = ({ editIdx, dashboard }: Props) => {
const panels: Array<SelectableValue<number>> = useMemo( const panels: Array<SelectableValue<number>> = useMemo(
() => () =>
dashboard?.panels dashboard?.panels
// Filtering out rows at the moment, revisit to only include panels that support annotations
// However the information to know if a panel supports annotations requires it to be already loaded
// panel.plugin?.dataSupport?.annotations
.filter((panel) => config.panels[panel.type])
.map((panel) => ({ .map((panel) => ({
value: panel.id, value: panel.id,
label: panel.title ?? `Panel ${panel.id}`, label: panel.title ?? `Panel ${panel.id}`,