mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations: Fix annotation line and marker colors (#35608)
This commit is contained in:
parent
1974bbb873
commit
75ff02a9fb
@ -160,7 +160,7 @@ function addRegionMarking(regions: any[], flotOptions: { grid: { markings: any }
|
||||
|
||||
each(regions, (region) => {
|
||||
if (region.source) {
|
||||
fillColor = region.source.iconColor || defaultColor;
|
||||
fillColor = region.color || defaultColor;
|
||||
} else {
|
||||
fillColor = defaultColor;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ describe('AnnotationsWorker', () => {
|
||||
snapshotData: undefined,
|
||||
datasource: 'Legacy',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
},
|
||||
@ -133,7 +133,7 @@ describe('AnnotationsWorker', () => {
|
||||
snapshotData: undefined,
|
||||
datasource: 'NextGen',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
},
|
||||
@ -167,7 +167,7 @@ describe('AnnotationsWorker', () => {
|
||||
snapshotData: undefined,
|
||||
datasource: 'NextGen',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
},
|
||||
@ -204,7 +204,7 @@ describe('AnnotationsWorker', () => {
|
||||
snapshotData: undefined,
|
||||
datasource: 'Legacy',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
},
|
||||
@ -244,7 +244,7 @@ describe('AnnotationsWorker', () => {
|
||||
snapshotData: undefined,
|
||||
datasource: 'Legacy',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
},
|
||||
|
@ -247,7 +247,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
||||
},
|
||||
annotations: [
|
||||
{
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
id: 'Legacy',
|
||||
isRegion: false,
|
||||
source: {
|
||||
@ -262,7 +262,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
||||
type: 'Test',
|
||||
},
|
||||
{
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
id: 'NextGen',
|
||||
isRegion: false,
|
||||
source: {
|
||||
@ -285,7 +285,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
||||
id: 'Snapshotted',
|
||||
name: 'Test',
|
||||
},
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
isRegion: true,
|
||||
source: {
|
||||
datasource: 'Legacy',
|
||||
|
@ -77,7 +77,7 @@ describe('SnapshotWorker', () => {
|
||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||
timeEnd: undefined,
|
||||
time: 1,
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
});
|
||||
@ -86,7 +86,7 @@ describe('SnapshotWorker', () => {
|
||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||
timeEnd: 2,
|
||||
time: 1,
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: true,
|
||||
});
|
||||
@ -95,7 +95,7 @@ describe('SnapshotWorker', () => {
|
||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||
timeEnd: 1,
|
||||
time: 1,
|
||||
color: 'pink',
|
||||
color: '#ffc0cb',
|
||||
type: 'Test',
|
||||
isRegion: false,
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { AnnotationEvent, AnnotationQuery, DataFrame, DataFrameView } from '@grafana/data';
|
||||
import { toDataQueryError } from '@grafana/runtime';
|
||||
import { config, toDataQueryError } from '@grafana/runtime';
|
||||
|
||||
import { dispatch } from 'app/store/store';
|
||||
import { createErrorNotification } from '../../../../core/copy/appNotification';
|
||||
@ -55,7 +55,7 @@ export function translateQueryResult(annotation: AnnotationQuery, results: Annot
|
||||
|
||||
for (const item of results) {
|
||||
item.source = annotation;
|
||||
item.color = annotation.iconColor;
|
||||
item.color = config.theme2.visualization.getColorByName(annotation.iconColor);
|
||||
item.type = annotation.name;
|
||||
item.isRegion = Boolean(item.timeEnd && item.time !== item.timeEnd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user