{"action":"created","comment":{"url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/comments/55826640","id":55826640,"diff_hunk":"@@ -0,0 +1,65 @@\n+import React from 'react';\n+import {DropdownButton, MenuItem} from 'react-bootstrap';\n+import naturalSort from 'javascript-natural-sort';\n+import SearchStore from 'stores/search/SearchStore';\n+\n+import moment from 'moment';\n+\n+const SurroundingSearchButton = React.createClass({\n+  propTypes: {\n+    id: React.PropTypes.string.isRequired,\n+    timestamp: React.PropTypes.number.isRequired,\n+    searchConfig: React.PropTypes.object.isRequired,\n+    messageFields: React.PropTypes.object.isRequired,\n+  },\n+\n+  _buildTimeRangeOptions(searchConfig) {\n+    const options = {};\n+\n+    Object.keys(searchConfig.surrounding_timerange_options).forEach((key) => {\n+      options[moment.duration(key).asSeconds()] = searchConfig.surrounding_timerange_options[key];\n+    });\n+\n+    return options;\n+  },\n+\n+  _buildFilterFields() {\n+    const fields = {};\n+\n+    if (this.props.searchConfig) {\n+      this.props.searchConfig.surrounding_filter_fields.forEach((field) => fields[field] = this.props.messageFields[field]);\n+    }\n+\n+    return fields;\n+  },\n+\n+  _onClick(range) {\n+    return (e) => {\n+      e.preventDefault();\n+\n+      const fromTime = moment.unix(this.props.timestamp - parseInt(range, 10)).toISOString();","path":"graylog2-web-interface/src/components/search/SurroundingSearchButton.jsx","position":40,"original_position":40,"commit_id":"6f97084534ab271ff5f1aab70703f1e6087077c3","original_commit_id":"6f97084534ab271ff5f1aab70703f1e6087077c3","user":{"login":"edmundoa","id":716185,"avatar_url":"https://avatars.githubusercontent.com/u/716185?v=3","gravatar_id":"","url":"https://api.github.com/users/edmundoa","html_url":"https://github.com/edmundoa","followers_url":"https://api.github.com/users/edmundoa/followers","following_url":"https://api.github.com/users/edmundoa/following{/other_user}","gists_url":"https://api.github.com/users/edmundoa/gists{/gist_id}","starred_url":"https://api.github.com/users/edmundoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edmundoa/subscriptions","organizations_url":"https://api.github.com/users/edmundoa/orgs","repos_url":"https://api.github.com/users/edmundoa/repos","events_url":"https://api.github.com/users/edmundoa/events{/privacy}","received_events_url":"https://api.github.com/users/edmundoa/received_events","type":"User","site_admin":false},"body":"What do we want to achieve with `parseInt`? I think we only use to convert the string `range` into a number, but then we should probably use `Number()` because of this:\r\n\r\n> “parseInt() is useful for parsing strings, but you have to be aware that it stops at the first illegal digit. Parsing strings via Number() is less forgiving, but may produce nonintegers.”\r\n\r\n> Excerpt From: Axel Rauschmayer. “Speaking JavaScript.”","created_at":"2016-03-11T13:06:53Z","updated_at":"2016-03-11T13:06:53Z","html_url":"https://github.com/Graylog2/graylog2-server/pull/1917#discussion_r55826640","pull_request_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917","_links":{"self":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/comments/55826640"},"html":{"href":"https://github.com/Graylog2/graylog2-server/pull/1917#discussion_r55826640"},"pull_request":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917"}}},"pull_request":{"url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917","id":62261735,"html_url":"https://github.com/Graylog2/graylog2-server/pull/1917","diff_url":"https://github.com/Graylog2/graylog2-server/pull/1917.diff","patch_url":"https://github.com/Graylog2/graylog2-server/pull/1917.patch","issue_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/1917","number":1917,"state":"open","locked":false,"title":"Search for surrounding messages","user":{"login":"bernd","id":461,"avatar_url":"https://avatars.githubusercontent.com/u/461?v=3","gravatar_id":"","url":"https://api.github.com/users/bernd","html_url":"https://github.com/bernd","followers_url":"https://api.github.com/users/bernd/followers","following_url":"https://api.github.com/users/bernd/following{/other_user}","gists_url":"https://api.github.com/users/bernd/gists{/gist_id}","starred_url":"https://api.github.com/users/bernd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bernd/subscriptions","organizations_url":"https://api.github.com/users/bernd/orgs","repos_url":"https://api.github.com/users/bernd/repos","events_url":"https://api.github.com/users/bernd/events{/privacy}","received_events_url":"https://api.github.com/users/bernd/received_events","type":"User","site_admin":false},"body":"There is a new button to search for surrounding messages. The time range options can be configured at \"System/Configurations\".\r\n\r\n![8frudyza qct0aaaaasuvork5cyii](https://cloud.githubusercontent.com/assets/461/13643328/8cec2f50-e620-11e5-8189-41eb5692c07e.png)\r\n\r\nBy default, the search is executed with the `source` and `gl2_source_input` fields as a filter. The filter fields are also configurable at \"System/Configurations\".\r\n\r\n![weze lb7gqbdgaaaabjru5erkjggg](https://cloud.githubusercontent.com/assets/461/13643329/8ea3f594-e620-11e5-9ed4-18232748a759.png)\r\n\r\nThe original message will be highlighted with a green bar so it's easier to find it.\r\n\r\n![hwpfuvk8qhfjaaaaaelftksuqmcc](https://cloud.githubusercontent.com/assets/461/13643332/907afdc2-e620-11e5-8128-eb9e53c9b78b.png)\r\n","created_at":"2016-03-09T17:05:53Z","updated_at":"2016-03-11T13:06:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f50f5ad35a80444df9f66b8e78390cdd7172e4a7","assignee":{"login":"edmundoa","id":716185,"avatar_url":"https://avatars.githubusercontent.com/u/716185?v=3","gravatar_id":"","url":"https://api.github.com/users/edmundoa","html_url":"https://github.com/edmundoa","followers_url":"https://api.github.com/users/edmundoa/followers","following_url":"https://api.github.com/users/edmundoa/following{/other_user}","gists_url":"https://api.github.com/users/edmundoa/gists{/gist_id}","starred_url":"https://api.github.com/users/edmundoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edmundoa/subscriptions","organizations_url":"https://api.github.com/users/edmundoa/orgs","repos_url":"https://api.github.com/users/edmundoa/repos","events_url":"https://api.github.com/users/edmundoa/events{/privacy}","received_events_url":"https://api.github.com/users/edmundoa/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Graylog2/graylog2-server/milestones/46","html_url":"https://github.com/Graylog2/graylog2-server/milestones/2.0.0","labels_url":"https://api.github.com/repos/Graylog2/graylog2-server/milestones/46/labels","id":1451974,"number":46,"title":"2.0.0","description":"","creator":{"login":"kroepke","id":52014,"avatar_url":"https://avatars.githubusercontent.com/u/52014?v=3","gravatar_id":"","url":"https://api.github.com/users/kroepke","html_url":"https://github.com/kroepke","followers_url":"https://api.github.com/users/kroepke/followers","following_url":"https://api.github.com/users/kroepke/following{/other_user}","gists_url":"https://api.github.com/users/kroepke/gists{/gist_id}","starred_url":"https://api.github.com/users/kroepke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kroepke/subscriptions","organizations_url":"https://api.github.com/users/kroepke/orgs","repos_url":"https://api.github.com/users/kroepke/repos","events_url":"https://api.github.com/users/kroepke/events{/privacy}","received_events_url":"https://api.github.com/users/kroepke/received_events","type":"User","site_admin":false},"open_issues":39,"closed_issues":143,"state":"open","created_at":"2015-12-09T14:24:24Z","updated_at":"2016-03-11T09:45:17Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917/commits","review_comments_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917/comments","review_comment_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/1917/comments","statuses_url":"https://api.github.com/repos/Graylog2/graylog2-server/statuses/6f97084534ab271ff5f1aab70703f1e6087077c3","head":{"label":"Graylog2:feature-surrounding-search","ref":"feature-surrounding-search","sha":"6f97084534ab271ff5f1aab70703f1e6087077c3","user":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"repo":{"id":671825,"name":"graylog2-server","full_name":"Graylog2/graylog2-server","owner":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Graylog2/graylog2-server","description":"Free and open source log management","fork":false,"url":"https://api.github.com/repos/Graylog2/graylog2-server","forks_url":"https://api.github.com/repos/Graylog2/graylog2-server/forks","keys_url":"https://api.github.com/repos/Graylog2/graylog2-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Graylog2/graylog2-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Graylog2/graylog2-server/teams","hooks_url":"https://api.github.com/repos/Graylog2/graylog2-server/hooks","issue_events_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/events{/number}","events_url":"https://api.github.com/repos/Graylog2/graylog2-server/events","assignees_url":"https://api.github.com/repos/Graylog2/graylog2-server/assignees{/user}","branches_url":"https://api.github.com/repos/Graylog2/graylog2-server/branches{/branch}","tags_url":"https://api.github.com/repos/Graylog2/graylog2-server/tags","blobs_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Graylog2/graylog2-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Graylog2/graylog2-server/languages","stargazers_url":"https://api.github.com/repos/Graylog2/graylog2-server/stargazers","contributors_url":"https://api.github.com/repos/Graylog2/graylog2-server/contributors","subscribers_url":"https://api.github.com/repos/Graylog2/graylog2-server/subscribers","subscription_url":"https://api.github.com/repos/Graylog2/graylog2-server/subscription","commits_url":"https://api.github.com/repos/Graylog2/graylog2-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Graylog2/graylog2-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Graylog2/graylog2-server/contents/{+path}","compare_url":"https://api.github.com/repos/Graylog2/graylog2-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Graylog2/graylog2-server/merges","archive_url":"https://api.github.com/repos/Graylog2/graylog2-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Graylog2/graylog2-server/downloads","issues_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues{/number}","pulls_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Graylog2/graylog2-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Graylog2/graylog2-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Graylog2/graylog2-server/labels{/name}","releases_url":"https://api.github.com/repos/Graylog2/graylog2-server/releases{/id}","deployments_url":"https://api.github.com/repos/Graylog2/graylog2-server/deployments","created_at":"2010-05-17T21:27:02Z","updated_at":"2016-03-11T07:57:35Z","pushed_at":"2016-03-11T09:45:17Z","git_url":"git://github.com/Graylog2/graylog2-server.git","ssh_url":"git@github.com:Graylog2/graylog2-server.git","clone_url":"https://github.com/Graylog2/graylog2-server.git","svn_url":"https://github.com/Graylog2/graylog2-server","homepage":"https://www.graylog.org/","size":52598,"stargazers_count":1622,"watchers_count":1622,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"open_issues_count":258,"forks":264,"open_issues":258,"watchers":1622,"default_branch":"master"}},"base":{"label":"Graylog2:master","ref":"master","sha":"965273e43f2a64c668307773333bfed82d4f1278","user":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"repo":{"id":671825,"name":"graylog2-server","full_name":"Graylog2/graylog2-server","owner":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Graylog2/graylog2-server","description":"Free and open source log management","fork":false,"url":"https://api.github.com/repos/Graylog2/graylog2-server","forks_url":"https://api.github.com/repos/Graylog2/graylog2-server/forks","keys_url":"https://api.github.com/repos/Graylog2/graylog2-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Graylog2/graylog2-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Graylog2/graylog2-server/teams","hooks_url":"https://api.github.com/repos/Graylog2/graylog2-server/hooks","issue_events_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/events{/number}","events_url":"https://api.github.com/repos/Graylog2/graylog2-server/events","assignees_url":"https://api.github.com/repos/Graylog2/graylog2-server/assignees{/user}","branches_url":"https://api.github.com/repos/Graylog2/graylog2-server/branches{/branch}","tags_url":"https://api.github.com/repos/Graylog2/graylog2-server/tags","blobs_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Graylog2/graylog2-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Graylog2/graylog2-server/languages","stargazers_url":"https://api.github.com/repos/Graylog2/graylog2-server/stargazers","contributors_url":"https://api.github.com/repos/Graylog2/graylog2-server/contributors","subscribers_url":"https://api.github.com/repos/Graylog2/graylog2-server/subscribers","subscription_url":"https://api.github.com/repos/Graylog2/graylog2-server/subscription","commits_url":"https://api.github.com/repos/Graylog2/graylog2-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Graylog2/graylog2-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Graylog2/graylog2-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Graylog2/graylog2-server/contents/{+path}","compare_url":"https://api.github.com/repos/Graylog2/graylog2-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Graylog2/graylog2-server/merges","archive_url":"https://api.github.com/repos/Graylog2/graylog2-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Graylog2/graylog2-server/downloads","issues_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues{/number}","pulls_url":"https://api.github.com/repos/Graylog2/graylog2-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Graylog2/graylog2-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Graylog2/graylog2-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Graylog2/graylog2-server/labels{/name}","releases_url":"https://api.github.com/repos/Graylog2/graylog2-server/releases{/id}","deployments_url":"https://api.github.com/repos/Graylog2/graylog2-server/deployments","created_at":"2010-05-17T21:27:02Z","updated_at":"2016-03-11T07:57:35Z","pushed_at":"2016-03-11T09:45:17Z","git_url":"git://github.com/Graylog2/graylog2-server.git","ssh_url":"git@github.com:Graylog2/graylog2-server.git","clone_url":"https://github.com/Graylog2/graylog2-server.git","svn_url":"https://github.com/Graylog2/graylog2-server","homepage":"https://www.graylog.org/","size":52598,"stargazers_count":1622,"watchers_count":1622,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"open_issues_count":258,"forks":264,"open_issues":258,"watchers":1622,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917"},"html":{"href":"https://github.com/Graylog2/graylog2-server/pull/1917"},"issue":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/issues/1917"},"comments":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/issues/1917/comments"},"review_comments":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917/comments"},"review_comment":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/pulls/1917/commits"},"statuses":{"href":"https://api.github.com/repos/Graylog2/graylog2-server/statuses/6f97084534ab271ff5f1aab70703f1e6087077c3"}}}}