summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Reports/reports/templates/base.html10
-rw-r--r--src/lib/Server/Reports/reports/templates/config_items/listing.html51
-rw-r--r--src/lib/Server/Reports/reports/views.py71
-rw-r--r--src/lib/Server/Reports/urls.py8
4 files changed, 137 insertions, 3 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 = {}
diff --git a/src/lib/Server/Reports/urls.py b/src/lib/Server/Reports/urls.py
index 0b0593fb9..6d5fe8833 100644
--- a/src/lib/Server/Reports/urls.py
+++ b/src/lib/Server/Reports/urls.py
@@ -19,9 +19,15 @@ urlpatterns = patterns('',
(r'^elements/modified/(?P<eyedee>\d+)/(?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))/$','Bcfg2.Server.Reports.reports.views.config_item_modified'),
(r'^elements/modified/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_modified'),
+ (r'^elements/modified/(?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))/$','Bcfg2.Server.Reports.reports.views.modified_item_index'),
+ (r'^elements/modified/$','Bcfg2.Server.Reports.reports.views.modified_item_index'),
(r'^elements/bad/(?P<eyedee>\d+)/(?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))/$','Bcfg2.Server.Reports.reports.views.config_item_bad'),
(r'^elements/bad/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_bad'),
- )
+ (r'^elements/bad/(?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))/$','Bcfg2.Server.Reports.reports.views.bad_item_index'),
+ (r'^elements/bad/$','Bcfg2.Server.Reports.reports.views.bad_item_index'),
+)
# Uncomment this for admin:
#(r'^admin/', include('django.contrib.admin.urls')),