{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/treeherder/pulls/comments/34061438","id":34061438,"diff_hunk":"@@ -720,16 +722,73 @@ perf.controller('TestChooserCtrl', function($scope, $modalInstance, $http,\n   $scope.loadingTestData = false;\n \n   var testInputCreated = false;\n-\n+  var testArray = [];\n+  var series = [];\n   $scope.addTestData = function () {\n-    var series = _.clone($scope.selectedSeries);\n-    series.projectName = $scope.selectedProject.name;\n-    $modalInstance.close(series);\n+      $scope.selectedSeriesList = $scope.rightList\n+      $scope.selectedSeriesList.forEach(function(selectedSeries, i) {\n+          series[i] = _.clone(selectedSeries); \n+          series[i].projectName = selectedSeries.projectName;\n+      })\n+      $modalInstance.close(series);\n   };\n \n   $scope.cancel = function () {\n     $modalInstance.dismiss('cancel');\n   };\n+  $scope.testList = [];\n+  $scope.rightSelected = [];\n+  $scope.rightList = [];\n+  \n+  var move_test_add = function(what, from, to) {\n+      var selected;\n+      what.forEach(function(test) {\n+          selected = from.indexOf(test);\n+          if(selected !== -1) {\n+          var series = from.splice(selected, 1)[0];\n+              var result = testArray.filter(function (obj) {\n+              return obj.name == series;\n+          });\n+          selected = _.clone(result[0]);\n+          selected.projectName = $scope.selectedProject.name;\n+          to.push(selected);\n+          console.log($scope.rightList);\n+          }\n+      });\n+  }\n+  var move_test_remove = function(what, from, to) {\n+      what.forEach(function(test) {\n+          console.log(test);\n+          test = JSON.parse(test);\n+          console.log(test);\n+          var selected = -1;\n+          from.forEach(function(obj, i){\n+              if(obj.name === test.name) {\n+                  selected = i;\n+              }\n+          });\n+          if (selected !== -1) {\n+              if (test.platform === $scope.selectedPlatform &&\n+                  test.projectName === $scope.selectedProject.name) {\n+                  var temp = (from.splice(selected, 1))[0].name\n+                  console.log(temp);\n+                  to.push(temp);\n+                  }\n+              // just remove the item because testlist will refresh when change platform or project \n+              else {\n+              from.splice(selected, 1);\n+              }\n+          }\n+      });\n+  }\n+  \n+  $scope.unselectTest = function () {\n+      move_test_remove($scope.testSelected, $scope.rightList, $scope.LeftList);","path":"ui/js/graphs.js","position":111,"original_position":111,"commit_id":"f88cb8890219439af93637f6d8c2509053d4113a","original_commit_id":"f88cb8890219439af93637f6d8c2509053d4113a","user":{"login":"wlach","id":20569,"avatar_url":"https://avatars.githubusercontent.com/u/20569?v=3","gravatar_id":"","url":"https://api.github.com/users/wlach","html_url":"https://github.com/wlach","followers_url":"https://api.github.com/users/wlach/followers","following_url":"https://api.github.com/users/wlach/following{/other_user}","gists_url":"https://api.github.com/users/wlach/gists{/gist_id}","starred_url":"https://api.github.com/users/wlach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlach/subscriptions","organizations_url":"https://api.github.com/users/wlach/orgs","repos_url":"https://api.github.com/users/wlach/repos","events_url":"https://api.github.com/users/wlach/events{/privacy}","received_events_url":"https://api.github.com/users/wlach/received_events","type":"User","site_admin":false},"body":"Let's just inline the content of `move_test_remove` inside this function.","created_at":"2015-07-07T16:43:31Z","updated_at":"2015-07-07T16:43:31Z","html_url":"https://github.com/mozilla/treeherder/pull/615#discussion_r34061438","pull_request_url":"https://api.github.com/repos/mozilla/treeherder/pulls/615","_links":{"self":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/comments/34061438"},"html":{"href":"https://github.com/mozilla/treeherder/pull/615#discussion_r34061438"},"pull_request":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/615"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/treeherder/pulls/615","id":37151731,"html_url":"https://github.com/mozilla/treeherder/pull/615","diff_url":"https://github.com/mozilla/treeherder/pull/615.diff","patch_url":"https://github.com/mozilla/treeherder/pull/615.patch","issue_url":"https://api.github.com/repos/mozilla/treeherder/issues/615","number":615,"state":"open","locked":false,"title":"Bug 1164074-Test chooser in graphs viewer could be better - do not merge","user":{"login":"MikeLing","id":2166227,"avatar_url":"https://avatars.githubusercontent.com/u/2166227?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeLing","html_url":"https://github.com/MikeLing","followers_url":"https://api.github.com/users/MikeLing/followers","following_url":"https://api.github.com/users/MikeLing/following{/other_user}","gists_url":"https://api.github.com/users/MikeLing/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeLing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeLing/subscriptions","organizations_url":"https://api.github.com/users/MikeLing/orgs","repos_url":"https://api.github.com/users/MikeLing/repos","events_url":"https://api.github.com/users/MikeLing/events{/privacy}","received_events_url":"https://api.github.com/users/MikeLing/received_events","type":"User","site_admin":false},"body":"\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/mozilla/treeherder/615)\n<!-- Reviewable:end -->\n","created_at":"2015-06-08T13:15:45Z","updated_at":"2015-07-07T16:43:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c607f9c35da30fa42b519dc4c35ecd01c132b39","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/treeherder/pulls/615/commits","review_comments_url":"https://api.github.com/repos/mozilla/treeherder/pulls/615/comments","review_comment_url":"https://api.github.com/repos/mozilla/treeherder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/treeherder/issues/615/comments","statuses_url":"https://api.github.com/repos/mozilla/treeherder/statuses/f88cb8890219439af93637f6d8c2509053d4113a","head":{"label":"MikeLing:bugfix-1164074","ref":"bugfix-1164074","sha":"f88cb8890219439af93637f6d8c2509053d4113a","user":{"login":"MikeLing","id":2166227,"avatar_url":"https://avatars.githubusercontent.com/u/2166227?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeLing","html_url":"https://github.com/MikeLing","followers_url":"https://api.github.com/users/MikeLing/followers","following_url":"https://api.github.com/users/MikeLing/following{/other_user}","gists_url":"https://api.github.com/users/MikeLing/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeLing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeLing/subscriptions","organizations_url":"https://api.github.com/users/MikeLing/orgs","repos_url":"https://api.github.com/users/MikeLing/repos","events_url":"https://api.github.com/users/MikeLing/events{/privacy}","received_events_url":"https://api.github.com/users/MikeLing/received_events","type":"User","site_admin":false},"repo":{"id":34638862,"name":"treeherder","full_name":"MikeLing/treeherder","owner":{"login":"MikeLing","id":2166227,"avatar_url":"https://avatars.githubusercontent.com/u/2166227?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeLing","html_url":"https://github.com/MikeLing","followers_url":"https://api.github.com/users/MikeLing/followers","following_url":"https://api.github.com/users/MikeLing/following{/other_user}","gists_url":"https://api.github.com/users/MikeLing/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeLing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeLing/subscriptions","organizations_url":"https://api.github.com/users/MikeLing/orgs","repos_url":"https://api.github.com/users/MikeLing/repos","events_url":"https://api.github.com/users/MikeLing/events{/privacy}","received_events_url":"https://api.github.com/users/MikeLing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MikeLing/treeherder","description":"The backend of treeherder, a replacement for TBPL. See wiki page for where to file bugs.","fork":true,"url":"https://api.github.com/repos/MikeLing/treeherder","forks_url":"https://api.github.com/repos/MikeLing/treeherder/forks","keys_url":"https://api.github.com/repos/MikeLing/treeherder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MikeLing/treeherder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MikeLing/treeherder/teams","hooks_url":"https://api.github.com/repos/MikeLing/treeherder/hooks","issue_events_url":"https://api.github.com/repos/MikeLing/treeherder/issues/events{/number}","events_url":"https://api.github.com/repos/MikeLing/treeherder/events","assignees_url":"https://api.github.com/repos/MikeLing/treeherder/assignees{/user}","branches_url":"https://api.github.com/repos/MikeLing/treeherder/branches{/branch}","tags_url":"https://api.github.com/repos/MikeLing/treeherder/tags","blobs_url":"https://api.github.com/repos/MikeLing/treeherder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MikeLing/treeherder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MikeLing/treeherder/git/refs{/sha}","trees_url":"https://api.github.com/repos/MikeLing/treeherder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MikeLing/treeherder/statuses/{sha}","languages_url":"https://api.github.com/repos/MikeLing/treeherder/languages","stargazers_url":"https://api.github.com/repos/MikeLing/treeherder/stargazers","contributors_url":"https://api.github.com/repos/MikeLing/treeherder/contributors","subscribers_url":"https://api.github.com/repos/MikeLing/treeherder/subscribers","subscription_url":"https://api.github.com/repos/MikeLing/treeherder/subscription","commits_url":"https://api.github.com/repos/MikeLing/treeherder/commits{/sha}","git_commits_url":"https://api.github.com/repos/MikeLing/treeherder/git/commits{/sha}","comments_url":"https://api.github.com/repos/MikeLing/treeherder/comments{/number}","issue_comment_url":"https://api.github.com/repos/MikeLing/treeherder/issues/comments{/number}","contents_url":"https://api.github.com/repos/MikeLing/treeherder/contents/{+path}","compare_url":"https://api.github.com/repos/MikeLing/treeherder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MikeLing/treeherder/merges","archive_url":"https://api.github.com/repos/MikeLing/treeherder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MikeLing/treeherder/downloads","issues_url":"https://api.github.com/repos/MikeLing/treeherder/issues{/number}","pulls_url":"https://api.github.com/repos/MikeLing/treeherder/pulls{/number}","milestones_url":"https://api.github.com/repos/MikeLing/treeherder/milestones{/number}","notifications_url":"https://api.github.com/repos/MikeLing/treeherder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MikeLing/treeherder/labels{/name}","releases_url":"https://api.github.com/repos/MikeLing/treeherder/releases{/id}","created_at":"2015-04-27T01:05:12Z","updated_at":"2015-04-27T01:05:13Z","pushed_at":"2015-07-07T02:23:17Z","git_url":"git://github.com/MikeLing/treeherder.git","ssh_url":"git@github.com:MikeLing/treeherder.git","clone_url":"https://github.com/MikeLing/treeherder.git","svn_url":"https://github.com/MikeLing/treeherder","homepage":"https://wiki.mozilla.org/Auto-tools/Projects/Treeherder","size":32297,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"a51b58a45167b371735729461e3932f2dad446c3","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":8463294,"name":"treeherder","full_name":"mozilla/treeherder","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/treeherder","description":"A reporting dashboard & service for managing CI data for commits to Mozilla projects","fork":false,"url":"https://api.github.com/repos/mozilla/treeherder","forks_url":"https://api.github.com/repos/mozilla/treeherder/forks","keys_url":"https://api.github.com/repos/mozilla/treeherder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/treeherder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/treeherder/teams","hooks_url":"https://api.github.com/repos/mozilla/treeherder/hooks","issue_events_url":"https://api.github.com/repos/mozilla/treeherder/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/treeherder/events","assignees_url":"https://api.github.com/repos/mozilla/treeherder/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/treeherder/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/treeherder/tags","blobs_url":"https://api.github.com/repos/mozilla/treeherder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/treeherder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/treeherder/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/treeherder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/treeherder/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/treeherder/languages","stargazers_url":"https://api.github.com/repos/mozilla/treeherder/stargazers","contributors_url":"https://api.github.com/repos/mozilla/treeherder/contributors","subscribers_url":"https://api.github.com/repos/mozilla/treeherder/subscribers","subscription_url":"https://api.github.com/repos/mozilla/treeherder/subscription","commits_url":"https://api.github.com/repos/mozilla/treeherder/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/treeherder/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/treeherder/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/treeherder/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/treeherder/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/treeherder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/treeherder/merges","archive_url":"https://api.github.com/repos/mozilla/treeherder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/treeherder/downloads","issues_url":"https://api.github.com/repos/mozilla/treeherder/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/treeherder/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/treeherder/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/treeherder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/treeherder/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/treeherder/releases{/id}","created_at":"2013-02-27T19:17:37Z","updated_at":"2015-07-02T05:58:54Z","pushed_at":"2015-07-07T15:53:44Z","git_url":"git://github.com/mozilla/treeherder.git","ssh_url":"git@github.com:mozilla/treeherder.git","clone_url":"https://github.com/mozilla/treeherder.git","svn_url":"https://github.com/mozilla/treeherder","homepage":"https://wiki.mozilla.org/Auto-tools/Projects/Treeherder","size":394194,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":24,"forks":52,"open_issues":24,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/615"},"html":{"href":"https://github.com/mozilla/treeherder/pull/615"},"issue":{"href":"https://api.github.com/repos/mozilla/treeherder/issues/615"},"comments":{"href":"https://api.github.com/repos/mozilla/treeherder/issues/615/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/615/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/615/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/treeherder/statuses/f88cb8890219439af93637f6d8c2509053d4113a"}}}}