-
Notifications
You must be signed in to change notification settings - Fork 993
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
Fixes #35274 - Make columns on host index page selectable #9319
Fixes #35274 - Make columns on host index page selectable #9319
Conversation
Issues: #35274 |
@ares, I guess you're the first one wanting to test this out :) |
bd2750d
to
01eb682
Compare
01eb682
to
059ecc7
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.
a quick comment from the first read, looks straightforward but don't take it as a full review :-)
@@ -16,6 +16,12 @@ def define(name, &block) | |||
tables[name] = table | |||
end | |||
|
|||
def register(name, &block) | |||
Foreman::Logging.logger('selectable columns').info _('Table %s is not defined, ignoring.') % name unless tables[name] |
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.
new logger will require a new entry in settings.yml.example
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.
Actually, I don't think we need a new logger. This message is for devs only. Ideally, users shouldn't see those messages at all. I'll use app
logger here.
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 to get my mental model straight:
Tables have columns, columns belong to categories. Categories themselves are not really displayed anywhere in the ui, they are just used as a container to mark some columns as default? Is there any additional functionality planned for them?
From what I've seen it works nicely, however the page looks slightly odd if you remove too many columns, but we can live with that for now.
Well, yes:
|
I guess the categories would help with having presets? As a user I don't want always to nitpick 5 out of 40 columns. I'd love to have a preset "compliance manager" which shows me compliance relevant data or "devops" which would show me puppet/ansible data or "patching sysadmin" which shows me counters of applicable errata. I'm not sure if it was meant that way or not, perhaps we'd need a way to have single column in multiple categories. But this is certainly something we should consider in future. |
@ares:
Currently if users change their table preference in a way we have now, it means they create their own preset and to be able to do so, we need to show all columns (this leads to nitpick 5 out of 40 for example). I just need to be sure what we want to share with users:
UPD: If we will go with the UPD2: Currently, this feature works as described in #9319 (comment), but with |
From user perspective, I always want to tweak which columns to see, e.g. specific 5 out of all 40. But if I'm a new user, I'd like the UI to guide me, e.g. if I chose I'm a compliance manager, I want the UI to preselect 7 specific checkboxes. I can still tick or untick more, but I'm happy for the app's suggestion of what I'll probably be interested in. Note that some of the columns would be shared among these presets, e.g. host name is probably a good candidate for all of them. My preference would be go the the 3.4 version of the DSL ready for additions in 3.5 so that plugins will specify the columns just once. So I'd be ok with merging something we don't use in the current version in 3.4. But I can also understand it is hard to predict and perhaps a later change will be inevitable. |
5ab6909
to
f4f3752
Compare
f4f3752
to
8e1c80c
Compare
05b9415
to
8406f6c
Compare
@adamruzicka, I guess it's ready now :) |
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.
One last suggestion, apart from that it looks good
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.
This looks good to me and I'd vote for getting it in.
Even though we're in stabilization week, I'd like to get this in for 3.4. I'll leave this open until wednesday to give people time to voice their concerns, if they have any.
As far as I know no concerns have been raised, merging. |
Thank you @ofedoren ! |
Please don't forget to demo this, this is a great addition. Worth listing as a 3.4 headline feature. |
…foreman#9319)" This reverts commit b1b46b6.
…)" This reverts commit b1b46b6.
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (#9319)")
Since b1b46b6 the labels are translated during initialization. This is because it uses () instead of N(). The latter only marks a string for translation. Doing this leads to infinite recursion while starting up when updating to fast_gettext 2.1+. It can also lead to other issues where a column can be translated multiple times. Fixes: b1b46b6 ("Fixes #35274 - Make columns on host index page selectable (theforeman#9319)")
This PR is logically divided into 4 smaller commits for easier review. The actual change which fixes https://projects.theforeman.org/issues/35274 is in 92f68ca, but 03dca15 and f23cd03 is required to be able to make those changes. 059ecc7 is extra commit which adds plugin support and some documentation.
This works only for ERB based pages. Some information can be used in React components (such as
PF4 Selector
@pkoprda works on), but in order to make columns selectable via React, we would need to rewrite the whole page in it and come with a different approach (probably it will require resource presenters or a way to extend actions' response from plugins and add some Slot&Fill support with filtering).This solution is not the best in terms of efficiency, so if there will be a better suggestion with a different approach, I'm open to it. Otherwise I propose this for 3.4, so we can collect users' feedback early. Meanwhile, I'm going to create a post on our forum about what additional columns we want to include on host index page.
Also, I've tried to make it as general as I can imagine, so there is support for plugins to be able to add some columns to existing pages or even use the storage within plugin itself to be able to make plugin's pages with selectable columns.
How to test it: this feature uses users'
table preferences
which can be defined via API or hammer (latest develop branch only for now). For this particular page you would need to call, e.g.There are some issues:
Power
column, since we use a setting to show/hide it. Can be refactored, so we no longer need to use settings for it.foreman_puppet
,foreman_rh_cloud
, etc), some columns will be shown regardless of user preferences.Concerns:
table preferences
. To not break UX with this feature, there are some column categories that can be defined as default. In this case default categories will be shown if user didn't configure any preferences for a table.TODO: