{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/kibana/issues/17586","repository_url":"https://api.github.com/repos/elastic/kibana","labels_url":"https://api.github.com/repos/elastic/kibana/issues/17586/labels{/name}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/17586/comments","events_url":"https://api.github.com/repos/elastic/kibana/issues/17586/events","html_url":"https://github.com/elastic/kibana/pull/17586","id":311764447,"number":17586,"title":"[Vega] Implement context filter modification","user":{"login":"nyurik","id":1641515,"avatar_url":"https://avatars0.githubusercontent.com/u/1641515?v=4","gravatar_id":"","url":"https://api.github.com/users/nyurik","html_url":"https://github.com/nyurik","followers_url":"https://api.github.com/users/nyurik/followers","following_url":"https://api.github.com/users/nyurik/following{/other_user}","gists_url":"https://api.github.com/users/nyurik/gists{/gist_id}","starred_url":"https://api.github.com/users/nyurik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyurik/subscriptions","organizations_url":"https://api.github.com/users/nyurik/orgs","repos_url":"https://api.github.com/users/nyurik/repos","events_url":"https://api.github.com/users/nyurik/events{/privacy}","received_events_url":"https://api.github.com/users/nyurik/received_events","type":"User","site_admin":false},"labels":[{"id":823208271,"url":"https://api.github.com/repos/elastic/kibana/labels/:Vega%20vis","name":":Vega vis","color":"0e8a16","default":false},{"id":462161355,"url":"https://api.github.com/repos/elastic/kibana/labels/:Visualizations","name":":Visualizations","color":"fef2c0","default":false},{"id":810298373,"url":"https://api.github.com/repos/elastic/kibana/labels/v6.3.0","name":"v6.3.0","color":"ffffff","default":false},{"id":654061976,"url":"https://api.github.com/repos/elastic/kibana/labels/v7.0.0","name":"v7.0.0","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-04-05T20:51:07Z","updated_at":"2018-04-11T00:57:16Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/17586","html_url":"https://github.com/elastic/kibana/pull/17586","diff_url":"https://github.com/elastic/kibana/pull/17586.diff","patch_url":"https://github.com/elastic/kibana/pull/17586.patch"},"body":"Implements https://github.com/elastic/kibana/issues/17210\r\n\r\nAPI:\r\n* `kibanaAddFilter` - adds ES query filter to the filter bar\r\n```js\r\nkibanaAddFilter(\r\n  { \"match\": { \"extension.keyword\": { \"query\": \"jpg\", \"type\": \"phrase\"  }}}   // ES Query language\r\n  { } // Optional filter metadata, e.g. enabled/disabled, etc\r\n)\r\n```\r\n* `kibanaRemoveFilter(query, [meta])` - same params as adding\r\n* `kibanaRemoveAllFilters()`\r\n* `kibanaSetTimeFilter(start, end, [mode])` sets time range for the dashboard - works with numbers, strings, and dates.  Mode is absolete by default, but maybe it should be quick for start/end that cannot be parsed as date values.\r\n\r\ncc: @timroes \r\n\r\nExtensive example:  https://gist.github.com/nyurik/3c579fb8e81c8a981d4b267ad1767227\r\n* select portion of the graph, move that portion around, resize on each side by the edge handles, and either double click or click apply to set the time.\r\n* click any of the extensions to add a filter\r\n* click on the extension again (when there is only one) to remove that filter\r\n* double click the graph to reset the time to last 15 days\r\n\r\n![screenshot from 2018-04-09 08-37-13](https://user-images.githubusercontent.com/1641515/38481022-778c69f0-3bd1-11e8-8d80-0fe1081148cf.png)\r\n\r\n\r\n\r\nSimple testing code (single button click) - modify the command to try them all.\r\n\r\n```\r\n{\r\n  $schema: https://vega.github.io/schema/vega/v3.json\r\n  marks: [\r\n    {\r\n      name: myButton\r\n      type: rect\r\n      encode: {\r\n        enter: {\r\n          xc: {signal: \"width/2\"}\r\n          yc: {signal: \"height/2\"}\r\n          width: {signal: \"width*0.7\"}\r\n          height: {signal: \"height*0.5\"}\r\n          cornerRadius: {value: 6}\r\n          strokeWidth: {value: 10}\r\n        }\r\n        update: {\r\n          stroke: {value: \"gray\"}\r\n          fill: {value: \"lightgray\"}\r\n        }\r\n        hover: {\r\n          fill: {value: \"gray\"}\r\n        }\r\n      }\r\n    }\r\n  ]\r\n  signals: [\r\n    {\r\n      name: btn\r\n      on: [\r\n        {\r\n          events: @myButton:click\r\n          update:\r\n            '''\r\n            kibanaAddFilter({\r\n            match: {\r\n              'extension.keyword': {\r\n                query: 'jpg',\r\n                type: 'phrase'\r\n            }}})\r\n            '''\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/elastic/kibana/issues/comments/380292731","html_url":"https://github.com/elastic/kibana/pull/17586#issuecomment-380292731","issue_url":"https://api.github.com/repos/elastic/kibana/issues/17586","id":380292731,"user":{"login":"elasticmachine","id":15837671,"avatar_url":"https://avatars3.githubusercontent.com/u/15837671?v=4","gravatar_id":"","url":"https://api.github.com/users/elasticmachine","html_url":"https://github.com/elasticmachine","followers_url":"https://api.github.com/users/elasticmachine/followers","following_url":"https://api.github.com/users/elasticmachine/following{/other_user}","gists_url":"https://api.github.com/users/elasticmachine/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticmachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticmachine/subscriptions","organizations_url":"https://api.github.com/users/elasticmachine/orgs","repos_url":"https://api.github.com/users/elasticmachine/repos","events_url":"https://api.github.com/users/elasticmachine/events{/privacy}","received_events_url":"https://api.github.com/users/elasticmachine/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T00:57:16Z","updated_at":"2018-04-11T00:57:16Z","author_association":"NONE","body":"## :broken_heart: Build Failed\n* [continuous-integration/kibana-ci/pull-request](https://kibana-ci.elastic.co/job/elastic-kibana-pull-request/1659/)\n\n"}}
{"actor":{"display_login":"elasticmachine"}}