{"action":"created","comment":{"url":"https://api.github.com/repos/getredash/redash/pulls/comments/56154979","id":56154979,"diff_hunk":"@@ -120,6 +122,40 @@\n       },\n       controller: function ($scope) {\n         $scope.subscribers = AlertSubscription.query({alertId: $scope.alertId});\n+        $scope.subscription = {};\n+        $scope.destinations = Destination.query();\n+\n+        $scope.destinationsDisplay = function(destination) {\n+            var icons = {\n+                'slack': 'fa-slack',\n+                'email': 'fa-envelope',","path":"rd_ui/app/scripts/controllers/alerts.js","position":39,"original_position":39,"commit_id":"1070c3b272fbd1cc69ca9857a0cf9dae44ee440b","original_commit_id":"1070c3b272fbd1cc69ca9857a0cf9dae44ee440b","user":{"login":"arikfr","id":71468,"avatar_url":"https://avatars.githubusercontent.com/u/71468?v=3","gravatar_id":"","url":"https://api.github.com/users/arikfr","html_url":"https://github.com/arikfr","followers_url":"https://api.github.com/users/arikfr/followers","following_url":"https://api.github.com/users/arikfr/following{/other_user}","gists_url":"https://api.github.com/users/arikfr/gists{/gist_id}","starred_url":"https://api.github.com/users/arikfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arikfr/subscriptions","organizations_url":"https://api.github.com/users/arikfr/orgs","repos_url":"https://api.github.com/users/arikfr/repos","events_url":"https://api.github.com/users/arikfr/events{/privacy}","received_events_url":"https://api.github.com/users/arikfr/received_events","type":"User","site_admin":false},"body":"It will be defined in `BaseDestination` derived classes, a method that returns the icon. And it will be returned in the API calls both for types and destination instances.","created_at":"2016-03-15T12:35:04Z","updated_at":"2016-03-15T12:35:04Z","html_url":"https://github.com/getredash/redash/pull/842#discussion_r56154979","pull_request_url":"https://api.github.com/repos/getredash/redash/pulls/842","_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments/56154979"},"html":{"href":"https://github.com/getredash/redash/pull/842#discussion_r56154979"},"pull_request":{"href":"https://api.github.com/repos/getredash/redash/pulls/842"}}},"pull_request":{"url":"https://api.github.com/repos/getredash/redash/pulls/842","id":60210497,"html_url":"https://github.com/getredash/redash/pull/842","diff_url":"https://github.com/getredash/redash/pull/842.diff","patch_url":"https://github.com/getredash/redash/pull/842.patch","issue_url":"https://api.github.com/repos/getredash/redash/issues/842","number":842,"state":"open","locked":false,"title":"Flexible notifications","user":{"login":"alexdebrie","id":6509926,"avatar_url":"https://avatars.githubusercontent.com/u/6509926?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdebrie","html_url":"https://github.com/alexdebrie","followers_url":"https://api.github.com/users/alexdebrie/followers","following_url":"https://api.github.com/users/alexdebrie/following{/other_user}","gists_url":"https://api.github.com/users/alexdebrie/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdebrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdebrie/subscriptions","organizations_url":"https://api.github.com/users/alexdebrie/orgs","repos_url":"https://api.github.com/users/alexdebrie/repos","events_url":"https://api.github.com/users/alexdebrie/events{/privacy}","received_events_url":"https://api.github.com/users/alexdebrie/received_events","type":"User","site_admin":false},"body":"Addresses #763.\r\n\r\nThis PR adds the ability to add `NotificationDestinations`, which are similar to data sources but for alerts. The idea is that you could register a particular destination, like a Slack room or a webhook, and then use it as a subscriber to a particular alert. \r\n\r\nGeneral items:\r\n\r\n- [x] Add `NotificationDestination` and `NotificationDestinationGroup` models.\r\n- [x] Create `BaseDestination` and convenience functions for registering and using destinations.\r\n- [x] Add `destination` handlers on backend.\r\n- [x] Add destination CRUD elements on frontend.\r\n- [x] Allow specifying which destination should be used when creating or subscribing to an alert.\r\n- [x] Update `check_alerts_for_query` task to conform with new setup.\r\n- [x] Implement Slack, Hipchat, and external webhook Destination types.\r\n\r\nRe: `AlertSubscriptions`, I've added a `destination` field which maps to a `NotificationDestination`. My thought is that the UI will have a dropdown where a user can pick a destination when subscribing. For emails, we could either leave the `destination_id` null or just create an initial row in the `notification_destinations` table that is for email.\r\n\r\nI'll probably need a little help on the Angular portion of creating AlertSubscriptions. Once we settle on how subscriptions will be created, I should be able to implement most of the remaining backend items.\r\n\r\nI'm open to any and all suggestions/comments/changes on what I have so far and plans going forward. ","created_at":"2016-02-22T17:35:40Z","updated_at":"2016-03-15T12:35:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"189028a97feb9acabf3e60e142dbbafcddbb2367","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/getredash/redash/pulls/842/commits","review_comments_url":"https://api.github.com/repos/getredash/redash/pulls/842/comments","review_comment_url":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getredash/redash/issues/842/comments","statuses_url":"https://api.github.com/repos/getredash/redash/statuses/1070c3b272fbd1cc69ca9857a0cf9dae44ee440b","head":{"label":"hudl:FlexibleNotifications","ref":"FlexibleNotifications","sha":"1070c3b272fbd1cc69ca9857a0cf9dae44ee440b","user":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"repo":{"id":43774066,"name":"redash","full_name":"hudl/redash","owner":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hudl/redash","description":"Rethinking how data is queried, shared and visualized. A web application that allows to easily query an existing database, share the dataset and visualize it in different ways. Oh and you can also create dashboards.","fork":true,"url":"https://api.github.com/repos/hudl/redash","forks_url":"https://api.github.com/repos/hudl/redash/forks","keys_url":"https://api.github.com/repos/hudl/redash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hudl/redash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hudl/redash/teams","hooks_url":"https://api.github.com/repos/hudl/redash/hooks","issue_events_url":"https://api.github.com/repos/hudl/redash/issues/events{/number}","events_url":"https://api.github.com/repos/hudl/redash/events","assignees_url":"https://api.github.com/repos/hudl/redash/assignees{/user}","branches_url":"https://api.github.com/repos/hudl/redash/branches{/branch}","tags_url":"https://api.github.com/repos/hudl/redash/tags","blobs_url":"https://api.github.com/repos/hudl/redash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hudl/redash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hudl/redash/git/refs{/sha}","trees_url":"https://api.github.com/repos/hudl/redash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hudl/redash/statuses/{sha}","languages_url":"https://api.github.com/repos/hudl/redash/languages","stargazers_url":"https://api.github.com/repos/hudl/redash/stargazers","contributors_url":"https://api.github.com/repos/hudl/redash/contributors","subscribers_url":"https://api.github.com/repos/hudl/redash/subscribers","subscription_url":"https://api.github.com/repos/hudl/redash/subscription","commits_url":"https://api.github.com/repos/hudl/redash/commits{/sha}","git_commits_url":"https://api.github.com/repos/hudl/redash/git/commits{/sha}","comments_url":"https://api.github.com/repos/hudl/redash/comments{/number}","issue_comment_url":"https://api.github.com/repos/hudl/redash/issues/comments{/number}","contents_url":"https://api.github.com/repos/hudl/redash/contents/{+path}","compare_url":"https://api.github.com/repos/hudl/redash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hudl/redash/merges","archive_url":"https://api.github.com/repos/hudl/redash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hudl/redash/downloads","issues_url":"https://api.github.com/repos/hudl/redash/issues{/number}","pulls_url":"https://api.github.com/repos/hudl/redash/pulls{/number}","milestones_url":"https://api.github.com/repos/hudl/redash/milestones{/number}","notifications_url":"https://api.github.com/repos/hudl/redash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hudl/redash/labels{/name}","releases_url":"https://api.github.com/repos/hudl/redash/releases{/id}","deployments_url":"https://api.github.com/repos/hudl/redash/deployments","created_at":"2015-10-06T19:40:08Z","updated_at":"2016-03-08T18:18:11Z","pushed_at":"2016-03-14T20:35:03Z","git_url":"git://github.com/hudl/redash.git","ssh_url":"git@github.com:hudl/redash.git","clone_url":"https://github.com/hudl/redash.git","svn_url":"https://github.com/hudl/redash","homepage":"http://redash.io/","size":3708,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"getredash:master","ref":"master","sha":"a26da3aed353ad3d9f2309d373bc9b2dbd891e70","user":{"login":"getredash","id":10746780,"avatar_url":"https://avatars.githubusercontent.com/u/10746780?v=3","gravatar_id":"","url":"https://api.github.com/users/getredash","html_url":"https://github.com/getredash","followers_url":"https://api.github.com/users/getredash/followers","following_url":"https://api.github.com/users/getredash/following{/other_user}","gists_url":"https://api.github.com/users/getredash/gists{/gist_id}","starred_url":"https://api.github.com/users/getredash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getredash/subscriptions","organizations_url":"https://api.github.com/users/getredash/orgs","repos_url":"https://api.github.com/users/getredash/repos","events_url":"https://api.github.com/users/getredash/events{/privacy}","received_events_url":"https://api.github.com/users/getredash/received_events","type":"Organization","site_admin":false},"repo":{"id":13926404,"name":"redash","full_name":"getredash/redash","owner":{"login":"getredash","id":10746780,"avatar_url":"https://avatars.githubusercontent.com/u/10746780?v=3","gravatar_id":"","url":"https://api.github.com/users/getredash","html_url":"https://github.com/getredash","followers_url":"https://api.github.com/users/getredash/followers","following_url":"https://api.github.com/users/getredash/following{/other_user}","gists_url":"https://api.github.com/users/getredash/gists{/gist_id}","starred_url":"https://api.github.com/users/getredash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getredash/subscriptions","organizations_url":"https://api.github.com/users/getredash/orgs","repos_url":"https://api.github.com/users/getredash/repos","events_url":"https://api.github.com/users/getredash/events{/privacy}","received_events_url":"https://api.github.com/users/getredash/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getredash/redash","description":"Make Your Company Data Driven. Connect to any data source, easily visualize and share your data.","fork":false,"url":"https://api.github.com/repos/getredash/redash","forks_url":"https://api.github.com/repos/getredash/redash/forks","keys_url":"https://api.github.com/repos/getredash/redash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getredash/redash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getredash/redash/teams","hooks_url":"https://api.github.com/repos/getredash/redash/hooks","issue_events_url":"https://api.github.com/repos/getredash/redash/issues/events{/number}","events_url":"https://api.github.com/repos/getredash/redash/events","assignees_url":"https://api.github.com/repos/getredash/redash/assignees{/user}","branches_url":"https://api.github.com/repos/getredash/redash/branches{/branch}","tags_url":"https://api.github.com/repos/getredash/redash/tags","blobs_url":"https://api.github.com/repos/getredash/redash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getredash/redash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getredash/redash/git/refs{/sha}","trees_url":"https://api.github.com/repos/getredash/redash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getredash/redash/statuses/{sha}","languages_url":"https://api.github.com/repos/getredash/redash/languages","stargazers_url":"https://api.github.com/repos/getredash/redash/stargazers","contributors_url":"https://api.github.com/repos/getredash/redash/contributors","subscribers_url":"https://api.github.com/repos/getredash/redash/subscribers","subscription_url":"https://api.github.com/repos/getredash/redash/subscription","commits_url":"https://api.github.com/repos/getredash/redash/commits{/sha}","git_commits_url":"https://api.github.com/repos/getredash/redash/git/commits{/sha}","comments_url":"https://api.github.com/repos/getredash/redash/comments{/number}","issue_comment_url":"https://api.github.com/repos/getredash/redash/issues/comments{/number}","contents_url":"https://api.github.com/repos/getredash/redash/contents/{+path}","compare_url":"https://api.github.com/repos/getredash/redash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getredash/redash/merges","archive_url":"https://api.github.com/repos/getredash/redash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getredash/redash/downloads","issues_url":"https://api.github.com/repos/getredash/redash/issues{/number}","pulls_url":"https://api.github.com/repos/getredash/redash/pulls{/number}","milestones_url":"https://api.github.com/repos/getredash/redash/milestones{/number}","notifications_url":"https://api.github.com/repos/getredash/redash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getredash/redash/labels{/name}","releases_url":"https://api.github.com/repos/getredash/redash/releases{/id}","deployments_url":"https://api.github.com/repos/getredash/redash/deployments","created_at":"2013-10-28T13:19:39Z","updated_at":"2016-03-14T09:29:52Z","pushed_at":"2016-03-15T12:22:18Z","git_url":"git://github.com/getredash/redash.git","ssh_url":"git@github.com:getredash/redash.git","clone_url":"https://github.com/getredash/redash.git","svn_url":"https://github.com/getredash/redash","homepage":"http://redash.io/","size":5403,"stargazers_count":1465,"watchers_count":1465,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":247,"mirror_url":null,"open_issues_count":113,"forks":247,"open_issues":113,"watchers":1465,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/842"},"html":{"href":"https://github.com/getredash/redash/pull/842"},"issue":{"href":"https://api.github.com/repos/getredash/redash/issues/842"},"comments":{"href":"https://api.github.com/repos/getredash/redash/issues/842/comments"},"review_comments":{"href":"https://api.github.com/repos/getredash/redash/pulls/842/comments"},"review_comment":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getredash/redash/pulls/842/commits"},"statuses":{"href":"https://api.github.com/repos/getredash/redash/statuses/1070c3b272fbd1cc69ca9857a0cf9dae44ee440b"}}}}