-
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 'visible' field to custom attributes #14611
Adding 'visible' field to custom attributes #14611
Conversation
It makes more sense to me to have default false, as custom attributes are an internal implementation detail. EDIT: this means you just omit the default. Lets wait to see what @gmcculloug and @himdel think |
c9da002
to
688b15e
Compare
Perfect. What is this trying to achieve? |
@isimluk Some times we don't want to display all Custom Attributes and we need an easy way to tell about a Custom Attribute if it should be displayed or not. |
what about default value ? isn`t it now nil ? is it ok ? |
@lpichler Yes, it is |
Suggested here: ManageIQ/manageiq-ui-classic#290 (comment) |
Please note that until now, all custom attributes with Therefore, defaulting visible to false definitely breaks everything ;) (if that |
@himdel |
Yes but as I understand we are adding the new column to switch to a general solution
existing code isn't looking at visible yet and should be converted to do so. |
and isn't better to use column with name |
Agreed @enoodle no problem with this assuming
@moolitayer That's IMHO exactly the wrong approach. The only way for us to treat custom attributes consistently is to exactly not let provider-specific people touch that code :). (That said, @enoodle's UI PR is fine IMHO :).) |
I agree with @himdel that the Two things are missing here:
@lpichler We tend to prefer the positive field name Also need to expose setting more properties of the custom_attributes from automate but I would expect that in a separate PR. |
This data migration please to the separated migration. |
7ae0064
to
72a9f77
Compare
@@ -0,0 +1,9 @@ | |||
class SetVisibleToTruedForCustomAttributes < ActiveRecord::Migration[5.0] | |||
def up | |||
CustomAttribute.where(:visible => nil).update_all(:visible => true) |
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.
We are adding the column so all rows would be nil
. I do not see a need for where(:visible => nil)
?
I realize someone could rollback to this migration without removing the column, but that seems highly unlikely and in my opinion more of a reason to include this in the migration that adds the column.
@lpichler What is the need to have this in a separate migration?
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.
@gmcculloug I removed the where(:visible => nil)
.
@@ -0,0 +1,5 @@ | |||
class AddVisibleFieldForCustomAttributes < ActiveRecord::Migration[5.0] | |||
def change | |||
add_column :custom_attributes, :visible, :boolean, default: true |
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.
Do we need the default
here as well as the default_value_for
? I would have expected just the default_value_for
setting.
cc @Fryguy
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.
@gmcculloug I removed the default: true
from the migration itself.
54a72cd
to
3efe49b
Compare
3efe49b
to
00d5a92
Compare
Checked commit enoodle@00d5a92 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 db/migrate/20170403135631_set_visible_to_true_for_custom_attributes.rb
|
@miq-bot add_label fine/no can we take another look at this?
Added |
CustomAttribute.update_all(:visible => true) | ||
end | ||
|
||
def down |
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.
@enoodle For future reference, there is no need to include the down
method if it is empty.
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.
@enoodle Yes, please remove the empty down migration.
@enoodle can you give an example (probably related to containers) where you expect this set to |
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.
Per previous comment this needs an example/explanation.
@simon3z It can be used to prevent displaying of custom attributes in the UI, for example the http_proxy ones that are from "cluster_settings" section. |
@enoodle didn't we say that visibility is by section? E.g. none of the |
@simon3z we had ManageIQ/manageiq-ui-classic#290 to control the visibility by section but then the discussion lead to this PR. I can try to re-open this or make a new one with a more wide reach across all providers to prevent showing custom attributes from certain sections but I have the feeling that there is some resistance to it from the UI/Automate team. |
👍 Visibility by section was abandoned because of the problems it would bring to all existing code and uses. |
@himdel @enoodle I think there is some confusion around what we're really doing here. Maybe at the end of the discussion this implementation will be OK but I feel that we're missing some background with a broader forum. I'll organize a meeting. For me for the time being at least for the use-case I have this is 👎 . |
@simon3z Please document your reasons and problems of this implementation in a textual form. If you need a meeting, it can happen after (I'm on PTO the rest of the week, sorry). But the short story is, there's limited number of things you can do with custom attributes without affecting everybody else, and if you need to have a concept of hidden sections, then you'd need a concept of sections as an entity. Which means migrations, etc. Per-attribute visibility is a general case that should cover any use case that would be solved by per-section visiblity, so .. please be specific about what your needs and constraints really are :). |
end | ||
|
||
def up | ||
CustomAttribute.update_all(:visible => true) |
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.
Please wrap this in a say_with_time
as per the other data migrations.
Since ManageIQ/manageiq-ui-classic#290 is closed, should this be closed as well, or is a discussion still happening? |
@Fryguy No, this PR goes with ManageIQ/manageiq-ui-classic#881 |
@simon3z I guess so.. can you please summarize the result of that discussion? (I had to leave the meeting before it ended, so.. not sure which solution you settled on in the end..) |
This pull request is not mergeable. Please rebase and repush. |
Database migrations have now been moved to the https://github.com/ManageIQ/manageiq-schema repo. Please see http://talk.manageiq.org/t/new-split-repo-manageiq-schema/2478 for instructions on how to transfer your database migrations. If this PR contains only migrations, I will leave it open for a short time during the transition, after which I will close this if it has not been moved over. |
The field's default value will be
true
to leave the behavior unchanged.