From 5dc9881ac52e2a6cb9c326931a0e5c92f138c74f Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Mon, 25 Jun 2007 19:34:56 +0000 Subject: Added UI to disable old hosts, hopefully made it possible to install app in non-root of webserver git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3365 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Reports/reports/templates/base.html | 22 +++++++++--------- .../reports/templates/clients/client-nodebox.html | 6 ++--- .../Reports/reports/templates/clients/detail.html | 5 +++- .../Reports/reports/templates/clients/index.html | 6 ++--- .../Reports/reports/templates/clients/manage.html | 27 ++++++++++++++++++++++ .../reports/templates/config_items/index.html | 16 +++++++++---- .../reports/templates/config_items/listing.html | 14 +++++------ .../Reports/reports/templates/displays/index.html | 6 ++--- .../displays/summary-block-direct-links.html | 12 +++++----- .../reports/templates/displays/summary.html | 6 ++--- .../Reports/reports/templates/displays/timing.html | 10 ++++---- src/lib/Server/Reports/reports/views.py | 25 ++++++++++++++++++++ src/lib/Server/Reports/urls.py | 2 ++ 13 files changed, 110 insertions(+), 47 deletions(-) create mode 100644 src/lib/Server/Reports/reports/templates/clients/manage.html (limited to 'src/lib/Server/Reports') diff --git a/src/lib/Server/Reports/reports/templates/base.html b/src/lib/Server/Reports/reports/templates/base.html index b968e4e84..d733e5563 100644 --- a/src/lib/Server/Reports/reports/templates/base.html +++ b/src/lib/Server/Reports/reports/templates/base.html @@ -3,9 +3,9 @@ {% block title %}Bcfg2 Reporting System{% endblock %} - - - + + + {% block extra_header_info %}{% endblock %} @@ -19,21 +19,21 @@ {% include "displays/summary-block-direct-links.html" %} diff --git a/src/lib/Server/Reports/reports/templates/displays/timing.html b/src/lib/Server/Reports/reports/templates/displays/timing.html index e9020b8ef..8586de2cf 100644 --- a/src/lib/Server/Reports/reports/templates/displays/timing.html +++ b/src/lib/Server/Reports/reports/templates/displays/timing.html @@ -1,8 +1,8 @@ {% extends "base.html" %} {% block extra_header_info %} - - + + {% endblock%} {% block title %}Display Index Listing{% endblock %} @@ -21,8 +21,8 @@ Calendar - - | + + |


@@ -38,7 +38,7 @@ {% for dict_unit in stats_list %} - {{dict_unit.name}} + {{dict_unit.name}} {{dict_unit.parse}} {{dict_unit.probe}} {{dict_unit.inventory}} diff --git a/src/lib/Server/Reports/reports/views.py b/src/lib/Server/Reports/reports/views.py index 5ddfa6533..1d7fabe52 100644 --- a/src/lib/Server/Reports/reports/views.py +++ b/src/lib/Server/Reports/reports/views.py @@ -172,6 +172,31 @@ def client_detail(request, hostname = None, pk = None): interaction = client.interactions.get(pk=pk)#can this be a get object or 404? return render_to_response('clients/detail.html', {'client': client, 'interaction': interaction}) +def client_manage(request, hostname = None): + #SETUP error pages for when you specify a client or interaction that doesn't exist + client = get_object_or_404(Client, name=hostname) + currenttime = datetime.now().isoformat('@') + if client.expiration != None: + message = "This client currently has an expiration date of %s. Reports after %s will not include data for this host. You may change this if you wish by selecting a new time, earlier or later."%(client.expiration,client.expiration) + else: + message = "This client is currently active and displayed. You may choose a date after which this client will no longer appear in reports." + if request.method == 'POST': + date = request.POST['date1'] + time = request.POST['time'] + try: + timestamp = datetime(*(strptime(date+"@"+time, "%Y-%m-%d@%H:%M:%S")[0:6])) + except ValueError: + timestamp = None + if timestamp==None: + message = "Invalid removal date, please try again using the format: yyyy-mm-dd hh:mm:ss." + else: + client.expiration = timestamp + client.save() + message = "Expiration for client set to %s."%client.expiration + return render_to_response('clients/manage.html', {'client': client, 'message': message, + 'timestamp_date' : currenttime[:10], + 'timestamp_time' : currenttime[11:19]}) + def display_sys_view(request, timestamp = 'now'): client_lists = prepare_client_lists(request, timestamp) return render_to_response('displays/sys_view.html', client_lists) diff --git a/src/lib/Server/Reports/urls.py b/src/lib/Server/Reports/urls.py index 6d5fe8833..9f602cb4d 100644 --- a/src/lib/Server/Reports/urls.py +++ b/src/lib/Server/Reports/urls.py @@ -4,7 +4,9 @@ urlpatterns = patterns('', # Example: # (r'^Bcfg2.Server.Reports/', include('Bcfg2.Server.Reports.apps.foo.urls.foo')), (r'^/*$','Bcfg2.Server.Reports.reports.views.index'), + (r'^clients/(?P\S+)/(?P\d+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), + (r'^clients/(?P\S+)/manage/$', 'Bcfg2.Server.Reports.reports.views.client_manage'), (r'^clients/(?P\S+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), (r'^clients/(?P\S+)$', 'Bcfg2.Server.Reports.reports.views.client_detail'), #hack because hostnames have periods and we still want to append slash -- cgit v1.2.3-1-g7c22