diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-07-19 04:52:06 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-07-19 04:52:06 +0000 |
commit | d3ffa20a399233283fba2d02147a761fdee0212d (patch) | |
tree | 89080586b876f8ae6ac132ead46b6fe5a6217716 /reports/brpt | |
parent | c95a959007e440c1a580e79993e9c75f20fff03a (diff) | |
download | bcfg2-d3ffa20a399233283fba2d02147a761fdee0212d.tar.gz bcfg2-d3ffa20a399233283fba2d02147a761fdee0212d.tar.bz2 bcfg2-d3ffa20a399233283fba2d02147a761fdee0212d.zip |
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
Diffstat (limited to 'reports/brpt')
-rw-r--r-- | reports/brpt/reports/models.py | 4 | ||||
-rw-r--r-- | reports/brpt/reports/templates/base.html | 1 | ||||
-rw-r--r-- | reports/brpt/reports/templates/clients/client-nodebox.html | 4 | ||||
-rw-r--r-- | reports/brpt/reports/templates/clients/index.html | 21 | ||||
-rw-r--r-- | reports/brpt/reports/templates/displays/sys_view.html | 4 | ||||
-rw-r--r-- | reports/brpt/reports/views.py | 51 | ||||
-rw-r--r-- | reports/brpt/settings.py | 14 | ||||
-rw-r--r-- | reports/brpt/urls.py | 7 |
8 files changed, 82 insertions, 24 deletions
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 %} - <br /><br /><p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p> </div> </div> </body> 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 @@ <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 %} - <li><strong>{{bad.kind}}: </strong><tt>{{bad.name}}</tt></li> + <li><strong>{{bad.kind}}: </strong><tt><a href="/elements/bad/{{bad.id}}">{{bad.name}}</a></tt></li> {% endfor %} </ul></div> </div> @@ -41,7 +41,7 @@ <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 %} - <li><strong>{{modified.kind}}: </strong><tt>{{modified.name}}</tt></li> + <li><strong>{{modified.kind}}: </strong><tt><a href="/elements/modified/{{modified.id}}">{{modified.name}}</a></tt></li> {% endfor %} </ul></div> </div> 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 %} + <div class="header"> + <h1>Clients List</h1> + </div> + <br/> +{% endblock %} + {% block content %} -{% if client_list %} +{% if client_list_a %} +<table><tr><td> <ul> - {% for client in client_list %} + {% for client in client_list_a %} <li><a href="{{client.name}}/">{{ client.name }}</a></li> {% endfor %} </ul> +</td><td> + <ul> + {% if client_list_b %} + {% for client in client_list_b %} + <li><a href="{{client.name}}/">{{ client.name }}</a></li> + {% endfor %} + {% endif %} + </ul> +</tr></tab.e> {% else %} <p>No client records are available.</p> {% 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 %} <div class="header"> - <h1>BCFG Performance Timings</h1> + <h1>Grand System View</h1> <span class="notebox">Report Run @ {% now "F j, Y P"%}</span> </div> <br/> {% endblock %} {% block content %} +<center><h2>This view is deprecated and will be removed soon.</h2><br/>Please use the "Summary" view and drill down instead.</center> + {% 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<hostname>\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<timestamp>(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<timestamp>(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<timestamp>(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<eyedee>\d+)/$','brpt.reports.views.config_item_modified'), + (r'^elements/bad/(?P<eyedee>\d+)/$','brpt.reports.views.config_item_bad'), # Uncomment this for admin: #(r'^admin/', include('django.contrib.admin.urls')), |