Closed Bug 621878 Opened 14 years ago Closed 14 years ago

Allow extensions to alter quicksearch terms and search format

Categories

(Bugzilla :: Extensions, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.0

People

(Reporter: gerv, Assigned: gerv)

Details

Attachments

(1 file, 3 obsolete files)

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
Attached patch Patch v.1 (obsolete) — Splinter Review
Assignee: extensions → gerv
Status: NEW → ASSIGNED
Attachment #500183 - Flags: review?(mkanat)
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-
Target Milestone: --- → Bugzilla 3.6
Attached patch Patch v.2 (obsolete) — Splinter Review
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 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-
You're giving me r- for an insufficiently interesting example in Example.pm? Oy vey... What would you suggest? :-) Gerv
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.
Attached patch Patch v.3 (obsolete) — Splinter Review
Now with marginally more interesting example ;-) Gerv
Attachment #507206 - Attachment is obsolete: true
Attachment #507399 - Flags: review?(mkanat)
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-
Attached patch Patch v.4Splinter Review
That's fine; I know I'm keeping you busy today :-) Gerv
Attachment #507399 - Attachment is obsolete: true
Attachment #507419 - Flags: review?(mkanat)
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+
The 3.6 approval only applies if there is no bitrot.
Flags: approval4.0+
Flags: approval3.6+
Flags: approval+
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
Okay, agreed.
Flags: approval3.6+
Target Milestone: Bugzilla 3.6 → Bugzilla 4.0
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.

Attachment

General

Created:
Updated:
Size: