Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptive custom attribute columns #14391

Merged

Conversation

zeari
Copy link

@zeari zeari commented Mar 17, 2017

update of #11916
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1416220
Completed on the UI side by ManageIQ/manageiq-ui-classic#733
does version -> Labels: version in report columns.

@lpichler Please review
cc @simon3z

@miq-bot add_label euwe/yes, chargeback, providers/containers

@simon3z
Copy link
Contributor

simon3z commented Mar 19, 2017

@zeari I added some comments on ManageIQ/manageiq-ui-classic#733 that are relevant here as well (adding the section in the field name, e.g. Custom Attribute: label : version and adding tests).

@zeari zeari force-pushed the descriptive_custom_attribute_columns2 branch 2 times, most recently from ee60b15 to bfa3077 Compare March 19, 2017 12:33
@@ -25,7 +25,7 @@ module CustomAttributeMixin
end

def self.custom_keys
CustomAttribute.where(:resource_type => base_class).distinct.pluck(:name).compact
CustomAttribute.where(:resource_type => base_class).distinct.pluck(:section, :name).compact
end
Copy link
Author

@zeari zeari Mar 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpichler I couldnt find any other place in the code that uses this particular method:custom_keys other than _custom_details_for in miq_expression.rb changed below.
So i hope this is reasonable.

I didnt go into it too far but i think reporting doesnt take into account that there could be two custom attributes with the same name but with different section belonging to the same record.

@zeari
Copy link
Author

zeari commented Mar 19, 2017

@zeari I added some comments on ManageIQ/manageiq-ui-classic#733 that are relevant here as well (adding the section in the field name, e.g. Custom Attribute: label : version and adding tests).

@simon3z

  1. Can CustomAttribute.section be nil? we need to take this into consideration since this change is across all of reporting
  2. I think labels: version is better than Custom Attribute: label : version since 'CustomAttribute' doesnt mean much to the user

@zeari zeari force-pushed the descriptive_custom_attribute_columns2 branch from bfa3077 to 0b1c0a3 Compare March 19, 2017 14:17
@simon3z
Copy link
Contributor

simon3z commented Mar 20, 2017

  1. Can CustomAttribute.section be nil? we need to take this into consideration since this change is across all of reporting

I don't think a section can be nil (I can't imagine what would mean). Anyway @gtanzillo and @blomquisg should have more information.

  1. I think labels: version is better than Custom Attribute: label : version since 'CustomAttribute' doesnt mean much to the user

Yes, I don't think it we should expose "Custom Attribute".

LGTM 👍
@miq-bot assign gtanzillo

@simon3z
Copy link
Contributor

simon3z commented Mar 20, 2017

@lpichler can you review this?

@zeari zeari force-pushed the descriptive_custom_attribute_columns2 branch 2 times, most recently from 9e82858 to db66eba Compare March 20, 2017 11:42
@chessbyte chessbyte requested a review from lpichler March 20, 2017 13:14
@@ -1172,11 +1172,11 @@ def self._custom_details_for(model, options)
custom_attributes_details = []

klass.custom_keys.each do |custom_key|
custom_detail_column = [model, CustomAttributeMixin::CUSTOM_ATTRIBUTES_PREFIX + custom_key].join("-")
custom_detail_name = custom_key
custom_detail_column = [model, CustomAttributeMixin::CUSTOM_ATTRIBUTES_PREFIX + custom_key[1]].join("-")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of array indexing, it might be more readable to do

klass.custom_keys.each do |custom_section, custom_key|

and then use the named variables.

@Fryguy
Copy link
Member

Fryguy commented Mar 20, 2017

@lpichler Please also review with respect to reporting and how custom attributes can be filtered against.

Can CustomAttribute.section be nil? we need to take this into consideration since this change is across all of reporting

@zeari Yes, it can be nil. The key/value part (and maybe source) are the only columns that matter. Section is extra, but is not necessarily needed. In my mind I think of this table like an ini file, where the section is optional, and the source would be like the ini file name.

@zeari zeari force-pushed the descriptive_custom_attribute_columns2 branch 2 times, most recently from 26a8a53 to a26fa1e Compare March 20, 2017 17:43
@miq-bot
Copy link
Member

miq-bot commented Mar 20, 2017

Checked commit zeari@a26fa1e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. 👍

Copy link
Contributor

@lpichler lpichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 finalized with @zeari
tested:
-reporting & UI reporting definition
-reporting with filtering (expression editor)

  • reporting with filtering with field which are not listed in selected field.

@zeari
Copy link
Author

zeari commented Mar 20, 2017

@Fryguy We are letting go of section for now. I think this is ready for merge once travis completes.

Copy link
Contributor

@simon3z simon3z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Ready for merge

@Fryguy @blomquisg @chessbyte @gtanzillo anyone around to merge this?
cc @chrispy1

@blomquisg blomquisg merged commit ab3ce4a into ManageIQ:master Mar 20, 2017
simaishi pushed a commit that referenced this pull request Mar 20, 2017
@simaishi
Copy link
Contributor

Euwe backport details:

$ git log -1
commit 88c3b52d2dc28ed19e573e6bc79053398b909454
Author: Greg Blomquist <[email protected]>
Date:   Mon Mar 20 16:33:19 2017 -0400

    Merge pull request #14391 from zeari/descriptive_custom_attribute_columns2
    
    Descriptive custom attribute columns
    (cherry picked from commit ab3ce4a3302e4e49df94a6b263bdb251f59658aa)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1434160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants