-
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
Adding detection of custom attributes field type in miq expression #11000
Adding detection of custom attributes field type in miq expression #11000
Conversation
db07fd0
to
784892c
Compare
@@ -1334,10 +1334,19 @@ def self.get_col_type(field) | |||
|
|||
model = determine_model(model, parts) | |||
return nil if model.nil? | |||
return custom_attribute_field_type(col) if col.include?("virtual_custom_attribute") |
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.
you can use ...::CUSTOM_ATTRIBUTES_PREFIX in custom attributes mixin
@alongoldboim is this PR still wip ? it would be nice to add some test case, let is see also what is it exactly doing. |
b243246
to
656b549
Compare
@lpichler working on the tests part, will remove WIP once done. |
4c584a8
to
015e939
Compare
@lpichler tests were added, please review :) |
015e939
to
8187f08
Compare
Depends on: #10896 |
@imtayadeway Note that this relies on the database migration changes in #10896, so you may have some opinion there as well. |
field_type = CustomAttribute.find_by_name(col.gsub(CustomAttributeMixin::CUSTOM_ATTRIBUTES_PREFIX, "")).field_type | ||
field_type.to_sym | ||
rescue | ||
_log.info("Couldn't detect custom-attribute: #{col} feild type") |
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.
/s/feild/field/
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.
fixing :)
@alongoldboim just a couple more questions above, otherwise LGTM 😄 |
6569330
to
ac6faa0
Compare
@imtayadeway I think i got them all :) |
4fb539a
to
d9a6ac2
Compare
@alongoldboim 👍 LGTM. Can you squash your refactor commit or otherwise give it a more descriptive commit message? Thanks! |
d9a6ac2
to
4687394
Compare
@imtayadeway Done. |
Checked commit alongoldboim@4687394 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 spec/models/custom_attribute_spec.rb
|
👍 |
@gtanzillo please label |
@miq-bot add-label euwe/yes |
…type_def_in_miq_expression Adding detection of custom attributes field type in miq expression (cherry picked from commit 58521b1)
Euwe Backport details: $ git log
commit e9562ca7eacd56d2d47c91240852cfb240c39842
Author: Gregg Tanzillo <[email protected]>
Date: Wed Sep 28 11:00:43 2016 -0400
Merge pull request #11000 from alongoldboim/enable_custom_attributes_type_def_in_miq_expression
Adding detection of custom attributes field type in miq expression
(cherry picked from commit 58521b147b364254b1de8b47d45739ef19bea915) |
For now, make the test expectations different for ruby 2.4.0+ vs. prior rubies. CustomAttribute#value_type returns a symbol for a ruby core class, a hardcoded value instead of the class's behavior. Do we use this? Why are we returning a value instead of caring about behavior of the old Fixnum and Integer? If we don't use this, we should remove the whole method and it's tests added in: ManageIQ@4687394 The PR that added this was: ManageIQ#11000 Adding CustomAttribute to provider UI/API was added in: ManageIQ#10897
Added field_type to custom-attributes in: #10897, in this pr i have modified the expression builder in polices to parse the custom-attribute by its field type.