Skip to content

Commit

Permalink
Falling back to event definition specs when no event is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed Jan 9, 2025
1 parent 8e38958 commit 6ae0146
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import * as Immutable from 'immutable';
import uniq from 'lodash/uniq';

import View from 'views/logic/views/View';
import type { AbsoluteTimeRange, ElasticsearchQueryString, RelativeTimeRangeStartOnly } from 'views/logic/queries/Query';
import type {
AbsoluteTimeRange,
ElasticsearchQueryString,
RelativeTimeRangeStartOnly,
TimeRange,
} from 'views/logic/queries/Query';
import type { Event } from 'components/events/events/types';
import type { EventDefinition, SearchFilter } from 'components/event-definitions/event-definitions-types';
import QueryGenerator from 'views/logic/queries/QueryGenerator';
Expand Down Expand Up @@ -224,14 +229,18 @@ export const UseCreateViewForEvent = (
const eventQueryString = eventData?.replay_info?.query ?? eventDefinition?.config?.query ?? '';
const streams = eventData?.replay_info?.streams ?? eventDefinition?.config?.streams ?? [];
const streamCategories = eventData?.replay_info?.stream_categories ?? eventDefinition?.config?.stream_categories ?? [];
const timeRange: AbsoluteTimeRange = {
type: 'absolute',
from: eventData?.replay_info?.timerange_start,
to: eventData?.replay_info?.timerange_end,
};
const timeRange: TimeRange = eventData
? {
type: 'absolute',
from: eventData?.replay_info?.timerange_start,
to: eventData?.replay_info?.timerange_end,
} : {
type: 'relative',
range: (eventDefinition?.config?.search_within_ms ?? 0) / 1000,
};
const queryString: ElasticsearchQueryString = {
type: 'elasticsearch',
query_string: concatQueryStrings([eventQueryString, queryStringFromGrouping]),
query_string: eventData ? concatQueryStrings([eventQueryString, queryStringFromGrouping]) : (eventDefinition?.config?.query ?? ''),
};

const queryParameters = eventDefinition?.config?.query_parameters ?? [];
Expand Down

0 comments on commit 6ae0146

Please sign in to comment.