{"action":"created","comment":{"url":"https://api.github.com/repos/3scale/porta/pulls/comments/285654427","pull_request_review_id":239577857,"id":285654427,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4NTY1NDQyNw==","diff_hunk":"@@ -0,0 +1,60 @@\n+// @flow\n+\n+import React from 'react'\n+import {useState, useEffect} from 'react'\n+\n+import {FormWrapper, HiddenServiceDiscoveryInput, ErrorMessage,\n+  ServiceDiscoveryListItems} from 'NewService/components/FormElements'\n+import {CSRFToken, fetchData} from 'utilities/utils'\n+import type {FormProps} from 'NewService/types'\n+\n+const BASE_PATH = '/p/admin/service_discovery'\n+const PROJECTS_PATH = `${BASE_PATH}/projects.json`\n+\n+const ServiceDiscoveryForm = ({formActionPath}: {formActionPath: string}) => {\n+  const [projects, setProjects] = useState([])\n+  const [services, setServices] = useState([])\n+  const [error, setError] = useState({hasError: false, errorMsg: ''})\n+\n+  const fetchProjects = async () => {","path":"app/javascript/src/NewService/components/ServiceDiscoveryForm.jsx","position":19,"original_position":19,"commit_id":"92cb1fe769529e3e6095b8a47ed584b975ce057c","original_commit_id":"92cb1fe769529e3e6095b8a47ed584b975ce057c","user":{"login":"didierofrivia","id":4183971,"node_id":"MDQ6VXNlcjQxODM5NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/4183971?v=4","gravatar_id":"","url":"https://api.github.com/users/didierofrivia","html_url":"https://github.com/didierofrivia","followers_url":"https://api.github.com/users/didierofrivia/followers","following_url":"https://api.github.com/users/didierofrivia/following{/other_user}","gists_url":"https://api.github.com/users/didierofrivia/gists{/gist_id}","starred_url":"https://api.github.com/users/didierofrivia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/didierofrivia/subscriptions","organizations_url":"https://api.github.com/users/didierofrivia/orgs","repos_url":"https://api.github.com/users/didierofrivia/repos","events_url":"https://api.github.com/users/didierofrivia/events{/privacy}","received_events_url":"https://api.github.com/users/didierofrivia/received_events","type":"User","site_admin":false},"body":"You can use the same try, catch block to fetch both projects and services. You await for the projects, then await for the services and set the state. If an error happens, you set the error... don't see the use of having 2 separate try, catch blocks.","created_at":"2019-05-20T15:37:41Z","updated_at":"2019-05-20T15:37:42Z","html_url":"https://github.com/3scale/porta/pull/763#discussion_r285654427","pull_request_url":"https://api.github.com/repos/3scale/porta/pulls/763","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/3scale/porta/pulls/comments/285654427"},"html":{"href":"https://github.com/3scale/porta/pull/763#discussion_r285654427"},"pull_request":{"href":"https://api.github.com/repos/3scale/porta/pulls/763"}}},"pull_request":{"url":"https://api.github.com/repos/3scale/porta/pulls/763","id":270458596,"node_id":"MDExOlB1bGxSZXF1ZXN0MjcwNDU4NTk2","html_url":"https://github.com/3scale/porta/pull/763","diff_url":"https://github.com/3scale/porta/pull/763.diff","patch_url":"https://github.com/3scale/porta/pull/763.patch","issue_url":"https://api.github.com/repos/3scale/porta/issues/763","number":763,"state":"open","locked":false,"title":"THREESCALE-2286: Refactor Service Discovery into a React component","user":{"login":"damianpm","id":13486237,"node_id":"MDQ6VXNlcjEzNDg2MjM3","avatar_url":"https://avatars0.githubusercontent.com/u/13486237?v=4","gravatar_id":"","url":"https://api.github.com/users/damianpm","html_url":"https://github.com/damianpm","followers_url":"https://api.github.com/users/damianpm/followers","following_url":"https://api.github.com/users/damianpm/following{/other_user}","gists_url":"https://api.github.com/users/damianpm/gists{/gist_id}","starred_url":"https://api.github.com/users/damianpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianpm/subscriptions","organizations_url":"https://api.github.com/users/damianpm/orgs","repos_url":"https://api.github.com/users/damianpm/repos","events_url":"https://api.github.com/users/damianpm/events{/privacy}","received_events_url":"https://api.github.com/users/damianpm/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\n\r\nRefactor Service discovery into a React component\r\nAdd flow type checking\r\nAdd js tests \r\n\r\n**Which issue(s) this PR fixes** \r\n\r\nhttps://issues.jboss.org/browse/THREESCALE-2286\r\n\r\n**Verification steps** \r\n\r\n- Configure a **Service** to be discovered on Openshift without SSO (instructions [here](https://access.redhat.com/documentation/en-us/red_hat_3scale_api_management/2.4/html/service_discovery/service-discovery-configuration-procedure#configuring-without-sso)).\r\n- Go to **Dashboard**\r\n- Click on **+New Api**\r\n- Click on **Import from OpenShift**\r\n\r\n**Screenshots:**\r\n\r\n**New service:**\r\n![manual](https://user-images.githubusercontent.com/13486237/58028079-47792a80-7b1a-11e9-877c-042893f92455.png)\r\n_____\r\n**Service Discovery:**\r\n![discovery](https://user-images.githubusercontent.com/13486237/58028066-3e885900-7b1a-11e9-9ccf-2fc4d8e21a31.png)\r\n_____\r\n**Error:**\r\n![error](https://user-images.githubusercontent.com/13486237/58028058-39c3a500-7b1a-11e9-8a08-ab42579fd875.png)\r\n\r\n\r\n\r\n\r\n**Note**:\r\nPlease test in IE11 and Firefox <61","created_at":"2019-04-15T10:30:33Z","updated_at":"2019-05-20T15:37:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e369582b4850d12ed81ebe210e9bf884f3ac0b86","assignee":{"login":"damianpm","id":13486237,"node_id":"MDQ6VXNlcjEzNDg2MjM3","avatar_url":"https://avatars0.githubusercontent.com/u/13486237?v=4","gravatar_id":"","url":"https://api.github.com/users/damianpm","html_url":"https://github.com/damianpm","followers_url":"https://api.github.com/users/damianpm/followers","following_url":"https://api.github.com/users/damianpm/following{/other_user}","gists_url":"https://api.github.com/users/damianpm/gists{/gist_id}","starred_url":"https://api.github.com/users/damianpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianpm/subscriptions","organizations_url":"https://api.github.com/users/damianpm/orgs","repos_url":"https://api.github.com/users/damianpm/repos","events_url":"https://api.github.com/users/damianpm/events{/privacy}","received_events_url":"https://api.github.com/users/damianpm/received_events","type":"User","site_admin":false},"assignees":[{"login":"damianpm","id":13486237,"node_id":"MDQ6VXNlcjEzNDg2MjM3","avatar_url":"https://avatars0.githubusercontent.com/u/13486237?v=4","gravatar_id":"","url":"https://api.github.com/users/damianpm","html_url":"https://github.com/damianpm","followers_url":"https://api.github.com/users/damianpm/followers","following_url":"https://api.github.com/users/damianpm/following{/other_user}","gists_url":"https://api.github.com/users/damianpm/gists{/gist_id}","starred_url":"https://api.github.com/users/damianpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianpm/subscriptions","organizations_url":"https://api.github.com/users/damianpm/orgs","repos_url":"https://api.github.com/users/damianpm/repos","events_url":"https://api.github.com/users/damianpm/events{/privacy}","received_events_url":"https://api.github.com/users/damianpm/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"thomasmaas","id":54224,"node_id":"MDQ6VXNlcjU0MjI0","avatar_url":"https://avatars1.githubusercontent.com/u/54224?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasmaas","html_url":"https://github.com/thomasmaas","followers_url":"https://api.github.com/users/thomasmaas/followers","following_url":"https://api.github.com/users/thomasmaas/following{/other_user}","gists_url":"https://api.github.com/users/thomasmaas/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasmaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasmaas/subscriptions","organizations_url":"https://api.github.com/users/thomasmaas/orgs","repos_url":"https://api.github.com/users/thomasmaas/repos","events_url":"https://api.github.com/users/thomasmaas/events{/privacy}","received_events_url":"https://api.github.com/users/thomasmaas/received_events","type":"User","site_admin":false},{"login":"josemigallas","id":11672286,"node_id":"MDQ6VXNlcjExNjcyMjg2","avatar_url":"https://avatars0.githubusercontent.com/u/11672286?v=4","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/3scale/porta/pulls/763/commits","review_comments_url":"https://api.github.com/repos/3scale/porta/pulls/763/comments","review_comment_url":"https://api.github.com/repos/3scale/porta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/3scale/porta/issues/763/comments","statuses_url":"https://api.github.com/repos/3scale/porta/statuses/92cb1fe769529e3e6095b8a47ed584b975ce057c","head":{"label":"3scale:THREESCALE-2286-Refactoring-Service-Discovery","ref":"THREESCALE-2286-Refactoring-Service-Discovery","sha":"92cb1fe769529e3e6095b8a47ed584b975ce057c","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":149315920,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkzMTU5MjA=","name":"porta","full_name":"3scale/porta","private":false,"owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/3scale/porta","description":"Red Hat 3scale API Management, Porta","fork":false,"url":"https://api.github.com/repos/3scale/porta","forks_url":"https://api.github.com/repos/3scale/porta/forks","keys_url":"https://api.github.com/repos/3scale/porta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/porta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/porta/teams","hooks_url":"https://api.github.com/repos/3scale/porta/hooks","issue_events_url":"https://api.github.com/repos/3scale/porta/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/porta/events","assignees_url":"https://api.github.com/repos/3scale/porta/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/porta/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/porta/tags","blobs_url":"https://api.github.com/repos/3scale/porta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/porta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/porta/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/porta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/porta/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/porta/languages","stargazers_url":"https://api.github.com/repos/3scale/porta/stargazers","contributors_url":"https://api.github.com/repos/3scale/porta/contributors","subscribers_url":"https://api.github.com/repos/3scale/porta/subscribers","subscription_url":"https://api.github.com/repos/3scale/porta/subscription","commits_url":"https://api.github.com/repos/3scale/porta/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/porta/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/porta/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/porta/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/porta/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/porta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/porta/merges","archive_url":"https://api.github.com/repos/3scale/porta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/porta/downloads","issues_url":"https://api.github.com/repos/3scale/porta/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/porta/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/porta/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/porta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/porta/labels{/name}","releases_url":"https://api.github.com/repos/3scale/porta/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/porta/deployments","created_at":"2018-09-18T16:03:13Z","updated_at":"2019-05-17T15:40:19Z","pushed_at":"2019-05-20T15:20:31Z","git_url":"git://github.com/3scale/porta.git","ssh_url":"git@github.com:3scale/porta.git","clone_url":"https://github.com/3scale/porta.git","svn_url":"https://github.com/3scale/porta","homepage":"","size":37705,"stargazers_count":18,"watchers_count":18,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":11,"open_issues":45,"watchers":18,"default_branch":"master"}},"base":{"label":"3scale:master","ref":"master","sha":"f591474f5e7b00b99ac41b026936616c237ca309","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":149315920,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkzMTU5MjA=","name":"porta","full_name":"3scale/porta","private":false,"owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/3scale/porta","description":"Red Hat 3scale API Management, Porta","fork":false,"url":"https://api.github.com/repos/3scale/porta","forks_url":"https://api.github.com/repos/3scale/porta/forks","keys_url":"https://api.github.com/repos/3scale/porta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/porta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/porta/teams","hooks_url":"https://api.github.com/repos/3scale/porta/hooks","issue_events_url":"https://api.github.com/repos/3scale/porta/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/porta/events","assignees_url":"https://api.github.com/repos/3scale/porta/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/porta/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/porta/tags","blobs_url":"https://api.github.com/repos/3scale/porta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/porta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/porta/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/porta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/porta/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/porta/languages","stargazers_url":"https://api.github.com/repos/3scale/porta/stargazers","contributors_url":"https://api.github.com/repos/3scale/porta/contributors","subscribers_url":"https://api.github.com/repos/3scale/porta/subscribers","subscription_url":"https://api.github.com/repos/3scale/porta/subscription","commits_url":"https://api.github.com/repos/3scale/porta/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/porta/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/porta/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/porta/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/porta/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/porta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/porta/merges","archive_url":"https://api.github.com/repos/3scale/porta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/porta/downloads","issues_url":"https://api.github.com/repos/3scale/porta/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/porta/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/porta/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/porta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/porta/labels{/name}","releases_url":"https://api.github.com/repos/3scale/porta/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/porta/deployments","created_at":"2018-09-18T16:03:13Z","updated_at":"2019-05-17T15:40:19Z","pushed_at":"2019-05-20T15:20:31Z","git_url":"git://github.com/3scale/porta.git","ssh_url":"git@github.com:3scale/porta.git","clone_url":"https://github.com/3scale/porta.git","svn_url":"https://github.com/3scale/porta","homepage":"","size":37705,"stargazers_count":18,"watchers_count":18,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":11,"open_issues":45,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/3scale/porta/pulls/763"},"html":{"href":"https://github.com/3scale/porta/pull/763"},"issue":{"href":"https://api.github.com/repos/3scale/porta/issues/763"},"comments":{"href":"https://api.github.com/repos/3scale/porta/issues/763/comments"},"review_comments":{"href":"https://api.github.com/repos/3scale/porta/pulls/763/comments"},"review_comment":{"href":"https://api.github.com/repos/3scale/porta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/3scale/porta/pulls/763/commits"},"statuses":{"href":"https://api.github.com/repos/3scale/porta/statuses/92cb1fe769529e3e6095b8a47ed584b975ce057c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"didierofrivia"}}