diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-01-12 21:49:23 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-01-12 21:49:23 +0000 |
commit | b2cd8e6bfc069f0665806e0d42163fa810778747 (patch) | |
tree | e5d2ff0e497d2c33043e4cbbccfed8aea692fc4e /src/lib/Server/Reports/reports | |
parent | 729d83a9a67795cf285ca8f0177007e1b21e35bc (diff) | |
download | bcfg2-b2cd8e6bfc069f0665806e0d42163fa810778747.tar.gz bcfg2-b2cd8e6bfc069f0665806e0d42163fa810778747.tar.bz2 bcfg2-b2cd8e6bfc069f0665806e0d42163fa810778747.zip |
Reporting system update to include browsing by config-item rather than host-only. This enables users of the system to track down where problems are occuring across the system by looking in a package and system oriented way, rather than a host centric view only.
*It is expected to be useful to verify that critical security updates are applied.*
Additionally this update includes a bunch of files (yet not complete) from the Yahoo User Interface Library. It is sparsely incorporated as the files are used. This library is BSD licensed and provides great capability for the web reports. It also will help when incorporating ajax technology in to the reports for performance improvements.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2660 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Reports/reports')
-rw-r--r-- | src/lib/Server/Reports/reports/templates/base.html | 10 | ||||
-rw-r--r-- | src/lib/Server/Reports/reports/templates/config_items/listing.html | 51 | ||||
-rw-r--r-- | src/lib/Server/Reports/reports/views.py | 71 |
3 files changed, 130 insertions, 2 deletions
diff --git a/src/lib/Server/Reports/reports/templates/base.html b/src/lib/Server/Reports/reports/templates/base.html index 1bee97206..b968e4e84 100644 --- a/src/lib/Server/Reports/reports/templates/base.html +++ b/src/lib/Server/Reports/reports/templates/base.html @@ -5,8 +5,7 @@ <title>{% block title %}Bcfg2 Reporting System{% endblock %}</title> <link rel="stylesheet" type="text/css" href="/site_media/boxypastel.css" /> <link rel="stylesheet" type="text/css" href="/site_media/base.css" /> - <script type="text/javascript" src="/site_media/main.js"> - </script> + <script type="text/javascript" src="/site_media/main.js"></script> {% block extra_header_info %}{% endblock %} </head> @@ -30,6 +29,13 @@ <li><a href="/displays/timing/" class="sidebar">Timing</a></li> </ul> </li> + <li> + <span class="sidebar">Config Items</span> + <ul class="sidebar-level2"> + <li><a href="/elements/bad/" class="sidebar">Bad</a></li> + <li><a href="/elements/modified/" class="sidebar">Modified</a></li> + </ul> + </li> </ul> {% endblock %} </div> diff --git a/src/lib/Server/Reports/reports/templates/config_items/listing.html b/src/lib/Server/Reports/reports/templates/config_items/listing.html new file mode 100644 index 000000000..8c4500258 --- /dev/null +++ b/src/lib/Server/Reports/reports/templates/config_items/listing.html @@ -0,0 +1,51 @@ +{% extends "base.html" %} +{% load django_templating_sigh %} + +{% block extra_header_info %} +<link rel="stylesheet" type="text/css" href="/site_media/yui/tabview/assets/tabview.css"> +<link rel="stylesheet" type="text/css" href="/site_media/yui/round_tabs.css"> + +<script type="text/javascript" src="/site_media/yui/yahoo/yahoo.js"></script> +<script type="text/javascript" src="/site_media/yui/event/event.js"></script> +<script type="text/javascript" src="/site_media/yui/dom/dom.js"></script> +<script type="text/javascript" src="/site_media/yui/tabview/tabview.js"></script> +<script type="text/javascript"> +YAHOO.example.init = function( ){ + var tabView = new YAHOO.widget.TabView( { id: 'demo' } ); + {% for item_list in item_list_pseudodict %} + tabView.addTab( new YAHOO.widget.Tab({ + label: '{{item_list.0}}', + content: '<p><ul style="list-style-type:none;">{% for item in item_list.1|sortwell %}<li><strong>{{item.kind}}: </strong><tt><a href="/elements/{{mod_or_bad}}/{{item.id}}">{{item.name}}</a></tt></li>{% endfor %}</ul></p>', + active: 'True' + })); + {% endfor %} + + YAHOO.util.Event.onContentReady('tabview', function() { + tabView.appendTo(this); /* append to #doc */ + }); + +}; +YAHOO.example.init(); + +</script> +<style type="text/css"> +#demo .yui-content { padding:1em; } /* pad content container */ +</style> +{% endblock %} + +{% block title %}{{mod_or_bad|capfirst}} Item Listing{% endblock %} + +{% block pagebanner %} + <div class="header"> + <h1>{{mod_or_bad|capfirst}} Configuration Elements</h1> + </div> + <br/> +{% endblock %} + +{% block content %} +{% if item_list_pseudodict %} +<div id="tabview"></div> +{% else %} + <p>There are currently no inconsistent configuration entries.</p> +{% endif %} +{% endblock %}
\ No newline at end of file diff --git a/src/lib/Server/Reports/reports/views.py b/src/lib/Server/Reports/reports/views.py index 7f62aab94..5ddfa6533 100644 --- a/src/lib/Server/Reports/reports/views.py +++ b/src/lib/Server/Reports/reports/views.py @@ -9,6 +9,7 @@ from time import strptime from django.db import connection from django.db.backends import util from django.contrib.auth.decorators import login_required +from sets import Set def index(request): return render_to_response('index.html') @@ -85,6 +86,74 @@ def config_item_bad(request, eyedee = None, timestamp = 'now'): 'timestamp_date' : timestamp[:10], 'timestamp_time' : timestamp[11:19]}) +def bad_item_index(request, timestamp = 'now'): + timestamp = timestamp.replace("@"," ") + mod_or_bad = "bad" + cursor = connection.cursor() + + if timestamp == 'now': + bad_kinds = dict([(x,x.kind) for x in Bad.objects.filter(interactions__in= + [c.current_interaction + for c in Client.objects.all()]).distinct()]) + #this will need expiration support + kinds = list(Set(bad_kinds.values())) + item_list_dict = dict([(x,[]) for x in kinds]) + for obj in bad_kinds: + item_list_dict[obj.kind].append(obj) + + else: #this isn't done yet + bad_kinds = dict([(x,x.kind) for x in Bad.objects.filter(interactions__in= + [c.current_interaction + for c in Client.objects.all()]).distinct()]) + #this will need expiration support + kinds = list(Set(bad_kinds.values())) + item_list_dict = dict([(x,[]) for x in kinds]) + for obj in bad_kinds: + item_list_dict[obj.kind].append(obj) + + item_list_pseudodict = item_list_dict.items() + if timestamp == 'now': + timestamp = datetime.now().isoformat('@') + + return render_to_response('config_items/listing.html', {'item_list_pseudodict':item_list_pseudodict, + 'mod_or_bad':mod_or_bad, + 'timestamp' : timestamp, + 'timestamp_date' : timestamp[:10], + 'timestamp_time' : timestamp[11:19]}) +def modified_item_index(request, timestamp = 'now'): + timestamp = timestamp.replace("@"," ") + mod_or_bad = "modified" + cursor = connection.cursor() + + if timestamp == 'now': + mod_kinds = dict([(x,x.kind) for x in Modified.objects.filter(interactions__in= + [c.current_interaction + for c in Client.objects.all()]).distinct()]) + #this will need expiration support + kinds = list(Set(mod_kinds.values())) + item_list_dict = dict([(x,[]) for x in kinds]) + for obj in mod_kinds: + item_list_dict[obj.kind].append(obj) + + else: #this isn't done yet + mod_kinds = dict([(x,x.kind) for x in Modified.objects.filter(interactions__in= + [c.current_interaction + for c in Client.objects.all()]).distinct()]) + #this will need expiration support + kinds = list(Set(mod_kinds.values())) + item_list_dict = dict([(x,[]) for x in kinds]) + for obj in mod_kinds: + item_list_dict[obj.kind].append(obj) + + item_list_pseudodict = item_list_dict.items() + if timestamp == 'now': + timestamp = datetime.now().isoformat('@') + + return render_to_response('config_items/listing.html', {'item_list_pseudodict':item_list_pseudodict, + 'mod_or_bad':mod_or_bad, + 'timestamp' : timestamp, + 'timestamp_date' : timestamp[:10], + 'timestamp_time' : timestamp[11:19]}) def client_index(request): @@ -175,6 +244,8 @@ def display_index(request): return render_to_response('displays/index.html') def prepare_client_lists(request, timestamp = 'now'): + #I suggest we implement "expiration" here. + timestamp = timestamp.replace("@"," ") #client_list = Client.objects.all().order_by('name')#change this to order by interaction's state client_interaction_dict = {} |