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

[WIP] Support special characters in reporting of Custom Attributes #11112

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented Sep 8, 2016

fixes #10482 point 1

Purpose

Reporting with custom attributes was broken when CustomAttribute#name contains some special characters as "." or "/".

This PR is fixing in UI : clicking on filter tab in report definition and in report generation.

The common thread is basically that we have couple method which processing(and expecting) attributes (defined report) with form (for example)
Vm.hosts.disks-name
and when we have virtual custom attribute it has form
Vm.virtual_custom_attribute_manage.org/kurbenetes so it is failing in some parsing method.

So I found such parsing methods and I added here some "IFs" for handling virtual custom attributes (794b986, 84a855d, 69c85ee)

I needed to change also regex in MiqExpression::Field to parse it, and I solved by prefix(6fbce18).

  1. At this moment I am allowing to have basically "whatever" in name of custom attribute and I didn't any issue with it maybe we should limited it. ?

  2. If we will limited it how I should tackle with custom attributes which contains forbidden characters ? (Don't display it at all ? )

cc @imtayadeway
@miq-bot assign @gtanzillo

fyi @cben @alongoldboim

@lpichler lpichler changed the title [WIP] Support special character in reporting Custom Attributes [WIP] Support special characters in reporting of Custom Attributes Sep 8, 2016
@chessbyte chessbyte added the wip label Sep 8, 2016
@lpichler lpichler force-pushed the support_special_characters_in_report_with_custom_attributes branch 2 times, most recently from ad66628 to 32ca4da Compare September 9, 2016 12:09
regex changed and determination of virtual custom attributes
now it is are based on prefix
in UI listing attributes in filter tab
example:
method converts "MiqGroup.vms.host-disconnected" to
["MiqGroup", ["vms", "host", "disconnected"]]
Virtual custom attributes can contains special characters and
thanks to that this parsing method did not work properly.

This commit is fixing it.
special characters in custom attributes
@lpichler lpichler force-pushed the support_special_characters_in_report_with_custom_attributes branch from 32ca4da to 1ce981c Compare September 9, 2016 12:54
@miq-bot
Copy link
Member

miq-bot commented Sep 9, 2016

Checked commits lpichler/manageiq@6fbce18~...1ce981c with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
5 files checked, 0 offenses detected
Everything looks good. 🍪

@lpichler lpichler changed the title [WIP] Support special characters in reporting of Custom Attributes Support special characters in reporting of Custom Attributes Sep 9, 2016
@@ -2,14 +2,19 @@ class MiqExpression::Field
FIELD_REGEX = /
(?<model_name>([[:upper:]][[:alnum:]]*(::)?)+)
\.?(?<associations>[a-z_\.]+)*
-(?<column>[a-z]+(_[[:alnum:]]+)*)
-
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary for this PR, but if this regex is getting increasingly complex it may be better to implement a bona fide parser. User feedback is valuable - LMK if you have any opinions either way

@gtanzillo
Copy link
Member

@imtayadeway Can you review and let me know if you're ok with it? Thanks.

@lpichler lpichler changed the title Support special characters in reporting of Custom Attributes [WIP] Support special characters in reporting of Custom Attributes Oct 17, 2016
@lpichler
Copy link
Contributor Author

@miq-bot add_label wip

@miq-bot miq-bot added the wip label Oct 17, 2016
@zeari
Copy link

zeari commented Nov 7, 2016

This works well with OSE labels 👍
cc @cben

@zeari
Copy link

zeari commented Nov 7, 2016

for #10482 point 2, change this line to if af[0].include?(":") && !af[1].include?(CustomAttributeMixin::CUSTOM_ATTRIBUTES_PREFIX) # Not a base column or equivalent

@cben
Copy link
Contributor

cben commented Nov 7, 2016

@zeari broken link, you mean this line ?

@zeari
Copy link

zeari commented Nov 8, 2016

@zeari broken link, you mean this line ?

yes

@miq-bot
Copy link
Member

miq-bot commented Jan 12, 2017

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented May 12, 2017

This pull request is not mergeable. Please rebase and repush.

@lpichler
Copy link
Contributor Author

done by other referenced PRs.

@lpichler lpichler closed this Jun 30, 2017
@lpichler lpichler deleted the support_special_characters_in_report_with_custom_attributes branch June 30, 2017 13:35
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.

custom attributes break report editor if name contains '.'
7 participants