-
Notifications
You must be signed in to change notification settings - Fork 900
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
[WIP] Support special characters in reporting of Custom Attributes #11112
Conversation
ad66628
to
32ca4da
Compare
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
32ca4da
to
1ce981c
Compare
Checked commits lpichler/manageiq@6fbce18~...1ce981c with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
@@ -2,14 +2,19 @@ class MiqExpression::Field | |||
FIELD_REGEX = / | |||
(?<model_name>([[:upper:]][[:alnum:]]*(::)?)+) | |||
\.?(?<associations>[a-z_\.]+)* | |||
-(?<column>[a-z]+(_[[:alnum:]]+)*) | |||
- |
There was a problem hiding this comment.
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
@imtayadeway Can you review and let me know if you're ok with it? Thanks. |
@miq-bot add_label wip |
This works well with OSE labels 👍 |
yes |
This pull request is not mergeable. Please rebase and repush. |
This pull request is not mergeable. Please rebase and repush. |
done by other referenced PRs. |
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).
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. ?
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