Blame view

src/dashboard/views.py 1.81 KB
81847ba2   haribo   Dashboard buttons...
1
2
from django.shortcuts import render, redirect
from django.core import urlresolvers
94082e77   haribo   Date: 03/06/2016
3
from django.contrib.auth.decorators import login_required
ddf59dd4   haribo   Remaniement :
4
from common.models import Log
77816f10   haribo   Workflow implemen...
5

6bba7ccd   Jeremy   Fix Django 1.10.2...
6
7
8
import logger.config as l
log = l.setupLogger("dashboard", "dashboard");

94082e77   haribo   Date: 03/06/2016
9
@login_required
62229d51   haribo   began dashboard (...
10
def users(request):
81847ba2   haribo   Dashboard buttons...
11
12
    url_ = urlresolvers.reverse('admin:auth_user_changelist')
    return redirect(url_)
62229d51   haribo   began dashboard (...
13

94082e77   haribo   Date: 03/06/2016
14
@login_required
62229d51   haribo   began dashboard (...
15
def routines(request):
ddf59dd4   haribo   Remaniement :
16
    url_ = urlresolvers.reverse('admin:common_request_changelist')
81847ba2   haribo   Dashboard buttons...
17
    return redirect(url_)
62229d51   haribo   began dashboard (...
18

77816f10   haribo   Workflow implemen...
19

94082e77   haribo   Date: 03/06/2016
20
@login_required
62229d51   haribo   began dashboard (...
21
def weather(request):
ddf59dd4   haribo   Remaniement :
22
    url_ = urlresolvers.reverse('admin:common_weatherwatch_changelist')
81847ba2   haribo   Dashboard buttons...
23
    return redirect(url_)
62229d51   haribo   began dashboard (...
24

77816f10   haribo   Workflow implemen...
25

94082e77   haribo   Date: 03/06/2016
26
@login_required
62229d51   haribo   began dashboard (...
27
def site(request):
ddf59dd4   haribo   Remaniement :
28
    url_ = urlresolvers.reverse('admin:common_sitewatch_changelist')
81847ba2   haribo   Dashboard buttons...
29
    return redirect(url_)
62229d51   haribo   began dashboard (...
30

77816f10   haribo   Workflow implemen...
31

94082e77   haribo   Date: 03/06/2016
32
@login_required
62229d51   haribo   began dashboard (...
33
def devices(request):
ddf59dd4   haribo   Remaniement :
34
    url_ = urlresolvers.reverse('admin:common_device_changelist')
81847ba2   haribo   Dashboard buttons...
35
    return redirect(url_)
62229d51   haribo   began dashboard (...
36

77816f10   haribo   Workflow implemen...
37

94082e77   haribo   Date: 03/06/2016
38
@login_required
62229d51   haribo   began dashboard (...
39
40
def system(request):
    return render(request, 'dashboard/system.html')
61e60444   Jeremy   Pushing on dev
41

94082e77   haribo   Date: 03/06/2016
42
@login_required
77816f10   haribo   Workflow implemen...
43
def system_retrieve_logs(request):
94082e77   haribo   Date: 03/06/2016
44
    '''
e39312f1   Jeremy   Fix bug on schedu...
45
        Called by the dashboard system page with ajax request every seconds, to get the logs and print them
94082e77   haribo   Date: 03/06/2016
46
    '''
77816f10   haribo   Workflow implemen...
47
    if request.is_ajax():
77816f10   haribo   Workflow implemen...
48
49
50
51
52
53
        alert_logs = Log.objects.filter(agent='Alert manager')
        scheduler_logs = Log.objects.filter(agent='Scheduler')
        majordome_logs = Log.objects.filter(agent='Majordome')
        obs_logs = Log.objects.filter(agent='Observation manager')
        analyzer_logs = Log.objects.filter(agent='Analyzer')
        return render(request, 'dashboard/system_logs.html', locals())
77816f10   haribo   Workflow implemen...
54
55


94082e77   haribo   Date: 03/06/2016
56
@login_required
62229d51   haribo   began dashboard (...
57
def schedule(request):
ddf59dd4   haribo   Remaniement :
58
    url_ = urlresolvers.reverse('admin:common_schedule_changelist')
81847ba2   haribo   Dashboard buttons...
59
    return redirect(url_)
62229d51   haribo   began dashboard (...
60

77816f10   haribo   Workflow implemen...
61

94082e77   haribo   Date: 03/06/2016
62
@login_required
62229d51   haribo   began dashboard (...
63
def quotas(request):
ddf59dd4   haribo   Remaniement :
64
    url_ = urlresolvers.reverse('admin:common_pyrosuser_changelist')
81847ba2   haribo   Dashboard buttons...
65
    return redirect(url_)