{"action":"created","comment":{"url":"https://api.github.com/repos/travis-ci/travis-web/pulls/comments/60740206","id":60740206,"diff_hunk":"@@ -0,0 +1,59 @@\n+import Ember from 'ember';\n+import config from 'travis/config/environment';\n+\n+export default Ember.Component.extend({\n+  classNames: ['form--cron'],\n+  store: Ember.inject.service(),\n+\n+  reset() {\n+    return this.setProperties({\n+      branch: null,\n+      interval: null,\n+      disable_by_build: null\n+    });\n+  },\n+\n+  actions: {\n+    save() {\n+      var cron, self, store, repo_id, branch;\n+\n+      if (this.get('isSaving')) {\n+        return;\n+      }\n+\n+      self = this;\n+      store = this.get('store');\n+      repo_id = this.get('branches').toArray()[0].get('repoId');\n+      branch = this.get('selectedBranch') ? this.get('selectedBranch') : this.get('branches').toArray()[0];\n+\n+      store.filter('cron', {\n+        repository_id: repo_id\n+      }, function(c) {\n+        return c.get('branch.repoId') === repo_id && c.get('branch.name') === branch.get('name');\n+      }).then(function(existing_crons){\n+        if(existing_crons.toArray()[0]){\n+          store.unloadRecord(existing_crons.toArray()[0]);\n+        }\n+\n+        self.set('isSaving', true);\n+        cron = store.createRecord('cron', {\n+          branch: branch,\n+          interval: self.get('selectedInterval') || 'monthly',\n+          disable_by_build: self.get('disable') || false\n+        });\n+        return cron.save().then(() => {\n+          self.set('isSaving', false);\n+          return self.reset();\n+        }, () => {\n+          self.set('isSaving', false);\n+          return self.reset();\n+        });\n+      });\n+    }\n+  },\n+\n+  intervals: function() {\n+    return ['monthly', 'weekly', 'daily'];\n+  }.property()","path":"app/components/add-cron-job.js","position":57,"original_position":57,"commit_id":"fb5f19019c9d3a269597a31ec1628769e85bc2cb","original_commit_id":"fb5f19019c9d3a269597a31ec1628769e85bc2cb","user":{"login":"backspace","id":43280,"avatar_url":"https://avatars.githubusercontent.com/u/43280?v=3","gravatar_id":"","url":"https://api.github.com/users/backspace","html_url":"https://github.com/backspace","followers_url":"https://api.github.com/users/backspace/followers","following_url":"https://api.github.com/users/backspace/following{/other_user}","gists_url":"https://api.github.com/users/backspace/gists{/gist_id}","starred_url":"https://api.github.com/users/backspace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/backspace/subscriptions","organizations_url":"https://api.github.com/users/backspace/orgs","repos_url":"https://api.github.com/users/backspace/repos","events_url":"https://api.github.com/users/backspace/events{/privacy}","received_events_url":"https://api.github.com/users/backspace/received_events","type":"User","site_admin":false},"body":"I should have said this earlier, but anyway, I just joined this project, so many of my comments thus far have been more general Ember Way things that aren’t necessarily backed up by the codebase. Another trend within Ember world is that people are moving away from the “prototype extensions” syntax and toward a more plain Javascript syntax. It’s a bit more verbose, but also more explicit. So this could be rewritten:\r\n\r\n```\r\nintervals: Ember.computed(function() {\r\n  return …\r\n})\r\n```\r\n\r\n_However_, does this even need to be a computed property? Could it just be this?\r\n\r\n`intervals: ['monthly', 'weekly', 'daily']`","created_at":"2016-04-22T13:43:04Z","updated_at":"2016-04-22T13:43:04Z","html_url":"https://github.com/travis-ci/travis-web/pull/464#discussion_r60740206","pull_request_url":"https://api.github.com/repos/travis-ci/travis-web/pulls/464","_links":{"self":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/comments/60740206"},"html":{"href":"https://github.com/travis-ci/travis-web/pull/464#discussion_r60740206"},"pull_request":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/464"}}},"pull_request":{"url":"https://api.github.com/repos/travis-ci/travis-web/pulls/464","id":60339778,"html_url":"https://github.com/travis-ci/travis-web/pull/464","diff_url":"https://github.com/travis-ci/travis-web/pull/464.diff","patch_url":"https://github.com/travis-ci/travis-web/pull/464.patch","issue_url":"https://api.github.com/repos/travis-ci/travis-web/issues/464","number":464,"state":"open","locked":false,"title":"Cronjobs","user":{"login":"Nef10","id":4551135,"avatar_url":"https://avatars.githubusercontent.com/u/4551135?v=3","gravatar_id":"","url":"https://api.github.com/users/Nef10","html_url":"https://github.com/Nef10","followers_url":"https://api.github.com/users/Nef10/followers","following_url":"https://api.github.com/users/Nef10/following{/other_user}","gists_url":"https://api.github.com/users/Nef10/gists{/gist_id}","starred_url":"https://api.github.com/users/Nef10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nef10/subscriptions","organizations_url":"https://api.github.com/users/Nef10/orgs","repos_url":"https://api.github.com/users/Nef10/repos","events_url":"https://api.github.com/users/Nef10/events{/privacy}","received_events_url":"https://api.github.com/users/Nef10/received_events","type":"User","site_admin":false},"body":"This add the GUI to travis-ci/travis-api#225\r\n\r\n- Cron jobs can be configured in settings of a repo \r\n- A tab next to Pull Requests which shows only cron builds\r\n- Cron jobs are included in the Build History tab\r\n- Cron jobs are included in the branch-row \r\n\r\nSettings:\r\n![screenshot 2016-02-23 14 32 26](https://cloud.githubusercontent.com/assets/4551135/13253063/4e49964e-da3a-11e5-83ca-6d02b4078c84.png)","created_at":"2016-02-23T13:33:13Z","updated_at":"2016-04-22T13:43:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d4928161a3aab5c468385398ac1f4b72204b77e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/travis-ci/travis-web/pulls/464/commits","review_comments_url":"https://api.github.com/repos/travis-ci/travis-web/pulls/464/comments","review_comment_url":"https://api.github.com/repos/travis-ci/travis-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/travis-ci/travis-web/issues/464/comments","statuses_url":"https://api.github.com/repos/travis-ci/travis-web/statuses/fb5f19019c9d3a269597a31ec1628769e85bc2cb","head":{"label":"HPI-BP2015H:cron","ref":"cron","sha":"fb5f19019c9d3a269597a31ec1628769e85bc2cb","user":{"login":"HPI-BP2015H","id":15087662,"avatar_url":"https://avatars.githubusercontent.com/u/15087662?v=3","gravatar_id":"","url":"https://api.github.com/users/HPI-BP2015H","html_url":"https://github.com/HPI-BP2015H","followers_url":"https://api.github.com/users/HPI-BP2015H/followers","following_url":"https://api.github.com/users/HPI-BP2015H/following{/other_user}","gists_url":"https://api.github.com/users/HPI-BP2015H/gists{/gist_id}","starred_url":"https://api.github.com/users/HPI-BP2015H/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HPI-BP2015H/subscriptions","organizations_url":"https://api.github.com/users/HPI-BP2015H/orgs","repos_url":"https://api.github.com/users/HPI-BP2015H/repos","events_url":"https://api.github.com/users/HPI-BP2015H/events{/privacy}","received_events_url":"https://api.github.com/users/HPI-BP2015H/received_events","type":"Organization","site_admin":false},"repo":{"id":44731757,"name":"travis-web","full_name":"HPI-BP2015H/travis-web","owner":{"login":"HPI-BP2015H","id":15087662,"avatar_url":"https://avatars.githubusercontent.com/u/15087662?v=3","gravatar_id":"","url":"https://api.github.com/users/HPI-BP2015H","html_url":"https://github.com/HPI-BP2015H","followers_url":"https://api.github.com/users/HPI-BP2015H/followers","following_url":"https://api.github.com/users/HPI-BP2015H/following{/other_user}","gists_url":"https://api.github.com/users/HPI-BP2015H/gists{/gist_id}","starred_url":"https://api.github.com/users/HPI-BP2015H/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HPI-BP2015H/subscriptions","organizations_url":"https://api.github.com/users/HPI-BP2015H/orgs","repos_url":"https://api.github.com/users/HPI-BP2015H/repos","events_url":"https://api.github.com/users/HPI-BP2015H/events{/privacy}","received_events_url":"https://api.github.com/users/HPI-BP2015H/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HPI-BP2015H/travis-web","description":"The Ember web client for Travis CI","fork":true,"url":"https://api.github.com/repos/HPI-BP2015H/travis-web","forks_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/forks","keys_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/teams","hooks_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/hooks","issue_events_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/issues/events{/number}","events_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/events","assignees_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/assignees{/user}","branches_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/branches{/branch}","tags_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/tags","blobs_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/statuses/{sha}","languages_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/languages","stargazers_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/stargazers","contributors_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/contributors","subscribers_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/subscribers","subscription_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/subscription","commits_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/contents/{+path}","compare_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/merges","archive_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/downloads","issues_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/issues{/number}","pulls_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/pulls{/number}","milestones_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/milestones{/number}","notifications_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/labels{/name}","releases_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/releases{/id}","deployments_url":"https://api.github.com/repos/HPI-BP2015H/travis-web/deployments","created_at":"2015-10-22T08:20:32Z","updated_at":"2016-02-04T13:46:09Z","pushed_at":"2016-04-22T09:47:40Z","git_url":"git://github.com/HPI-BP2015H/travis-web.git","ssh_url":"git@github.com:HPI-BP2015H/travis-web.git","clone_url":"https://github.com/HPI-BP2015H/travis-web.git","svn_url":"https://github.com/HPI-BP2015H/travis-web","homepage":"https://travis-ci.org/","size":56732,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"travis-ci:master","ref":"master","sha":"171c9b0ef7bfdf4ca5fb3423cac52cb3df67eb6f","user":{"login":"travis-ci","id":639823,"avatar_url":"https://avatars.githubusercontent.com/u/639823?v=3","gravatar_id":"","url":"https://api.github.com/users/travis-ci","html_url":"https://github.com/travis-ci","followers_url":"https://api.github.com/users/travis-ci/followers","following_url":"https://api.github.com/users/travis-ci/following{/other_user}","gists_url":"https://api.github.com/users/travis-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/travis-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travis-ci/subscriptions","organizations_url":"https://api.github.com/users/travis-ci/orgs","repos_url":"https://api.github.com/users/travis-ci/repos","events_url":"https://api.github.com/users/travis-ci/events{/privacy}","received_events_url":"https://api.github.com/users/travis-ci/received_events","type":"Organization","site_admin":false},"repo":{"id":4693087,"name":"travis-web","full_name":"travis-ci/travis-web","owner":{"login":"travis-ci","id":639823,"avatar_url":"https://avatars.githubusercontent.com/u/639823?v=3","gravatar_id":"","url":"https://api.github.com/users/travis-ci","html_url":"https://github.com/travis-ci","followers_url":"https://api.github.com/users/travis-ci/followers","following_url":"https://api.github.com/users/travis-ci/following{/other_user}","gists_url":"https://api.github.com/users/travis-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/travis-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travis-ci/subscriptions","organizations_url":"https://api.github.com/users/travis-ci/orgs","repos_url":"https://api.github.com/users/travis-ci/repos","events_url":"https://api.github.com/users/travis-ci/events{/privacy}","received_events_url":"https://api.github.com/users/travis-ci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/travis-ci/travis-web","description":"The Ember web client for Travis CI","fork":false,"url":"https://api.github.com/repos/travis-ci/travis-web","forks_url":"https://api.github.com/repos/travis-ci/travis-web/forks","keys_url":"https://api.github.com/repos/travis-ci/travis-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/travis-ci/travis-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/travis-ci/travis-web/teams","hooks_url":"https://api.github.com/repos/travis-ci/travis-web/hooks","issue_events_url":"https://api.github.com/repos/travis-ci/travis-web/issues/events{/number}","events_url":"https://api.github.com/repos/travis-ci/travis-web/events","assignees_url":"https://api.github.com/repos/travis-ci/travis-web/assignees{/user}","branches_url":"https://api.github.com/repos/travis-ci/travis-web/branches{/branch}","tags_url":"https://api.github.com/repos/travis-ci/travis-web/tags","blobs_url":"https://api.github.com/repos/travis-ci/travis-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/travis-ci/travis-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/travis-ci/travis-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/travis-ci/travis-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/travis-ci/travis-web/statuses/{sha}","languages_url":"https://api.github.com/repos/travis-ci/travis-web/languages","stargazers_url":"https://api.github.com/repos/travis-ci/travis-web/stargazers","contributors_url":"https://api.github.com/repos/travis-ci/travis-web/contributors","subscribers_url":"https://api.github.com/repos/travis-ci/travis-web/subscribers","subscription_url":"https://api.github.com/repos/travis-ci/travis-web/subscription","commits_url":"https://api.github.com/repos/travis-ci/travis-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/travis-ci/travis-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/travis-ci/travis-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/travis-ci/travis-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/travis-ci/travis-web/contents/{+path}","compare_url":"https://api.github.com/repos/travis-ci/travis-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/travis-ci/travis-web/merges","archive_url":"https://api.github.com/repos/travis-ci/travis-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/travis-ci/travis-web/downloads","issues_url":"https://api.github.com/repos/travis-ci/travis-web/issues{/number}","pulls_url":"https://api.github.com/repos/travis-ci/travis-web/pulls{/number}","milestones_url":"https://api.github.com/repos/travis-ci/travis-web/milestones{/number}","notifications_url":"https://api.github.com/repos/travis-ci/travis-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/travis-ci/travis-web/labels{/name}","releases_url":"https://api.github.com/repos/travis-ci/travis-web/releases{/id}","deployments_url":"https://api.github.com/repos/travis-ci/travis-web/deployments","created_at":"2012-06-17T16:30:56Z","updated_at":"2016-04-20T22:39:30Z","pushed_at":"2016-04-22T11:36:56Z","git_url":"git://github.com/travis-ci/travis-web.git","ssh_url":"git@github.com:travis-ci/travis-web.git","clone_url":"https://github.com/travis-ci/travis-web.git","svn_url":"https://github.com/travis-ci/travis-web","homepage":"https://travis-ci.org/","size":60990,"stargazers_count":319,"watchers_count":319,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":12,"forks":143,"open_issues":12,"watchers":319,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/464"},"html":{"href":"https://github.com/travis-ci/travis-web/pull/464"},"issue":{"href":"https://api.github.com/repos/travis-ci/travis-web/issues/464"},"comments":{"href":"https://api.github.com/repos/travis-ci/travis-web/issues/464/comments"},"review_comments":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/464/comments"},"review_comment":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/travis-ci/travis-web/pulls/464/commits"},"statuses":{"href":"https://api.github.com/repos/travis-ci/travis-web/statuses/fb5f19019c9d3a269597a31ec1628769e85bc2cb"}}}}