{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/71076736","id":71076736,"diff_hunk":"@@ -0,0 +1,56 @@\n+class TreeBuilderRolesByServer < TreeBuilder\n+  has_kids_for MiqServer, [:x_get_tree_miq_server_kids]\n+\n+  def initialize(name, type, sandbox, build = true, parent = nil)\n+    @root = parent\n+    super(name, type, sandbox, build)\n+  end\n+\n+  private\n+\n+  def tree_init_options(_tree_name)\n+    {\n+      :add_root => false,\n+      :expand   => true,\n+      :lazy     => false,\n+      :open_all => true\n+    }\n+  end\n+\n+  def set_locals_for_render\n+    locals = super\n+    locals.merge!(:autoload  => false,\n+                  :click_url => \"/ops/diagnostics_tree_select/\",\n+                  :onclick   => \"miqOnClickServerRoles\")\n+  end\n+\n+  def root_options\n+    []\n+  end\n+\n+  def x_get_tree_roots(count_only = false, _options)\n+    count_only_or_objects(count_only, x_get_tree_miq_servers)\n+  end\n+\n+  def x_get_tree_miq_servers\n+    objects = []\n+    @root.miq_servers.sort_by { |s| s.name.to_s }.each do |s|\n+      unless @sb[:diag_selected_id] # Set default selected record vars\n+        @sb[:diag_selected_model] = s.class.to_s\n+        @sb[:diag_selected_id] = s.id\n+      end\n+      objects.push(s)\n+    end\n+    objects\n+  end\n+\n+  def x_get_tree_miq_server_kids(parent, _count_only)\n+    objects = []","path":"app/presenters/tree_builder_roles_by_server.rb","position":48,"original_position":48,"commit_id":"58b6189428bdbb65de049397af64752eb77717ce","original_commit_id":"58b6189428bdbb65de049397af64752eb77717ce","user":{"login":"martinpovolny","id":51095,"avatar_url":"https://avatars.githubusercontent.com/u/51095?v=3","gravatar_id":"","url":"https://api.github.com/users/martinpovolny","html_url":"https://github.com/martinpovolny","followers_url":"https://api.github.com/users/martinpovolny/followers","following_url":"https://api.github.com/users/martinpovolny/following{/other_user}","gists_url":"https://api.github.com/users/martinpovolny/gists{/gist_id}","starred_url":"https://api.github.com/users/martinpovolny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinpovolny/subscriptions","organizations_url":"https://api.github.com/users/martinpovolny/orgs","repos_url":"https://api.github.com/users/martinpovolny/repos","events_url":"https://api.github.com/users/martinpovolny/events{/privacy}","received_events_url":"https://api.github.com/users/martinpovolny/received_events","type":"User","site_admin":false},"body":"same here, save 2 lines by `s/each/each_with_object({})`","created_at":"2016-07-17T05:27:33Z","updated_at":"2016-07-17T05:27:33Z","html_url":"https://github.com/ManageIQ/manageiq/pull/9735#discussion_r71076736","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/71076736"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/9735#discussion_r71076736"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735","id":77030980,"html_url":"https://github.com/ManageIQ/manageiq/pull/9735","diff_url":"https://github.com/ManageIQ/manageiq/pull/9735.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/9735.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/9735","number":9735,"state":"open","locked":false,"title":"Server/Roles trees conversion to user TreeBuilder.","user":{"login":"h-kataria","id":3450808,"avatar_url":"https://avatars.githubusercontent.com/u/3450808?v=3","gravatar_id":"","url":"https://api.github.com/users/h-kataria","html_url":"https://github.com/h-kataria","followers_url":"https://api.github.com/users/h-kataria/followers","following_url":"https://api.github.com/users/h-kataria/following{/other_user}","gists_url":"https://api.github.com/users/h-kataria/gists{/gist_id}","starred_url":"https://api.github.com/users/h-kataria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h-kataria/subscriptions","organizations_url":"https://api.github.com/users/h-kataria/orgs","repos_url":"https://api.github.com/users/h-kataria/repos","events_url":"https://api.github.com/users/h-kataria/events{/privacy}","received_events_url":"https://api.github.com/users/h-kataria/received_events","type":"User","site_admin":false},"body":"- Server By Roles and Roles By Servers trees in OPS/Diagnostics(Zone and Region nodes) conversion to use TreeBuilder class.\r\n- Had to pass in sandbox to TreeNodeBuilder class to get correct node titles to appear on the trees and also needed it for other node calculations.\r\n- Adjusted any existing broken spec tests to work changes in the commit. Updated delete_server diagnostics_spec test to add another server to be able to build and return tree nodes successfully after one of the server nodes is deleted.\r\n\r\naffected tree screenshots:\r\n![zone_tree1](https://cloud.githubusercontent.com/assets/3450808/16820406/e2c2739c-491e-11e6-8cb5-103d9da9b6bd.png)\r\n\r\n![zone_tree2](https://cloud.githubusercontent.com/assets/3450808/16820410/e6be5060-491e-11e6-97c1-4ed6cfc21336.png)\r\n\r\n![region_tree1](https://cloud.githubusercontent.com/assets/3450808/16820414/ea089424-491e-11e6-9f48-2bec8c4a3a09.png)\r\n\r\n![region_tree2](https://cloud.githubusercontent.com/assets/3450808/16820424/ee0a4bee-491e-11e6-8c31-04ccab53d3d3.png)\r\n\r\n\r\n","created_at":"2016-07-11T22:03:14Z","updated_at":"2016-07-17T05:27:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d22a3f65640181a9e5bdc68a89967ca78a860c2","assignee":{"login":"martinpovolny","id":51095,"avatar_url":"https://avatars.githubusercontent.com/u/51095?v=3","gravatar_id":"","url":"https://api.github.com/users/martinpovolny","html_url":"https://github.com/martinpovolny","followers_url":"https://api.github.com/users/martinpovolny/followers","following_url":"https://api.github.com/users/martinpovolny/following{/other_user}","gists_url":"https://api.github.com/users/martinpovolny/gists{/gist_id}","starred_url":"https://api.github.com/users/martinpovolny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinpovolny/subscriptions","organizations_url":"https://api.github.com/users/martinpovolny/orgs","repos_url":"https://api.github.com/users/martinpovolny/repos","events_url":"https://api.github.com/users/martinpovolny/events{/privacy}","received_events_url":"https://api.github.com/users/martinpovolny/received_events","type":"User","site_admin":false},"assignees":[{"login":"martinpovolny","id":51095,"avatar_url":"https://avatars.githubusercontent.com/u/51095?v=3","gravatar_id":"","url":"https://api.github.com/users/martinpovolny","html_url":"https://github.com/martinpovolny","followers_url":"https://api.github.com/users/martinpovolny/followers","following_url":"https://api.github.com/users/martinpovolny/following{/other_user}","gists_url":"https://api.github.com/users/martinpovolny/gists{/gist_id}","starred_url":"https://api.github.com/users/martinpovolny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinpovolny/subscriptions","organizations_url":"https://api.github.com/users/martinpovolny/orgs","repos_url":"https://api.github.com/users/martinpovolny/repos","events_url":"https://api.github.com/users/martinpovolny/events{/privacy}","received_events_url":"https://api.github.com/users/martinpovolny/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/9735/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/58b6189428bdbb65de049397af64752eb77717ce","head":{"label":"h-kataria:zone_tree_in_ops","ref":"zone_tree_in_ops","sha":"58b6189428bdbb65de049397af64752eb77717ce","user":{"login":"h-kataria","id":3450808,"avatar_url":"https://avatars.githubusercontent.com/u/3450808?v=3","gravatar_id":"","url":"https://api.github.com/users/h-kataria","html_url":"https://github.com/h-kataria","followers_url":"https://api.github.com/users/h-kataria/followers","following_url":"https://api.github.com/users/h-kataria/following{/other_user}","gists_url":"https://api.github.com/users/h-kataria/gists{/gist_id}","starred_url":"https://api.github.com/users/h-kataria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h-kataria/subscriptions","organizations_url":"https://api.github.com/users/h-kataria/orgs","repos_url":"https://api.github.com/users/h-kataria/repos","events_url":"https://api.github.com/users/h-kataria/events{/privacy}","received_events_url":"https://api.github.com/users/h-kataria/received_events","type":"User","site_admin":false},"repo":{"id":20811753,"name":"manageiq","full_name":"h-kataria/manageiq","owner":{"login":"h-kataria","id":3450808,"avatar_url":"https://avatars.githubusercontent.com/u/3450808?v=3","gravatar_id":"","url":"https://api.github.com/users/h-kataria","html_url":"https://github.com/h-kataria","followers_url":"https://api.github.com/users/h-kataria/followers","following_url":"https://api.github.com/users/h-kataria/following{/other_user}","gists_url":"https://api.github.com/users/h-kataria/gists{/gist_id}","starred_url":"https://api.github.com/users/h-kataria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h-kataria/subscriptions","organizations_url":"https://api.github.com/users/h-kataria/orgs","repos_url":"https://api.github.com/users/h-kataria/repos","events_url":"https://api.github.com/users/h-kataria/events{/privacy}","received_events_url":"https://api.github.com/users/h-kataria/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/h-kataria/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/h-kataria/manageiq","forks_url":"https://api.github.com/repos/h-kataria/manageiq/forks","keys_url":"https://api.github.com/repos/h-kataria/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/h-kataria/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/h-kataria/manageiq/teams","hooks_url":"https://api.github.com/repos/h-kataria/manageiq/hooks","issue_events_url":"https://api.github.com/repos/h-kataria/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/h-kataria/manageiq/events","assignees_url":"https://api.github.com/repos/h-kataria/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/h-kataria/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/h-kataria/manageiq/tags","blobs_url":"https://api.github.com/repos/h-kataria/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/h-kataria/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/h-kataria/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/h-kataria/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/h-kataria/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/h-kataria/manageiq/languages","stargazers_url":"https://api.github.com/repos/h-kataria/manageiq/stargazers","contributors_url":"https://api.github.com/repos/h-kataria/manageiq/contributors","subscribers_url":"https://api.github.com/repos/h-kataria/manageiq/subscribers","subscription_url":"https://api.github.com/repos/h-kataria/manageiq/subscription","commits_url":"https://api.github.com/repos/h-kataria/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/h-kataria/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/h-kataria/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/h-kataria/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/h-kataria/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/h-kataria/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/h-kataria/manageiq/merges","archive_url":"https://api.github.com/repos/h-kataria/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/h-kataria/manageiq/downloads","issues_url":"https://api.github.com/repos/h-kataria/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/h-kataria/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/h-kataria/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/h-kataria/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/h-kataria/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/h-kataria/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/h-kataria/manageiq/deployments","created_at":"2014-06-13T17:15:09Z","updated_at":"2014-06-24T23:08:03Z","pushed_at":"2016-07-15T21:14:20Z","git_url":"git://github.com/h-kataria/manageiq.git","ssh_url":"git@github.com:h-kataria/manageiq.git","clone_url":"https://github.com/h-kataria/manageiq.git","svn_url":"https://github.com/h-kataria/manageiq","homepage":null,"size":133941,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"fcc88eecc8886fd885ee9564de85a96719864580","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 Open-Source 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}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2016-07-13T16:26:10Z","pushed_at":"2016-07-17T05:22:30Z","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":177276,"stargazers_count":299,"watchers_count":299,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":323,"mirror_url":null,"open_issues_count":738,"forks":323,"open_issues":738,"watchers":299,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/9735"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/9735"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/9735/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/9735/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/58b6189428bdbb65de049397af64752eb77717ce"}}}}
{"actor":{"display_login":"martinpovolny"}}