mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Annotation UI text edits (#32458)
* Update event_editor.html * Update annotations_srv.ts * Update editor_ctrl.ts * Update standardAnnotationSupport.ts
This commit is contained in:
parent
e5027982ef
commit
56159a1c43
@ -55,12 +55,12 @@ export class AnnotationsSrv {
|
||||
.then((results) => {
|
||||
// combine the annotations and flatten results
|
||||
let annotations: AnnotationEvent[] = flattenDeep(results[0]);
|
||||
// when in edit mode we need to use this function to get the saved id
|
||||
// when in edit mode we need to use this function to get the saved ID
|
||||
let panelFilterId = options.panel.getSavedId();
|
||||
|
||||
// filter out annotations that do not belong to requesting panel
|
||||
annotations = annotations.filter((item) => {
|
||||
// if event has panel id and query is of type dashboard then panel and requesting panel id must match
|
||||
// if event has panel ID and query is of type dashboard then panel and requesting panel ID must match
|
||||
if (item.panelId && item.source.type === 'dashboard') {
|
||||
return item.panelId === panelFilterId;
|
||||
}
|
||||
@ -154,7 +154,7 @@ export class AnnotationsSrv {
|
||||
dashboard: dashboard,
|
||||
});
|
||||
}
|
||||
// Note: future annotatoin lifecycle will use observables directly
|
||||
// Note: future annotation lifecycle will use observables directly
|
||||
return executeAnnotationQuery(options, datasource, annotation)
|
||||
.toPromise()
|
||||
.then((res) => {
|
||||
|
@ -33,12 +33,12 @@ export class AnnotationsEditorCtrl {
|
||||
buttonTitle: 'Add Annotation Query',
|
||||
infoBox: {
|
||||
__html: `<p>Annotations provide a way to integrate event data into your graphs. They are visualized as vertical lines
|
||||
and icons on all graph panels. When you hover over an annotation icon you can get event text & tags for
|
||||
the event. You can add annotation events directly from grafana by holding CTRL or CMD + click on graph (or
|
||||
and icons on all graph panels. When you hover over an annotation icon you can get event text and tags for
|
||||
the event. You can add annotation events directly from Grafana by holding Ctrl or CMD + click on graph (or
|
||||
drag region). These will be stored in Grafana's annotation database.
|
||||
</p>
|
||||
Checkout the
|
||||
<a class='external-link' target='_blank' href='http://docs.grafana.org/reference/annotations/'
|
||||
Check out the
|
||||
<a class='external-link' target='_blank' href='https://grafana.com/docs/grafana/latest/dashboards/annotations/'
|
||||
>Annotations documentation</a
|
||||
>
|
||||
for more information.`,
|
||||
@ -86,7 +86,7 @@ export class AnnotationsEditorCtrl {
|
||||
});
|
||||
|
||||
if (!replaced) {
|
||||
console.warn('updating annotatoin, but not in the dashboard', annotation);
|
||||
console.warn('updating annotation, but not in the dashboard', annotation);
|
||||
}
|
||||
|
||||
this.currentAnnotation = annotation;
|
||||
@ -132,7 +132,7 @@ export class AnnotationsEditorCtrl {
|
||||
add() {
|
||||
const sameName: any = _.find(this.dashboard.annotations.list, { name: this.currentAnnotation.name });
|
||||
if (sameName) {
|
||||
appEvents.emit(AppEvents.alertWarning, ['Validation', 'Annotations with the same name already exists']);
|
||||
appEvents.emit(AppEvents.alertWarning, ['Validation', 'Annotation with the same name already exists']);
|
||||
return;
|
||||
}
|
||||
this.dashboard.annotations.list = [...this.dashboard.annotations.list, this.currentAnnotation];
|
||||
|
@ -5,8 +5,8 @@
|
||||
</div>
|
||||
|
||||
<div class="graph-annotation__title">
|
||||
<span ng-if="!ctrl.event.id">Add Annotation</span>
|
||||
<span ng-if="ctrl.event.id">Edit Annotation</span>
|
||||
<span ng-if="!ctrl.event.id">Add annotation</span>
|
||||
<span ng-if="ctrl.event.id">Edit annotation</span>
|
||||
</div>
|
||||
|
||||
<div class="graph-annotation__time">{{ctrl.timeFormated}}</div>
|
||||
|
@ -35,8 +35,8 @@ export const standardAnnotationSupport: AnnotationSupport = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert the stored JSON model and environment to a standard datasource query object.
|
||||
* This query will be executed in the datasource and the results converted into events.
|
||||
* Convert the stored JSON model and environment to a standard data source query object.
|
||||
* This query will be executed in the data source and the results converted into events.
|
||||
* Returning an undefined result will quietly skip query execution
|
||||
*/
|
||||
prepareQuery: (anno: AnnotationQuery) => anno.target,
|
||||
|
Loading…
Reference in New Issue
Block a user