{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/25813390","id":25813390,"diff_hunk":"@@ -0,0 +1,535 @@\n+class ProviderForemanController < ApplicationController\n+  before_filter :check_privileges\n+  before_filter :get_session_data\n+\n+  after_filter :cleanup_action\n+  after_filter :set_session_data\n+\n+  def index\n+    redirect_to :action => 'explorer'\n+  end\n+\n+  PROVIDER_FOREMAN_X_BUTTON_ALLOWED_ACTIONS = {\n+    'provider_foreman_new'     => :provider_foreman_new,\n+    'provider_foreman_edit'    => :provider_foreman_edit,\n+    'provider_foreman_delete'  => :provider_foreman_delete,\n+    'provider_foreman_refresh' => :provider_foreman_refresh,\n+  }.freeze\n+\n+  def x_button\n+    @sb[:action] = action = params[:pressed]\n+\n+    raise ActionController::RoutingError.new('invalid button action') unless\n+        PROVIDER_FOREMAN_X_BUTTON_ALLOWED_ACTIONS.key?(action)\n+\n+    send(PROVIDER_FOREMAN_X_BUTTON_ALLOWED_ACTIONS[action])\n+  end\n+\n+  def provider_foreman_new\n+    assert_privileges(\"provider_foreman_new\")\n+    @in_a_form = true\n+    @provider_foreman = ProviderForeman.new\n+    replace_right_cell\n+  end\n+\n+  def provider_foreman_edit\n+    assert_privileges(\"provider_foreman_edit\")\n+    case params[:button]\n+    when \"cancel\"\n+      @in_a_form = false\n+      @sb[:action] = nil\n+      add_flash(_(\"%{action} %{model} was cancelled by the user\") %\n+        {:model  => ui_lookup(:model => \"ProviderForeman\"),\n+         :action => params[:id] == \"new\" ? \"Add of\" : \"Edit of\"})\n+      replace_right_cell\n+    when \"save\"\n+      if params[:id] == \"new\"\n+        @provider_foreman = ProviderForeman.new(:name    => params[:name],\n+                                                :url     => params[:url],\n+                                                :zone_id => Zone.find_by_name(MiqServer.my_zone).id)\n+        @provider_foreman.update_attributes(:verify_ssl => 1) if params[:verify_ssl] == \"on\"\n+      else\n+        @provider_foreman = find_by_id_filtered(ProviderForeman, params[:id])\n+        @provider_foreman.update_attributes(:name => params[:name], :url => params[:url])\n+        if params[:verify_ssl] == \"on\"\n+          @provider_foreman.update_attributes(:verify_ssl => 1)\n+        else\n+          @provider_foreman.update_attributes(:verify_ssl => nil)\n+        end\n+      end\n+      if @provider_foreman.save\n+        construct_edit\n+        AuditEvent.success(build_created_audit(@provider_foreman, @edit))\n+        @in_a_form = false\n+        @sb[:action] = nil\n+        add_flash(_(\"%{model} \\\"%{name}\\\" was %{action}\") % {:model  => ui_lookup(:model => \"ProviderForeman\"),\n+                                                             :name   => @provider_foreman.name,\n+                                                             :action => params[:id] == \"new\" ? \"added\" : \"updated\"})\n+        replace_right_cell([:foreman_providers])\n+      else\n+        @provider_foreman.errors.each do |field, msg|\n+          add_flash(\"#{field.to_s.capitalize} #{msg}\", :error)\n+        end\n+      end\n+    else\n+      @provider_foreman = find_by_id_filtered(ProviderForeman, from_cid(params[:miq_grid_checks]))\n+      @in_a_form = true\n+      replace_right_cell\n+    end\n+  end\n+\n+  def provider_foreman_delete\n+    assert_privileges(\"provider_foreman_delete\")\n+    foremen = find_checked_items\n+    if foremen.empty?\n+      add_flash(_(\"No %{model} were selected for %{task}\") % {:model => ui_lookup(:tables => \"providers\"),\n+                                                              :task  => \"deletion\"}, :error)\n+    end","path":"vmdb/app/controllers/provider_foreman_controller.rb","position":87,"original_position":87,"commit_id":"bcad248386a7d96be0ec5a0d7270b83bc53da9d5","original_commit_id":"bcad248386a7d96be0ec5a0d7270b83bc53da9d5","user":{"login":"kbrock","id":1930,"avatar_url":"https://avatars.githubusercontent.com/u/1930?v=3","gravatar_id":"","url":"https://api.github.com/users/kbrock","html_url":"https://github.com/kbrock","followers_url":"https://api.github.com/users/kbrock/followers","following_url":"https://api.github.com/users/kbrock/following{/other_user}","gists_url":"https://api.github.com/users/kbrock/gists{/gist_id}","starred_url":"https://api.github.com/users/kbrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbrock/subscriptions","organizations_url":"https://api.github.com/users/kbrock/orgs","repos_url":"https://api.github.com/users/kbrock/repos","events_url":"https://api.github.com/users/kbrock/events{/privacy}","received_events_url":"https://api.github.com/users/kbrock/received_events","type":"User","site_admin":false},"body":"use `else` ?","created_at":"2015-03-04T21:01:10Z","updated_at":"2015-03-04T21:01:10Z","html_url":"https://github.com/ManageIQ/manageiq/pull/1981#discussion_r25813390","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/25813390"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/1981#discussion_r25813390"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981","id":30419064,"html_url":"https://github.com/ManageIQ/manageiq/pull/1981","diff_url":"https://github.com/ManageIQ/manageiq/pull/1981.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/1981.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/1981","number":1981,"state":"open","locked":false,"title":"Foreman UI - showing Providers, Configuration Profiles & Configured Systems","user":{"login":"AparnaKarve","id":1538216,"avatar_url":"https://avatars.githubusercontent.com/u/1538216?v=3","gravatar_id":"","url":"https://api.github.com/users/AparnaKarve","html_url":"https://github.com/AparnaKarve","followers_url":"https://api.github.com/users/AparnaKarve/followers","following_url":"https://api.github.com/users/AparnaKarve/following{/other_user}","gists_url":"https://api.github.com/users/AparnaKarve/gists{/gist_id}","starred_url":"https://api.github.com/users/AparnaKarve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AparnaKarve/subscriptions","organizations_url":"https://api.github.com/users/AparnaKarve/orgs","repos_url":"https://api.github.com/users/AparnaKarve/repos","events_url":"https://api.github.com/users/AparnaKarve/events{/privacy}","received_events_url":"https://api.github.com/users/AparnaKarve/received_events","type":"User","site_admin":false},"body":"1. Accessed via Infrastructure -> Configuration Management\r\n2. Displays Foreman data in 'explorer' style UI \r\n3. CRUD capabilities added for Providers\r\n4. Advanced search for Configured Systems\r\n5. Angular Provider Editor\r\n\r\n*Things to note: Some icons may change down the line.\r\nProvider and Configured Systems icons are from http://theforeman.org/\r\nConfiguration Profile icon is a placeholder icon.","created_at":"2015-03-03T22:24:10Z","updated_at":"2015-03-04T21:01:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63623c8b9f57f95424a6a27028940f6f2a450a94","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/1981/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/bcad248386a7d96be0ec5a0d7270b83bc53da9d5","head":{"label":"AparnaKarve:foreman_ui","ref":"foreman_ui","sha":"bcad248386a7d96be0ec5a0d7270b83bc53da9d5","user":{"login":"AparnaKarve","id":1538216,"avatar_url":"https://avatars.githubusercontent.com/u/1538216?v=3","gravatar_id":"","url":"https://api.github.com/users/AparnaKarve","html_url":"https://github.com/AparnaKarve","followers_url":"https://api.github.com/users/AparnaKarve/followers","following_url":"https://api.github.com/users/AparnaKarve/following{/other_user}","gists_url":"https://api.github.com/users/AparnaKarve/gists{/gist_id}","starred_url":"https://api.github.com/users/AparnaKarve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AparnaKarve/subscriptions","organizations_url":"https://api.github.com/users/AparnaKarve/orgs","repos_url":"https://api.github.com/users/AparnaKarve/repos","events_url":"https://api.github.com/users/AparnaKarve/events{/privacy}","received_events_url":"https://api.github.com/users/AparnaKarve/received_events","type":"User","site_admin":false},"repo":{"id":20812346,"name":"manageiq","full_name":"AparnaKarve/manageiq","owner":{"login":"AparnaKarve","id":1538216,"avatar_url":"https://avatars.githubusercontent.com/u/1538216?v=3","gravatar_id":"","url":"https://api.github.com/users/AparnaKarve","html_url":"https://github.com/AparnaKarve","followers_url":"https://api.github.com/users/AparnaKarve/followers","following_url":"https://api.github.com/users/AparnaKarve/following{/other_user}","gists_url":"https://api.github.com/users/AparnaKarve/gists{/gist_id}","starred_url":"https://api.github.com/users/AparnaKarve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AparnaKarve/subscriptions","organizations_url":"https://api.github.com/users/AparnaKarve/orgs","repos_url":"https://api.github.com/users/AparnaKarve/repos","events_url":"https://api.github.com/users/AparnaKarve/events{/privacy}","received_events_url":"https://api.github.com/users/AparnaKarve/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AparnaKarve/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/AparnaKarve/manageiq","forks_url":"https://api.github.com/repos/AparnaKarve/manageiq/forks","keys_url":"https://api.github.com/repos/AparnaKarve/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AparnaKarve/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AparnaKarve/manageiq/teams","hooks_url":"https://api.github.com/repos/AparnaKarve/manageiq/hooks","issue_events_url":"https://api.github.com/repos/AparnaKarve/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/AparnaKarve/manageiq/events","assignees_url":"https://api.github.com/repos/AparnaKarve/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/AparnaKarve/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/AparnaKarve/manageiq/tags","blobs_url":"https://api.github.com/repos/AparnaKarve/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AparnaKarve/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AparnaKarve/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/AparnaKarve/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AparnaKarve/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/AparnaKarve/manageiq/languages","stargazers_url":"https://api.github.com/repos/AparnaKarve/manageiq/stargazers","contributors_url":"https://api.github.com/repos/AparnaKarve/manageiq/contributors","subscribers_url":"https://api.github.com/repos/AparnaKarve/manageiq/subscribers","subscription_url":"https://api.github.com/repos/AparnaKarve/manageiq/subscription","commits_url":"https://api.github.com/repos/AparnaKarve/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/AparnaKarve/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/AparnaKarve/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/AparnaKarve/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/AparnaKarve/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/AparnaKarve/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AparnaKarve/manageiq/merges","archive_url":"https://api.github.com/repos/AparnaKarve/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AparnaKarve/manageiq/downloads","issues_url":"https://api.github.com/repos/AparnaKarve/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/AparnaKarve/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/AparnaKarve/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/AparnaKarve/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AparnaKarve/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/AparnaKarve/manageiq/releases{/id}","created_at":"2014-06-13T17:37:56Z","updated_at":"2014-06-24T23:08:57Z","pushed_at":"2015-03-03T22:08:34Z","git_url":"git://github.com/AparnaKarve/manageiq.git","ssh_url":"git@github.com:AparnaKarve/manageiq.git","clone_url":"https://github.com/AparnaKarve/manageiq.git","svn_url":"https://github.com/AparnaKarve/manageiq","homepage":null,"size":64891,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"bcaf04aa201fcba0a7427a6226e0bc68789b0f60","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Cloud Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","created_at":"2014-06-13T02:31:26Z","updated_at":"2015-03-04T20:49:49Z","pushed_at":"2015-03-04T20:49:49Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":104733,"stargazers_count":93,"watchers_count":93,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":294,"forks":92,"open_issues":294,"watchers":93,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/1981"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/1981"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/1981/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/1981/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/bcad248386a7d96be0ec5a0d7270b83bc53da9d5"}}}}