From e6b922973a2c38642584d6eb42ead7dced012d13 Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Wed, 26 Jul 2006 20:12:22 +0000 Subject: 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 --- reports/brpt.sqlite | Bin 669696 -> 0 bytes .../brpt/reports/templates/clients/client-nodebox.html | 7 ++++--- .../brpt/reports/templates/displays/summary-block.html | 14 +++++++------- .../reports/templatetags/django_templating_sigh.py | 10 +++++++++- reports/brpt/reports/views.py | 2 +- reports/brpt/settings.py | 14 ++++++++++---- 6 files changed, 31 insertions(+), 16 deletions(-) delete mode 100644 reports/brpt.sqlite diff --git a/reports/brpt.sqlite b/reports/brpt.sqlite deleted file mode 100644 index b2248d763..000000000 Binary files a/reports/brpt.sqlite and /dev/null differ 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 %}
@@ -30,7 +31,7 @@
{{interaction.bad_items.count}} items did not verify and are considered Dirty.
    - {% 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 %}
  • {{bad.kind}}: {{bad.name}}
  • {% endfor %}
@@ -40,7 +41,7 @@
{{interaction.modified_items.count}} items were modified in the last run.
    - {% 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 %}
  • {{modified.kind}}: {{modified.name}}
  • {% endfor %}
@@ -50,7 +51,7 @@
{{interaction.extra_items.count}} extra configuration elements on the node.
    - {% 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 %}
  • {{extra.kind}}: {{extra.name}}
  • {% endfor %}
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 @@
{{clean_client_list|length}} nodes are clean.
    - {% for client in clean_client_list %} + {% for client in clean_client_list|sortname %} {% set_interaction "foo" %}
  • Node: {{client.name}}{{interaction.timestamp}}
  • @@ -19,7 +19,7 @@
    {{bad_client_list|length}} nodes are bad.
      - {% for client in bad_client_list %} + {% for client in bad_client_list|sortname %} {% set_interaction "foo" %}
    • Node: {{client.name}}{{interaction.timestamp}}
    • @@ -31,7 +31,7 @@
      {{modified_client_list|length}} nodes were modified in the previous run.
        - {% for client in modified_client_list %} + {% for client in modified_client_list|sortname %} {% set_interaction "foo" %}
      • Node: {{client.name}}{{interaction.timestamp}}
      • @@ -43,7 +43,7 @@
        {{extra_client_list|length}} nodes have extra configuration. (includes both good and bad nodes)
          - {% for client in extra_client_list %} + {% for client in extra_client_list|sortname %} {% set_interaction "foo" %}
        • Node: {{client.name}}{{interaction.timestamp}}
        • @@ -55,7 +55,7 @@
          {{stale_up_client_list|length}} nodes did not run within the last 24 hours but were pingable.
            - {% for client in stale_up_client_list %} + {% for client in stale_up_client_list|sortname %} {% set_interaction "foo" %}
          • Node: {{client.name}}{{interaction.timestamp}}
          • @@ -67,7 +67,7 @@
            {{stale_all_client_list|length}} nodes did not run within the last 24 hours. (includes nodes up and down)
              - {% for client in stale_all_client_list %} + {% for client in stale_all_client_list|sortname %} {% set_interaction "foo" %}
            • Node: {{client.name}}{{interaction.timestamp}}
            • @@ -79,7 +79,7 @@
              {{down_client_list|length}} nodes were down.
                - {% for client in down_client_list %} + {% for client in down_client_list|sortname %} {% set_interaction "foo" %}
              • Node: {{client.name}}{{interaction.timestamp}}
              • 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. -- cgit v1.2.3-1-g7c22