{"action":"created","comment":{"url":"https://api.github.com/repos/getredash/redash/pulls/comments/165844247","pull_request_review_id":93845044,"id":165844247,"diff_hunk":"@@ -7,10 +9,35 @@ export default function init(ngModule) {\n     replace: true,\n     scope: {\n       column: '=',\n-      value: '=',\n+      row: '=',\n     },\n     link: ($scope) => {\n-      $scope.sanitize = value => $sanitize(value);\n+      // `dynamicTable` will recreate all table cells if some columns changed.\n+      // This means two things:\n+      // 1. `column` object will be always \"fresh\" - no need to watch it.\n+      // 2. we will always have a column object already available in `link` function.\n+      // Note that `row` may change during this directive's lifetime.\n+\n+      if ($scope.column.displayAs === 'string') {\n+        $scope.allowHTML = $scope.column.allowHTML;\n+      } else {\n+        $scope.allowHTML = contains(['image', 'link'], $scope.column.displayAs);\n+      }\n+\n+      let renderValue;\n+      switch ($scope.column.displayAs) {\n+        case 'image': renderValue = renderImage; break;\n+        case 'link': renderValue = renderLink; break;\n+        default: renderValue = renderDefault; break;\n+      }","path":"client/app/components/dynamic-table/default-cell/index.js","position":32,"original_position":32,"commit_id":"55d47ede08567b158dac8f98db65be8cc7299c14","original_commit_id":"55d47ede08567b158dac8f98db65be8cc7299c14","user":{"login":"arikfr","id":71468,"avatar_url":"https://avatars2.githubusercontent.com/u/71468?v=4","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":"```javascript\r\nconst types = {image: renderImage, link: renderLink};\r\nconst renderValue = types[$scope.column.displayAs] || renderDefault;\r\n```\r\n\r\nHow about this instead of a switch case?\r\n\r\nRight now it's not a huge difference, but as the column types list grows it will become more manageable.","created_at":"2018-02-04T13:20:22Z","updated_at":"2018-02-04T13:21:17Z","html_url":"https://github.com/getredash/redash/pull/2287#discussion_r165844247","pull_request_url":"https://api.github.com/repos/getredash/redash/pulls/2287","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments/165844247"},"html":{"href":"https://github.com/getredash/redash/pull/2287#discussion_r165844247"},"pull_request":{"href":"https://api.github.com/repos/getredash/redash/pulls/2287"}}},"pull_request":{"url":"https://api.github.com/repos/getredash/redash/pulls/2287","id":167009530,"html_url":"https://github.com/getredash/redash/pull/2287","diff_url":"https://github.com/getredash/redash/pull/2287.diff","patch_url":"https://github.com/getredash/redash/pull/2287.patch","issue_url":"https://api.github.com/repos/getredash/redash/issues/2287","number":2287,"state":"open","locked":false,"title":"Table visualization: \"Link\" column type","user":{"login":"kravets-levko","id":12139186,"avatar_url":"https://avatars3.githubusercontent.com/u/12139186?v=4","gravatar_id":"","url":"https://api.github.com/users/kravets-levko","html_url":"https://github.com/kravets-levko","followers_url":"https://api.github.com/users/kravets-levko/followers","following_url":"https://api.github.com/users/kravets-levko/following{/other_user}","gists_url":"https://api.github.com/users/kravets-levko/gists{/gist_id}","starred_url":"https://api.github.com/users/kravets-levko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kravets-levko/subscriptions","organizations_url":"https://api.github.com/users/kravets-levko/orgs","repos_url":"https://api.github.com/users/kravets-levko/repos","events_url":"https://api.github.com/users/kravets-levko/events{/privacy}","received_events_url":"https://api.github.com/users/kravets-levko/received_events","type":"User","site_admin":false},"body":"Related to this PR getredash/redash/pull/2283 and works in a similar way.\r\n\r\nAdded new column type (\"Link\") and several options for it: \"URL template\", \"Text template\", \"Title template\", \"Open in new tab\" (adds `target=\"_blank\"` attribute) (see screenshots below). All options allows to use values from another columns via `{{ column_name }}` syntax.\r\n\r\n![image](https://user-images.githubusercontent.com/12139186/35777841-6e8c4a6e-09bd-11e8-9c78-9b1ae56dd1e2.png)\r\n![image](https://user-images.githubusercontent.com/12139186/35777847-7c109780-09bd-11e8-807d-d045fa2ea5ca.png)\r\n![image](https://user-images.githubusercontent.com/12139186/35777849-82f06bb6-09bd-11e8-916d-910965664b77.png)\r\n\r\nP.S. Sorry for a lot of changes comparing to PR getredash/redash/pull/2283 - I moved some code to better place, and somewhere `git` wrongly detected file renaming instead of delete + adding new file.","created_at":"2018-02-04T13:13:34Z","updated_at":"2018-02-04T13:21:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"921931cb3e16260a827edb4db78fe52ba27e7fe9","assignee":{"login":"arikfr","id":71468,"avatar_url":"https://avatars2.githubusercontent.com/u/71468?v=4","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},"assignees":[{"login":"arikfr","id":71468,"avatar_url":"https://avatars2.githubusercontent.com/u/71468?v=4","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}],"requested_reviewers":[{"login":"kocsmy","id":2378022,"avatar_url":"https://avatars2.githubusercontent.com/u/2378022?v=4","gravatar_id":"","url":"https://api.github.com/users/kocsmy","html_url":"https://github.com/kocsmy","followers_url":"https://api.github.com/users/kocsmy/followers","following_url":"https://api.github.com/users/kocsmy/following{/other_user}","gists_url":"https://api.github.com/users/kocsmy/gists{/gist_id}","starred_url":"https://api.github.com/users/kocsmy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kocsmy/subscriptions","organizations_url":"https://api.github.com/users/kocsmy/orgs","repos_url":"https://api.github.com/users/kocsmy/repos","events_url":"https://api.github.com/users/kocsmy/events{/privacy}","received_events_url":"https://api.github.com/users/kocsmy/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/getredash/redash/pulls/2287/commits","review_comments_url":"https://api.github.com/repos/getredash/redash/pulls/2287/comments","review_comment_url":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getredash/redash/issues/2287/comments","statuses_url":"https://api.github.com/repos/getredash/redash/statuses/55d47ede08567b158dac8f98db65be8cc7299c14","head":{"label":"kravets-levko:feature/table-link-column","ref":"feature/table-link-column","sha":"55d47ede08567b158dac8f98db65be8cc7299c14","user":{"login":"kravets-levko","id":12139186,"avatar_url":"https://avatars3.githubusercontent.com/u/12139186?v=4","gravatar_id":"","url":"https://api.github.com/users/kravets-levko","html_url":"https://github.com/kravets-levko","followers_url":"https://api.github.com/users/kravets-levko/followers","following_url":"https://api.github.com/users/kravets-levko/following{/other_user}","gists_url":"https://api.github.com/users/kravets-levko/gists{/gist_id}","starred_url":"https://api.github.com/users/kravets-levko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kravets-levko/subscriptions","organizations_url":"https://api.github.com/users/kravets-levko/orgs","repos_url":"https://api.github.com/users/kravets-levko/repos","events_url":"https://api.github.com/users/kravets-levko/events{/privacy}","received_events_url":"https://api.github.com/users/kravets-levko/received_events","type":"User","site_admin":false},"repo":{"id":105663177,"name":"redash","full_name":"kravets-levko/redash","owner":{"login":"kravets-levko","id":12139186,"avatar_url":"https://avatars3.githubusercontent.com/u/12139186?v=4","gravatar_id":"","url":"https://api.github.com/users/kravets-levko","html_url":"https://github.com/kravets-levko","followers_url":"https://api.github.com/users/kravets-levko/followers","following_url":"https://api.github.com/users/kravets-levko/following{/other_user}","gists_url":"https://api.github.com/users/kravets-levko/gists{/gist_id}","starred_url":"https://api.github.com/users/kravets-levko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kravets-levko/subscriptions","organizations_url":"https://api.github.com/users/kravets-levko/orgs","repos_url":"https://api.github.com/users/kravets-levko/repos","events_url":"https://api.github.com/users/kravets-levko/events{/privacy}","received_events_url":"https://api.github.com/users/kravets-levko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kravets-levko/redash","description":"Make Your Company Data Driven. Connect to any data source, easily visualize and share your data.","fork":true,"url":"https://api.github.com/repos/kravets-levko/redash","forks_url":"https://api.github.com/repos/kravets-levko/redash/forks","keys_url":"https://api.github.com/repos/kravets-levko/redash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kravets-levko/redash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kravets-levko/redash/teams","hooks_url":"https://api.github.com/repos/kravets-levko/redash/hooks","issue_events_url":"https://api.github.com/repos/kravets-levko/redash/issues/events{/number}","events_url":"https://api.github.com/repos/kravets-levko/redash/events","assignees_url":"https://api.github.com/repos/kravets-levko/redash/assignees{/user}","branches_url":"https://api.github.com/repos/kravets-levko/redash/branches{/branch}","tags_url":"https://api.github.com/repos/kravets-levko/redash/tags","blobs_url":"https://api.github.com/repos/kravets-levko/redash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kravets-levko/redash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kravets-levko/redash/git/refs{/sha}","trees_url":"https://api.github.com/repos/kravets-levko/redash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kravets-levko/redash/statuses/{sha}","languages_url":"https://api.github.com/repos/kravets-levko/redash/languages","stargazers_url":"https://api.github.com/repos/kravets-levko/redash/stargazers","contributors_url":"https://api.github.com/repos/kravets-levko/redash/contributors","subscribers_url":"https://api.github.com/repos/kravets-levko/redash/subscribers","subscription_url":"https://api.github.com/repos/kravets-levko/redash/subscription","commits_url":"https://api.github.com/repos/kravets-levko/redash/commits{/sha}","git_commits_url":"https://api.github.com/repos/kravets-levko/redash/git/commits{/sha}","comments_url":"https://api.github.com/repos/kravets-levko/redash/comments{/number}","issue_comment_url":"https://api.github.com/repos/kravets-levko/redash/issues/comments{/number}","contents_url":"https://api.github.com/repos/kravets-levko/redash/contents/{+path}","compare_url":"https://api.github.com/repos/kravets-levko/redash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kravets-levko/redash/merges","archive_url":"https://api.github.com/repos/kravets-levko/redash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kravets-levko/redash/downloads","issues_url":"https://api.github.com/repos/kravets-levko/redash/issues{/number}","pulls_url":"https://api.github.com/repos/kravets-levko/redash/pulls{/number}","milestones_url":"https://api.github.com/repos/kravets-levko/redash/milestones{/number}","notifications_url":"https://api.github.com/repos/kravets-levko/redash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kravets-levko/redash/labels{/name}","releases_url":"https://api.github.com/repos/kravets-levko/redash/releases{/id}","deployments_url":"https://api.github.com/repos/kravets-levko/redash/deployments","created_at":"2017-10-03T14:42:17Z","updated_at":"2017-10-03T14:42:22Z","pushed_at":"2018-02-04T13:06:19Z","git_url":"git://github.com/kravets-levko/redash.git","ssh_url":"git@github.com:kravets-levko/redash.git","clone_url":"https://github.com/kravets-levko/redash.git","svn_url":"https://github.com/kravets-levko/redash","homepage":"http://redash.io/","size":9963,"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":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"getredash:master","ref":"master","sha":"d97b8d0958d764fa425123b874bda2c2f22c59df","user":{"login":"getredash","id":10746780,"avatar_url":"https://avatars2.githubusercontent.com/u/10746780?v=4","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://avatars2.githubusercontent.com/u/10746780?v=4","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":"2018-02-04T08:22:19Z","pushed_at":"2018-02-04T13:13:35Z","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":9567,"stargazers_count":8370,"watchers_count":8370,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1252,"mirror_url":null,"archived":false,"open_issues_count":286,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":1252,"open_issues":286,"watchers":8370,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/2287"},"html":{"href":"https://github.com/getredash/redash/pull/2287"},"issue":{"href":"https://api.github.com/repos/getredash/redash/issues/2287"},"comments":{"href":"https://api.github.com/repos/getredash/redash/issues/2287/comments"},"review_comments":{"href":"https://api.github.com/repos/getredash/redash/pulls/2287/comments"},"review_comment":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getredash/redash/pulls/2287/commits"},"statuses":{"href":"https://api.github.com/repos/getredash/redash/statuses/55d47ede08567b158dac8f98db65be8cc7299c14"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"arikfr"}}