diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-06-25 19:34:56 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-06-25 19:34:56 +0000 |
commit | 5dc9881ac52e2a6cb9c326931a0e5c92f138c74f (patch) | |
tree | b7fd71e52005c1d179d2c97a739d3a67952da3f2 /src/lib/Server/Reports/reports/views.py | |
parent | fed36b44453477c31626e77005bb22e95110798d (diff) | |
download | bcfg2-5dc9881ac52e2a6cb9c326931a0e5c92f138c74f.tar.gz bcfg2-5dc9881ac52e2a6cb9c326931a0e5c92f138c74f.tar.bz2 bcfg2-5dc9881ac52e2a6cb9c326931a0e5c92f138c74f.zip |
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
Diffstat (limited to 'src/lib/Server/Reports/reports/views.py')
-rw-r--r-- | src/lib/Server/Reports/reports/views.py | 25 |
1 files changed, 25 insertions, 0 deletions
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) |