Opened 15 years ago
Closed 15 years ago
#6875 closed enhancement (fixed)
Allow batch keyword removal
Reported by: | BradT | Owned by: | CuriousCurmudgeon |
---|---|---|---|
Priority: | normal | Component: | BatchModifyPlugin |
Severity: | normal | Keywords: | |
Cc: | oliver@… | Trac Release: | 0.11 |
Description
We use keywords for some ad-hoc information and frequently need to remove one keyword and add another to a large number of tickets. The changes for ticket #2311 help with adding new keywords (which was pretty much unusable before), but it doesn't allow for batch removal of keywords. I looked through the tickets and didn't find anything about removing keywords.
This is my scenario
- Ticket A has keywords "foo bar baz" and is checked
- Ticket B has keywords "foo" and is checked
- I want to remove the keyword foo from the selected tickets. Once this is done, Ticket A should have keywords "bar baz" and ticket B should have an empty keywords field.
If keywords could be both added and removed simultaneously, that would be ideal.
I'm not sure what the best way to build this GUI would be, but it would be very useful for us to have the functionality
Attachments (1)
Change History (13)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
I the spirit of simplicity, what about simply having "keywords to add" and "keywords to remove"?
A friendlier version would be good, but just a separate field for removals would probably do the trick.
comment:3 follow-up: 4 Changed 15 years ago by
Cc: | oliver@… added; anonymous removed |
---|
I've created a patch that addresses this ticket in the simplest way I can think of. Basically, if you want to remove a keyword from a ticket, you stick a - (hyphen) in front of the keyword name.
This also addresses some shortcomings I've had with the keywords functionality. Maybe I'm misunderstanding the way it is supposed to work, but if I have the keyword field set to "foo" and I type "bar, baz", I would expect the keywords to be changed to "foo, bar, baz" — not "foo bar baz", as they seem to be.
Here's some example behaviour with the new format in this patch (in the format existing + input = output):
foo
+bar
=foo, bar
foo, bar
+-foo
=bar
foo, bar, baz
+foo, -bar, boo
=foo, baz, boo
Hope this makes sense.
Changed 15 years ago by
Attachment: | keywords.diff added |
---|
Patch to add keyword removal and modify the keyword modification behaviour to "make sense"
comment:4 Changed 15 years ago by
Replying to oliver@obeattie.com:
I've created a patch that addresses this ticket in the simplest way I can think of. Basically, if you want to remove a keyword from a ticket, you stick a - (hyphen) in front of the keyword name.
Thank you! I'm using a modified version of it now.
comment:6 Changed 15 years ago by
Status: | new → assigned |
---|
Patch applied. Thanks a lot. It's a very simple and clean way to solve the problem.
comment:7 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:8 Changed 15 years ago by
Unfortunately this patch only allows comma separated keywords, so you might find some users don't like the change.
New:
regexp = re.compile(r'\,(\w+)?')
vs the original:
regexp = re.compile(r'\W+')
What I'm using:
regexp = re.compile(r'\s+')
comment:9 Changed 15 years ago by
There was more in my comment, but it didn't take.
This is the regex I think we want, since it separates on anything but '-' or word characters.
regexp = re.compile(r'[^-\w]+')
>>> regexp = re.compile(r'[^-\w]+') >>> regexp.split("foo, -bar, baz gar") ['foo', '-bar', 'baz', 'gar'] >>> regexp.split("foo,-bar,baz gar") ['foo', '-bar', 'baz', 'gar'] >>> regexp.split("foo, -bar,baz gar") ['foo', '-bar', 'baz', 'gar'] >>> regexp.split("foo -bar baz gar") ['foo', '-bar', 'baz', 'gar']
comment:10 Changed 15 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
User expectations seem to vary quite a bit, but I lean towards using any whitespace character. I will use the above regex.
comment:11 Changed 15 years ago by
comment:12 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I agree that batch removal should be possible. When implementing #2311 I wasn't quite sure how to create the GUI for this as well. My only idea right now is that checking the Keywords checkbox would trigger an AJAX request to pull down all the keywords on the selected tickets. Then you would be able to choose the ones you want to remove. If the query already included keywords in the results the request is probably unnecessary.