{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/46425457","id":46425457,"diff_hunk":"@@ -0,0 +1,221 @@\n+var EventEmitter = require(\"events\").EventEmitter;\n+\n+var AppDispatcher = require(\"../AppDispatcher\");\n+var InfoStore = require(\"../stores/InfoStore\");\n+var InfoActions = require(\"../actions/InfoActions\");\n+var InfoEvents = require(\"../events/InfoEvents\");\n+var MesosActions = require(\"../actions/MesosActions\");\n+var MesosEvents = require(\"../events/MesosEvents\");\n+\n+const FILES_TTL = 60000;\n+const STATE_TTL = 60000;\n+const MASTER_ID = \"master\";\n+\n+var stateMap = {};\n+var taskFileMap = {};\n+var taskFileRequestQue = [];\n+\n+var MesosStore = Object.assign({\n+\n+  getState: function (nodeId) {\n+    var data = stateMap[nodeId];\n+    if (data == null || data.timestamp + STATE_TTL < Date.now()) {\n+      invalidateState(nodeId);\n+      return null;\n+    }\n+    return data.state;\n+  },\n+\n+  getTaskFiles: function (taskId) {\n+    var data = taskFileMap[taskId];\n+    if (data == null || data.timestamp + FILES_TTL < Date.now()) {\n+      invalidateTaskFiles(taskId);\n+      return null;\n+    }\n+    return data.files;\n+  }\n+\n+}, EventEmitter.prototype);\n+\n+function addState(nodeId, state) {\n+  stateMap[nodeId] = {\n+    state: state,\n+    timestamp: Date.now()\n+  };\n+  MesosStore.emit(MesosEvents.CHANGE);\n+}\n+\n+function invalidateState(nodeId) {\n+  stateMap[nodeId] = null;\n+}\n+\n+function addTaskFiles(taskId, files) {\n+  taskFileMap[taskId] = {\n+    files: files,\n+    timestamp: Date.now()\n+  };\n+  MesosStore.emit(MesosEvents.CHANGE);\n+}\n+\n+function invalidateTaskFiles(taskId) {\n+  delete taskFileMap[taskId];\n+}\n+\n+function getNodeUrl(nodeId) {\n+  var master = MesosStore.getState(MASTER_ID);\n+  if (master == null) {\n+    throw new Error(","path":"src/js/stores/MesosStore.js","position":67,"original_position":67,"commit_id":"f7418cb234eb594e6837511075f4bcf0d137d22a","original_commit_id":"f7418cb234eb594e6837511075f4bcf0d137d22a","user":{"login":"orlandohohmeier","id":647035,"avatar_url":"https://avatars.githubusercontent.com/u/647035?v=3","gravatar_id":"","url":"https://api.github.com/users/orlandohohmeier","html_url":"https://github.com/orlandohohmeier","followers_url":"https://api.github.com/users/orlandohohmeier/followers","following_url":"https://api.github.com/users/orlandohohmeier/following{/other_user}","gists_url":"https://api.github.com/users/orlandohohmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/orlandohohmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlandohohmeier/subscriptions","organizations_url":"https://api.github.com/users/orlandohohmeier/orgs","repos_url":"https://api.github.com/users/orlandohohmeier/repos","events_url":"https://api.github.com/users/orlandohohmeier/events{/privacy}","received_events_url":"https://api.github.com/users/orlandohohmeier/received_events","type":"User","site_admin":false},"body":"How do I fail those methods in a way that helps with debugging but didn't break the app?","created_at":"2015-12-02T15:12:57Z","updated_at":"2015-12-02T15:12:57Z","html_url":"https://github.com/mesosphere/marathon-ui/pull/449#discussion_r46425457","pull_request_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments/46425457"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/449#discussion_r46425457"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449","id":52002973,"html_url":"https://github.com/mesosphere/marathon-ui/pull/449","diff_url":"https://github.com/mesosphere/marathon-ui/pull/449.diff","patch_url":"https://github.com/mesosphere/marathon-ui/pull/449.patch","issue_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/449","number":449,"state":"open","locked":false,"title":"DO NOT MERGE: Feature/2721 show error and output logs","user":{"login":"orlandohohmeier","id":647035,"avatar_url":"https://avatars.githubusercontent.com/u/647035?v=3","gravatar_id":"","url":"https://api.github.com/users/orlandohohmeier","html_url":"https://github.com/orlandohohmeier","followers_url":"https://api.github.com/users/orlandohohmeier/followers","following_url":"https://api.github.com/users/orlandohohmeier/following{/other_user}","gists_url":"https://api.github.com/users/orlandohohmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/orlandohohmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlandohohmeier/subscriptions","organizations_url":"https://api.github.com/users/orlandohohmeier/orgs","repos_url":"https://api.github.com/users/orlandohohmeier/repos","events_url":"https://api.github.com/users/orlandohohmeier/events{/privacy}","received_events_url":"https://api.github.com/users/orlandohohmeier/received_events","type":"User","site_admin":false},"body":"![ouput-error-log-download](https://cloud.githubusercontent.com/assets/647035/11532077/96ac660c-9901-11e5-9919-e69b1e6d8aae.gif)\r\nProvide links to download logs within the marathon ui, to streamline the task debugging.\r\n\r\n**AC**\r\n* [ ] Task/Instance Detail / Get and display list of task files\r\n* [ ] App Detail / Provide error/output links\r\n* [ ] \"Cache\" mesos calls to improve performance\r\n* [ ]  Indicate (file/state) loading progress (**WIP**)\r\n* [ ]  Test components, store and helpers (**WIP**)\r\n* [ ]  Changelog entry (**WIP**)\r\n\r\nCloses mesosphere/marathon#2721","created_at":"2015-11-27T15:01:10Z","updated_at":"2015-12-02T15:12:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"267905d94add19ac786016e66ac682d5e52aaa3e","assignee":{"login":"pierlo-upitup","id":1078545,"avatar_url":"https://avatars.githubusercontent.com/u/1078545?v=3","gravatar_id":"","url":"https://api.github.com/users/pierlo-upitup","html_url":"https://github.com/pierlo-upitup","followers_url":"https://api.github.com/users/pierlo-upitup/followers","following_url":"https://api.github.com/users/pierlo-upitup/following{/other_user}","gists_url":"https://api.github.com/users/pierlo-upitup/gists{/gist_id}","starred_url":"https://api.github.com/users/pierlo-upitup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierlo-upitup/subscriptions","organizations_url":"https://api.github.com/users/pierlo-upitup/orgs","repos_url":"https://api.github.com/users/pierlo-upitup/repos","events_url":"https://api.github.com/users/pierlo-upitup/events{/privacy}","received_events_url":"https://api.github.com/users/pierlo-upitup/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449/commits","review_comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449/comments","review_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/449/comments","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/f7418cb234eb594e6837511075f4bcf0d137d22a","head":{"label":"mesosphere:feature/2721-show-error-and-output-logs","ref":"feature/2721-show-error-and-output-logs","sha":"f7418cb234eb594e6837511075f4bcf0d137d22a","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":36859608,"name":"marathon-ui","full_name":"mesosphere/marathon-ui","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon-ui","description":"The web-ui for Marathon (https://github.com/mesosphere/marathon)","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon-ui","forks_url":"https://api.github.com/repos/mesosphere/marathon-ui/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon-ui/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon-ui/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon-ui/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon-ui/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon-ui/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon-ui/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon-ui/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon-ui/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon-ui/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon-ui/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon-ui/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon-ui/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon-ui/releases{/id}","created_at":"2015-06-04T09:00:20Z","updated_at":"2015-11-25T22:39:46Z","pushed_at":"2015-12-02T14:51:17Z","git_url":"git://github.com/mesosphere/marathon-ui.git","ssh_url":"git@github.com:mesosphere/marathon-ui.git","clone_url":"https://github.com/mesosphere/marathon-ui.git","svn_url":"https://github.com/mesosphere/marathon-ui","homepage":"","size":8638,"stargazers_count":35,"watchers_count":35,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":35,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"f92871ad8c8050172bc0645c2c284eefaf2c9bb2","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":36859608,"name":"marathon-ui","full_name":"mesosphere/marathon-ui","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/marathon-ui","description":"The web-ui for Marathon (https://github.com/mesosphere/marathon)","fork":false,"url":"https://api.github.com/repos/mesosphere/marathon-ui","forks_url":"https://api.github.com/repos/mesosphere/marathon-ui/forks","keys_url":"https://api.github.com/repos/mesosphere/marathon-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/marathon-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/marathon-ui/teams","hooks_url":"https://api.github.com/repos/mesosphere/marathon-ui/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/marathon-ui/events","assignees_url":"https://api.github.com/repos/mesosphere/marathon-ui/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/marathon-ui/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/tags","blobs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/marathon-ui/languages","stargazers_url":"https://api.github.com/repos/mesosphere/marathon-ui/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/marathon-ui/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/marathon-ui/subscription","commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/marathon-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/marathon-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/marathon-ui/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/marathon-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/marathon-ui/merges","archive_url":"https://api.github.com/repos/mesosphere/marathon-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/marathon-ui/downloads","issues_url":"https://api.github.com/repos/mesosphere/marathon-ui/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/marathon-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/marathon-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/marathon-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/marathon-ui/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/marathon-ui/releases{/id}","created_at":"2015-06-04T09:00:20Z","updated_at":"2015-11-25T22:39:46Z","pushed_at":"2015-12-02T14:51:17Z","git_url":"git://github.com/mesosphere/marathon-ui.git","ssh_url":"git@github.com:mesosphere/marathon-ui.git","clone_url":"https://github.com/mesosphere/marathon-ui.git","svn_url":"https://github.com/mesosphere/marathon-ui","homepage":"","size":8638,"stargazers_count":35,"watchers_count":35,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449"},"html":{"href":"https://github.com/mesosphere/marathon-ui/pull/449"},"issue":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/449"},"comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/issues/449/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/pulls/449/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/marathon-ui/statuses/f7418cb234eb594e6837511075f4bcf0d137d22a"}}}}