Blame view

src/dashboard/views.py 1.87 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

bca9a283   Jeremy   Reworked the sche...
6
import utils.Logger as l
6c2793c2   jeremy   Update
7
log = l.setupLogger("dashboard", "dashboard")
6bba7ccd   Jeremy   Fix Django 1.10.2...
8

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

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

94082e77   haribo   Date: 03/06/2016
41
@login_required
77816f10   haribo   Workflow implemen...
42
def system_retrieve_logs(request):
94082e77   haribo   Date: 03/06/2016
43
    '''
e39312f1   Jeremy   Fix bug on schedu...
44
        Called by the dashboard system page with ajax request every seconds, to get the logs and print them
94082e77   haribo   Date: 03/06/2016
45
    '''
77816f10   haribo   Workflow implemen...
46
    if request.is_ajax():
77816f10   haribo   Workflow implemen...
47
48
49
50
51
        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')
bca9a283   Jeremy   Reworked the sche...
52
        monitoring_logs = Log.objects.filter(agent='Monitoring')
77816f10   haribo   Workflow implemen...
53
        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_)