{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/kibana/pulls/comments/83520068","pull_request_review_id":4362118,"id":83520068,"diff_hunk":"@@ -44,6 +44,7 @@ <h5 ng-show=\"!field.details.error\">Quick Count <kbn-info info=\"Top 5 values base\n \n       <a\n         ng-href=\"{{vizLocation(field)}}\"\n+        ng-if=\"field.aggregatable\"","path":"src/core_plugins/kibana/public/discover/components/field_chooser/lib/detail_views/string.html","position":4,"original_position":4,"commit_id":"02548187cf8378c13fed2d7cc848fe29512a9279","original_commit_id":"02548187cf8378c13fed2d7cc848fe29512a9279","user":{"login":"cjcenizal","id":1238659,"avatar_url":"https://avatars.githubusercontent.com/u/1238659?v=3","gravatar_id":"","url":"https://api.github.com/users/cjcenizal","html_url":"https://github.com/cjcenizal","followers_url":"https://api.github.com/users/cjcenizal/followers","following_url":"https://api.github.com/users/cjcenizal/following{/other_user}","gists_url":"https://api.github.com/users/cjcenizal/gists{/gist_id}","starred_url":"https://api.github.com/users/cjcenizal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjcenizal/subscriptions","organizations_url":"https://api.github.com/users/cjcenizal/orgs","repos_url":"https://api.github.com/users/cjcenizal/repos","events_url":"https://api.github.com/users/cjcenizal/events{/privacy}","received_events_url":"https://api.github.com/users/cjcenizal/received_events","type":"User","site_admin":false},"body":"I think this would be more ergonomic if it called a method, like this:\r\n\r\n```\r\nng-if=\"canFieldBeVisualized(field)\"\r\n```\r\n\r\nwhich then called a service:\r\n\r\n```\r\nimport isFieldVisualizable from 'ui/visualize/is_field_visualizable'; // location tbd\r\nscope.canFieldBeVisualized = canFieldBeVisualized;\r\n```\r\n\r\nwhich codified this rule (and future related rules):\r\n\r\n```\r\n// is_field_visualizable.js\r\nexport default isFieldVisualizable(field) {\r\n  // Some explanation here about why non-aggregatable fields can't be visualized.\r\n  if (!field.aggregatable) {\r\n    return false;\r\n  }\r\n\r\n  return true;\r\n}\r\n```\r\n\r\nIt seems like a lot of code for such a small feature, but I think it's important we codify our business logic this way. Otherwise the \"what\" of the code isn't justified by a \"why\". Other benefits include increased readability, testability (we can test the service), and scalability (we can add additional rules to the service).","created_at":"2016-10-15T00:14:33Z","updated_at":"2016-10-15T00:14:33Z","html_url":"https://github.com/elastic/kibana/pull/8694#discussion_r83520068","pull_request_url":"https://api.github.com/repos/elastic/kibana/pulls/8694","_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments/83520068"},"html":{"href":"https://github.com/elastic/kibana/pull/8694#discussion_r83520068"},"pull_request":{"href":"https://api.github.com/repos/elastic/kibana/pulls/8694"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/8694","id":89464760,"html_url":"https://github.com/elastic/kibana/pull/8694","diff_url":"https://github.com/elastic/kibana/pull/8694.diff","patch_url":"https://github.com/elastic/kibana/pull/8694.patch","issue_url":"https://api.github.com/repos/elastic/kibana/issues/8694","number":8694,"state":"open","locked":false,"title":"Conditionally show Visualize button based on aggregatable status","user":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"body":"Now that we know [which fields are aggregatable](https://github.com/elastic/kibana/pull/8421), we should only show the Visualize button in the Discover sidebar when a field is in fact aggregatable.\r\n\r\nFixes https://github.com/elastic/kibana/issues/5873\r\n\r\n![screen shot 2016-10-14 at 6 27 24 pm](https://cloud.githubusercontent.com/assets/6239176/19404427/e367a194-923b-11e6-871e-83e44f30287c.png)\r\n","created_at":"2016-10-14T22:27:58Z","updated_at":"2016-10-15T00:14:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2931e3c099e6bd62f4f08071d323b1f54dc758d","assignee":{"login":"cjcenizal","id":1238659,"avatar_url":"https://avatars.githubusercontent.com/u/1238659?v=3","gravatar_id":"","url":"https://api.github.com/users/cjcenizal","html_url":"https://github.com/cjcenizal","followers_url":"https://api.github.com/users/cjcenizal/followers","following_url":"https://api.github.com/users/cjcenizal/following{/other_user}","gists_url":"https://api.github.com/users/cjcenizal/gists{/gist_id}","starred_url":"https://api.github.com/users/cjcenizal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjcenizal/subscriptions","organizations_url":"https://api.github.com/users/cjcenizal/orgs","repos_url":"https://api.github.com/users/cjcenizal/repos","events_url":"https://api.github.com/users/cjcenizal/events{/privacy}","received_events_url":"https://api.github.com/users/cjcenizal/received_events","type":"User","site_admin":false},"assignees":[{"login":"cjcenizal","id":1238659,"avatar_url":"https://avatars.githubusercontent.com/u/1238659?v=3","gravatar_id":"","url":"https://api.github.com/users/cjcenizal","html_url":"https://github.com/cjcenizal","followers_url":"https://api.github.com/users/cjcenizal/followers","following_url":"https://api.github.com/users/cjcenizal/following{/other_user}","gists_url":"https://api.github.com/users/cjcenizal/gists{/gist_id}","starred_url":"https://api.github.com/users/cjcenizal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjcenizal/subscriptions","organizations_url":"https://api.github.com/users/cjcenizal/orgs","repos_url":"https://api.github.com/users/cjcenizal/repos","events_url":"https://api.github.com/users/cjcenizal/events{/privacy}","received_events_url":"https://api.github.com/users/cjcenizal/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/kibana/pulls/8694/commits","review_comments_url":"https://api.github.com/repos/elastic/kibana/pulls/8694/comments","review_comment_url":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/8694/comments","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/02548187cf8378c13fed2d7cc848fe29512a9279","head":{"label":"Bargs:filterVisualizeButton","ref":"filterVisualizeButton","sha":"02548187cf8378c13fed2d7cc848fe29512a9279","user":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"repo":{"id":42202308,"name":"kibana","full_name":"Bargs/kibana","owner":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bargs/kibana","description":"Kibana","fork":true,"url":"https://api.github.com/repos/Bargs/kibana","forks_url":"https://api.github.com/repos/Bargs/kibana/forks","keys_url":"https://api.github.com/repos/Bargs/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bargs/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bargs/kibana/teams","hooks_url":"https://api.github.com/repos/Bargs/kibana/hooks","issue_events_url":"https://api.github.com/repos/Bargs/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/Bargs/kibana/events","assignees_url":"https://api.github.com/repos/Bargs/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/Bargs/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/Bargs/kibana/tags","blobs_url":"https://api.github.com/repos/Bargs/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bargs/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bargs/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bargs/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bargs/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/Bargs/kibana/languages","stargazers_url":"https://api.github.com/repos/Bargs/kibana/stargazers","contributors_url":"https://api.github.com/repos/Bargs/kibana/contributors","subscribers_url":"https://api.github.com/repos/Bargs/kibana/subscribers","subscription_url":"https://api.github.com/repos/Bargs/kibana/subscription","commits_url":"https://api.github.com/repos/Bargs/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bargs/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bargs/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bargs/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bargs/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/Bargs/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bargs/kibana/merges","archive_url":"https://api.github.com/repos/Bargs/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bargs/kibana/downloads","issues_url":"https://api.github.com/repos/Bargs/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/Bargs/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/Bargs/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/Bargs/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bargs/kibana/labels{/name}","releases_url":"https://api.github.com/repos/Bargs/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/Bargs/kibana/deployments","created_at":"2015-09-09T20:17:45Z","updated_at":"2016-01-26T15:29:23Z","pushed_at":"2016-10-14T22:24:00Z","git_url":"git://github.com/Bargs/kibana.git","ssh_url":"git@github.com:Bargs/kibana.git","clone_url":"https://github.com/Bargs/kibana.git","svn_url":"https://github.com/Bargs/kibana","homepage":"https://www.elastic.co/products/kibana","size":217614,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"a5aad4874eec24eff9d922fece0cf16c52e868cc","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":7833168,"name":"kibana","full_name":"elastic/kibana","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":false,"url":"https://api.github.com/repos/elastic/kibana","forks_url":"https://api.github.com/repos/elastic/kibana/forks","keys_url":"https://api.github.com/repos/elastic/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/kibana/teams","hooks_url":"https://api.github.com/repos/elastic/kibana/hooks","issue_events_url":"https://api.github.com/repos/elastic/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/kibana/events","assignees_url":"https://api.github.com/repos/elastic/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/kibana/tags","blobs_url":"https://api.github.com/repos/elastic/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/kibana/languages","stargazers_url":"https://api.github.com/repos/elastic/kibana/stargazers","contributors_url":"https://api.github.com/repos/elastic/kibana/contributors","subscribers_url":"https://api.github.com/repos/elastic/kibana/subscribers","subscription_url":"https://api.github.com/repos/elastic/kibana/subscription","commits_url":"https://api.github.com/repos/elastic/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/kibana/merges","archive_url":"https://api.github.com/repos/elastic/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/kibana/downloads","issues_url":"https://api.github.com/repos/elastic/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/kibana/labels{/name}","releases_url":"https://api.github.com/repos/elastic/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/kibana/deployments","created_at":"2013-01-26T04:00:59Z","updated_at":"2016-10-14T22:11:43Z","pushed_at":"2016-10-14T23:47:09Z","git_url":"git://github.com/elastic/kibana.git","ssh_url":"git@github.com:elastic/kibana.git","clone_url":"https://github.com/elastic/kibana.git","svn_url":"https://github.com/elastic/kibana","homepage":"https://www.elastic.co/products/kibana","size":266631,"stargazers_count":6135,"watchers_count":6135,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2267,"mirror_url":null,"open_issues_count":1220,"forks":2267,"open_issues":1220,"watchers":6135,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/8694"},"html":{"href":"https://github.com/elastic/kibana/pull/8694"},"issue":{"href":"https://api.github.com/repos/elastic/kibana/issues/8694"},"comments":{"href":"https://api.github.com/repos/elastic/kibana/issues/8694/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/kibana/pulls/8694/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/kibana/pulls/8694/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/kibana/statuses/02548187cf8378c13fed2d7cc848fe29512a9279"}}}}
{"actor":{"display_login":"cjcenizal"}}