{"action":"created","comment":{"url":"https://api.github.com/repos/prometheus/promdash/pulls/comments/23773363","id":23773363,"diff_hunk":"@@ -0,0 +1,44 @@\n+require 'server_transformer'\n+class StaticDashboardsController < ApplicationController\n+  protect_from_forgery with: :exception, only: :update\n+  before_action :set_dashboard, only: :show\n+  before_action :set_directories, only: :show\n+\n+  def show\n+    @servers = Server.order(\"lower(name)\")\n+    render 'dashboards/show'\n+  end\n+\n+  def create\n+    @dashboard = Dashboard.create_static(dashboard_params)\n+    if @dashboard.save\n+      payload = {\n+        url: \"/static/\" + SlugMaker.slug(\"#{@dashboard.id} #{@dashboard.slug}\")\n+      }\n+      render json: payload, status: :created\n+    else\n+      render json: @dashboard.errors, status: :unprocessable_entity\n+    end\n+  end\n+\n+  private\n+  # Use callbacks to share common setup or constraints between actions.\n+  def set_dashboard\n+    @dashboard = Dashboard.find(params[:id])\n+  end\n+\n+  def set_directories\n+    @directories = Directory.all\n+  end\n+\n+  # Never trust parameters from the scary internet, only allow the white list through.","path":"app/controllers/static_dashboards_controller.rb","position":34,"original_position":34,"commit_id":"4690c3653f07f26bba824404ca00c4656fd55b9b","original_commit_id":"4690c3653f07f26bba824404ca00c4656fd55b9b","user":{"login":"juliusv","id":538008,"avatar_url":"https://avatars.githubusercontent.com/u/538008?v=3","gravatar_id":"","url":"https://api.github.com/users/juliusv","html_url":"https://github.com/juliusv","followers_url":"https://api.github.com/users/juliusv/followers","following_url":"https://api.github.com/users/juliusv/following{/other_user}","gists_url":"https://api.github.com/users/juliusv/gists{/gist_id}","starred_url":"https://api.github.com/users/juliusv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliusv/subscriptions","organizations_url":"https://api.github.com/users/juliusv/orgs","repos_url":"https://api.github.com/users/juliusv/repos","events_url":"https://api.github.com/users/juliusv/events{/privacy}","received_events_url":"https://api.github.com/users/juliusv/received_events","type":"User","site_admin":false},"body":"Seems like duplicating some complex code. I'm wondering whether to have just one controller for both types of dashboard and just send the \"static\" attribute as part of the normal POST data instead of differentiating it in the URL.","created_at":"2015-01-29T15:09:07Z","updated_at":"2015-01-29T15:09:07Z","html_url":"https://github.com/prometheus/promdash/pull/296#discussion_r23773363","pull_request_url":"https://api.github.com/repos/prometheus/promdash/pulls/296","_links":{"self":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/comments/23773363"},"html":{"href":"https://github.com/prometheus/promdash/pull/296#discussion_r23773363"},"pull_request":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/296"}}},"pull_request":{"url":"https://api.github.com/repos/prometheus/promdash/pulls/296","id":28043901,"html_url":"https://github.com/prometheus/promdash/pull/296","diff_url":"https://github.com/prometheus/promdash/pull/296.diff","patch_url":"https://github.com/prometheus/promdash/pull/296.patch","issue_url":"https://api.github.com/repos/prometheus/promdash/issues/296","number":296,"state":"open","locked":false,"title":"offer dashboard perma-link instead of base64 encoding after hash","user":{"login":"stuartnelson3","id":1398104,"avatar_url":"https://avatars.githubusercontent.com/u/1398104?v=3","gravatar_id":"","url":"https://api.github.com/users/stuartnelson3","html_url":"https://github.com/stuartnelson3","followers_url":"https://api.github.com/users/stuartnelson3/followers","following_url":"https://api.github.com/users/stuartnelson3/following{/other_user}","gists_url":"https://api.github.com/users/stuartnelson3/gists{/gist_id}","starred_url":"https://api.github.com/users/stuartnelson3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuartnelson3/subscriptions","organizations_url":"https://api.github.com/users/stuartnelson3/orgs","repos_url":"https://api.github.com/users/stuartnelson3/repos","events_url":"https://api.github.com/users/stuartnelson3/events{/privacy}","received_events_url":"https://api.github.com/users/stuartnelson3/received_events","type":"User","site_admin":false},"body":"requested in #288 \r\n\r\nquestion: keep url updated is still an option. do we want this to be removed?","created_at":"2015-01-26T17:24:57Z","updated_at":"2015-01-29T15:09:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0b8c4d6dc89ce0fdc0731cc286d78533bcc8d65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/prometheus/promdash/pulls/296/commits","review_comments_url":"https://api.github.com/repos/prometheus/promdash/pulls/296/comments","review_comment_url":"https://api.github.com/repos/prometheus/promdash/pulls/comments/{number}","comments_url":"https://api.github.com/repos/prometheus/promdash/issues/296/comments","statuses_url":"https://api.github.com/repos/prometheus/promdash/statuses/4690c3653f07f26bba824404ca00c4656fd55b9b","head":{"label":"prometheus:static-dashboards","ref":"static-dashboards","sha":"4690c3653f07f26bba824404ca00c4656fd55b9b","user":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"repo":{"id":13788490,"name":"promdash","full_name":"prometheus/promdash","owner":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prometheus/promdash","description":"Prometheus Dashboard Builder","fork":false,"url":"https://api.github.com/repos/prometheus/promdash","forks_url":"https://api.github.com/repos/prometheus/promdash/forks","keys_url":"https://api.github.com/repos/prometheus/promdash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prometheus/promdash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prometheus/promdash/teams","hooks_url":"https://api.github.com/repos/prometheus/promdash/hooks","issue_events_url":"https://api.github.com/repos/prometheus/promdash/issues/events{/number}","events_url":"https://api.github.com/repos/prometheus/promdash/events","assignees_url":"https://api.github.com/repos/prometheus/promdash/assignees{/user}","branches_url":"https://api.github.com/repos/prometheus/promdash/branches{/branch}","tags_url":"https://api.github.com/repos/prometheus/promdash/tags","blobs_url":"https://api.github.com/repos/prometheus/promdash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prometheus/promdash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prometheus/promdash/git/refs{/sha}","trees_url":"https://api.github.com/repos/prometheus/promdash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prometheus/promdash/statuses/{sha}","languages_url":"https://api.github.com/repos/prometheus/promdash/languages","stargazers_url":"https://api.github.com/repos/prometheus/promdash/stargazers","contributors_url":"https://api.github.com/repos/prometheus/promdash/contributors","subscribers_url":"https://api.github.com/repos/prometheus/promdash/subscribers","subscription_url":"https://api.github.com/repos/prometheus/promdash/subscription","commits_url":"https://api.github.com/repos/prometheus/promdash/commits{/sha}","git_commits_url":"https://api.github.com/repos/prometheus/promdash/git/commits{/sha}","comments_url":"https://api.github.com/repos/prometheus/promdash/comments{/number}","issue_comment_url":"https://api.github.com/repos/prometheus/promdash/issues/comments/{number}","contents_url":"https://api.github.com/repos/prometheus/promdash/contents/{+path}","compare_url":"https://api.github.com/repos/prometheus/promdash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prometheus/promdash/merges","archive_url":"https://api.github.com/repos/prometheus/promdash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prometheus/promdash/downloads","issues_url":"https://api.github.com/repos/prometheus/promdash/issues{/number}","pulls_url":"https://api.github.com/repos/prometheus/promdash/pulls{/number}","milestones_url":"https://api.github.com/repos/prometheus/promdash/milestones{/number}","notifications_url":"https://api.github.com/repos/prometheus/promdash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prometheus/promdash/labels{/name}","releases_url":"https://api.github.com/repos/prometheus/promdash/releases{/id}","created_at":"2013-10-22T23:15:38Z","updated_at":"2015-01-29T13:56:44Z","pushed_at":"2015-01-29T13:56:45Z","git_url":"git://github.com/prometheus/promdash.git","ssh_url":"git@github.com:prometheus/promdash.git","clone_url":"https://github.com/prometheus/promdash.git","svn_url":"https://github.com/prometheus/promdash","homepage":"http://prometheus.io/","size":4439,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":54,"forks":3,"open_issues":54,"watchers":14,"default_branch":"master"}},"base":{"label":"prometheus:master","ref":"master","sha":"0b462c92aa8e29b4252427460388e6ba80e21801","user":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"repo":{"id":13788490,"name":"promdash","full_name":"prometheus/promdash","owner":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prometheus/promdash","description":"Prometheus Dashboard Builder","fork":false,"url":"https://api.github.com/repos/prometheus/promdash","forks_url":"https://api.github.com/repos/prometheus/promdash/forks","keys_url":"https://api.github.com/repos/prometheus/promdash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prometheus/promdash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prometheus/promdash/teams","hooks_url":"https://api.github.com/repos/prometheus/promdash/hooks","issue_events_url":"https://api.github.com/repos/prometheus/promdash/issues/events{/number}","events_url":"https://api.github.com/repos/prometheus/promdash/events","assignees_url":"https://api.github.com/repos/prometheus/promdash/assignees{/user}","branches_url":"https://api.github.com/repos/prometheus/promdash/branches{/branch}","tags_url":"https://api.github.com/repos/prometheus/promdash/tags","blobs_url":"https://api.github.com/repos/prometheus/promdash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prometheus/promdash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prometheus/promdash/git/refs{/sha}","trees_url":"https://api.github.com/repos/prometheus/promdash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prometheus/promdash/statuses/{sha}","languages_url":"https://api.github.com/repos/prometheus/promdash/languages","stargazers_url":"https://api.github.com/repos/prometheus/promdash/stargazers","contributors_url":"https://api.github.com/repos/prometheus/promdash/contributors","subscribers_url":"https://api.github.com/repos/prometheus/promdash/subscribers","subscription_url":"https://api.github.com/repos/prometheus/promdash/subscription","commits_url":"https://api.github.com/repos/prometheus/promdash/commits{/sha}","git_commits_url":"https://api.github.com/repos/prometheus/promdash/git/commits{/sha}","comments_url":"https://api.github.com/repos/prometheus/promdash/comments{/number}","issue_comment_url":"https://api.github.com/repos/prometheus/promdash/issues/comments/{number}","contents_url":"https://api.github.com/repos/prometheus/promdash/contents/{+path}","compare_url":"https://api.github.com/repos/prometheus/promdash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prometheus/promdash/merges","archive_url":"https://api.github.com/repos/prometheus/promdash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prometheus/promdash/downloads","issues_url":"https://api.github.com/repos/prometheus/promdash/issues{/number}","pulls_url":"https://api.github.com/repos/prometheus/promdash/pulls{/number}","milestones_url":"https://api.github.com/repos/prometheus/promdash/milestones{/number}","notifications_url":"https://api.github.com/repos/prometheus/promdash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prometheus/promdash/labels{/name}","releases_url":"https://api.github.com/repos/prometheus/promdash/releases{/id}","created_at":"2013-10-22T23:15:38Z","updated_at":"2015-01-29T13:56:44Z","pushed_at":"2015-01-29T13:56:45Z","git_url":"git://github.com/prometheus/promdash.git","ssh_url":"git@github.com:prometheus/promdash.git","clone_url":"https://github.com/prometheus/promdash.git","svn_url":"https://github.com/prometheus/promdash","homepage":"http://prometheus.io/","size":4439,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":54,"forks":3,"open_issues":54,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/296"},"html":{"href":"https://github.com/prometheus/promdash/pull/296"},"issue":{"href":"https://api.github.com/repos/prometheus/promdash/issues/296"},"comments":{"href":"https://api.github.com/repos/prometheus/promdash/issues/296/comments"},"review_comments":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/296/comments"},"review_comment":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/296/commits"},"statuses":{"href":"https://api.github.com/repos/prometheus/promdash/statuses/4690c3653f07f26bba824404ca00c4656fd55b9b"}}}}