Blame view

src/dashboard/views.py 1.96 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
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
10
11
12
13
def index(request):
    return render(request, 'dashboard/index.html')

@login_required
62229d51   haribo   began dashboard (...
14
def users(request):
81847ba2   haribo   Dashboard buttons...
15
16
    url_ = urlresolvers.reverse('admin:auth_user_changelist')
    return redirect(url_)
62229d51   haribo   began dashboard (...
17

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

77816f10   haribo   Workflow implemen...
23

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

77816f10   haribo   Workflow implemen...
29

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

77816f10   haribo   Workflow implemen...
35

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

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

94082e77   haribo   Date: 03/06/2016
45
@login_required
77816f10   haribo   Workflow implemen...
46
def system_retrieve_logs(request):
94082e77   haribo   Date: 03/06/2016
47
    '''
e39312f1   Jeremy   Fix bug on schedu...
48
        Called by the dashboard system page with ajax request every seconds, to get the logs and print them
94082e77   haribo   Date: 03/06/2016
49
    '''
77816f10   haribo   Workflow implemen...
50
    if request.is_ajax():
77816f10   haribo   Workflow implemen...
51
52
53
54
55
        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...
56
        monitoring_logs = Log.objects.filter(agent='Monitoring')
77816f10   haribo   Workflow implemen...
57
        return render(request, 'dashboard/system_logs.html', locals())
77816f10   haribo   Workflow implemen...
58
59


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

77816f10   haribo   Workflow implemen...
65

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