Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let field charts use the stream and time range of the current search #1938

Merged
merged 1 commit into from Mar 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 10 additions & 25 deletions graylog2-web-interface/src/legacy/analyzers/fieldcharts.js
Expand Up @@ -80,45 +80,30 @@ export const FieldChart = {
opts.valuetype = 'mean';
}

if (opts.streamid === undefined) {
opts.streamid = '';
}

if (opts.query === undefined) {
opts.query = searchParams.query;
}

if (opts.rangetype === undefined) {
opts.rangetype = searchParams.range_type;
}

if (opts.range === undefined) {
opts.range = {};
}

if (opts.createdAt === undefined) {
opts.createdAt = moment().valueOf();
}

// Always get stream and time range params from the current search request.
// Ignore the streamid, rangetype and range params that have been stored in localStorage. (see FieldGraphsStore)
opts.streamid = searchParams.streamId;
opts.rangetype = searchParams.range_type;
opts.range = {};

switch (opts.rangetype) {
case 'relative':
if (opts.range.relative === undefined) {
opts.range.relative = searchParams.relative;
}
opts.range.relative = searchParams.relative;
break;
case 'absolute':
if (opts.range.from === undefined) {
opts.range.from = searchParams.from;
}

if (opts.range.to === undefined) {
opts.range.to = searchParams.to;
}
opts.range.from = searchParams.from;
opts.range.to = searchParams.to;
break;
case 'keyword':
if (opts.range.keyword === undefined) {
opts.range.keyword = searchParams.keyword;
}
opts.range.keyword = searchParams.keyword;
break;
default:
}
Expand Down