Skip to content
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 #10985 - Set css class for width of filter select on puppetca#index #2511

Closed
wants to merge 1 commit into from

Conversation

shlomizadok
Copy link
Member

Please note that at some point we will refactor this page to work with javascript filtering

@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • e98c4b3 must be in the format Fixes/refs #redmine_number - brief description.

Guidelines are available on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@shlomizadok
Copy link
Member Author

per @ohadlevy idea, moved those fields to use data-tables

@@ -4,7 +4,7 @@ def index
# expire cache if forced
Rails.cache.delete("ca_#{@proxy.id}") if params[:expire_cache] == "true"
certs = find_certs
@certificates = certs.sort.paginate :page => params[:page], :per_page => Setting::General.entries_per_page
@certificates = certs.sort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should apply client side sorting instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous behavior was that they arrive sorted (sort from the server) and the can be re-sorted on the client

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i understand, imho you should set the default sort on the js side now, as it has no knowledge on which field sorting was done

@@ -77,7 +77,8 @@ function onContentLoad(){
$('[data-table=inline]').not('.dataTable').dataTable(
{
"sDom": "<'row'<'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
"sPaginationType": "bootstrap"
"sPaginationType": "bootstrap",
"order": [[ 0, 'asc' ]] // Set default order for the first column
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will sort each data-table with the first column (usually name)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left this on this PR even though not using data-tables (as it is a good practice to have default sort)

@@ -3,8 +3,7 @@ def index
@proxy = find_proxy
# expire cache if forced
Rails.cache.delete("ca_#{@proxy.id}") if params[:expire_cache] == "true"
certs = find_certs
@certificates = certs.sort.paginate :page => params[:page], :per_page => Setting::General.entries_per_page
@certificates = find_certs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method returns only valid and pending certificates by default, then it used to be possible to select "revoked" from the dropdown (in theory) to view revoked certs too. I can't see how to do this now? Also, the find_certs method still uses params[:state] which is no longer set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed find_certs method and now returning all certs. Filtering is done only on the client side. Seems reasonable?

@domcleal domcleal changed the title fixes #10985 - Add width to puppet ca filter select fixes #10985 - Use dataTables on puppetca#index and autosign#index Jul 7, 2015
@ohadlevy
Copy link
Member

ohadlevy commented Jul 8, 2015

@shlomizadok imho the usability here is worse, its hard to filter, and at first glance you lose visibility.

by default imho, the user is looking for pending certs (else why go there), sorting based on name is useless if you have uuid for certnames.

i wonder if there is a way to keep the old drop down, and apply it via search to data-table or something that will keep the old ux and improve the client side sorting.

@domcleal
Copy link
Contributor

domcleal commented Jul 8, 2015

So why the suggestion that it should move to the JS table impl if we lose the filtering feature in the process? We're moving further and further from fixing the original bug it appears.

@shlomizadok
Copy link
Member Author

Reverted back the changes to autosign controller & view.
Reverted back to setting min-width, bootstrap class did not play well

@@ -77,7 +77,8 @@ function onContentLoad(){
$('[data-table=inline]').not('.dataTable').dataTable(
{
"sDom": "<'row'<'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
"sPaginationType": "bootstrap"
"sPaginationType": "bootstrap",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

@domcleal
Copy link
Contributor

Is the multi-line layout deliberate? If so, it could probably do with a bit of padding between the select and table.

screenshot from 2015-07-15 10 25 19

@shlomizadok
Copy link
Member Author

Weird, this does not happen to on chrome
image
Nor on Firefox
image

Will remove the unused stuff

@domcleal
Copy link
Contributor

I think it's probably due to mark_translated then which makes the text a little longer. Is the width of that text container limited precisely to the length of the English text? If so then it's going to wrap in any language where "Filter by state" translates to a slightly longer string.

@shlomizadok
Copy link
Member Author

the text container is not limited, the <div> above is :/
I can wrap the text also in a div, so with long text it would look like:
image

Looks reasonable?

(though, to be honest, I don't understand why we give so little space on https://github.com/theforeman/foreman/blob/develop/app/views/layouts/application.html.erb#L13 [col-md-4])

@shlomizadok
Copy link
Member Author

I'm sorry - I'll just give a little less space to the select list, so it will look like that:
image
(Deutsch is the longest language I've found 😉 )

@shlomizadok
Copy link
Member Author

re[test] - RKF

@shlomizadok
Copy link
Member Author

[test]

@domcleal
Copy link
Contributor

Merged as befd671, thanks @shlomizadok.

@domcleal domcleal closed this Jul 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants