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) => {
|
each(regions, (region) => {
|
||||||
if (region.source) {
|
if (region.source) {
|
||||||
fillColor = region.source.iconColor || defaultColor;
|
fillColor = region.color || defaultColor;
|
||||||
} else {
|
} else {
|
||||||
fillColor = defaultColor;
|
fillColor = defaultColor;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ describe('AnnotationsWorker', () => {
|
|||||||
snapshotData: undefined,
|
snapshotData: undefined,
|
||||||
datasource: 'Legacy',
|
datasource: 'Legacy',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
},
|
},
|
||||||
@ -133,7 +133,7 @@ describe('AnnotationsWorker', () => {
|
|||||||
snapshotData: undefined,
|
snapshotData: undefined,
|
||||||
datasource: 'NextGen',
|
datasource: 'NextGen',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
},
|
},
|
||||||
@ -167,7 +167,7 @@ describe('AnnotationsWorker', () => {
|
|||||||
snapshotData: undefined,
|
snapshotData: undefined,
|
||||||
datasource: 'NextGen',
|
datasource: 'NextGen',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
},
|
},
|
||||||
@ -204,7 +204,7 @@ describe('AnnotationsWorker', () => {
|
|||||||
snapshotData: undefined,
|
snapshotData: undefined,
|
||||||
datasource: 'Legacy',
|
datasource: 'Legacy',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
},
|
},
|
||||||
@ -244,7 +244,7 @@ describe('AnnotationsWorker', () => {
|
|||||||
snapshotData: undefined,
|
snapshotData: undefined,
|
||||||
datasource: 'Legacy',
|
datasource: 'Legacy',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
},
|
},
|
||||||
|
@ -247,7 +247,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
|||||||
},
|
},
|
||||||
annotations: [
|
annotations: [
|
||||||
{
|
{
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
id: 'Legacy',
|
id: 'Legacy',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
source: {
|
source: {
|
||||||
@ -262,7 +262,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
|||||||
type: 'Test',
|
type: 'Test',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
id: 'NextGen',
|
id: 'NextGen',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
source: {
|
source: {
|
||||||
@ -285,7 +285,7 @@ function getExpectedForAllResult(): DashboardQueryRunnerResult {
|
|||||||
id: 'Snapshotted',
|
id: 'Snapshotted',
|
||||||
name: 'Test',
|
name: 'Test',
|
||||||
},
|
},
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
isRegion: true,
|
isRegion: true,
|
||||||
source: {
|
source: {
|
||||||
datasource: 'Legacy',
|
datasource: 'Legacy',
|
||||||
|
@ -77,7 +77,7 @@ describe('SnapshotWorker', () => {
|
|||||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||||
timeEnd: undefined,
|
timeEnd: undefined,
|
||||||
time: 1,
|
time: 1,
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
});
|
});
|
||||||
@ -86,7 +86,7 @@ describe('SnapshotWorker', () => {
|
|||||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||||
timeEnd: 2,
|
timeEnd: 2,
|
||||||
time: 1,
|
time: 1,
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: true,
|
isRegion: true,
|
||||||
});
|
});
|
||||||
@ -95,7 +95,7 @@ describe('SnapshotWorker', () => {
|
|||||||
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
source: { enable: true, hide: false, name: 'Test', iconColor: 'pink' },
|
||||||
timeEnd: 1,
|
timeEnd: 1,
|
||||||
time: 1,
|
time: 1,
|
||||||
color: 'pink',
|
color: '#ffc0cb',
|
||||||
type: 'Test',
|
type: 'Test',
|
||||||
isRegion: false,
|
isRegion: false,
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { AnnotationEvent, AnnotationQuery, DataFrame, DataFrameView } from '@grafana/data';
|
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 { dispatch } from 'app/store/store';
|
||||||
import { createErrorNotification } from '../../../../core/copy/appNotification';
|
import { createErrorNotification } from '../../../../core/copy/appNotification';
|
||||||
@ -55,7 +55,7 @@ export function translateQueryResult(annotation: AnnotationQuery, results: Annot
|
|||||||
|
|
||||||
for (const item of results) {
|
for (const item of results) {
|
||||||
item.source = annotation;
|
item.source = annotation;
|
||||||
item.color = annotation.iconColor;
|
item.color = config.theme2.visualization.getColorByName(annotation.iconColor);
|
||||||
item.type = annotation.name;
|
item.type = annotation.name;
|
||||||
item.isRegion = Boolean(item.timeEnd && item.time !== item.timeEnd);
|
item.isRegion = Boolean(item.timeEnd && item.time !== item.timeEnd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user