{"action":"created","comment":{"url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/comments/58219734","id":58219734,"diff_hunk":"@@ -0,0 +1,52 @@\n+var React = require('react');\n+var Typeahead = require('react-typeahead').Typeahead;\n+require('./admin-search.css');\n+\n+var AdminSearch = React.createClass({\n+  admins: function() {\n+    var admin_objs = this.props.admin_details.admin_data_by_code;\n+\n+    // Maintain array of selected country iso codes\n+    var available_countries = Object.keys(\n+      this.props.selected_countries.selected_country_codes\n+    );\n+\n+    // Maintain list of admins that belong to selected countries\n+    var admins = Object.keys(this.props.admin_details.admin_data_by_code)\n+    .filter(function(key) {\n+      var admin_code = admin_objs[key].admin_code.split('-')[0];\n+      return available_countries.find(function(e) {\n+        return e === admin_code;\n+      });\n+    // Return array of admin names\n+    }).map(function(key) {\n+      return admin_objs[key].name + ' ' +\n+      admin_objs[key].admin_code;\n+    }).sort();\n+    return admins;\n+  },\n+\n+  optionSelected: function() {\n+    var argument = arguments[0];\n+    var admin_objs = this.props.admin_details.admin_data_by_code;\n+    var admin_code = Object.keys(this.props.admin_details.admin_data_by_code)\n+    .find(function(key) {\n+      return admin_objs[key].name + ' ' + admin_objs[key].admin_code === argument;","path":"public/view/overlay-controls/admin-search.jsx","position":34,"original_position":34,"commit_id":"4509b5ac279881330b73bc266d29ab4583bba778","original_commit_id":"4509b5ac279881330b73bc266d29ab4583bba778","user":{"login":"gatoatigrado","id":95724,"avatar_url":"https://avatars.githubusercontent.com/u/95724?v=3","gravatar_id":"","url":"https://api.github.com/users/gatoatigrado","html_url":"https://github.com/gatoatigrado","followers_url":"https://api.github.com/users/gatoatigrado/followers","following_url":"https://api.github.com/users/gatoatigrado/following{/other_user}","gists_url":"https://api.github.com/users/gatoatigrado/gists{/gist_id}","starred_url":"https://api.github.com/users/gatoatigrado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gatoatigrado/subscriptions","organizations_url":"https://api.github.com/users/gatoatigrado/orgs","repos_url":"https://api.github.com/users/gatoatigrado/repos","events_url":"https://api.github.com/users/gatoatigrado/events{/privacy}","received_events_url":"https://api.github.com/users/gatoatigrado/received_events","type":"User","site_admin":false},"body":"up to you: you could build up a map from search key to admin code, on line 23 above, and just do a lookup here. That way, if you change how something is updated, you can't update one call site but not the other. It's not a big deal though.","created_at":"2016-04-01T15:11:43Z","updated_at":"2016-04-01T15:11:43Z","html_url":"https://github.com/unicef/carrotjuice2/pull/67#discussion_r58219734","pull_request_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/comments/58219734"},"html":{"href":"https://github.com/unicef/carrotjuice2/pull/67#discussion_r58219734"},"pull_request":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67","id":64895153,"html_url":"https://github.com/unicef/carrotjuice2/pull/67","diff_url":"https://github.com/unicef/carrotjuice2/pull/67.diff","patch_url":"https://github.com/unicef/carrotjuice2/pull/67.patch","issue_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/67","number":67,"state":"open","locked":false,"title":"Mikefab search admin event","user":{"login":"mikefab","id":42814,"avatar_url":"https://avatars.githubusercontent.com/u/42814?v=3","gravatar_id":"","url":"https://api.github.com/users/mikefab","html_url":"https://github.com/mikefab","followers_url":"https://api.github.com/users/mikefab/followers","following_url":"https://api.github.com/users/mikefab/following{/other_user}","gists_url":"https://api.github.com/users/mikefab/gists{/gist_id}","starred_url":"https://api.github.com/users/mikefab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikefab/subscriptions","organizations_url":"https://api.github.com/users/mikefab/orgs","repos_url":"https://api.github.com/users/mikefab/repos","events_url":"https://api.github.com/users/mikefab/events{/privacy}","received_events_url":"https://api.github.com/users/mikefab/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-01T04:48:03Z","updated_at":"2016-04-01T15:11:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2ba5f1588642b71999c1125bcb58805181d5e18","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67/commits","review_comments_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67/comments","review_comment_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/67/comments","statuses_url":"https://api.github.com/repos/unicef/carrotjuice2/statuses/4509b5ac279881330b73bc266d29ab4583bba778","head":{"label":"unicef:mikefab-search-admin-event","ref":"mikefab-search-admin-event","sha":"4509b5ac279881330b73bc266d29ab4583bba778","user":{"login":"unicef","id":175849,"avatar_url":"https://avatars.githubusercontent.com/u/175849?v=3","gravatar_id":"","url":"https://api.github.com/users/unicef","html_url":"https://github.com/unicef","followers_url":"https://api.github.com/users/unicef/followers","following_url":"https://api.github.com/users/unicef/following{/other_user}","gists_url":"https://api.github.com/users/unicef/gists{/gist_id}","starred_url":"https://api.github.com/users/unicef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicef/subscriptions","organizations_url":"https://api.github.com/users/unicef/orgs","repos_url":"https://api.github.com/users/unicef/repos","events_url":"https://api.github.com/users/unicef/events{/privacy}","received_events_url":"https://api.github.com/users/unicef/received_events","type":"Organization","site_admin":false},"repo":{"id":52188236,"name":"carrotjuice2","full_name":"unicef/carrotjuice2","owner":{"login":"unicef","id":175849,"avatar_url":"https://avatars.githubusercontent.com/u/175849?v=3","gravatar_id":"","url":"https://api.github.com/users/unicef","html_url":"https://github.com/unicef","followers_url":"https://api.github.com/users/unicef/followers","following_url":"https://api.github.com/users/unicef/following{/other_user}","gists_url":"https://api.github.com/users/unicef/gists{/gist_id}","starred_url":"https://api.github.com/users/unicef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicef/subscriptions","organizations_url":"https://api.github.com/users/unicef/orgs","repos_url":"https://api.github.com/users/unicef/repos","events_url":"https://api.github.com/users/unicef/events{/privacy}","received_events_url":"https://api.github.com/users/unicef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unicef/carrotjuice2","description":"Front end to resources repo. Defaults to Brazil but will eventually be virus and country agnostic.","fork":false,"url":"https://api.github.com/repos/unicef/carrotjuice2","forks_url":"https://api.github.com/repos/unicef/carrotjuice2/forks","keys_url":"https://api.github.com/repos/unicef/carrotjuice2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unicef/carrotjuice2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unicef/carrotjuice2/teams","hooks_url":"https://api.github.com/repos/unicef/carrotjuice2/hooks","issue_events_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/events{/number}","events_url":"https://api.github.com/repos/unicef/carrotjuice2/events","assignees_url":"https://api.github.com/repos/unicef/carrotjuice2/assignees{/user}","branches_url":"https://api.github.com/repos/unicef/carrotjuice2/branches{/branch}","tags_url":"https://api.github.com/repos/unicef/carrotjuice2/tags","blobs_url":"https://api.github.com/repos/unicef/carrotjuice2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unicef/carrotjuice2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unicef/carrotjuice2/git/refs{/sha}","trees_url":"https://api.github.com/repos/unicef/carrotjuice2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unicef/carrotjuice2/statuses/{sha}","languages_url":"https://api.github.com/repos/unicef/carrotjuice2/languages","stargazers_url":"https://api.github.com/repos/unicef/carrotjuice2/stargazers","contributors_url":"https://api.github.com/repos/unicef/carrotjuice2/contributors","subscribers_url":"https://api.github.com/repos/unicef/carrotjuice2/subscribers","subscription_url":"https://api.github.com/repos/unicef/carrotjuice2/subscription","commits_url":"https://api.github.com/repos/unicef/carrotjuice2/commits{/sha}","git_commits_url":"https://api.github.com/repos/unicef/carrotjuice2/git/commits{/sha}","comments_url":"https://api.github.com/repos/unicef/carrotjuice2/comments{/number}","issue_comment_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/comments{/number}","contents_url":"https://api.github.com/repos/unicef/carrotjuice2/contents/{+path}","compare_url":"https://api.github.com/repos/unicef/carrotjuice2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unicef/carrotjuice2/merges","archive_url":"https://api.github.com/repos/unicef/carrotjuice2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unicef/carrotjuice2/downloads","issues_url":"https://api.github.com/repos/unicef/carrotjuice2/issues{/number}","pulls_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls{/number}","milestones_url":"https://api.github.com/repos/unicef/carrotjuice2/milestones{/number}","notifications_url":"https://api.github.com/repos/unicef/carrotjuice2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unicef/carrotjuice2/labels{/name}","releases_url":"https://api.github.com/repos/unicef/carrotjuice2/releases{/id}","deployments_url":"https://api.github.com/repos/unicef/carrotjuice2/deployments","created_at":"2016-02-21T03:08:24Z","updated_at":"2016-03-14T07:22:15Z","pushed_at":"2016-04-01T04:54:11Z","git_url":"git://github.com/unicef/carrotjuice2.git","ssh_url":"git@github.com:unicef/carrotjuice2.git","clone_url":"https://github.com/unicef/carrotjuice2.git","svn_url":"https://github.com/unicef/carrotjuice2","homepage":null,"size":488,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":1,"default_branch":"master"}},"base":{"label":"unicef:master","ref":"master","sha":"f9c64f582f0995ea66c4f30190b4fa7ff2e5cbe9","user":{"login":"unicef","id":175849,"avatar_url":"https://avatars.githubusercontent.com/u/175849?v=3","gravatar_id":"","url":"https://api.github.com/users/unicef","html_url":"https://github.com/unicef","followers_url":"https://api.github.com/users/unicef/followers","following_url":"https://api.github.com/users/unicef/following{/other_user}","gists_url":"https://api.github.com/users/unicef/gists{/gist_id}","starred_url":"https://api.github.com/users/unicef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicef/subscriptions","organizations_url":"https://api.github.com/users/unicef/orgs","repos_url":"https://api.github.com/users/unicef/repos","events_url":"https://api.github.com/users/unicef/events{/privacy}","received_events_url":"https://api.github.com/users/unicef/received_events","type":"Organization","site_admin":false},"repo":{"id":52188236,"name":"carrotjuice2","full_name":"unicef/carrotjuice2","owner":{"login":"unicef","id":175849,"avatar_url":"https://avatars.githubusercontent.com/u/175849?v=3","gravatar_id":"","url":"https://api.github.com/users/unicef","html_url":"https://github.com/unicef","followers_url":"https://api.github.com/users/unicef/followers","following_url":"https://api.github.com/users/unicef/following{/other_user}","gists_url":"https://api.github.com/users/unicef/gists{/gist_id}","starred_url":"https://api.github.com/users/unicef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicef/subscriptions","organizations_url":"https://api.github.com/users/unicef/orgs","repos_url":"https://api.github.com/users/unicef/repos","events_url":"https://api.github.com/users/unicef/events{/privacy}","received_events_url":"https://api.github.com/users/unicef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unicef/carrotjuice2","description":"Front end to resources repo. Defaults to Brazil but will eventually be virus and country agnostic.","fork":false,"url":"https://api.github.com/repos/unicef/carrotjuice2","forks_url":"https://api.github.com/repos/unicef/carrotjuice2/forks","keys_url":"https://api.github.com/repos/unicef/carrotjuice2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unicef/carrotjuice2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unicef/carrotjuice2/teams","hooks_url":"https://api.github.com/repos/unicef/carrotjuice2/hooks","issue_events_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/events{/number}","events_url":"https://api.github.com/repos/unicef/carrotjuice2/events","assignees_url":"https://api.github.com/repos/unicef/carrotjuice2/assignees{/user}","branches_url":"https://api.github.com/repos/unicef/carrotjuice2/branches{/branch}","tags_url":"https://api.github.com/repos/unicef/carrotjuice2/tags","blobs_url":"https://api.github.com/repos/unicef/carrotjuice2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unicef/carrotjuice2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unicef/carrotjuice2/git/refs{/sha}","trees_url":"https://api.github.com/repos/unicef/carrotjuice2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unicef/carrotjuice2/statuses/{sha}","languages_url":"https://api.github.com/repos/unicef/carrotjuice2/languages","stargazers_url":"https://api.github.com/repos/unicef/carrotjuice2/stargazers","contributors_url":"https://api.github.com/repos/unicef/carrotjuice2/contributors","subscribers_url":"https://api.github.com/repos/unicef/carrotjuice2/subscribers","subscription_url":"https://api.github.com/repos/unicef/carrotjuice2/subscription","commits_url":"https://api.github.com/repos/unicef/carrotjuice2/commits{/sha}","git_commits_url":"https://api.github.com/repos/unicef/carrotjuice2/git/commits{/sha}","comments_url":"https://api.github.com/repos/unicef/carrotjuice2/comments{/number}","issue_comment_url":"https://api.github.com/repos/unicef/carrotjuice2/issues/comments{/number}","contents_url":"https://api.github.com/repos/unicef/carrotjuice2/contents/{+path}","compare_url":"https://api.github.com/repos/unicef/carrotjuice2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unicef/carrotjuice2/merges","archive_url":"https://api.github.com/repos/unicef/carrotjuice2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unicef/carrotjuice2/downloads","issues_url":"https://api.github.com/repos/unicef/carrotjuice2/issues{/number}","pulls_url":"https://api.github.com/repos/unicef/carrotjuice2/pulls{/number}","milestones_url":"https://api.github.com/repos/unicef/carrotjuice2/milestones{/number}","notifications_url":"https://api.github.com/repos/unicef/carrotjuice2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unicef/carrotjuice2/labels{/name}","releases_url":"https://api.github.com/repos/unicef/carrotjuice2/releases{/id}","deployments_url":"https://api.github.com/repos/unicef/carrotjuice2/deployments","created_at":"2016-02-21T03:08:24Z","updated_at":"2016-03-14T07:22:15Z","pushed_at":"2016-04-01T04:54:11Z","git_url":"git://github.com/unicef/carrotjuice2.git","ssh_url":"git@github.com:unicef/carrotjuice2.git","clone_url":"https://github.com/unicef/carrotjuice2.git","svn_url":"https://github.com/unicef/carrotjuice2","homepage":null,"size":488,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67"},"html":{"href":"https://github.com/unicef/carrotjuice2/pull/67"},"issue":{"href":"https://api.github.com/repos/unicef/carrotjuice2/issues/67"},"comments":{"href":"https://api.github.com/repos/unicef/carrotjuice2/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unicef/carrotjuice2/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/unicef/carrotjuice2/statuses/4509b5ac279881330b73bc266d29ab4583bba778"}}}}