From d3ffa20a399233283fba2d02147a761fdee0212d Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Wed, 19 Jul 2006 04:52:06 +0000 Subject: New Reports: Lots of changes to faciliate Reasons info display. Clicking on Bad or Modified configuration item name now brings up a page that describes the problem. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1970 ce84e21b-d406-0410-9b95-82705330c041 --- reports/brpt-db | Bin 212992 -> 669696 bytes reports/brpt/reports/models.py | 4 +- reports/brpt/reports/templates/base.html | 1 - .../reports/templates/clients/client-nodebox.html | 4 +- reports/brpt/reports/templates/clients/index.html | 21 ++++++++- .../brpt/reports/templates/displays/sys_view.html | 4 +- reports/brpt/reports/views.py | 51 +++++++++++++++++---- reports/brpt/settings.py | 14 ++++-- reports/brpt/urls.py | 7 ++- 9 files changed, 82 insertions(+), 24 deletions(-) diff --git a/reports/brpt-db b/reports/brpt-db index 3173a251a..b2248d763 100644 Binary files a/reports/brpt-db and b/reports/brpt-db differ diff --git a/reports/brpt/reports/models.py b/reports/brpt/reports/models.py index 9868df84b..b6ac51005 100644 --- a/reports/brpt/reports/models.py +++ b/reports/brpt/reports/models.py @@ -76,13 +76,13 @@ class Interaction(models.Model): def percentgood(self): if not self.totalcount == 0: - return (self.goodcount/self.totalcount)*100 + return (self.goodcount/float(self.totalcount))*100 else: return 0 def percentbad(self): if not self.totalcount == 0: - return (self.totalcount-self.goodcount)/(self.totalcount) + return ((self.totalcount-self.goodcount)/(float(self.totalcount)))*100 else: return 0 diff --git a/reports/brpt/reports/templates/base.html b/reports/brpt/reports/templates/base.html index 5c2430c3a..1bee97206 100644 --- a/reports/brpt/reports/templates/base.html +++ b/reports/brpt/reports/templates/base.html @@ -39,7 +39,6 @@ {% block pagebanner %}{% endblock %} {% block content %}{% endblock %} -

Valid XHTML 1.0!

diff --git a/reports/brpt/reports/templates/clients/client-nodebox.html b/reports/brpt/reports/templates/clients/client-nodebox.html index e3ed25cee..1072ba324 100644 --- a/reports/brpt/reports/templates/clients/client-nodebox.html +++ b/reports/brpt/reports/templates/clients/client-nodebox.html @@ -31,7 +31,7 @@ {{interaction.bad_items.count}} items did not verify and are considered Dirty.
@@ -41,7 +41,7 @@ {{interaction.modified_items.count}} items were modified in the last run.
diff --git a/reports/brpt/reports/templates/clients/index.html b/reports/brpt/reports/templates/clients/index.html index a474667b3..7f2caac84 100644 --- a/reports/brpt/reports/templates/clients/index.html +++ b/reports/brpt/reports/templates/clients/index.html @@ -2,13 +2,30 @@ {% block title %}Client Index Listing{% endblock %} +{% block pagebanner %} +
+

Clients List

+
+
+{% endblock %} + {% block content %} -{% if client_list %} +{% if client_list_a %} + {% else %}

No client records are available.

{% endif %} diff --git a/reports/brpt/reports/templates/displays/sys_view.html b/reports/brpt/reports/templates/displays/sys_view.html index bf80f545d..1298059bf 100644 --- a/reports/brpt/reports/templates/displays/sys_view.html +++ b/reports/brpt/reports/templates/displays/sys_view.html @@ -4,12 +4,14 @@ {% block title %}System-View Display{% endblock %} {% block pagebanner %}
-

BCFG Performance Timings

+

Grand System View

Report Run @ {% now "F j, Y P"%}

{% endblock %} {% block content %} +

This view is deprecated and will be removed soon.


Please use the "Summary" view and drill down instead.
+ {% include "displays/summary-block.html" %} {% for client in client_list %} {% set_interaction "foo" %} diff --git a/reports/brpt/reports/views.py b/reports/brpt/reports/views.py index a8cf08276..e4be8f745 100644 --- a/reports/brpt/reports/views.py +++ b/reports/brpt/reports/views.py @@ -3,7 +3,7 @@ from django.template import Context, loader from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response, get_object_or_404 -from brpt.reports.models import Client, Interaction, Bad, Modified, Extra, Performance +from brpt.reports.models import Client, Interaction, Bad, Modified, Extra, Performance, Reason from datetime import datetime, timedelta from time import strptime from django.db import connection @@ -11,9 +11,42 @@ from django.db import connection def index(request): return render_to_response('index.html') +def config_item_modified(request, eyedee =None): + #if eyedee = None, dump with a 404 + mod_or_bad = "Modified" + + item = Modified.objects.get(id=eyedee) + + #if everything is blank except current_exists, do something special + + #cursor = connection.cursor() + #cursor.execute("select client_id from reports_interaction, reports_modified_interactions, reports_client "+ + # "WHERE reports_client.current_interaction_id = reports_modified_interactions.interaction_id "+ + # "AND reports_modified_interactions.interaction_id = reports_interaction.id"+ + # "AND reports_modified_interactions = %s", [eyedee]) + + #associated_client_list = Clients.objects.filter(id__in=[x[0] for x in cursor.fetchall()]) + + + return render_to_response('config_items/index.html',{'item':item, + 'mod_or_bad':mod_or_bad, + }) + #'associated_client_list':associated_client_list}) + +def config_item_bad(request, eyedee = None): + mod_or_bad = "Bad" + item = Bad.objects.get(id=eyedee) + return render_to_response('config_items/index.html',{'item':item, + 'mod_or_bad':mod_or_bad}) + + + def client_index(request): client_list = Client.objects.all().order_by('name') - return render_to_response('clients/index.html',{'client_list': client_list}) + client_list_a = client_list[:len(client_list)/2] + client_list_b = client_list[len(client_list)/2:] + return render_to_response('clients/index.html',{'client_list_a': client_list_a, + 'client_list_b': client_list_b}) def client_detail(request, hostname = None, pk = None): #SETUP error pages for when you specify a client or interaction that doesn't exist @@ -23,18 +56,16 @@ def client_detail(request, hostname = None, pk = None): else: interaction = client.interactions.get(pk=pk)#can this be a get object or 404? - for q in connection.queries: - print q - - + #for q in connection.queries: + # print q return render_to_response('clients/detail.html',{'client': client, 'interaction': interaction}) def display_sys_view(request, timestamp = 'now'): client_lists = prepare_client_lists(request, timestamp) - for q in connection.queries: - print q + #for q in connection.queries: + # print q return render_to_response('displays/sys_view.html', client_lists) @@ -43,8 +74,8 @@ def display_summary(request, timestamp = 'now'): client_lists = prepare_client_lists(request, timestamp) - for q in connection.queries: - print q + #for q in connection.queries: + # print q return render_to_response('displays/summary.html', client_lists) diff --git a/reports/brpt/settings.py b/reports/brpt/settings.py index bcdcdbd0b..cd93abccf 100644 --- a/reports/brpt/settings.py +++ b/reports/brpt/settings.py @@ -10,10 +10,16 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. -DATABASE_NAME = '/Users/joey/anl-mcs/dev/bcfg2/reports/brpt-db' # 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 = '/Users/joey/anl-mcs/dev/bcfg2/reports/brpt-db' # 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. diff --git a/reports/brpt/urls.py b/reports/brpt/urls.py index 9d015723b..44050a774 100644 --- a/reports/brpt/urls.py +++ b/reports/brpt/urls.py @@ -9,13 +9,16 @@ urlpatterns = patterns('', (r'^clients/(?P\S+)$', 'brpt.reports.views.client_detail'), #hack because hostnames have periods and we still want to append slash (r'^clients/$','brpt.reports.views.client_index'), - + (r'^displays/sys-view/(?P(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','brpt.reports.views.display_sys_view'), (r'^displays/sys-view/$','brpt.reports.views.display_sys_view'), + (r'^displays/summary/(?P(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','brpt.reports.views.display_summary'), (r'^displays/summary/$','brpt.reports.views.display_summary'), (r'^displays/timing/(?P(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','brpt.reports.views.display_timing'), - (r'^displays/timing/$','brpt.reports.views.display_timing'), + (r'^displays/timing/$','brpt.reports.views.display_timing'), (r'^displays/$','brpt.reports.views.display_index'), + (r'^elements/modified/(?P\d+)/$','brpt.reports.views.config_item_modified'), + (r'^elements/bad/(?P\d+)/$','brpt.reports.views.config_item_bad'), # Uncomment this for admin: #(r'^admin/', include('django.contrib.admin.urls')), -- cgit v1.2.3-1-g7c22
    - {% for client in client_list %} + {% for client in client_list_a %}
  • {{ client.name }}
  • {% endfor %}
+
+
    + {% if client_list_b %} + {% for client in client_list_b %} +
  • {{ client.name }}
  • + {% endfor %} + {% endif %} +
+