Commit cb0d7389 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 304267: Large lists in admin pages fail to display (they take too much time)…

Bug 304267: Large lists in admin pages fail to display (they take too much time) - Patch by Michael Thomas <mockodin@gmail.com> r/a=LpSolit
parent 0ccecfb5
......@@ -86,23 +86,19 @@
}) %]
[%# Overrides the initialowner and the initialqacontact with right values %]
[% overrides.initialowner = [] %]
[% overrides.initialqacontact = [] %]
[% overrides.initialowner = {} %]
[% overrides.initialqacontact = {} %]
[% FOREACH component = product.components %]
[% overrides.initialowner.push({
match_value => component.name
match_field => 'name'
[% overrides.initialowner.name.${component.name} = {
override_content => 1
content => component.default_assignee.login
})
}
%]
[% overrides.initialqacontact.push({
match_value => component.name
match_field => 'name'
[% overrides.initialqacontact.name.${component.name} = {
override_content => 1
content => component.default_qa_contact.login
})
}
%]
[% END %]
......
......@@ -68,27 +68,25 @@
[% custom_fields = Bugzilla.get_fields({ custom => 1 }) %]
[%# We want to display the type name of fields, not their type ID. %]
[% overrides.type = [] %]
[% overrides.type = {} %]
[% FOREACH field_type = field_types.keys %]
[% overrides.type.push({
match_value => field_type
match_field => 'type'
[% overrides.type.type.$field_type = {
override_content => 1
content => field_types.${field_type}
})
content => field_types.$field_type
}
%]
[% END %]
[% overrides.action = [ {
match_value => 1
match_field => 'obsolete'
override_content => 1
content => "Delete"
override_contentlink => 1
contentlink => delete_contentlink
} ]
[% overrides.action.obsolete = {
"1" => {
override_content => 1
content => "Delete"
override_contentlink => 1
contentlink => delete_contentlink
}
}
%]
[% PROCESS admin/table.html.tmpl
......
......@@ -59,27 +59,23 @@
%]
[% SET overrides.action = [] %]
[% SET overrides.action = {} %]
[% FOREACH check_value = values %]
[% IF check_value.is_static %]
[% overrides.action.push({
match_value => check_value.name
match_field => 'name'
[% overrides.action.name.${check_value.name} = {
override_content => 1
content => "(Non-deletable value)"
override_contentlink => 1
contentlink => undef
})
}
%]
[% ELSIF check_value.is_default %]
[% overrides.action.push({
match_value => check_value.name
match_field => 'name'
override_content => 1
content => "(Default value)"
override_contentlink => 1
contentlink => undef })
[% overrides.action.name.${check_value.name} = {
override_content => 1
content => "(Default value)"
override_contentlink => 1
contentlink => undef
}
%]
[% END %]
......
......@@ -66,68 +66,60 @@
]
%]
[% overrides.is_active_bug_group = [ {
match_value => "0"
match_field => 'is_active_bug_group'
override_content => 1
content => "&nbsp;"
},
{
match_value => "1"
match_field => 'is_active_bug_group'
override_content => 1
content => "X"
}]
overrides.userregexp = [ {
match_value => ""
match_field => 'userregexp'
override_content => 1
content => "&nbsp;"
}]
overrides.action = [ {
match_value => Param("chartgroup")
match_field => 'name'
override_content => 1
content => "(used as the 'chartgroup')"
},
{
match_value => Param("insidergroup")
match_field => 'name'
override_content => 1
content => "(used as the 'insidergroup')"
},
{
match_value => Param("timetrackinggroup")
match_field => 'name'
override_content => 1
content => "(used as the 'timetrackinggroup')"
},
{
match_value => Param("querysharegroup")
match_field => 'name'
override_content => 1
content => "(used as the 'querysharegroup')"
},
{
match_value => "1"
match_field => 'isbuggroup'
override_content => 1
content => "Delete"
override_contentlink => 1
contentlink => del_contentlink
}]
overrides.type = [ {
match_value => "0"
match_field => 'isbuggroup'
override_content => 1
content => "system"
},
{
match_value => "1"
match_field => 'isbuggroup'
override_content => 1
content => "user"
}]
[% overrides.is_active_bug_group = {
'is_active_bug_group' => {
"0" => {
override_content => 1
content => "&nbsp;"
}
"1" => {
override_content => 1
content => "X"
}
}
}
overrides.userregexp = {
'userregexp' => {
"" => {
override_content => 1
content => "&nbsp;"
}
}
}
%]
[% FOREACH group IN ["chartgroup", "insidergroup", "timetrackinggroup", "querysharegroup"] %]
[% special_group = Param(group) %]
[% IF special_group %]
[% overrides.action.name.$special_group = {
override_content => 1
content => "(used as the '$group')"
}
%]
[% END %]
[% END %]
[% overrides.action.isbuggroup = {
"1" => {
override_content => 1
content => "Delete"
override_contentlink => 1
contentlink => del_contentlink
}
}
overrides.type.isbuggroup = {
"0" => {
override_content => 1
content => "system"
}
"1" => {
override_content => 1
content => "user"
}
}
%]
[% PROCESS admin/table.html.tmpl
......
......@@ -77,16 +77,13 @@
})
%]
[%# We want to override the usual 'Delete' link for the default
milestone %]
[% overrides.action = [ {
match_value => product.default_milestone
match_field => 'name'
[%# We want to override the usual 'Delete' link for the default milestone %]
[% overrides.action.name.${product.default_milestone} = {
override_content => 1
content => "(Default milestone)"
override_contentlink => 1
contentlink => undef
} ]
}
%]
[% PROCESS admin/table.html.tmpl
......
......@@ -50,14 +50,26 @@
# keys are column names from columns subhashes name field.
#
# overrides:
# Provides a method for overriding individual table cells. This is
# a hash, whose key is the column name, so the column must be
# named for one of it's cells to be overwritten. The hash value is
# an array. Each item in this array is a hash specifying
# row-matching criteria, and any overridden values. The
# row-matching criteria consist of keys:
# match_field: The name of the row value we want to match
# match_value: The value to match against
# Example:
# overrides { # first hash
# column_name_to_be_overwriten => { # second hash
# name_of_row_to_match_against => { # third hash
# value_to_match_against => { # fourth hash
# content => "some contents"
# override_content => 1
# }
# }
# }
# }
#
# Provides a method for overriding individual table cells. This is a hash
# (1), whose key is the column name, so the column must be named for
# one of it's cells to be overwritten. The hash value is another hash
# (2). The keys of that second hash are the name of the row to match
# against. The second hash then again points to another hash. Within this
# third hash (3), the keys represent values to match against. The item
# contains a fourth hash (4) specifying overridden values.
#
# Each column value mentioned in the 'columns' documentation above
# can be overwritten (apart from name and heading). To override a
# table-cell value 'xxx', specify a new 'xxx' value, and specify a
......@@ -98,30 +110,30 @@
yesno_field = c.yesno_field
%]
[%# Are there any specific overrides for this column? %]
[% FOREACH override = overrides.${c.name} %]
[%# Is the override for this row? %]
[% IF override.match_value == row.${override.match_field} %]
[% SET contentlink = override.contentlink
IF override.override_contentlink %]
[% SET content = override.content
IF override.override_content %]
[% SET content_use_field = override.content_use_field
IF override.override_content_use_field %]
[% SET align = override.align
IF override.override_align %]
[% SET class = override.class
IF override.override_class %]
[% SET allow_html_content = override.allow_html_content
IF override.override_allow_html_content %]
[% SET yesno_field = override.yesno_field
IF override.override_yesno_field %]
[% LAST %]
[%# Get any specific "important" overrides for this c.name and row.name ? %]
[% SET important = overrides.${c.name}.name.${row.name} %]
[% END %]
[% IF important %]
[% FOREACH key IN important.keys %]
[% SET ${key} = important.${key} %]
[% END %]
[% ELSE %]
[%# Are there any specific overrides for this column? %]
[% FOREACH match_field = overrides.${c.name}.keys %]
[% override = overrides.${c.name}.${match_field}.${row.$match_field} %]
[% NEXT UNLESS override %]
[% FOREACH key IN override.keys %]
[% SET ${key} = override.${key} %]
[% END %]
[% LAST %]
[% END %]
[% END %]
<td [% IF align %] align="[% align FILTER html %]" [% END %]
......
......@@ -63,36 +63,33 @@
[% END %]
[%# Disabled users are crossed out. Missing realnames are noticed in red. %]
[% overrides.login_name = [] %]
[% overrides.realname = [] %]
[% overrides.login_name = {} %]
[% overrides.realname = {} %]
[% FOREACH thisuser = users %]
[% IF !thisuser.realname %]
[%# We cannot pass one class now and one class later. %]
[% SET classes = (thisuser.disabledtext ? "bz_inactive missing" : "missing") %]
[% overrides.realname.push({
match_value => "$thisuser.login_name"
match_field => 'login_name'
content => "missing"
override_content => 1
class => "$classes"
override_class => 1 })
[% overrides.realname.login_name.${thisuser.login_name} = {
content => "missing"
override_content => 1
class => "$classes"
override_class => 1
}
%]
[% ELSIF thisuser.disabledtext %]
[% overrides.realname.login_name.${thisuser.login_name} = {
class => "bz_inactive"
override_class => 1
}
%]
[% END %]
[% IF thisuser.disabledtext %]
[% overrides.login_name.push({
match_value => "$thisuser.login_name"
match_field => 'login_name'
class => "bz_inactive"
override_class => 1 })
%]
[% overrides.realname.push({
match_value => "$thisuser.login_name"
match_field => 'login_name'
class => "bz_inactive"
override_class => 1 })
[% overrides.login_name.login_name.${thisuser.login_name} = {
class => "bz_inactive"
override_class => 1
}
%]
[% END %]
[% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment