{"action":"created","comment":{"url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/comments/42151739","id":42151739,"diff_hunk":"@@ -129,6 +129,101 @@ export class LabradRegistry extends polymer.Base {\n     );\n   }\n \n+  //Drag and drop\n+  @listen('dragenter')\n+  overBehaviour(event) {\n+    event.preventDefault(); //I don't understand this.\n+  }\n+\n+  @listen('dragover')\n+  changeBehaviour(event) {\n+    //allows the ctrl key to be pressed to change cursor between copy/move\n+    event.preventDefault(); //I don't understand this. But needs to be here\n+\n+    if (event.ctrlKey) {\n+      event.dataTransfer.dropEffect = \"copy\";\n+    }\n+    else {\n+      event.dataTransfer.dropEffect = \"move\";\n+    }\n+  }\n+\n+  @listen('dragleave')\n+  leaveDrag(event) {\n+    event.preventDefault(); //I don't understand this. But it needs to be here\n+  }\n+\n+  @listen('dragstart')\n+  startDrag(event) {\n+    //detect start of drag event, grab info about target\n+    var data: any; //I tried enum, but kept getting errors...\n+    data = {path: this.path, name: event.target.name};\n+    event.dataTransfer.setData('text', JSON.stringify(data));\n+    event.dataTransfer.effectAllowed = 'copyMove';\n+    this.$.toastText.text = \"drag to move, hold ctrl to copy\";\n+    this.$.toastText.show();\n+  }\n+\n+  @listen('dragend')\n+  endDrag(event) {\n+    console.log('drag ended',event);\n+  }\n+\n+  dirDrop(event) {\n+    //behaviour for dropping on folders\n+    console.log(event);\n+    var data: any;\n+    data = JSON.parse(event.dataTransfer.getData('text'));\n+    console.log('dirDrop');\n+    event.target.closest('td').classList.remove('over');\n+    if (event.ctrlKey) {\n+      console.log('dropped on', event.target.closest('td').name, 'with data', data ); \n+      console.log(event.target);\n+      var newPath: string[] = this.path.splice(0);\n+      var oldFullPath: string[] = data.path;\n+      newPath.push(event.target.closest('td').name);\n+      var dialog = this.$.dragCopyDialog,\n+          copyOriginName = this.$.originName,\n+          copyOriginPath = this.$.originPath,\n+          copyNameElem = this.$.dragCopyNameInput,\n+          copyPathElem = this.$.dragCopyPathInput;\n+      copyNameElem.value = data.name;\n+      copyOriginName.textContent = data.name;\n+      copyOriginPath.textContent = JSON.stringify(data.path);\n+      copyPathElem.value = this.pathToString(newPath);\n+      dialog.open();\n+      window.setTimeout(() => copyNameElem.$.input.focus(), 0);\n+    }\n+  }\n+\n+  @listen('drop')\n+  handleDrop(event) {\n+    //handles folders dropped not on other folders\n+    event.preventDefault();\n+    var data: any;\n+    data = JSON.parse(event.dataTransfer.getData('text'));\n+    console.log('dropped', event.dataTransfer);\n+    if (event.ctrlKey) {\n+      if (JSON.stringify(this.path) != JSON.stringify(data.path)){","path":"client-js/app/elements/labrad-registry.ts","position":79,"original_position":79,"commit_id":"e77da4794d0cf39cfdb8627be12137176c2d8e65","original_commit_id":"e77da4794d0cf39cfdb8627be12137176c2d8e65","user":{"login":"maffoo","id":129268,"avatar_url":"https://avatars.githubusercontent.com/u/129268?v=3","gravatar_id":"","url":"https://api.github.com/users/maffoo","html_url":"https://github.com/maffoo","followers_url":"https://api.github.com/users/maffoo/followers","following_url":"https://api.github.com/users/maffoo/following{/other_user}","gists_url":"https://api.github.com/users/maffoo/gists{/gist_id}","starred_url":"https://api.github.com/users/maffoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maffoo/subscriptions","organizations_url":"https://api.github.com/users/maffoo/orgs","repos_url":"https://api.github.com/users/maffoo/repos","events_url":"https://api.github.com/users/maffoo/events{/privacy}","received_events_url":"https://api.github.com/users/maffoo/received_events","type":"User","site_admin":false},"body":"nit: whitespace before open brace","created_at":"2015-10-15T17:09:16Z","updated_at":"2015-10-15T17:09:16Z","html_url":"https://github.com/labrad/scalabrad-web/pull/74#discussion_r42151739","pull_request_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/comments/42151739"},"html":{"href":"https://github.com/labrad/scalabrad-web/pull/74#discussion_r42151739"},"pull_request":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74","id":46357882,"html_url":"https://github.com/labrad/scalabrad-web/pull/74","diff_url":"https://github.com/labrad/scalabrad-web/pull/74.diff","patch_url":"https://github.com/labrad/scalabrad-web/pull/74.patch","issue_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/74","number":74,"state":"open","locked":false,"title":"add drag and drop to registry editor","user":{"login":"joshmutus","id":8173925,"avatar_url":"https://avatars.githubusercontent.com/u/8173925?v=3","gravatar_id":"","url":"https://api.github.com/users/joshmutus","html_url":"https://github.com/joshmutus","followers_url":"https://api.github.com/users/joshmutus/followers","following_url":"https://api.github.com/users/joshmutus/following{/other_user}","gists_url":"https://api.github.com/users/joshmutus/gists{/gist_id}","starred_url":"https://api.github.com/users/joshmutus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshmutus/subscriptions","organizations_url":"https://api.github.com/users/joshmutus/orgs","repos_url":"https://api.github.com/users/joshmutus/repos","events_url":"https://api.github.com/users/joshmutus/events{/privacy}","received_events_url":"https://api.github.com/users/joshmutus/received_events","type":"User","site_admin":false},"body":"This should be working essentially. I think there are issues with the feature as I've implemented it. Right now, it has the ability to drag entire folders into entire folders. \r\n\r\nAdding the ability to copy keys is easy to add.\r\n\r\nI'm a bit concerned that it feels like \"move\" but is actually \"copy\" and that will be confusing to users. \r\n\r\nIt's lacking the feature to drop into a window and place it in the folder that is contained in that window. That feature has an edge case that it wouldn't make sense if the window was full of directories, there'd be no place to drop it. I've started to add a \"Drop here\" dialog to handle this, but it would be nice to get some feedback..","created_at":"2015-09-30T03:25:01Z","updated_at":"2015-10-15T17:09:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"171598a2a5da4a975383a2acf39a17fad2a33f0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74/commits","review_comments_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74/comments","review_comment_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/74/comments","statuses_url":"https://api.github.com/repos/labrad/scalabrad-web/statuses/e77da4794d0cf39cfdb8627be12137176c2d8e65","head":{"label":"labrad:u/joshmutus/drag-drop","ref":"u/joshmutus/drag-drop","sha":"e77da4794d0cf39cfdb8627be12137176c2d8e65","user":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"repo":{"id":32440005,"name":"scalabrad-web","full_name":"labrad/scalabrad-web","owner":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labrad/scalabrad-web","description":"A web interface for labrad","fork":false,"url":"https://api.github.com/repos/labrad/scalabrad-web","forks_url":"https://api.github.com/repos/labrad/scalabrad-web/forks","keys_url":"https://api.github.com/repos/labrad/scalabrad-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labrad/scalabrad-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labrad/scalabrad-web/teams","hooks_url":"https://api.github.com/repos/labrad/scalabrad-web/hooks","issue_events_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/events{/number}","events_url":"https://api.github.com/repos/labrad/scalabrad-web/events","assignees_url":"https://api.github.com/repos/labrad/scalabrad-web/assignees{/user}","branches_url":"https://api.github.com/repos/labrad/scalabrad-web/branches{/branch}","tags_url":"https://api.github.com/repos/labrad/scalabrad-web/tags","blobs_url":"https://api.github.com/repos/labrad/scalabrad-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labrad/scalabrad-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labrad/scalabrad-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/labrad/scalabrad-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labrad/scalabrad-web/statuses/{sha}","languages_url":"https://api.github.com/repos/labrad/scalabrad-web/languages","stargazers_url":"https://api.github.com/repos/labrad/scalabrad-web/stargazers","contributors_url":"https://api.github.com/repos/labrad/scalabrad-web/contributors","subscribers_url":"https://api.github.com/repos/labrad/scalabrad-web/subscribers","subscription_url":"https://api.github.com/repos/labrad/scalabrad-web/subscription","commits_url":"https://api.github.com/repos/labrad/scalabrad-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/labrad/scalabrad-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/labrad/scalabrad-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/labrad/scalabrad-web/contents/{+path}","compare_url":"https://api.github.com/repos/labrad/scalabrad-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labrad/scalabrad-web/merges","archive_url":"https://api.github.com/repos/labrad/scalabrad-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labrad/scalabrad-web/downloads","issues_url":"https://api.github.com/repos/labrad/scalabrad-web/issues{/number}","pulls_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls{/number}","milestones_url":"https://api.github.com/repos/labrad/scalabrad-web/milestones{/number}","notifications_url":"https://api.github.com/repos/labrad/scalabrad-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labrad/scalabrad-web/labels{/name}","releases_url":"https://api.github.com/repos/labrad/scalabrad-web/releases{/id}","created_at":"2015-03-18T05:34:53Z","updated_at":"2015-07-21T20:46:06Z","pushed_at":"2015-10-14T16:44:36Z","git_url":"git://github.com/labrad/scalabrad-web.git","ssh_url":"git@github.com:labrad/scalabrad-web.git","clone_url":"https://github.com/labrad/scalabrad-web.git","svn_url":"https://github.com/labrad/scalabrad-web","homepage":"","size":1484,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":0,"default_branch":"master"}},"base":{"label":"labrad:master","ref":"master","sha":"149021a7aa9621180b5a7c1021b98c201b5176df","user":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"repo":{"id":32440005,"name":"scalabrad-web","full_name":"labrad/scalabrad-web","owner":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labrad/scalabrad-web","description":"A web interface for labrad","fork":false,"url":"https://api.github.com/repos/labrad/scalabrad-web","forks_url":"https://api.github.com/repos/labrad/scalabrad-web/forks","keys_url":"https://api.github.com/repos/labrad/scalabrad-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labrad/scalabrad-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labrad/scalabrad-web/teams","hooks_url":"https://api.github.com/repos/labrad/scalabrad-web/hooks","issue_events_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/events{/number}","events_url":"https://api.github.com/repos/labrad/scalabrad-web/events","assignees_url":"https://api.github.com/repos/labrad/scalabrad-web/assignees{/user}","branches_url":"https://api.github.com/repos/labrad/scalabrad-web/branches{/branch}","tags_url":"https://api.github.com/repos/labrad/scalabrad-web/tags","blobs_url":"https://api.github.com/repos/labrad/scalabrad-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labrad/scalabrad-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labrad/scalabrad-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/labrad/scalabrad-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labrad/scalabrad-web/statuses/{sha}","languages_url":"https://api.github.com/repos/labrad/scalabrad-web/languages","stargazers_url":"https://api.github.com/repos/labrad/scalabrad-web/stargazers","contributors_url":"https://api.github.com/repos/labrad/scalabrad-web/contributors","subscribers_url":"https://api.github.com/repos/labrad/scalabrad-web/subscribers","subscription_url":"https://api.github.com/repos/labrad/scalabrad-web/subscription","commits_url":"https://api.github.com/repos/labrad/scalabrad-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/labrad/scalabrad-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/labrad/scalabrad-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/labrad/scalabrad-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/labrad/scalabrad-web/contents/{+path}","compare_url":"https://api.github.com/repos/labrad/scalabrad-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labrad/scalabrad-web/merges","archive_url":"https://api.github.com/repos/labrad/scalabrad-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labrad/scalabrad-web/downloads","issues_url":"https://api.github.com/repos/labrad/scalabrad-web/issues{/number}","pulls_url":"https://api.github.com/repos/labrad/scalabrad-web/pulls{/number}","milestones_url":"https://api.github.com/repos/labrad/scalabrad-web/milestones{/number}","notifications_url":"https://api.github.com/repos/labrad/scalabrad-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labrad/scalabrad-web/labels{/name}","releases_url":"https://api.github.com/repos/labrad/scalabrad-web/releases{/id}","created_at":"2015-03-18T05:34:53Z","updated_at":"2015-07-21T20:46:06Z","pushed_at":"2015-10-14T16:44:36Z","git_url":"git://github.com/labrad/scalabrad-web.git","ssh_url":"git@github.com:labrad/scalabrad-web.git","clone_url":"https://github.com/labrad/scalabrad-web.git","svn_url":"https://github.com/labrad/scalabrad-web","homepage":"","size":1484,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74"},"html":{"href":"https://github.com/labrad/scalabrad-web/pull/74"},"issue":{"href":"https://api.github.com/repos/labrad/scalabrad-web/issues/74"},"comments":{"href":"https://api.github.com/repos/labrad/scalabrad-web/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/labrad/scalabrad-web/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/labrad/scalabrad-web/statuses/e77da4794d0cf39cfdb8627be12137176c2d8e65"}}}}