mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations: Fix annotation title (#85614)
This commit is contained in:
parent
391d2ba7c7
commit
5f0ca1429b
@ -1533,7 +1533,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/features/alerting/state/query_part.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
|
@ -207,6 +207,25 @@ function getAlertAnnotationInfo(ah: any) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Copy of getAlertAnnotationInfo, used in annotation tooltip
|
||||
function getAlertAnnotationText(annotationData: any) {
|
||||
// backward compatibility, can be removed in grafana 5.x
|
||||
// old way stored evalMatches in data property directly,
|
||||
// new way stores it in evalMatches property on new data object
|
||||
|
||||
if (isArray(annotationData)) {
|
||||
return joinEvalMatches(annotationData, ', ');
|
||||
} else if (isArray(annotationData.evalMatches)) {
|
||||
return joinEvalMatches(annotationData.evalMatches, ', ');
|
||||
}
|
||||
|
||||
if (annotationData.error) {
|
||||
return 'Error: ' + annotationData.error;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
export default {
|
||||
alertQueryDef: alertQueryDef,
|
||||
getStateDisplayModel: getStateDisplayModel,
|
||||
@ -218,5 +237,6 @@ export default {
|
||||
reducerTypes: reducerTypes,
|
||||
createReducerPart: createReducerPart,
|
||||
getAlertAnnotationInfo: getAlertAnnotationInfo,
|
||||
getAlertAnnotationText: getAlertAnnotationText,
|
||||
alertStateSortScore: alertStateSortScore,
|
||||
};
|
||||
|
@ -54,9 +54,9 @@ export const AnnotationTooltip2 = ({ annoVals, annoIdx, timeZone, onEdit }: Prop
|
||||
</div>
|
||||
);
|
||||
|
||||
// alertText = alertDef.getAlertAnnotationInfo(annotation); // @TODO ??
|
||||
alertText = annoVals.data?.[annoIdx] ? alertDef.getAlertAnnotationText(annoVals.data[annoIdx]) : '';
|
||||
} else if (annoVals.title?.[annoIdx]) {
|
||||
text = annoVals.title[annoIdx] + text ? `<br />${text}` : '';
|
||||
text = annoVals.title[annoIdx] + (text ? `<br />${text}` : '');
|
||||
}
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user