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/views.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/lib/Server/Reports/reports/views.py') 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) -- cgit v1.2.3-1-g7c22