Ticket #2876 (closed defect: fixed)
Opened 6 years ago
Last modified 4 years ago
WebAdmin: severity order selection field is invalid
| Reported by: | eblot | Owned by: | osimons |
|---|---|---|---|
| Priority: | low | Milestone: | 0.11 |
| Component: | admin/web | Version: | devel |
| Severity: | minor | Keywords: | |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
In WebAdmin, when a severity item is deleted, the drop-down list of priority order is not reset.
For example:
- Initial severities { critical: 1, major: 2, normal: 3, minor: 4 }
- Action: delete severity "normal"
- Final severities { critical: 1, major: 2, minor: 4 }
-> order 3 is cannot be selected anymore.
Btw, I think a webadmin component should be added on p.e.c., as it is going to be part of the next Trac release.
Attachments
Change History
comment:1 Changed 5 years ago by mgood
comment:2 Changed 5 years ago by mgood
- Component changed from trac-admin to webadmin
- Keywords webadmin removed
- Milestone set to 0.11
- Owner changed from daniel to cmlenz
comment:3 Changed 5 years ago by anonymous
This also goes for Priority enum.
I have changed these a couple of times (adding and deleting keywords and changing the order. I now have three Priority values: high, normal, wish. Their associated values are 7, 8, 9 which also breaks the coloring by priority report: all tickets are displayed in red.
comment:4 follow-up: ↓ 6 Changed 5 years ago by anonymous
Another problem I have is the top value in the list cannot be moved: when i now add a priority using trac_admin, and try to priority order <name> down/up, it won't move. Are these problems connected?
comment:5 Changed 4 years ago by osimons
- Owner changed from cmlenz to osimons
- Priority changed from lowest to low
- Severity changed from trivial to minor
A simple patch that sets new order (value field) to current-1 for all the values that are higher than the one being deleted:
-
trac/ticket/model.py
371 371 self.env.log.info('Deleting %s %s' % (self.type, self.name)) 372 372 cursor.execute("DELETE FROM enum WHERE type=%s AND value=%s", 373 373 (self.type, self._old_value)) 374 cursor.execute("UPDATE enum set value=value-1 where " 375 "type=%s and value>%s", (self.type, self._old_value)) 374 376 375 377 if handle_ta: 376 378 db.commit()
By doing it in the model code, it works the same for both trac-admin and webadmin usage. I only have SQLite, but should be valid syntax on all backends, I guess?
comment:6 in reply to: ↑ 4 Changed 4 years ago by osimons
Replying to anonymous:
Another problem I have is the top value in the list cannot be moved: when i now add a priority using trac_admin, and try to priority order <name> down/up, it won't move. Are these problems connected?
This works fine for me - all works up and down as expected.
Changed 4 years ago by osimons
- Attachment t2876-r6286-enum_order-a.diff added
Reorder + delete default setting from trac.ini if that option is deleted (strictly not needed). Added some tests.
comment:7 Changed 4 years ago by osimons
- Milestone changed from 0.11.1 to 0.11
- Resolution set to fixed
- Status changed from new to closed
Implemented as [6317]. Ended up leaving the default setting in trac.ini as it does not interfere with anything.
Closes ticket.
comment:8 Changed 4 years ago by osimons
comment:9 Changed 4 years ago by osimons
#4982 closed as duplicate.



#3555 has been marked as a duplicate.