mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
Explore: Align multiple log volumes (#64356)
* Align log volumes on x an y axes * Move helper functions to logs/utils * Add tests * Simplify supplementaryQueries.ts * Fix tests * Revert code simplifications To simplify the PR, this can be added in a separate PR * Fix reusing logs volume when limited/non-limited are used * Use more specific property name * Add missing property * Stretch graph to selected range but only if there's data available * Fix unit tests * Fix calculating maximum when bars are stacked * Sort log volumes by data source name * Simplify logic to determine if log volumes can be zoomed in
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
LogRowModel,
|
||||
LogsDedupStrategy,
|
||||
LogsMetaKind,
|
||||
LogsVolumeCustomMetaData,
|
||||
LogsVolumeType,
|
||||
MutableDataFrame,
|
||||
sortDataFrame,
|
||||
@@ -1207,6 +1208,16 @@ describe('logs volume', () => {
|
||||
it('applies correct meta data', async () => {
|
||||
setup(setupMultipleResults);
|
||||
|
||||
const logVolumeCustomMeta: LogsVolumeCustomMetaData = {
|
||||
sourceQuery: { refId: 'A', target: 'volume query 1' } as DataQuery,
|
||||
datasourceName: 'loki',
|
||||
logsVolumeType: LogsVolumeType.FullRange,
|
||||
absoluteRange: {
|
||||
from: FROM.valueOf(),
|
||||
to: TO.valueOf(),
|
||||
},
|
||||
};
|
||||
|
||||
await expect(volumeProvider).toEmitValuesWith((received) => {
|
||||
expect(received).toContainEqual({ state: LoadingState.Loading, error: undefined, data: [] });
|
||||
expect(received).toContainEqual({
|
||||
@@ -1216,15 +1227,7 @@ describe('logs volume', () => {
|
||||
expect.objectContaining({
|
||||
fields: expect.anything(),
|
||||
meta: {
|
||||
custom: {
|
||||
sourceQuery: { refId: 'A', target: 'volume query 1' },
|
||||
datasourceName: 'loki',
|
||||
logsVolumeType: LogsVolumeType.FullRange,
|
||||
absoluteRange: {
|
||||
from: FROM.valueOf(),
|
||||
to: TO.valueOf(),
|
||||
},
|
||||
},
|
||||
custom: logVolumeCustomMeta,
|
||||
},
|
||||
}),
|
||||
expect.anything(),
|
||||
@@ -1236,6 +1239,16 @@ describe('logs volume', () => {
|
||||
it('applies correct meta data when streaming', async () => {
|
||||
setup(setupMultipleResultsStreaming);
|
||||
|
||||
const logVolumeCustomMeta: LogsVolumeCustomMetaData = {
|
||||
sourceQuery: { refId: 'A', target: 'volume query 1' } as DataQuery,
|
||||
datasourceName: 'loki',
|
||||
logsVolumeType: LogsVolumeType.FullRange,
|
||||
absoluteRange: {
|
||||
from: FROM.valueOf(),
|
||||
to: TO.valueOf(),
|
||||
},
|
||||
};
|
||||
|
||||
await expect(volumeProvider).toEmitValuesWith((received) => {
|
||||
expect(received).toContainEqual({ state: LoadingState.Loading, error: undefined, data: [] });
|
||||
expect(received).toContainEqual({
|
||||
@@ -1245,15 +1258,7 @@ describe('logs volume', () => {
|
||||
expect.objectContaining({
|
||||
fields: expect.anything(),
|
||||
meta: {
|
||||
custom: {
|
||||
sourceQuery: { refId: 'A', target: 'volume query 1' },
|
||||
datasourceName: 'loki',
|
||||
logsVolumeType: LogsVolumeType.FullRange,
|
||||
absoluteRange: {
|
||||
from: FROM.valueOf(),
|
||||
to: TO.valueOf(),
|
||||
},
|
||||
},
|
||||
custom: logVolumeCustomMeta,
|
||||
},
|
||||
}),
|
||||
expect.anything(),
|
||||
|
||||
Reference in New Issue
Block a user