{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/treeherder/pulls/comments/236486733","pull_request_review_id":178571626,"id":236486733,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjQ4NjczMw==","diff_hunk":"@@ -377,3 +389,407 @@ export const getGraphsLink = function getGraphsLink(\n \n   return `perf.html#/graphs${createQueryParams(params)}`;\n };\n+\n+// old PhAlerts' inner workings\n+const Alert = (alertData, optionCollectionMap) => ({\n+  ...alertData,\n+  title: getSeriesName(alertData.series_signature, optionCollectionMap),\n+});\n+\n+export const getAlertStatusText = alert =>\n+  Object.values(phAlertStatusMap).find(status => status.id === alert.status)\n+    .text;\n+\n+export const getGraphsURL = (\n+  alert,\n+  timeRange,\n+  alertRepository,\n+  performanceFrameworkId,\n+) => {\n+  let url = `#/graphs?timerange=${timeRange}&series=${alertRepository},${\n+    alert.series_signature.id\n+  },1`;\n+\n+  // automatically add related branches (we take advantage of\n+  // the otherwise rather useless signature hash to avoid having to fetch this\n+  // information from the server)\n+  if (phFrameworksWithRelatedBranches.includes(performanceFrameworkId)) {\n+    const branches =\n+      alertRepository === 'mozilla-beta'\n+        ? ['mozilla-inbound']\n+        : thPerformanceBranches.filter(branch => branch !== alertRepository);\n+    url += branches\n+      .map(\n+        branch =>\n+          `&series=${branch},${alert.series_signature.signature_hash},0`,\n+      )\n+      .join('');\n+  }\n+\n+  return url;\n+};\n+\n+export const getSubtestsURL = (alert, alertSummary) => {\n+  const endpoint = '#/comparesubtest';\n+  const urlParameters = {\n+    framework: alertSummary.framework,\n+    originalProject: alertSummary.repository,\n+    originalSignature: alert.series_signature.signature_hash,\n+    newProject: alertSummary.repository,\n+    newSignature: alert.series_signature.signature_hash,\n+  };\n+  if (alertSummary.prevResultSetMetadata) {\n+    urlParameters.originalRevision =\n+      alertSummary.prevResultSetMetadata.revision;\n+  }\n+  if (alertSummary.prevResultSetMetadata) {\n+    urlParameters.newRevision = alertSummary.resultSetMetadata.revision;\n+  }\n+\n+  return `${endpoint}${createQueryParams(urlParameters)}`;\n+};\n+\n+const modifyAlert = (alert, modification) =>\n+  update(getApiUrl(`/performance/alert/${alert.id}/`), modification);\n+\n+export const alertIsOfState = (alert, phAlertStatus) =>\n+  alert.status === phAlertStatus.id;\n+\n+export const toggleStar = alert => {\n+  const toggledStar = !alert.starred;\n+  modifyAlert(alert, {\n+    starred: toggledStar,\n+  }).then(() => {\n+    alert.starred = toggledStar;\n+  });\n+};\n+\n+let issueTrackers; // will cache on first AlertSummary call\n+\n+const _initializeAlerts = (alertSummary, optionCollectionMap) => {\n+  // this function converts the representation returned by the perfherder\n+  // api into a representation more suited for display in the UI\n+\n+  // just treat related (reassigned or downstream) alerts as one\n+  // big block -- we'll display in the UI depending on their content\n+  alertSummary.alerts = alertSummary.alerts","path":"ui/perfherder/helpers.js","position":116,"original_position":116,"commit_id":"8bad7648f64c0dc9d601a2e136dd1b45820255db","original_commit_id":"8bad7648f64c0dc9d601a2e136dd1b45820255db","user":{"login":"camd","id":419924,"node_id":"MDQ6VXNlcjQxOTkyNA==","avatar_url":"https://avatars1.githubusercontent.com/u/419924?v=4","gravatar_id":"","url":"https://api.github.com/users/camd","html_url":"https://github.com/camd","followers_url":"https://api.github.com/users/camd/followers","following_url":"https://api.github.com/users/camd/following{/other_user}","gists_url":"https://api.github.com/users/camd/gists{/gist_id}","starred_url":"https://api.github.com/users/camd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camd/subscriptions","organizations_url":"https://api.github.com/users/camd/orgs","repos_url":"https://api.github.com/users/camd/repos","events_url":"https://api.github.com/users/camd/events{/privacy}","received_events_url":"https://api.github.com/users/camd/received_events","type":"User","site_admin":false},"body":"I must admit, I'm not usually a fan of a function that modifies one of the passed-in parameters.  Would it be possible to make this a ``get``er and modify ``alertSummary.alerts`` with the result of this function?  ","created_at":"2018-11-27T01:03:15Z","updated_at":"2018-11-27T01:11:35Z","html_url":"https://github.com/mozilla/treeherder/pull/4263#discussion_r236486733","pull_request_url":"https://api.github.com/repos/mozilla/treeherder/pulls/4263","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/comments/236486733"},"html":{"href":"https://github.com/mozilla/treeherder/pull/4263#discussion_r236486733"},"pull_request":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/4263"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/treeherder/pulls/4263","id":230153922,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwMTUzOTIy","html_url":"https://github.com/mozilla/treeherder/pull/4263","diff_url":"https://github.com/mozilla/treeherder/pull/4263.diff","patch_url":"https://github.com/mozilla/treeherder/pull/4263.patch","issue_url":"https://api.github.com/repos/mozilla/treeherder/issues/4263","number":4263,"state":"open","locked":false,"title":"Bug 1506553 - Convert PhAlerts model to ReactJS","user":{"login":"ionutgoldan","id":12194756,"node_id":"MDQ6VXNlcjEyMTk0NzU2","avatar_url":"https://avatars0.githubusercontent.com/u/12194756?v=4","gravatar_id":"","url":"https://api.github.com/users/ionutgoldan","html_url":"https://github.com/ionutgoldan","followers_url":"https://api.github.com/users/ionutgoldan/followers","following_url":"https://api.github.com/users/ionutgoldan/following{/other_user}","gists_url":"https://api.github.com/users/ionutgoldan/gists{/gist_id}","starred_url":"https://api.github.com/users/ionutgoldan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ionutgoldan/subscriptions","organizations_url":"https://api.github.com/users/ionutgoldan/orgs","repos_url":"https://api.github.com/users/ionutgoldan/repos","events_url":"https://api.github.com/users/ionutgoldan/events{/privacy}","received_events_url":"https://api.github.com/users/ionutgoldan/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-12T14:32:00Z","updated_at":"2018-11-27T01:11:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00031fce2bfcf238dd9e561793b3aff3a8d533e9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/treeherder/pulls/4263/commits","review_comments_url":"https://api.github.com/repos/mozilla/treeherder/pulls/4263/comments","review_comment_url":"https://api.github.com/repos/mozilla/treeherder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/treeherder/issues/4263/comments","statuses_url":"https://api.github.com/repos/mozilla/treeherder/statuses/8bad7648f64c0dc9d601a2e136dd1b45820255db","head":{"label":"ionutgoldan:phalerts-model-to-react","ref":"phalerts-model-to-react","sha":"8bad7648f64c0dc9d601a2e136dd1b45820255db","user":{"login":"ionutgoldan","id":12194756,"node_id":"MDQ6VXNlcjEyMTk0NzU2","avatar_url":"https://avatars0.githubusercontent.com/u/12194756?v=4","gravatar_id":"","url":"https://api.github.com/users/ionutgoldan","html_url":"https://github.com/ionutgoldan","followers_url":"https://api.github.com/users/ionutgoldan/followers","following_url":"https://api.github.com/users/ionutgoldan/following{/other_user}","gists_url":"https://api.github.com/users/ionutgoldan/gists{/gist_id}","starred_url":"https://api.github.com/users/ionutgoldan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ionutgoldan/subscriptions","organizations_url":"https://api.github.com/users/ionutgoldan/orgs","repos_url":"https://api.github.com/users/ionutgoldan/repos","events_url":"https://api.github.com/users/ionutgoldan/events{/privacy}","received_events_url":"https://api.github.com/users/ionutgoldan/received_events","type":"User","site_admin":false},"repo":{"id":116953034,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY5NTMwMzQ=","name":"treeherder","full_name":"ionutgoldan/treeherder","private":false,"owner":{"login":"ionutgoldan","id":12194756,"node_id":"MDQ6VXNlcjEyMTk0NzU2","avatar_url":"https://avatars0.githubusercontent.com/u/12194756?v=4","gravatar_id":"","url":"https://api.github.com/users/ionutgoldan","html_url":"https://github.com/ionutgoldan","followers_url":"https://api.github.com/users/ionutgoldan/followers","following_url":"https://api.github.com/users/ionutgoldan/following{/other_user}","gists_url":"https://api.github.com/users/ionutgoldan/gists{/gist_id}","starred_url":"https://api.github.com/users/ionutgoldan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ionutgoldan/subscriptions","organizations_url":"https://api.github.com/users/ionutgoldan/orgs","repos_url":"https://api.github.com/users/ionutgoldan/repos","events_url":"https://api.github.com/users/ionutgoldan/events{/privacy}","received_events_url":"https://api.github.com/users/ionutgoldan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ionutgoldan/treeherder","description":"A system for managing CI data for Mozilla projects","fork":true,"url":"https://api.github.com/repos/ionutgoldan/treeherder","forks_url":"https://api.github.com/repos/ionutgoldan/treeherder/forks","keys_url":"https://api.github.com/repos/ionutgoldan/treeherder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ionutgoldan/treeherder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ionutgoldan/treeherder/teams","hooks_url":"https://api.github.com/repos/ionutgoldan/treeherder/hooks","issue_events_url":"https://api.github.com/repos/ionutgoldan/treeherder/issues/events{/number}","events_url":"https://api.github.com/repos/ionutgoldan/treeherder/events","assignees_url":"https://api.github.com/repos/ionutgoldan/treeherder/assignees{/user}","branches_url":"https://api.github.com/repos/ionutgoldan/treeherder/branches{/branch}","tags_url":"https://api.github.com/repos/ionutgoldan/treeherder/tags","blobs_url":"https://api.github.com/repos/ionutgoldan/treeherder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ionutgoldan/treeherder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ionutgoldan/treeherder/git/refs{/sha}","trees_url":"https://api.github.com/repos/ionutgoldan/treeherder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ionutgoldan/treeherder/statuses/{sha}","languages_url":"https://api.github.com/repos/ionutgoldan/treeherder/languages","stargazers_url":"https://api.github.com/repos/ionutgoldan/treeherder/stargazers","contributors_url":"https://api.github.com/repos/ionutgoldan/treeherder/contributors","subscribers_url":"https://api.github.com/repos/ionutgoldan/treeherder/subscribers","subscription_url":"https://api.github.com/repos/ionutgoldan/treeherder/subscription","commits_url":"https://api.github.com/repos/ionutgoldan/treeherder/commits{/sha}","git_commits_url":"https://api.github.com/repos/ionutgoldan/treeherder/git/commits{/sha}","comments_url":"https://api.github.com/repos/ionutgoldan/treeherder/comments{/number}","issue_comment_url":"https://api.github.com/repos/ionutgoldan/treeherder/issues/comments{/number}","contents_url":"https://api.github.com/repos/ionutgoldan/treeherder/contents/{+path}","compare_url":"https://api.github.com/repos/ionutgoldan/treeherder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ionutgoldan/treeherder/merges","archive_url":"https://api.github.com/repos/ionutgoldan/treeherder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ionutgoldan/treeherder/downloads","issues_url":"https://api.github.com/repos/ionutgoldan/treeherder/issues{/number}","pulls_url":"https://api.github.com/repos/ionutgoldan/treeherder/pulls{/number}","milestones_url":"https://api.github.com/repos/ionutgoldan/treeherder/milestones{/number}","notifications_url":"https://api.github.com/repos/ionutgoldan/treeherder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ionutgoldan/treeherder/labels{/name}","releases_url":"https://api.github.com/repos/ionutgoldan/treeherder/releases{/id}","deployments_url":"https://api.github.com/repos/ionutgoldan/treeherder/deployments","created_at":"2018-01-10T12:10:22Z","updated_at":"2018-09-26T09:53:09Z","pushed_at":"2018-11-23T13:12:43Z","git_url":"git://github.com/ionutgoldan/treeherder.git","ssh_url":"git@github.com:ionutgoldan/treeherder.git","clone_url":"https://github.com/ionutgoldan/treeherder.git","svn_url":"https://github.com/ionutgoldan/treeherder","homepage":"https://wiki.mozilla.org/EngineeringProductivity/Projects/Treeherder","size":56026,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"60f2dee13b80d1142099bdefbb7bdf847a771464","user":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk4NDYzMjk0","name":"treeherder","full_name":"mozilla/treeherder","private":false,"owner":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","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},"html_url":"https://github.com/mozilla/treeherder","description":"A system for managing CI data for 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}","deployments_url":"https://api.github.com/repos/mozilla/treeherder/deployments","created_at":"2013-02-27T19:17:37Z","updated_at":"2018-11-26T21:00:09Z","pushed_at":"2018-11-26T22:16:29Z","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/EngineeringProductivity/Projects/Treeherder","size":82424,"stargazers_count":135,"watchers_count":135,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":226,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":226,"open_issues":19,"watchers":135,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/4263"},"html":{"href":"https://github.com/mozilla/treeherder/pull/4263"},"issue":{"href":"https://api.github.com/repos/mozilla/treeherder/issues/4263"},"comments":{"href":"https://api.github.com/repos/mozilla/treeherder/issues/4263/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/4263/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/treeherder/pulls/4263/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/treeherder/statuses/8bad7648f64c0dc9d601a2e136dd1b45820255db"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"camd"}}