Annotations: Hide edit/delete if annotations are from loki (#96141)

add in logic to hide edit/delete on annotations from loki
This commit is contained in:
Kristina 2024-11-12 07:38:33 -06:00 committed by GitHub
parent ed623f52db
commit 06f2f62223
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,8 +22,10 @@ export const AnnotationTooltip2 = ({ annoVals, annoIdx, timeZone, onEdit }: Prop
const { canEditAnnotations = retFalse, canDeleteAnnotations = retFalse, onAnnotationDelete } = usePanelContext();
const dashboardUID = annoVals.dashboardUID?.[annoIdx];
const canEdit = canEditAnnotations(dashboardUID);
const canDelete = canDeleteAnnotations(dashboardUID) && onAnnotationDelete != null;
// grafana can be configured to load alert rules from loki. Those annotations cannot be edited or deleted. The id being 0 is the best indicator the annotation came from loki
const canEdit = annoId !== 0 && canEditAnnotations(dashboardUID);
const canDelete = annoId !== 0 && canDeleteAnnotations(dashboardUID) && onAnnotationDelete != null;
const timeFormatter = (value: number) =>
dateTimeFormat(value, {