Closed
Bug 1161070
Opened 9 years ago
Closed 9 years ago
api searches should honour the same fields in its "order" parameter as the web UI
Categories
(Bugzilla :: WebService, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 6.0
People
(Reporter: glob, Assigned: dkl)
Details
Attachments
(1 file, 2 obsolete files)
4.28 KB,
patch
|
dylan
:
review+
|
Details | Diff | Splinter Review |
api searches should honour the same fields in its "order" parameter as the web UI. eg. "Last Changed" --> "changeddate"
Assignee | ||
Comment 1•9 years ago
|
||
Here is the code from buglist.cgi that the API would need to mimic /^Bug Number$/ && do { @order_columns = ("bug_id"); last ORDER; }; /^Importance$/ && do { @order_columns = ("priority", "bug_severity"); last ORDER; }; /^Assignee$/ && do { @order_columns = ("assigned_to", "bug_status", "priority", "bug_id"); last ORDER; }; /^Last Changed$/ && do { @order_columns = ("changeddate", "bug_status", "priority", "assigned_to", "bug_id"); last ORDER; };
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → dkl
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8602143 -
Flags: review?(dylan)
Comment 3•9 years ago
|
||
Comment on attachment 8602143 [details] [diff] [review] 1161070_1.patch Review of attachment 8602143 [details] [diff] [review]: ----------------------------------------------------------------- r- I think using for/last and regexes that match fixed strings is pretty inefficient and hard to understand. Perhaps something like this would work? # Allow the use of order shortcuts similar to web UI my @order_columns; if ($match_params->{order}) { # Convert the value of the "order" form field into a list of columns # by which to sort the results. my %order_types = ( "Bug Number" => [ "bug_id" ], "Importance" => [ "priority", "bug_severity" ], "Assignee" => [ "assigned_to", "bug_status", "priority", "bug_id" ], "Last Changed" => [ "changeddate", "bug_status", "priority", "assigned_to", "bug_id" ], ); $options{order} = $order_types{ $match_params->{order} } // [split(/\s*,\s*/, $match_params->{order})]; }
Attachment #8602143 -
Flags: review?(dylan) → review-
Assignee | ||
Comment 4•9 years ago
|
||
I am thinking now that this could be useful upstream as well. dkl
Component: API → WebService
Product: bugzilla.mozilla.org → Bugzilla
QA Contact: default-qa
Version: Production → 5.1
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8602143 -
Attachment is obsolete: true
Attachment #8602186 -
Flags: review?(dylan)
Comment 6•9 years ago
|
||
Comment on attachment 8602186 [details] [diff] [review] 1161070_2.patch Review of attachment 8602186 [details] [diff] [review]: ----------------------------------------------------------------- r- for the scalar-context issue with ||. Sorry :( ::: buglist.cgi @@ +651,5 @@ > + "Assignee" => [ "assigned_to", "bug_status", "priority", "bug_id" ], > + "Last Changed" => [ "changeddate", "bug_status", "priority", > + "assigned_to", "bug_id" ], > + ); > + @order_columns = @{ $order_types{ $order } || [] } || split(/\s*,\s*/, $order); subtle bug here I almost didn't notice, the left-hand-side of || is evaluated in scalar context, so the @order_columns will always be the last item in $order_types{ $order }.
Attachment #8602186 -
Flags: review?(dylan) → review+
Comment 7•9 years ago
|
||
Comment on attachment 8602186 [details] [diff] [review] 1161070_2.patch Woops, that was an r-
Attachment #8602186 -
Flags: review+ → review-
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8602186 -
Attachment is obsolete: true
Attachment #8629035 -
Flags: review?(dylan)
Updated•9 years ago
|
Attachment #8629035 -
Flags: review?(dylan) → review+
Assignee | ||
Updated•9 years ago
|
Flags: approval?
Updated•9 years ago
|
Flags: approval? → approval+
Target Milestone: --- → Bugzilla 6.0
Assignee | ||
Comment 9•9 years ago
|
||
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 300331b..3331c1b master -> master
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•