{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/85960861","pull_request_review_id":6644126,"id":85960861,"diff_hunk":"@@ -174,6 +174,47 @@\n         end\n       end\n     end\n+\n+    def non_empty_category\n+      cat = FactoryGirl.create(:classification, :name => \"non_empty\", :description => \"Has entries\")\n+      cat.add_entry(:name => \"foo\", :description => \"Foo\")\n+      cat.add_entry(:name => \"bar\", :description => \"Bar\")\n+      cat\n+    end\n+\n+    def empty_category\n+      FactoryGirl.create(:classification, :name => \"empty\", :description => \"Zero entries\")\n+    end\n+\n+    describe \"#categories_hash\" do\n+      it \"returns non-empty categories\" do\n+        non_empty_category\n+        empty_category\n+        expect(controller.send(:categories_hash)).to eq(\"non_empty\" => \"Has entries\")\n+      end\n+\n+      it \"omits show: false categories\" do\n+        non_empty_category.update(:show => false)","path":"spec/controllers/miq_report_controller/reports/editor_spec.rb","position":24,"original_position":24,"commit_id":"0d9d73c01efe28889b501ed514172f8d8310760e","original_commit_id":"0d9d73c01efe28889b501ed514172f8d8310760e","user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"body":"Do you that memoized `let` would be better than `def`?  IIUC the transaction is rolled back between every example, so if I use `let` in two examples it would still create it twice.\r\n\r\nI think you mean `.update` is doing a 2nd unnecessary write.  Fixing...","created_at":"2016-11-01T16:07:30Z","updated_at":"2016-11-01T16:07:30Z","html_url":"https://github.com/ManageIQ/manageiq/pull/10459#discussion_r85960861","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/85960861"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/10459#discussion_r85960861"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459","id":81245401,"html_url":"https://github.com/ManageIQ/manageiq/pull/10459","diff_url":"https://github.com/ManageIQ/manageiq/pull/10459.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/10459.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/10459","number":10459,"state":"open","locked":false,"title":"Reports: include read_only tag categories","user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"body":"https://bugzilla.redhat.com/show_bug.cgi?id=1388659\n## Purpose or Intent\n\nSplit off [discussion on #9914](https://github.com/ManageIQ/manageiq/pull/9914#issuecomment-234917815).\nReports editor hides any `read_only` tag categories.\nI suspect the condition was simply copied (it's exactly same line) from \nhttps://github.com/ManageIQ/manageiq/blob/62874a37/app/controllers/application_controller/tags.rb#L265\nhttps://github.com/ManageIQ/manageiq/blob/62874a37/app/controllers/application_controller/tags.rb#L316\nbut that code deals with user assigning/unassigning the tags, so forbidding read only makes sense;\nreports merely want to _read_ tags which I think is fine.\n## Effects\n- Reports editor, first \"Columns\" tab:\n  ![screenshot-localhost 3000 2016-08-14 16-51-03 available fields](https://cloud.githubusercontent.com/assets/273688/17649512/c01bda2e-623f-11e6-98eb-0ab52bde03dc.png)\n- selecting the category in \"Columns\", allows manipulating it in other tabs (\"Consolidation\", \"Styling\" etc) \n- Reports editor, \"Filters\" tab, with \"Tag\" expression:\n  ![screenshot-localhost 3000 2016-08-14 16-29-31 read_only cat](https://cloud.githubusercontent.com/assets/273688/17649437/26c66ffc-623e-11e6-8238-16ccc6c57822.png)\n  ![screenshot-localhost 3000 2016-08-14 16-30-42 read_only ent](https://cloud.githubusercontent.com/assets/273688/17649440/2ede2324-623e-11e6-8d0b-9041885ad019.png)\n- Chargeback assignments, \"Tagged ...\", categories dropdown:\n  ![screenshot](https://gist.githubusercontent.com/cben/89e0232e2e5c7429637313651775968e/raw/955f85847514d8f74c0e14310f811bbdbbbad11c/ManageIQChargebackAssign.png)\n\n[Where do read_only tags come from?  I don't know generally, my use case is tags auto-assigned from kubernetes labels (#7460, to be exposed in UI by #11591) which I want read_only so users don't assign them manually — refresh would overwrite that anyway.]\n## Steps for Testing/QA\n1. If #11591 and #11806 landed, use auto-tagging UI to create a tag:\n   - Label something in OpenShift, e.g. `oc label node mynode foo=entry1`.\n   - Add mapping from `foo` label key to `read_only cat 1` category.\n   - Refresh the OpenShift provider.  Verify the labeled entity got a \"read_only cat 1 : entry1\" tag.\n   \n   (It's important that at least one tag actually got created — reports editor won't list tag categories that have no entries, even after this change.)\n   \n   Alternatively, create a read_only tag directly in `rails console`:\n   \n   ``` ruby\n   cat = Classification.create_category!(name: \"rocat1\", description: \"read_only cat 1\", read_only: true)\n   cat.add_entry(name: \"roent1\", description: \"read_only entry 1\")\n   ```\n2. In Cloud Intel -> Reports -> Create new (or Edit), verify \"read_only cat 1\" tag category is in list of columns.\n3. In Cloud Intel -> Chargeback -> Assignments -> Compute, choose \"Assign To: Tagged VMs and Instances\" and verify \"read_only cat 1\" is in \"Tag Category\" dropdown.\n4. In Cloud Intel -> Chargeback -> Assignments -> Storage, choose \"Assign To: Tagged Datastores\" and verify \"read_only cat 1\" is in \"Tag Category\" dropdown.\n\n@miq-bot add-labels reporting, ui, bug, darga/yes\n","created_at":"2016-08-14T14:40:04Z","updated_at":"2016-11-01T16:07:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e4f183233b4aaebbc2a8805b30f1381fd1257e7","assignee":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"assignees":[{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/10459/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/0d9d73c01efe28889b501ed514172f8d8310760e","head":{"label":"cben:chargeback-read_only-tags","ref":"chargeback-read_only-tags","sha":"0d9d73c01efe28889b501ed514172f8d8310760e","user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"repo":{"id":51248694,"name":"manageiq","full_name":"cben/manageiq","owner":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cben/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/cben/manageiq","forks_url":"https://api.github.com/repos/cben/manageiq/forks","keys_url":"https://api.github.com/repos/cben/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cben/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cben/manageiq/teams","hooks_url":"https://api.github.com/repos/cben/manageiq/hooks","issue_events_url":"https://api.github.com/repos/cben/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/cben/manageiq/events","assignees_url":"https://api.github.com/repos/cben/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/cben/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/cben/manageiq/tags","blobs_url":"https://api.github.com/repos/cben/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cben/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cben/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/cben/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cben/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/cben/manageiq/languages","stargazers_url":"https://api.github.com/repos/cben/manageiq/stargazers","contributors_url":"https://api.github.com/repos/cben/manageiq/contributors","subscribers_url":"https://api.github.com/repos/cben/manageiq/subscribers","subscription_url":"https://api.github.com/repos/cben/manageiq/subscription","commits_url":"https://api.github.com/repos/cben/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/cben/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/cben/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/cben/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/cben/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/cben/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cben/manageiq/merges","archive_url":"https://api.github.com/repos/cben/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cben/manageiq/downloads","issues_url":"https://api.github.com/repos/cben/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/cben/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/cben/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/cben/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cben/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/cben/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/cben/manageiq/deployments","created_at":"2016-02-07T13:36:17Z","updated_at":"2016-02-07T13:36:35Z","pushed_at":"2016-11-01T15:31:50Z","git_url":"git://github.com/cben/manageiq.git","ssh_url":"git@github.com:cben/manageiq.git","clone_url":"https://github.com/cben/manageiq.git","svn_url":"https://github.com/cben/manageiq","homepage":"manageiq.org","size":168601,"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":"814d77cb3f70bafe09c80e34ad8c1a1200309c0d","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-11-01T15:10:30Z","pushed_at":"2016-11-01T16:04:12Z","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":218159,"stargazers_count":343,"watchers_count":343,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":373,"mirror_url":null,"open_issues_count":860,"forks":373,"open_issues":860,"watchers":343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/10459"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/10459"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/10459/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10459/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/0d9d73c01efe28889b501ed514172f8d8310760e"}}}}
{"actor":{"display_login":"cben"}}