Edgewall Software
Modify

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:

  1. Initial severities { critical: 1, major: 2, normal: 3, minor: 4 }
  2. Action: delete severity "normal"
  3. 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

t2876-r6286-enum_order-a.diff (1.4 KB) - added by osimons 4 years ago.
Reorder + delete default setting from trac.ini if that option is deleted (strictly not needed). Added some tests.

Download all attachments as: .zip

Change History

comment:1 Changed 5 years ago by mgood

#3555 has been marked as a duplicate.

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: 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

     
    371371        self.env.log.info('Deleting %s %s' % (self.type, self.name)) 
    372372        cursor.execute("DELETE FROM enum WHERE type=%s AND value=%s", 
    373373                       (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)) 
    374376 
    375377        if handle_ta: 
    376378            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

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

Actually, that was not the end of it... Follow-up in #6490, hopefully finally fixed in [6323].

comment:9 Changed 4 years ago by osimons

#4982 closed as duplicate.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from osimons. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.