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

Generate virtual custom attributes with sections #14837

Conversation

lpichler
Copy link
Contributor

pulled out from #14823
VCA = Virtual Custom Attributes

When there are more custom_attributes with same name we were not able to distinguish them.

In this PR I distinguish them by column CustomAttribute#section
and I am extending format of virtual custom attributes to
virtual_custom_attribute_NAMEOFATTR:SECTION:docker_labels
and thanks to that it has a format in UI
Docker Labels: NAMEOFATTR and
when there is no section it looks like:
Custom Attribute: NAMEOFATTR so it
means that this also works with origin form. (part :SECTION: is not mandatory)

Images

let's assume that we have 3 different custom attributes with name com.redhat.component
but with different sections

on the report:
screen shot 2017-04-20 at 16 29 20

columns in report definition
screen shot 2017-04-20 at 16 50 56

expression
screen shot 2017-04-20 at 16 55 22

Links

follow up #14391
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1434077

Depends on

#14835
It is a reason for WIP.

@miq-bot add_label enhancement,core, fine/yes, euwe/yes, wip

@miq-bot assign @gtanzillo

cc @zeari @simon3z

@lpichler
Copy link
Contributor Author

From @simon3z

It will work but it is strongly recommended to re-select them because then you can use #section for distinguishing. without re-selecting, we are not able to determine wich attribute is which.
I hope, this is acceptable for existing reports.

@gtanzillo I suppose this should go in the release notes and somehow reach the users. cc @Loicavenel

@lpichler
Copy link
Contributor Author

cc @zeari

…ibutes

Example:

before
assume that we have custom attribute record with #name column ’test1
so from for this custom attribute is virtual_custom_attribute_test1

after
assume that we have custom attribute record with #name column ’test1 and
#section ’section1’ so from for this custom attribute there is format
 virtual_custom_attribute_test1:SECTION:section1

Method custom_keys is returning all virtual attributes from
object.

This new format is used for distinguish custom attributes with same
column #name
SECTION separator is :SECTION:
in CustomAttributes
Now the method is parsing from virtual attribute also section
and this section is used for query to custom attribute table

example:

virtual_custom_attribute_ANYNAME:SECTION:ANYSECTION

is basically query

object.custom_attributes.where(:name => ‘ANYNAME’, :section => ‘ANYSECTION’)

and old format (virtual_custom_attribute_ANYNAME)
is also working
VCA = virtual custom attribute
@lpichler lpichler changed the title [WIP] Generate virtual custom attributes with sections Generate virtual custom attributes with sections Apr 25, 2017
@lpichler lpichler force-pushed the generate_virtual_custom_attributes_with_sections branch from 0ce565c to 7e47947 Compare April 25, 2017 09:00
@lpichler
Copy link
Contributor Author

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Apr 25, 2017
@miq-bot
Copy link
Member

miq-bot commented Apr 25, 2017

Checked commits lpichler/manageiq@8da0481~...7e47947 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 0 offenses detected
Everything looks good. 🍰

Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

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

Very nice! 👍

@gtanzillo gtanzillo added this to the Sprint 59 Ending Apr 24, 2017 milestone Apr 25, 2017
@gtanzillo gtanzillo merged commit 688310e into ManageIQ:master Apr 25, 2017
@lpichler lpichler deleted the generate_virtual_custom_attributes_with_sections branch May 2, 2017 14:48
@lpichler
Copy link
Contributor Author

lpichler commented May 2, 2017

@simaishi This is second part for https://bugzilla.redhat.com/show_bug.cgi?id=1434077 and #14835

@simaishi
Copy link
Contributor

Backported to Euwe via #14971

@simaishi simaishi removed the euwe/yes label May 19, 2017
simaishi pushed a commit that referenced this pull request Jun 2, 2017
…butes_with_sections

Generate virtual custom attributes with sections
(cherry picked from commit 688310e)

https://bugzilla.redhat.com/show_bug.cgi?id=1458341
@simaishi
Copy link
Contributor

simaishi commented Jun 2, 2017

Fine backport details:

$ git log -1
commit 9d5c250378a30205eba621a02731b428316da793
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Tue Apr 25 10:07:09 2017 -0400

    Merge pull request #14837 from lpichler/generate_virtual_custom_attributes_with_sections
    
    Generate virtual custom attributes with sections
    (cherry picked from commit 688310e3bbc2a8e7b8d93145585f2252246c10b9)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1458341

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.

4 participants