Closed
Bug 621878
Opened 14 years ago
Closed 14 years ago
Allow extensions to alter quicksearch terms and search format
Categories
(Bugzilla :: Extensions, enhancement)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.0
People
(Reporter: gerv, Assigned: gerv)
Details
Attachments
(1 file, 3 obsolete files)
2.65 KB,
patch
|
mkanat
:
review+
|
Details | Diff | Splinter Review |
b.m.o. does this - it alters quicksearch to provide a better syntax for searching our status-related custom fields. It would be good to have an official hook to make this possible for us and for other extensions. I can imagine it being something authors who are adding bug fields and capabilities might want to do.
Gerv
Assignee | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Comment on attachment 500183 [details] [diff] [review]
Patch v.1
Ah, let's just call the argument "map". But otherwise, this looks good.
Will need documentation and an example.
Attachment #500183 -
Flags: review?(mkanat) → review-
Updated•14 years ago
|
Target Milestone: --- → Bugzilla 3.6
Assignee | ||
Comment 3•14 years ago
|
||
With documentation and an example. (Which is so handy, actually, it should perhaps be part of the basic function...)
Gerv
Attachment #500183 -
Attachment is obsolete: true
Attachment #507206 -
Flags: review?(mkanat)
Comment 4•14 years ago
|
||
Comment on attachment 507206 [details] [diff] [review]
Patch v.2
Ah, what's done in that example already is possible in normal Quicksearch, actually.
Attachment #507206 -
Flags: review?(mkanat) → review-
Assignee | ||
Comment 5•14 years ago
|
||
You're giving me r- for an insufficiently interesting example in Example.pm? Oy vey...
What would you suggest? :-)
Gerv
Comment 6•14 years ago
|
||
Hahaha. Well, I don't want to confuse people and make them think that Bugzilla doesn't already do that. You could invent a fake field and add it to the map, that seems simplest.
Assignee | ||
Comment 7•14 years ago
|
||
Now with marginally more interesting example ;-)
Gerv
Attachment #507206 -
Attachment is obsolete: true
Attachment #507399 -
Flags: review?(mkanat)
Comment 8•14 years ago
|
||
Comment on attachment 507399 [details] [diff] [review]
Patch v.3
>=== modified file 'Bugzilla/Hook.pm'
>+=item C<map> - a hash where the keys are the words you want to use in Quicksearch, and the values are the column names on the C<bugs> table, or C<tablename.columnname> for other tables, you want them to map to. You can
>+modify existing mappings or add new ones.
Actually, it's not tablename.columnname or even C<bugs> columns--it's always names from the fielddefs table.
>+sub quicksearch_map {
>+ my ($self, $args) = @_;
>+ my $map = $args->{'map'};
>+
>+ # This demonstrates adding a shorter alias for a long custom field name.
>+ foreach my $name (keys %$map) {
>+ if ($name eq 'cf_long_field_name_for_impact_field') {
>+ $map->{'impact'} = $map->{$name};
>+ }
>+ }
Ah, I don't see why you'd encourage people to loop through hash keys and check if they're equal. (People *will* copy and paste this code, very likely.)
Otherwise the general concept looks fine. Just fixing those two things should be enough for a checkin. (The reason I didn't notice these before is that I didn't do a real review, I just did a drive-by check.)
Attachment #507399 -
Flags: review?(mkanat) → review-
Assignee | ||
Comment 9•14 years ago
|
||
That's fine; I know I'm keeping you busy today :-)
Gerv
Attachment #507399 -
Attachment is obsolete: true
Attachment #507419 -
Flags: review?(mkanat)
Comment 10•14 years ago
|
||
Comment on attachment 507419 [details] [diff] [review]
Patch v.4
Awesome!
I'm totally thrilled to be kept busy if it's to help get new contributions in. :-) I'm really thankful for all of the patch work you've done lately.
Attachment #507419 -
Flags: review?(mkanat) → review+
Comment 11•14 years ago
|
||
The 3.6 approval only applies if there is no bitrot.
Flags: approval4.0+
Flags: approval3.6+
Flags: approval+
Assignee | ||
Comment 12•14 years ago
|
||
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/
modified extensions/Example/Extension.pm
modified Bugzilla/Search/Quicksearch.pm
modified Bugzilla/Hook.pm
Committed revision 7684.
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/4.0/
modified extensions/Example/Extension.pm
modified Bugzilla/Search/Quicksearch.pm
modified Bugzilla/Hook.pm
Committed revision 7538.
The code parts of the patch apply to 3.6; the Hook.pm part fails, presumably because the hook either above or below the place I've inserted the text doesn't exist in 3.6. But given that the 4.0 release is imminent, I'm not worried about this.
Gerv
Comment 13•14 years ago
|
||
Okay, agreed.
Flags: approval3.6+
Target Milestone: Bugzilla 3.6 → Bugzilla 4.0
![]() |
||
Comment 14•14 years ago
|
||
So we can close this bug.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•