-
Notifications
You must be signed in to change notification settings - Fork 897
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
Hide deprecated and duplicate attributes #20664
Conversation
c5395ba
to
1cbca13
Compare
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.
thanks, this is excellent, it looks perfectly cromulent
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.
Just some thoughts about making this a bit more robust and avoid some smells. I think the concept is fine though, so feel free to push back if you think these suggestions are invalid.
I think the preferred way to do this is to use private instead of adding yet more metadata - but I felt like turning all these fields private has some unknown consequences |
9022920
to
e9aaf79
Compare
I like this idea... seems like a decent compromise over straight |
yea so models that inherit from the ActsAsArModel aren't going to work with this as it is now |
c0f9097
to
35c92d3
Compare
35c92d3
to
67b6ce4
Compare
a05aaf4
to
9dec939
Compare
507d42a
to
6bb6b4b
Compare
This doesn't sound like a just a whitespace fix... |
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.
Looks good to me. Took a peek at the tests, which look good and I think are a solid/clever way of testing without mucking with "un-privatizing" methods after each test.
Regarding Jason's feedback, I will leave that discussion to him. I can see both sides of that argument, so I don't have a strong opinion one way or the other.
lib/miq_expression.rb
Outdated
@@ -909,7 +909,7 @@ def self.build_relats(model, parent = {}, seen = []) | |||
parent[:class_path] ||= model.name | |||
parent[:assoc_path] ||= model.name | |||
parent[:root] ||= model.name | |||
result = {:columns => model.attribute_names, :parent => parent} | |||
result = {:columns => model.public_attribute_names, :parent => parent} |
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.
The public_attribute_names
is a good addition here, and really cleaned this up. 👍
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.
I don't love the name private_attribute
because it makes me think that the attribute will act like a private method (unusable to public callers), maybe hidden_attribute
would be better? Or built into deprecate_attribute
as deprecated_attributes
on the class? 🤷♂️
Overall, I like the idea of having a way to list the non-deprecated (public) attributes on a model. 👍
I had this in deprecated attribute mixin. But the original intent was to hide new virtual attributes |
From Pull Request: ManageIQ/manageiq#20664
for this pr, lets test across many repos (trying to get a handle on how this bot stuff works) @miq-bot cross-repo-tests manageiq-ui-classic, manageiq-api, ManageIQ/manageiq-providers-amazon, ManageIQ/manageiq-providers-azure, ManageIQ/manageiq-providers-ibm_cloud, ManageIQ/manageiq-providers-kubernetes, ManageIQ/manageiq-providers-openstack, ManageIQ/manageiq-providers-vmware |
From Pull Request: ManageIQ/manageiq#20664
Some virtual_attributes are not needed in reporting nor the api. Some deprecated attributes should not be advertised to the customer as attributes to use. After this change, the attributes are still accessible. Just these attributes are no longer advertised on the public apis (i.e.: report builder and rest api). This allows us to control which parts of our models are exposed. This fixes ManageIQ#18130 This enables ManageIQ#20532 Hide deprecated and duplicate attributes. Some virtual_attributes are not needed in reporting nor the api. Some deprecated attributes should not be advertised for customers to use. After this change, the attributes are still accessible. So nothing will break, but these attributes are no longer advertised in the public apis (i.e.: report builder and rest api). This allows us to control which parts of our models are exposed. This fixes ManageIQ#18130 This enables ManageIQ#20532
4e8f58f
to
79e3e33
Compare
status: cross repo failure was because this PR is against an older version of the code base |
@miq-bot cross-repo-tests manageiq-ui-classic, manageiq-api, ManageIQ/manageiq-providers-amazon, ManageIQ/manageiq-providers-azure, ManageIQ/manageiq-providers-ibm_cloud, ManageIQ/manageiq-providers-kubernetes, ManageIQ/manageiq-providers-openstack, ManageIQ/manageiq-providers-vmware |
From Pull Request: ManageIQ/manageiq#20664
Ahhhh...my original intent was for it to act more like private (ref & ref). This is probably why I was confused here. However, I'm good if your intent is to act more like hidden. If that's the case, then I agree that EDIT: Apologies for the super-late reply (I do realize my comment makes some annoying changes) |
right about now is when I wish my git-fu were not as good and I had an earlier commit with the hidden word in it (rather than rebasing and the changes I made) coming right up UPDATE: huh. for some reason I had the rename as a separate commit. Only had to add the fixes to this one (for the children tests). |
79e3e33
to
151b057
Compare
Checked commits kbrock/manageiq@a926389~...151b057 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint |
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.
👍 LGTM
cc @agrare ... wonder if we can start using this to hide the support features stuff. |
Hide deprecated and duplicate attributes
Some virtual_attributes are not needed in reporting nor the api.
Some deprecated attributes should not be advertised for customers to start using.
Now, the attributes are still accessible. So nothing will break. But
these attributes are no longer advertised on the public apis (i.e.: report builder and rest api).
This allows us to control which parts of our models are exposed.
So it will fix #18130 and also allows us to introduce attributes in PRs like #20532 because we will not need to expose the newly introduced attribute.
This does modify the report builder, but minimal changes over in the api repo are necessary to plug up this hole over there.