Skip to content

Commit 7778f8a

Browse files
committed
pass normalized date selection to api payload
1 parent e396e43 commit 7778f8a

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/sentry/static/sentry/app/views/events/utils/getParams.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export function getParams(params: Params): {[key: string]: string | string[]} {
3030
// `statsPeriod` takes precendence for now
3131
let coercedPeriod = statsPeriod || period;
3232

33-
if (!start && !end && !coercedPeriod) {
33+
const isValid = (start && end) || coercedPeriod;
34+
35+
if (!isValid) {
3436
coercedPeriod = DEFAULT_STATS_PERIOD;
3537
}
3638

src/sentry/static/sentry/app/views/eventsV2/eventView.tsx

+19-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {DEFAULT_PER_PAGE} from 'app/constants';
55
import {EventViewv1} from 'app/types';
66
import {SavedQuery as LegacySavedQuery} from 'app/views/discover/types';
77
import {SavedQuery, NewQuery} from 'app/stores/discoverSavedQueriesStore';
8+
import {getParams} from 'app/views/events/utils/getParams';
89

910
import {AUTOLINK_FIELDS, SPECIAL_FIELDS, FIELD_FORMATTERS} from './data';
1011
import {MetaType, EventQuery, getAggregateAlias, decodeColumnOrder} from './utils';
@@ -786,17 +787,29 @@ class EventView {
786787

787788
const picked = pickRelevantLocationQueryStrings(location);
788789

790+
const normalizdTimeWindowParams = getParams({
791+
start: this.start,
792+
end: this.end,
793+
period: decodeScalar(query.period),
794+
statsPeriod: this.statsPeriod,
795+
utc: decodeScalar(query.utc),
796+
});
797+
789798
const sort = this.sorts.length > 0 ? encodeSort(this.sorts[0]) : undefined;
790799
const fields = this.getFields();
791800

792801
// generate event query
793802

794-
const eventQuery: EventQuery & LocationQuery = Object.assign(picked, {
795-
field: [...new Set(fields)],
796-
sort,
797-
per_page: DEFAULT_PER_PAGE,
798-
query: this.getQuery(query.query),
799-
});
803+
const eventQuery: EventQuery & LocationQuery = Object.assign(
804+
picked,
805+
normalizdTimeWindowParams,
806+
{
807+
field: [...new Set(fields)],
808+
sort,
809+
per_page: DEFAULT_PER_PAGE,
810+
query: this.getQuery(query.query),
811+
}
812+
);
800813

801814
if (!eventQuery.sort) {
802815
delete eventQuery.sort;

0 commit comments

Comments
 (0)