Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11103 closed defect (fixed)

Admin Manage Components table does not hide when there are no components

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: admin/web Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Hide the Components table on the Manage Components page when there are no components defined. Hide the repositories table on the Manage Repositories page when there are no repositories defined.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Here is a screen capture of the Manage Milestones view with all of the milestones deleted:

Here is a screen capture of the Manage Components view with all of the components deleted:

The message As long as you don't add any items to the list, this field will remain completely hidden from the user interface. should be displayed and the table header should be hidden when all of the Components are deleted.

The problem is that Component.select returns a generator, and it's not expanded to a list in _render_admin_panel. For all of the other cases of Ticket System fields, select either returns a list or the generator is expanded to a list in _render_admin_panel (e.g. enums).

Attachments (2)

ManageComponents.png (14.3 KB ) - added by Ryan J Ollos <ryan.j.ollos@…> 11 years ago.
ManageMilestones.png (8.7 KB ) - added by Ryan J Ollos <ryan.j.ollos@…> 11 years ago.

Download all attachments as: .zip

Change History (20)

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: ManageComponents.png added

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: ManageMilestones.png added

comment:1 by Christian Boos, 11 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Should I just expand the generator to a list before passing to the template, or is there something else that should be done here?

comment:3 by Christian Boos, 11 years ago

It's just "by luck" that some other select return a list and not a generator. It would look suspicious to have a 'components': list(model.Component.select(self.env)), line but then a 'versions': model.Version.select(self.env) a bit later. As we already have the list(...) for the abstract enums, I think we should better add it everywhere, to be consistent and better express that the templates actually expect a list.

Btw, I just saw we still have the ticket related admin templates still below admin/templates. It would be better to have them below the ticket/templates.

in reply to:  3 comment:4 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Replying to cboos:

Btw, I just saw we still have the ticket related admin templates still below admin/templates. It would be better to have them below the ticket/templates.

Cool, I've been meaning to bring that up. I'll make that change in the Git branch for this ticket.

comment:5 by Christian Boos, 11 years ago

Milestone: 1.0.2

comment:6 by Ryan J Ollos, 11 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:7 by Ryan J Ollos, 11 years ago

Description: modified (diff)

The Manage Repositories panel has the same issue as the Manage Components panel.

in reply to:  3 comment:8 by Ryan J Ollos, 11 years ago

Replying to cboos:

Btw, I just saw we still have the ticket related admin templates still below admin/templates. It would be better to have them below the ticket/templates.

Initially I had some concerns about making this change on 1.0-stable, and how it might affect the translations, but after regenerating the catalog template and string catalogs, it seems the result is that no manual changes to the catalogs are required to accommodate the templates being moved. Does making the change on 1.0-stable sound okay?

All of the proposed changes for this ticket can be found in rjollos.git:t11103.

comment:9 by Christian Boos, 11 years ago

Series looks good to me and 1.0 seems to be fine for the move of templates.

comment:10 by Ryan J Ollos, 11 years ago

Release Notes: modified (diff)

Thanks for reviewing. I'll go ahead and push the changes to 1.0-stable this evening.

comment:11 by Jun Omae, 11 years ago

I notice that [11923] breaks RegressionTestTicket11194 test case. The sorted_repos variable is not used in trac/versioncontrol/admin.py in default repository and repos:rjollos.git:t11103.

======================================================================
FAIL: Test for regression of http://trac.edgewall.org/ticket/11194
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jun66j5/src/trac/edgewall/github/trac/versioncontrol/tests/functional.py", line 205, in runTest
    tc.follow('\\b' + names[1] + '\\b')
  File "/usr/lib/python2.5/site-packages/twill/commands.py", line 202, in follow
    raise TwillAssertionError("no links match to '%s'" % (what,))
TwillAssertionError: no links match to '\bshrewishly_1\b'

----------------------------------------------------------------------
Ran 140 tests in 734.110s

comment:12 by Ryan J Ollos, 11 years ago

Thanks for catching the failure. I don't have the subversion bindings installed in the environment that I was running the tests, which is why I wasn't seeing this failure.

It's not obvious to me at the moment why it is failing since sorted_repos is defined on the body element, and then used to populate the table. I'll take a closer look in the morning.

Changes from repos:rjollos.git:t11103 committed to 1.0-stable in [11918:11924].

comment:13 by Ryan J Ollos, 11 years ago

Oh, I think I made a stupid error here, due to looking at admin_components.html. Do I just need a py:if instead of a py:when?

Version 0, edited 11 years ago by Ryan J Ollos (next)

in reply to:  13 comment:14 by Jun Omae, 11 years ago

Replying to rjollos:

Do I just need a py:if instead of a py:when?

Yeah, the test case passes! Please commit it.

comment:15 by Ryan J Ollos, 11 years ago

Thanks, Jun! Committed to 1.0-stable in [11925].

comment:16 by Ryan J Ollos, 11 years ago

Fixed another issue in [11929], which wasn't discovered until merging the changes to the trunk and running the test suite.

======================================================================
ERROR: runTest (trac.ticket.tests.functional.TestReportDynamicVariables)
Generate a report with dynamic variables in title, summary
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/Workspace/t11103/trac-trunk/trac/ticket/tests/functional.py", line 1173, in runTest
    ticket_id = self._tester.create_ticket(summary, fields)
  File "/home/user/Workspace/t11103/trac-trunk/trac/tests/functional/tester.py", line 87, in create_ticket
    tc.formvalue('propertyform', 'field_%s' % field, value)
  File "/home/user/Workspace/t11103/trac-trunk/trac/tests/functional/better_twill.py", line 160, in better_formvalue
    fv(form, field, value)
  File "/home/user/Workspace/t11103/local/lib/python2.7/site-packages/twill-0.9-py2.7.egg/twill/commands.py", line 435, in formvalue
    control = browser.get_form_field(form, fieldname)
  File "/home/user/Workspace/t11103/local/lib/python2.7/site-packages/twill-0.9-py2.7.egg/twill/browser.py", line 365, in get_form_field
    raise TwillException('no field matches "%s"' % (fieldname,))
TwillException: no field matches "field_component"

----------------------------------------------------------------------

comment:17 by Ryan J Ollos, 11 years ago

Resolution: fixed
Status: assignedclosed

Merged to trunk in [11930].

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:18 by Ryan J Ollos, 11 years ago

Reporter: changed from Ryan J Ollos <ryan.j.ollos@…> to Ryan J Ollos

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.