Annotations: Fix annotation line and marker colors (#35608)

This commit is contained in:
Torkel Ödegaard 2021-06-14 11:36:33 +02:00 committed by GitHub
parent 1974bbb873
commit 75ff02a9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View File

@ -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;
}

View File

@ -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,
},

View File

@ -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',

View File

@ -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,
});

View File

@ -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);