GitHub PullRequestReviewCommentEvent at 2014-12-08 22:08:58
Repository: cycledash
Actor: tavinathanson
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hammerlab/cycledash/pulls/comments/21490389","id":21490389,"diff_hunk":"@@ -262,15 +330,119 @@ var VCFRecord = React.createClass({\n     var classes = React.addons.classSet({selected: this.props.isSelected});\n     var record = this.props.record;\n     return (\n-      <tr className={classes}>\n-        <td title='contig:position' className='pos'>{record.contig}:{record.position}</td>\n-        <td className='ref' title={record.reference}>{record.reference}</td>\n-        <td className='arrow'>→</td>\n-        <td className='alt' title={record.alternates}>{record.alternates}</td>\n+      <tr className={classes} onClick={this.onClick}>\n+        {this.props.initialTdElements}\n         {tds}\n       </tr>\n     );\n   }\n });\n \n+var VCFRecordComment = React.createClass({\n+  propTypes: {\n+    record: React.PropTypes.object.isRequired,\n+    columns: React.PropTypes.object.isRequired,\n+    comment: React.PropTypes.object,\n+    isSelected: React.PropTypes.bool.isRequired,\n+    handleOpenViewer: React.PropTypes.func.isRequired,\n+    handleSetComment: React.PropTypes.func.isRequired,\n+    handleDeleteComment: React.PropTypes.func.isRequired,\n+    numInitialTdElements: React.PropTypes.number.isRequired\n+  },\n+  handleSubmit: function(e) {\n+    // Don't reload the page.\n+    e.preventDefault();\n+\n+    // Save the latest comment text, if there is any.\n+    var commentText = this.refs.text.getDOMNode().value.trim();\n+    if (commentText != '') {\n+      var comment = this.props.comment;\n+\n+      // Create a new comment if none existed.\n+      if (_.isNull(comment)) {\n+        comment = this.createNewComment(this.props.record, commentText);\n+        this.props.handleSetComment(comment);\n+        return;\n+      }\n+      // Update the comment if it changed.\n+      else if (comment.comment_text !== commentText) {\n+        comment.comment_text = commentText;\n+        this.props.handleSetComment(comment);\n+        return;\n+      }\n+    }\n+\n+    // TODO(tavi) Alert the user to the fact their update (e.g. '') was not\n+    // submitted.\n+  },\n+  createNewComment: function(record, text) {\n+    var comment = {}\n+    comment.contig = record.contig;","path":"cycledash/static/js/examine/components/VCFTable.js","position":259,"original_position":259,"commit_id":"cc4a39fb3d8a23c483a88958802ed6888ca8b0ad","original_commit_id":"cc4a39fb3d8a23c483a88958802ed6888ca8b0ad","user":{"login":"tavinathanson","id":322932,"avatar_url":"https://avatars.githubusercontent.com/u/322932?v=3","gravatar_id":"","url":"https://api.github.com/users/tavinathanson","html_url":"https://github.com/tavinathanson","followers_url":"https://api.github.com/users/tavinathanson/followers","following_url":"https://api.github.com/users/tavinathanson/following{/other_user}","gists_url":"https://api.github.com/users/tavinathanson/gists{/gist_id}","starred_url":"https://api.github.com/users/tavinathanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tavinathanson/subscriptions","organizations_url":"https://api.github.com/users/tavinathanson/orgs","repos_url":"https://api.github.com/users/tavinathanson/repos","events_url":"https://api.github.com/users/tavinathanson/events{/privacy}","received_events_url":"https://api.github.com/users/tavinathanson/received_events","type":"User","site_admin":false},"body":"Neat.","created_at":"2014-12-08T22:08:58Z","updated_at":"2014-12-08T22:08:58Z","html_url":"https://github.com/hammerlab/cycledash/pull/378#discussion_r21490389","pull_request_url":"https://api.github.com/repos/hammerlab/cycledash/pulls/378","_links":{"self":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/comments/21490389"},"html":{"href":"https://github.com/hammerlab/cycledash/pull/378#discussion_r21490389"},"pull_request":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/378"}}},"pull_request":{"url":"https://api.github.com/repos/hammerlab/cycledash/pulls/378","id":25689517,"html_url":"https://github.com/hammerlab/cycledash/pull/378","diff_url":"https://github.com/hammerlab/cycledash/pull/378.diff","patch_url":"https://github.com/hammerlab/cycledash/pull/378.patch","issue_url":"https://api.github.com/repos/hammerlab/cycledash/issues/378","number":378,"state":"open","locked":false,"title":"Add user comments","user":{"login":"tavinathanson","id":322932,"avatar_url":"https://avatars.githubusercontent.com/u/322932?v=3","gravatar_id":"","url":"https://api.github.com/users/tavinathanson","html_url":"https://github.com/tavinathanson","followers_url":"https://api.github.com/users/tavinathanson/followers","following_url":"https://api.github.com/users/tavinathanson/following{/other_user}","gists_url":"https://api.github.com/users/tavinathanson/gists{/gist_id}","starred_url":"https://api.github.com/users/tavinathanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tavinathanson/subscriptions","organizations_url":"https://api.github.com/users/tavinathanson/orgs","repos_url":"https://api.github.com/users/tavinathanson/repos","events_url":"https://api.github.com/users/tavinathanson/events{/privacy}","received_events_url":"https://api.github.com/users/tavinathanson/received_events","type":"User","site_admin":false},"body":"After this is merged, you'll need to run:\r\n\r\n```\r\nCREATE TABLE user_comments (\r\n    id BIGSERIAL PRIMARY KEY,\r\n    vcf_id BIGINT REFERENCES vcfs ON DELETE CASCADE NOT NULL,\r\n    sample_name TEXT,\r\n    contig TEXT,\r\n    position INTEGER,\r\n    reference TEXT,\r\n    alternates TEXT,\r\n    comment_text TEXT NOT NULL\r\n);\r\n```\r\n\r\nOn the backend, the PR adds the user comments table and an API for accessing comments in `comments.py`.\r\n\r\nOn the frontend, I changed `RecordStore.js` to recognize the difference between a selected record (showing the comment box) and Dalliance being open (which is now accessed from the comment box area). I introduced `VCFRecordComment`, which displays comments in a textarea. A new column is also added to show whether a row has a comment.\r\n\r\nA few notes:\r\n\r\n- I wanted to start with plaintext comments, and save author/tagging/other fanciness for later.\r\n- Right now, we just retrieve all comments for the VCF, rather than the comments for the rows shown. The latter seemed like it'd be a premature optimization, since I don't imagine that many user comments.\r\n- I wanted to use Bootstrap's buttons and form control, so I pulled those specific pieces out to use on Examine.\r\n- Overwritten comments are currently a problem. User A might accidentally clobber User B's comment if he hasn't loaded User B's comment.\r\n- Similarly, multiple comments with the same contig/pos/ref/alt/sample name can happen. (Due to out-of-sync clients.) Currently, in that case, one of them is chosen to display. We shouldn't allow that situation to happen. (SQL constraints, displaying errors to the user, etc.)\r\n- I think a good way to display all comments on a page will be to integrate with CQL to filter by rows with comments, but that's not a part of this PR.\r\n- The comment icon can be improved. Maybe a glyphicon would work?\r\n- Scrolling the row to top mostly still works, though it doesn't always go all the way to the top.\r\n- I should add some tests.\r\n\r\n![screen shot 2014-12-08 at 12 30 52 pm](https://cloud.githubusercontent.com/assets/322932/5345384/68157b9e-7ee5-11e4-9333-cdee885ea7fd.png)\r\n\r\n(I'll update `dpxdt` after the review, before merging.)","created_at":"2014-12-08T19:19:07Z","updated_at":"2014-12-08T22:08:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"danvk","id":98301,"avatar_url":"https://avatars.githubusercontent.com/u/98301?v=3","gravatar_id":"","url":"https://api.github.com/users/danvk","html_url":"https://github.com/danvk","followers_url":"https://api.github.com/users/danvk/followers","following_url":"https://api.github.com/users/danvk/following{/other_user}","gists_url":"https://api.github.com/users/danvk/gists{/gist_id}","starred_url":"https://api.github.com/users/danvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danvk/subscriptions","organizations_url":"https://api.github.com/users/danvk/orgs","repos_url":"https://api.github.com/users/danvk/repos","events_url":"https://api.github.com/users/danvk/events{/privacy}","received_events_url":"https://api.github.com/users/danvk/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/hammerlab/cycledash/pulls/378/commits","review_comments_url":"https://api.github.com/repos/hammerlab/cycledash/pulls/378/comments","review_comment_url":"https://api.github.com/repos/hammerlab/cycledash/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hammerlab/cycledash/issues/378/comments","statuses_url":"https://api.github.com/repos/hammerlab/cycledash/statuses/cc4a39fb3d8a23c483a88958802ed6888ca8b0ad","head":{"label":"hammerlab:add_user_comments","ref":"add_user_comments","sha":"cc4a39fb3d8a23c483a88958802ed6888ca8b0ad","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":20279144,"name":"cycledash","full_name":"hammerlab/cycledash","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/cycledash","description":"Variant Caller Analysis Dashboard and Data Management System","fork":false,"url":"https://api.github.com/repos/hammerlab/cycledash","forks_url":"https://api.github.com/repos/hammerlab/cycledash/forks","keys_url":"https://api.github.com/repos/hammerlab/cycledash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/cycledash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/cycledash/teams","hooks_url":"https://api.github.com/repos/hammerlab/cycledash/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/cycledash/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/cycledash/events","assignees_url":"https://api.github.com/repos/hammerlab/cycledash/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/cycledash/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/cycledash/tags","blobs_url":"https://api.github.com/repos/hammerlab/cycledash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/cycledash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/cycledash/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/cycledash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/cycledash/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/cycledash/languages","stargazers_url":"https://api.github.com/repos/hammerlab/cycledash/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/cycledash/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/cycledash/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/cycledash/subscription","commits_url":"https://api.github.com/repos/hammerlab/cycledash/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/cycledash/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/cycledash/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/cycledash/issues/comments/{number}","contents_url":"https://api.github.com/repos/hammerlab/cycledash/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/cycledash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/cycledash/merges","archive_url":"https://api.github.com/repos/hammerlab/cycledash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/cycledash/downloads","issues_url":"https://api.github.com/repos/hammerlab/cycledash/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/cycledash/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/cycledash/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/cycledash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/cycledash/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/cycledash/releases{/id}","created_at":"2014-05-29T01:58:41Z","updated_at":"2014-12-06T00:21:54Z","pushed_at":"2014-12-08T20:42:39Z","git_url":"git://github.com/hammerlab/cycledash.git","ssh_url":"git@github.com:hammerlab/cycledash.git","clone_url":"https://github.com/hammerlab/cycledash.git","svn_url":"https://github.com/hammerlab/cycledash","homepage":null,"size":21604,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":96,"forks":0,"open_issues":96,"watchers":3,"default_branch":"master"}},"base":{"label":"hammerlab:master","ref":"master","sha":"2e06c58916f9739d4715e29683bdf3ff05386def","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":20279144,"name":"cycledash","full_name":"hammerlab/cycledash","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/cycledash","description":"Variant Caller Analysis Dashboard and Data Management System","fork":false,"url":"https://api.github.com/repos/hammerlab/cycledash","forks_url":"https://api.github.com/repos/hammerlab/cycledash/forks","keys_url":"https://api.github.com/repos/hammerlab/cycledash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/cycledash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/cycledash/teams","hooks_url":"https://api.github.com/repos/hammerlab/cycledash/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/cycledash/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/cycledash/events","assignees_url":"https://api.github.com/repos/hammerlab/cycledash/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/cycledash/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/cycledash/tags","blobs_url":"https://api.github.com/repos/hammerlab/cycledash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/cycledash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/cycledash/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/cycledash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/cycledash/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/cycledash/languages","stargazers_url":"https://api.github.com/repos/hammerlab/cycledash/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/cycledash/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/cycledash/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/cycledash/subscription","commits_url":"https://api.github.com/repos/hammerlab/cycledash/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/cycledash/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/cycledash/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/cycledash/issues/comments/{number}","contents_url":"https://api.github.com/repos/hammerlab/cycledash/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/cycledash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/cycledash/merges","archive_url":"https://api.github.com/repos/hammerlab/cycledash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/cycledash/downloads","issues_url":"https://api.github.com/repos/hammerlab/cycledash/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/cycledash/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/cycledash/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/cycledash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/cycledash/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/cycledash/releases{/id}","created_at":"2014-05-29T01:58:41Z","updated_at":"2014-12-06T00:21:54Z","pushed_at":"2014-12-08T20:42:39Z","git_url":"git://github.com/hammerlab/cycledash.git","ssh_url":"git@github.com:hammerlab/cycledash.git","clone_url":"https://github.com/hammerlab/cycledash.git","svn_url":"https://github.com/hammerlab/cycledash","homepage":null,"size":21604,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":96,"forks":0,"open_issues":96,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/378"},"html":{"href":"https://github.com/hammerlab/cycledash/pull/378"},"issue":{"href":"https://api.github.com/repos/hammerlab/cycledash/issues/378"},"comments":{"href":"https://api.github.com/repos/hammerlab/cycledash/issues/378/comments"},"review_comments":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/378/comments"},"review_comment":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hammerlab/cycledash/pulls/378/commits"},"statuses":{"href":"https://api.github.com/repos/hammerlab/cycledash/statuses/cc4a39fb3d8a23c483a88958802ed6888ca8b0ad"}}}}