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
MINOR: adding filter variable for dev/tasks #10242
Conversation
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.
Is there an easy way to implement a small filter form on the page? Otherwise I feel like this is likely to go unnoticed by people who would otherwise find it useful.
I'm assuming this is mostly for use in the browser, since getting tasks with sake you can just pipe into grep for the same functionality.
src/Dev/TaskRunner.php
Outdated
$tasks = $this->getTasks(); | ||
$filter = (string) trim($request->requestVar('q')); | ||
if($filter) { |
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.
if($filter) { | |
if ($filter) { |
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.
Fixed
src/Dev/TaskRunner.php
Outdated
$tasks, | ||
function ($v) use ($filter) { | ||
$t = $v['title'] ?? ''; | ||
$d = $v['description'] ?? ''; |
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 $v
, $d
, and $t
variables should probably be more verbose. I'm not even sure what $v
is short for.
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.
Fixed
I'm assuming this is mostly for use in the browser, since getting tasks with sake you can just pipe into grep for the same functionality. Not from my point of view. This requires you to know how to use grep, etc... I would keep it simpler (or provide some information on how to use grep). |
$tasks = $this->getTasks(); | ||
$filter = (string) trim($request->requestVar('q')); |
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.
trim
already casts to string, so the extra casting is not necessary
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.
true!
If you guys like it then I will make a new pull request with everything sorted. I am not sure about the form though as we dont want to make it too fancy. Just simple. |
Maybe we can add a little form, but then I think this should be Javascript based, not PHP based. |
{ | ||
$baseUrl = Director::absoluteBaseURL(); |
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 line does nothing here by the looks, is it needed?
My 2c — even though it's quite a small addition, I personally think it's not a scope we want to support within the framework in the long term, mainly because there are other quite standard ways how to achieve the same without this — as Guy mentioned, in the CLI folks can use grep or other filtering mechanisms, in the browser you can search within the content of the page using CTLR/CMD+F shortcut. |
Yeah - then lets leave it. Dont you think? I guess what would be awesome if we had some sort of autocomplete. I usually use CTRL+F on the screen, but most of the time I run it from command line and then I just copy the output and do a CTRL+F. Maybe it is better to have the tasks grouped or something like that as we work on lots of projects with 50 or so tasks - where it is a real pain to find the right one. |
Closing this PR |
Long overdue change to find tasks easily.
Tasks can be filtered by adding the
q
request variable (e.g./dev/tasks/?q=test
ORvendor/bin/sake dev/tasks q=test
)