-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Services filtering and other stuff #11241
Conversation
Good question. I didn't consider this! |
I went for Automatic Startup since it matches what we show on the Services details page where it forms the sentence "Automatic Startup Enabled". It also feels like more natural language to me. |
Do you think it could work to relabel the dropdown "All Timers" etc. on the Timers page (and same for all the other pages). I realize this ends up being a bunch more work, but it would reflect the notion that the filter only applies to the current page. |
I honestly don't understand how systemd templates work. Maybe @martinpitt can shed some light. |
Yeah, maybe templates should have their own class. You can enable/disable/start/stop a template, which will create instances -- But you always have to give it an actual instantiation value, so this requires a dialog. I. e. it makes no sense to start/stop Please see "man systemd.unit" for details about templates, but in short it's a way to build a family of similar services which differ only in a parameter (usually a device name or something such). |
Thank you @andreasn for answers, I will incorporate them. |
Right, that does make no sense. Templates by themselves are nothing by themselves, we should only show the instances. These can be enabled or static. |
Sorry, I meant "show the instances in their respective categories". Templates themselves can/should of course still be shown, but in their separate category. |
Does it currently only filter based on Id's? If so, it's probably best to mention that in the filter inputs placeholder text to give a hint of how the search will function. |
I played around with this now. It jumps around a little bit, but it's not too bad. |
A lot of confusion between category, class, type... :)
Ids and description. But yes, design states also having there
That would be a solution. Kinda hard to guess the widths though :) But surely I can play with it and see if there is something reasonable that can be used. (Mind that timers need custom widths as there are more columns) |
@garrett pointed out that the text for the no-results-found state was a little too complex, so changing that to No Matching Results |
With the help of @garrett I figured out a way to make the columns not jump around so much.
It will of course still jump a little bit when the web browser adds and removes the scrollbar due to the page height, but that tolerable. |
It probably makes most sense to spin off any changes to Templates into it's own issue. I don't think it's really blocking this PR. |
Awesome. I just realized that the description seems case-sensitive. Is there a quick way to make it not case-sensitive? That would make searching for the description easier. |
Seems the dropdown centers the text due to the |
Awesome! Thanks :)
Agree. I will open issue after this one gets merged (or at least design stabled).
Sure, adding into TODO.
It is developed in React. Services page is not in React yet. |
Ah, ok. Let's use the pull-left class on the span then. |
It's possible to make the page not jump in that case, with You could, for example, set |
It would most likely be better to use BTW: The new dropdown widget is a drop-in replacement for React components, but copy/pasting the HTML (when it is done and merged) should be possible, as the CSS will be in the global CSS used for Cockpit. |
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.
Issues I've found in this PR
- There's an empty
<div>
around "create-timer". (See inline comment.) - Hitting escape doesn't clear the filter box.
- There's no label for the filter with a
for="Element_ID_goes_HERE"
or aria-labelledby (as a fallback for elements without a label but with text somewhere) — or, in this case, as there's no element visibly saying "Filter", an aria-label. - Filter isn't focused by default (this is debatable, but probably would be nice feature-wise — there's a possible accessibility issue by skipping the toggle buttons on the left, however).
This last one is debatable. I'm fine if we talk about this and if it comes later. Or we could discuss it and it would be implement The other items on the list should be fixed, however.
As noted above, the dropdown has some issues, but we're hoping to solve those elsewhere (and backport it to the non-React parts of Cockpit, like here).
Suitable for another PR
- Filter bar behaves oddly in small viewports. As the list is also problematic in small viewports, and this is an existing problem (although now excerbated with the filtering), I'm happy with it as another PR.
pkg/systemd/services.html
Outdated
@@ -56,13 +59,27 @@ | |||
<button class="btn btn-default" role="tab" data-pattern="\.timer$" translatable="yes">Timers</button> | |||
<button class="btn btn-default" role="tab" data-pattern="\.path$" translatable="yes">Paths</button> | |||
</div> | |||
<button id="create-timer" data-toggle="#timer-dialog" data-target="#timer-dialog" class="btn btn-primary pull-right" translate>Create Timer</button> | |||
<div> |
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.
There's an empty <div>
here. Usually this comes up with React, where <React.Fragment>
should be used. I'm not sure why there's an empty div here though. If you need to group elements in a wrapper, try to use a semantic element (when it makes sense) and please at least give it a class and/or ID regardless to describe why this is here. (Something like "services-filter" might work.)
What do you think is the timeline for the non-react-dropdown fixes? Is it blocking this PR on fixing that first, or should we do the pull-left hack? |
No, it's not blocking on the dropdown. We should all avoid I don't think it has anything to do with the dropdown though? There are other ways to solve it? |
Oh, I looked at it, and
Go for it. 👍 |
93871b8
to
ec874d4
Compare
A bit of thinking about the second issue - the breaking layout. Possibly grid, where each column would be some percentage could work. We would need a few classes as different tables may have different number of columns, but surely could be done. Ideas? |
I simply typed into the box and hit the ESC key. Nothing happened. It should clear the entry (but keep focus). The layout fixing should be in another PR, hence me opening up #11258 earlier today. It's too complex to block this PR, and it is an existing problem. It's probably tricky with lots of HTML/CSS changes too. (The HTML changes would most likely be attribute related, not massive restructuring.) More details about making accessible tables are in #11260. But I guess that's more for react tables and we'd handle services similarly, but sadly as a one-off, as it isn't React based. |
278c417
to
d155407
Compare
d155407
to
e333e83
Compare
e333e83
to
4da0f11
Compare
4da0f11
to
bd37b3d
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.
Just one bug away from landing, from my POV. The page works really well now, great work!
pkg/systemd/services.html
Outdated
<script id="service-empty-tmpl" type="x-template/mustache"> | ||
<div id="empty-search" class="blank-slate-pf blank-screen"> | ||
<h1 translate> | ||
No Matching Results |
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 whitiespacing doesn't work, it gets copied literally to cockpit.pot:
msgid " No Matching Results "
Please write it as <h1>Bla</h1>
.
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.
Ach, did not notice that. Thank you for pointing this out. Repushed
@@ -62,6 +62,19 @@ | |||
<div class="filter-group"> | |||
<button id="create-timer" data-toggle="#timer-dialog" data-target="#timer-dialog" class="btn btn-primary" translate>Create Timer</button> | |||
<input type="search" id="services-text-filter" class="form-control" aria-label="Filter" placeholder="Filter by Id or description..." translate="placeholder"/> | |||
<div class="dropdown" id="services-dropdown"> |
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.
FTR, in the spirit of #11155 this should become an actual <select>
soon. Right now the selector isn't keyboard navigatable at all. Fine for a follow-up of course.
Use one table and autostart option move to the table. Design: cockpit-project#11237 Fixes: cockpit-project#11237
This prevents small jumps while filtering as on few results scroll bar is removed and content resized.
Keeping table for better accessibility. Follows design from cockpit-project#11237
Services are ordered by ids and if the this column is second users are not able to identify how the list is ordered. Design: cockpit-project#11237
bd37b3d
to
f77d03f
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 for the tabindex change, that should help!
<li class="active" aria-current=true tabindex="0" data-pattern="\.service$"><a translatable="yes">System Services</a></li> | ||
<li tabindex="0" data-pattern="\.socket$"><a translatable="yes">Sockets</a></li> | ||
<li tabindex="0" data-pattern="\.timer$"><a translatable="yes">Timers</a><li> | ||
<li tabindex="0" data-pattern="\.path$"><a translatable="yes">Paths</a><li> |
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.
Ah, cool to see tabindex as the tabs need to be selected — but why is it in <li>
instead of <a>
? (Better yet would be to add href
to the <a>
, instead of using a tabindex
, and use a URL fragment* to remember the state in the URL.)
* URL fragment (#this-thing-here
), not to be confused with a Document Fragment, React.Fragment, CSS Fragmentation, or anything else called "fragment" in webdev. 😉
This PR implements #10010 and #11237.
This PR is WIP and I am happy to improve further if design moves (especially in #11237).
I am opening as there are a lot of questions for design that rose as I was implementing this. (See screenshots at the end, there are the issues visible). Mostly asking @andreasn as he is reporter of both issues, but every single option would be great!
Automatic Startup
is rather long. On PC screen it is fine, problem is on small screens. If I put there wrapping then it wraps on PC screen (surely can be limited by screen size). Would for exampleAutostart
be suitable?All services
or some state for empty search (sth. likeNo services...
) can be confusing as there are buttonTargets
,Sockets
,Timers
,Paths
and you would filter them byAll services
. And also it is filtering autostart options.Templates
behavior (very likely I misunderstood templates) - but now they can be under all Enabled/Disabled/Static. Would it make sense to make it own "class"?Screenshots:
TODOs:
Automatic Startup
on small screensAll Services
by page