{"action":"created","comment":{"url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/comments/206556216","pull_request_review_id":141989204,"id":206556216,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjU1NjIxNg==","diff_hunk":"@@ -0,0 +1,152 @@\n+import React from \"react\";\n+import {\n+    ListViewItem, Grid, Row, Col\n+} from \"patternfly-react\";\n+import style from \"./resolversList.css\";\n+import { formatType } from \"../../helper/GraphQLFormatters\";\n+\n+const fireEditEvent = (handler, type, field, resolver) => {\n+    if (handler) {\n+        handler(type, field, resolver);\n+    }\n+};\n+\n+const getResolverForField = (data, field) => {\n+    const { resolvers } = data;\n+    return resolvers.find(item => item.field === field);\n+};\n+\n+const renderFields = (type, fields, resolvers, onClick) => {\n+    const mapped = fields.map(field => {\n+        const resolver = getResolverForField(resolvers, field.name);\n+        const resolverText = resolver ? resolver.DataSource.name : \"No Resolver\";\n+\n+        return (\n+            <Row key={field.name}>\n+                <Col xs={6} md={4}>\n+                    {field.name}\n+                </Col>\n+                <Col xs={6} md={4} style={{ textAlign: \"center\" }}>\n+                    {formatType(field.type)}\n+                </Col>\n+                <Col xs={6} md={4} style={{ textAlign: \"right\", color: \"#188bcc\" }}>\n+                    <span\n+                        role=\"button\"\n+                        tabIndex={0}\n+                        onClick={() => {\n+                            fireEditEvent(onClick, type, field.name, resolver);\n+                        }}\n+                        onKeyDown={() => {\n+                            fireEditEvent(onClick, type, field.name, resolver);\n+                        }}\n+                    >{resolverText}\n+                    </span>\n+                </Col>\n+            </Row>\n+        );\n+    });\n+\n+    return (\n+        <Grid fluid>\n+            {mapped}\n+        </Grid>\n+    );\n+};\n+\n+const renderArguments = args => {\n+    // Don't render anything (not even an empty grid) when there are no args\n+    if (!args.length) {\n+        return null;\n+    }\n+\n+    const mapped = args.map(arg => (\n+        <Row key={arg.name}>\n+            <Col xs={6} md={6}>\n+                {arg.name}\n+            </Col>\n+            <Col xs={6} md={6} style={{ textAlign: \"right\" }}>\n+                {formatType(arg.type)}\n+            </Col>\n+        </Row>\n+    ));\n+\n+    return (\n+        <Grid fluid>\n+            {mapped}\n+        </Grid>\n+    );\n+};\n+\n+const renderAdditionalInfo = (resolvers, kind, field, type, onClick) => {\n+    // TODO:implement subscription resolvers\n+    // For the moment we just don't display anything here\n+    if (kind === \"subscription\") {\n+        return <span key={field} />;\n+    }\n+\n+    const resolver = getResolverForField(resolvers, field);\n+    const resolverText = resolver ? resolver.DataSource.name : \"No Resolver\";\n+\n+    return (\n+        <span\n+            role=\"button\"\n+            tabIndex={0}\n+            onClick={() => {\n+                fireEditEvent(onClick, type, field, resolver);\n+            }}\n+            onKeyDown={() => {\n+                fireEditEvent(onClick, type, field, resolver);\n+            }}\n+            key={field}\n+        >{resolverText}\n+        </span>\n+    );\n+};\n+\n+const renderGeneric = ({ kind, type, item, resolvers, onClick }) => {\n+    const { args, name } = item;\n+    const argsText = `${args.length} Argument${args.length !== 1 ? \"s\" : \"\"}`;\n+\n+    return (\n+        <ListViewItem\n+            key={name}\n+            className=\"structure-list-item resolvers-list\"\n+            leftContent={<span className={style[\"structure-heading\"]}>{name}</span>}\n+            description={<span>{argsText}</span>}\n+            hideCloseIcon\n+            additionalInfo={[renderAdditionalInfo(resolvers, kind, name, type, onClick)]}\n+        >\n+            { renderArguments(args, resolvers) }\n+        </ListViewItem>\n+    );\n+};\n+\n+const renderCustom = ({ type, item, resolvers, onClick }) => {\n+    const { fields, name } = item;\n+    const fieldsText = `${fields.length} Field${fields.length !== 1 ? \"s\" : \"\"}`;\n+\n+    return (\n+        <ListViewItem\n+            key={name}\n+            className=\"structure-list-item resolvers-list\"\n+            leftContent={<span className={style[\"structure-heading\"]}>{name}</span>}\n+            description={<span>{fieldsText}</span>}\n+            hideCloseIcon\n+        >\n+            { renderFields(type, fields, resolvers, onClick) }\n+        </ListViewItem>\n+    );\n+};\n+\n+const ResolversListItem = props => {\n+    switch (props.kind) {","path":"ui/components/resolvers/ResolversListItem.js","position":142,"original_position":142,"commit_id":"a6fe7fdc32f0fec62842f13a7e283cb7426956f7","original_commit_id":"a6fe7fdc32f0fec62842f13a7e283cb7426956f7","user":{"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},"body":"We would avoid so much hassle if we define a component for each kind of item (see comment above).","created_at":"2018-07-31T14:42:07Z","updated_at":"2018-07-31T14:42:07Z","html_url":"https://github.com/aerogear/data-sync-ui/pull/77#discussion_r206556216","pull_request_url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/comments/206556216"},"html":{"href":"https://github.com/aerogear/data-sync-ui/pull/77#discussion_r206556216"},"pull_request":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77"}}},"pull_request":{"url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77","id":205071505,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MDcxNTA1","html_url":"https://github.com/aerogear/data-sync-ui/pull/77","diff_url":"https://github.com/aerogear/data-sync-ui/pull/77.diff","patch_url":"https://github.com/aerogear/data-sync-ui/pull/77.patch","issue_url":"https://api.github.com/repos/aerogear/data-sync-ui/issues/77","number":77,"state":"open","locked":false,"title":"Resolvers tab","user":{"login":"pb82","id":1851198,"node_id":"MDQ6VXNlcjE4NTExOTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1851198?v=4","gravatar_id":"","url":"https://api.github.com/users/pb82","html_url":"https://github.com/pb82","followers_url":"https://api.github.com/users/pb82/followers","following_url":"https://api.github.com/users/pb82/following{/other_user}","gists_url":"https://api.github.com/users/pb82/gists{/gist_id}","starred_url":"https://api.github.com/users/pb82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pb82/subscriptions","organizations_url":"https://api.github.com/users/pb82/orgs","repos_url":"https://api.github.com/users/pb82/repos","events_url":"https://api.github.com/users/pb82/events{/privacy}","received_events_url":"https://api.github.com/users/pb82/received_events","type":"User","site_admin":false},"body":"## Motivation\r\n\r\nImplements the left side of the resolvers tab (structure view & resolver selection)\r\n\r\n## Checklist:\r\n\r\n- [x] Code has been tested locally by PR requester\r\n\r\n\r\n## Progress\r\n\r\n- [x] Finished task\r\n\r\n## Additional Notes\r\n\r\nWhen i click on the resolver of a query or mutation that has arguments, the arguments will expand. That should be improved but can be done in another PR.\r\n \r\n\r\n","created_at":"2018-07-31T10:50:14Z","updated_at":"2018-07-31T14:42:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b3cf6fb8b9a1c80898f556fdf5a1d5638245288","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77/commits","review_comments_url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77/comments","review_comment_url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aerogear/data-sync-ui/issues/77/comments","statuses_url":"https://api.github.com/repos/aerogear/data-sync-ui/statuses/a6fe7fdc32f0fec62842f13a7e283cb7426956f7","head":{"label":"pb82:resolvers-tab","ref":"resolvers-tab","sha":"a6fe7fdc32f0fec62842f13a7e283cb7426956f7","user":{"login":"pb82","id":1851198,"node_id":"MDQ6VXNlcjE4NTExOTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1851198?v=4","gravatar_id":"","url":"https://api.github.com/users/pb82","html_url":"https://github.com/pb82","followers_url":"https://api.github.com/users/pb82/followers","following_url":"https://api.github.com/users/pb82/following{/other_user}","gists_url":"https://api.github.com/users/pb82/gists{/gist_id}","starred_url":"https://api.github.com/users/pb82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pb82/subscriptions","organizations_url":"https://api.github.com/users/pb82/orgs","repos_url":"https://api.github.com/users/pb82/repos","events_url":"https://api.github.com/users/pb82/events{/privacy}","received_events_url":"https://api.github.com/users/pb82/received_events","type":"User","site_admin":false},"repo":{"id":139414172,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk0MTQxNzI=","name":"data-sync-ui","full_name":"pb82/data-sync-ui","owner":{"login":"pb82","id":1851198,"node_id":"MDQ6VXNlcjE4NTExOTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1851198?v=4","gravatar_id":"","url":"https://api.github.com/users/pb82","html_url":"https://github.com/pb82","followers_url":"https://api.github.com/users/pb82/followers","following_url":"https://api.github.com/users/pb82/following{/other_user}","gists_url":"https://api.github.com/users/pb82/gists{/gist_id}","starred_url":"https://api.github.com/users/pb82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pb82/subscriptions","organizations_url":"https://api.github.com/users/pb82/orgs","repos_url":"https://api.github.com/users/pb82/repos","events_url":"https://api.github.com/users/pb82/events{/privacy}","received_events_url":"https://api.github.com/users/pb82/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pb82/data-sync-ui","description":"UI for the AeroGear Data Sync server","fork":true,"url":"https://api.github.com/repos/pb82/data-sync-ui","forks_url":"https://api.github.com/repos/pb82/data-sync-ui/forks","keys_url":"https://api.github.com/repos/pb82/data-sync-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pb82/data-sync-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pb82/data-sync-ui/teams","hooks_url":"https://api.github.com/repos/pb82/data-sync-ui/hooks","issue_events_url":"https://api.github.com/repos/pb82/data-sync-ui/issues/events{/number}","events_url":"https://api.github.com/repos/pb82/data-sync-ui/events","assignees_url":"https://api.github.com/repos/pb82/data-sync-ui/assignees{/user}","branches_url":"https://api.github.com/repos/pb82/data-sync-ui/branches{/branch}","tags_url":"https://api.github.com/repos/pb82/data-sync-ui/tags","blobs_url":"https://api.github.com/repos/pb82/data-sync-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pb82/data-sync-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pb82/data-sync-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/pb82/data-sync-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pb82/data-sync-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/pb82/data-sync-ui/languages","stargazers_url":"https://api.github.com/repos/pb82/data-sync-ui/stargazers","contributors_url":"https://api.github.com/repos/pb82/data-sync-ui/contributors","subscribers_url":"https://api.github.com/repos/pb82/data-sync-ui/subscribers","subscription_url":"https://api.github.com/repos/pb82/data-sync-ui/subscription","commits_url":"https://api.github.com/repos/pb82/data-sync-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/pb82/data-sync-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/pb82/data-sync-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/pb82/data-sync-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/pb82/data-sync-ui/contents/{+path}","compare_url":"https://api.github.com/repos/pb82/data-sync-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pb82/data-sync-ui/merges","archive_url":"https://api.github.com/repos/pb82/data-sync-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pb82/data-sync-ui/downloads","issues_url":"https://api.github.com/repos/pb82/data-sync-ui/issues{/number}","pulls_url":"https://api.github.com/repos/pb82/data-sync-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/pb82/data-sync-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/pb82/data-sync-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pb82/data-sync-ui/labels{/name}","releases_url":"https://api.github.com/repos/pb82/data-sync-ui/releases{/id}","deployments_url":"https://api.github.com/repos/pb82/data-sync-ui/deployments","created_at":"2018-07-02T08:31:47Z","updated_at":"2018-07-02T08:31:49Z","pushed_at":"2018-07-31T14:20:06Z","git_url":"git://github.com/pb82/data-sync-ui.git","ssh_url":"git@github.com:pb82/data-sync-ui.git","clone_url":"https://github.com/pb82/data-sync-ui.git","svn_url":"https://github.com/pb82/data-sync-ui","homepage":null,"size":5891,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aerogear:master","ref":"master","sha":"b06f85a03cc9b87939e29f4d64a72f9f300ecacb","user":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"repo":{"id":139133264,"node_id":"MDEwOlJlcG9zaXRvcnkxMzkxMzMyNjQ=","name":"data-sync-ui","full_name":"aerogear/data-sync-ui","owner":{"login":"aerogear","id":954205,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NDIwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/954205?v=4","gravatar_id":"","url":"https://api.github.com/users/aerogear","html_url":"https://github.com/aerogear","followers_url":"https://api.github.com/users/aerogear/followers","following_url":"https://api.github.com/users/aerogear/following{/other_user}","gists_url":"https://api.github.com/users/aerogear/gists{/gist_id}","starred_url":"https://api.github.com/users/aerogear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerogear/subscriptions","organizations_url":"https://api.github.com/users/aerogear/orgs","repos_url":"https://api.github.com/users/aerogear/repos","events_url":"https://api.github.com/users/aerogear/events{/privacy}","received_events_url":"https://api.github.com/users/aerogear/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aerogear/data-sync-ui","description":"UI for the AeroGear Data Sync server","fork":false,"url":"https://api.github.com/repos/aerogear/data-sync-ui","forks_url":"https://api.github.com/repos/aerogear/data-sync-ui/forks","keys_url":"https://api.github.com/repos/aerogear/data-sync-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aerogear/data-sync-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aerogear/data-sync-ui/teams","hooks_url":"https://api.github.com/repos/aerogear/data-sync-ui/hooks","issue_events_url":"https://api.github.com/repos/aerogear/data-sync-ui/issues/events{/number}","events_url":"https://api.github.com/repos/aerogear/data-sync-ui/events","assignees_url":"https://api.github.com/repos/aerogear/data-sync-ui/assignees{/user}","branches_url":"https://api.github.com/repos/aerogear/data-sync-ui/branches{/branch}","tags_url":"https://api.github.com/repos/aerogear/data-sync-ui/tags","blobs_url":"https://api.github.com/repos/aerogear/data-sync-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aerogear/data-sync-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aerogear/data-sync-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/aerogear/data-sync-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aerogear/data-sync-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/aerogear/data-sync-ui/languages","stargazers_url":"https://api.github.com/repos/aerogear/data-sync-ui/stargazers","contributors_url":"https://api.github.com/repos/aerogear/data-sync-ui/contributors","subscribers_url":"https://api.github.com/repos/aerogear/data-sync-ui/subscribers","subscription_url":"https://api.github.com/repos/aerogear/data-sync-ui/subscription","commits_url":"https://api.github.com/repos/aerogear/data-sync-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/aerogear/data-sync-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/aerogear/data-sync-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/aerogear/data-sync-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/aerogear/data-sync-ui/contents/{+path}","compare_url":"https://api.github.com/repos/aerogear/data-sync-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aerogear/data-sync-ui/merges","archive_url":"https://api.github.com/repos/aerogear/data-sync-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aerogear/data-sync-ui/downloads","issues_url":"https://api.github.com/repos/aerogear/data-sync-ui/issues{/number}","pulls_url":"https://api.github.com/repos/aerogear/data-sync-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/aerogear/data-sync-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/aerogear/data-sync-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aerogear/data-sync-ui/labels{/name}","releases_url":"https://api.github.com/repos/aerogear/data-sync-ui/releases{/id}","deployments_url":"https://api.github.com/repos/aerogear/data-sync-ui/deployments","created_at":"2018-06-29T09:58:59Z","updated_at":"2018-07-30T15:10:26Z","pushed_at":"2018-07-31T14:20:07Z","git_url":"git://github.com/aerogear/data-sync-ui.git","ssh_url":"git@github.com:aerogear/data-sync-ui.git","clone_url":"https://github.com/aerogear/data-sync-ui.git","svn_url":"https://github.com/aerogear/data-sync-ui","homepage":null,"size":5831,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":5,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77"},"html":{"href":"https://github.com/aerogear/data-sync-ui/pull/77"},"issue":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/issues/77"},"comments":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/issues/77/comments"},"review_comments":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77/comments"},"review_comment":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/pulls/77/commits"},"statuses":{"href":"https://api.github.com/repos/aerogear/data-sync-ui/statuses/a6fe7fdc32f0fec62842f13a7e283cb7426956f7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"josemigallas"}}