diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-07-26 20:12:22 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-07-26 20:12:22 +0000 |
commit | e6b922973a2c38642584d6eb42ead7dced012d13 (patch) | |
tree | 1a1a854ea546a3e9e5d8a4b32d23b34f7e3575ba /reports/brpt | |
parent | ccba37d8303f0c4d94b6dd2f899aaf36f9e54efb (diff) | |
download | bcfg2-e6b922973a2c38642584d6eb42ead7dced012d13.tar.gz bcfg2-e6b922973a2c38642584d6eb42ead7dced012d13.tar.bz2 bcfg2-e6b922973a2c38642584d6eb42ead7dced012d13.zip |
Updated templates so that output is properly sorted
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2005 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'reports/brpt')
-rw-r--r-- | reports/brpt/reports/templates/clients/client-nodebox.html | 7 | ||||
-rw-r--r-- | reports/brpt/reports/templates/displays/summary-block.html | 14 | ||||
-rw-r--r-- | reports/brpt/reports/templatetags/django_templating_sigh.py | 10 | ||||
-rw-r--r-- | reports/brpt/reports/views.py | 2 | ||||
-rw-r--r-- | reports/brpt/settings.py | 14 |
5 files changed, 31 insertions, 16 deletions
diff --git a/reports/brpt/reports/templates/clients/client-nodebox.html b/reports/brpt/reports/templates/clients/client-nodebox.html index 1072ba324..e92a5a874 100644 --- a/reports/brpt/reports/templates/clients/client-nodebox.html +++ b/reports/brpt/reports/templates/clients/client-nodebox.html @@ -1,3 +1,4 @@ +{% load django_templating_sigh %} {% if client %} <a name="{{client.name}}"></a> <div class="nodebox" name="{{client.name}}"> @@ -30,7 +31,7 @@ <div class="bad"> <span class="nodelisttitle"><a href="javascript:toggleLayer('{{client.name}}-bad');" title="Click to expand" class="commentLink">{{interaction.bad_items.count}}</a> items did not verify and are considered Dirty.<br /></span> <div class="items" id="{{client.name}}-bad"><ul class="plain"> - {% for bad in interaction.bad_items.all %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} + {% for bad in interaction.bad_items.all|sortwell %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} <li><strong>{{bad.kind}}: </strong><tt><a href="/elements/bad/{{bad.id}}">{{bad.name}}</a></tt></li> {% endfor %} </ul></div> @@ -40,7 +41,7 @@ <div class="modified"> <span class="nodelisttitle"><a href="javascript:toggleLayer('{{client.name}}-modified');" title="Click to expand" class="commentLink">{{interaction.modified_items.count}}</a> items were modified in the last run.<br /></span> <div class="items" id="{{client.name}}-modified"><ul class="plain"> - {% for modified in interaction.modified_items.all %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} + {% for modified in interaction.modified_items.all|sortwell %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} <li><strong>{{modified.kind}}: </strong><tt><a href="/elements/modified/{{modified.id}}">{{modified.name}}</a></tt></li> {% endfor %} </ul></div> @@ -50,7 +51,7 @@ <div class="extra"> <span class="nodelisttitle"><a href="javascript:toggleLayer('{{client.name}}-extra');" title="Click to expand" class="commentLink">{{interaction.extra_items.count}}</a> extra configuration elements on the node.<br /></span> <div class="items" id="{{client.name}}-extra"><ul class="plain"> - {% for extra in interaction.extra_items.all %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} + {% for extra in interaction.extra_items.all|sortwell %} {% comment %}HOWDOI? order_by('kind', 'name'){% endcomment %} <li><strong>{{extra.kind}}: </strong><tt>{{extra.name}}</tt></li> {% endfor %} </ul></div> diff --git a/reports/brpt/reports/templates/displays/summary-block.html b/reports/brpt/reports/templates/displays/summary-block.html index 3632cc870..a42176183 100644 --- a/reports/brpt/reports/templates/displays/summary-block.html +++ b/reports/brpt/reports/templates/displays/summary-block.html @@ -7,7 +7,7 @@ <div class="clean"> <span class="nodelisttitle"><a href="javascript:toggleLayer('goodsummary');" title="Click to Expand" class="commentLink">{{clean_client_list|length}}</a> nodes are clean.<br /></span> <div class="items" id="goodsummary"><ul class="plain"> - {% for client in clean_client_list %} + {% for client in clean_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix1 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -19,7 +19,7 @@ <div class="bad"> <span class="nodelisttitle"><a href="javascript:toggleLayer('badsummary');" title="Click to Expand" class="commentLink">{{bad_client_list|length}}</a> nodes are bad.<br /></span> <div class="items" id="badsummary"><ul class="plain"> - {% for client in bad_client_list %} + {% for client in bad_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix2 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -31,7 +31,7 @@ <div class="modified"> <span class="nodelisttitle"><a href="javascript:toggleLayer('modifiedsummary');" title="Click to Expand" class="commentLink">{{modified_client_list|length}}</a> nodes were modified in the previous run.<br /></span> <div class="items" id="modifiedsummary"><ul class="plain"> - {% for client in modified_client_list %} + {% for client in modified_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix3 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -43,7 +43,7 @@ <div class="extra"> <span class="nodelisttitle"><a href="javascript:toggleLayer('extrasummary');" title="Click to Expand" class="commentLink">{{extra_client_list|length}}</a> nodes have extra configuration. (includes both good and bad nodes)<br /></span> <div class="items" id="extrasummary"><ul class="plain"> - {% for client in extra_client_list %} + {% for client in extra_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix4 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -55,7 +55,7 @@ <div class="warning"> <span class="nodelisttitle"><a href="javascript:toggleLayer('vstalesummary');" title="Click to Expand" class="commentLink">{{stale_up_client_list|length}}</a> nodes did not run within the last 24 hours but were pingable.<br /></span> <div class="items" id="vstalesummary"><ul class="plain"> - {% for client in stale_up_client_list %} + {% for client in stale_up_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix5 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -67,7 +67,7 @@ <div class="all-warning"> <span class="nodelisttitle"><a href="javascript:toggleLayer('stalesummary');" title="Click to Expand" class="commentLink">{{stale_all_client_list|length}}</a> nodes did not run within the last 24 hours. (includes nodes up and down)<br /></span> <div class="items" id="stalesummary"><ul class="plain"> - {% for client in stale_all_client_list %} + {% for client in stale_all_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="{% block linkprefix6 %}#{% endblock %}{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> @@ -79,7 +79,7 @@ <div class="down"> <span class="nodelisttitle"><a href="javascript:toggleLayer('unpingablesummary');" title="Click to Expand" class="commentLink">{{down_client_list|length}}</a> nodes were down.<br /></span> <div class="items" id="unpingablesummary"><ul class="plain"> - {% for client in down_client_list %} + {% for client in down_client_list|sortname %} {% set_interaction "foo" %} <li><b>Node: </b></tt> <tt><a href="#{{client.name}}">{{client.name}}</a></tt><span class="mini-date">{{interaction.timestamp}}</span></li> diff --git a/reports/brpt/reports/templatetags/django_templating_sigh.py b/reports/brpt/reports/templatetags/django_templating_sigh.py index 35378f444..59fcce204 100644 --- a/reports/brpt/reports/templatetags/django_templating_sigh.py +++ b/reports/brpt/reports/templatetags/django_templating_sigh.py @@ -13,10 +13,16 @@ def set_interaction(parser, token): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name return SetInteraction(format_string[1:-1]) +def sortwell(value): + "sorts a list(or evaluates queryset to list) of bad, extra, or modified items in the best way for presentation" + return sorted(sorted(list(value),lambda x,y: cmp(x.name, y.name)), lambda x,y: cmp(x.kind, y.kind)) +def sortname(value): + "sorts a list( or evaluates queryset) by name" + return sorted(list(value),lambda x,y: cmp(x.name, y.name)) class SetInteraction(template.Node): def __init__(self, times): - self.times = times#do soemthing to select different interaction with host + self.times = times#do soemthing to select different interaction with host? def render(self, context): try: context['interaction'] = context['client_interaction_dict'][context['client'].id] @@ -25,3 +31,5 @@ class SetInteraction(template.Node): return '' register.tag('set_interaction', set_interaction) +register.filter('sortwell', sortwell) +register.filter('sortname', sortname) diff --git a/reports/brpt/reports/views.py b/reports/brpt/reports/views.py index a9dde75fc..f2b9f9108 100644 --- a/reports/brpt/reports/views.py +++ b/reports/brpt/reports/views.py @@ -124,7 +124,7 @@ def display_sys_view(request, timestamp = 'now'): def display_summary(request, timestamp = 'now'): client_lists = prepare_client_lists(request, timestamp) - #this returns timestamp and the timestamp parts + #this returns timestamp and the timestamp parts too #for q in connection.queries: # print q diff --git a/reports/brpt/settings.py b/reports/brpt/settings.py index 63a7132ab..ea8dd5783 100644 --- a/reports/brpt/settings.py +++ b/reports/brpt/settings.py @@ -13,10 +13,16 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. -DATABASE_NAME = sqlitedbpath # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. +#DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. +#DATABASE_NAME = sqlitedbpath # Or path to database file if using sqlite3. +#DATABASE_USER = '' # Not used with sqlite3. +#DATABASE_PASSWORD = '' # Not used with sqlite3. +#DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +#DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +DATABASE_ENGINE = 'mysql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. +DATABASE_NAME = 'brpt' # Or path to database file if using sqlite3. +DATABASE_USER = 'brptadmin' # Not used with sqlite3. +DATABASE_PASSWORD = 'sekret' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. |