1 6
from django.conf.urls import url
2 6
from django.views.generic.base import TemplateView
3 6
from django.contrib.staticfiles import views
4 6
from django.urls import re_path
5

6

7 6
from cyborgbackup.main.utils.tasks import catalog_is_running, celery_worker_is_running
8 6
from cyborgbackup.main.models import Job, Policy, Repository, Schedule, Client
9

10 6
app_name = 'ui'
11

12

13 6
class IndexView(TemplateView):
14

15 6
    template_name = 'ui/index.html'
16

17 6
    def get_context_data(self, **kwargs):
18 0
        context = super(IndexView, self).get_context_data(**kwargs)
19 0
        context['celery'] = celery_worker_is_running()
20 0
        context['catalog'] = catalog_is_running()
21 0
        context['jobs'] = len(Job.objects.filter())
22 0
        context['policies'] = len(Policy.objects.filter())
23 0
        context['clients'] = len(Client.objects.filter())
24 0
        context['schedules'] = len(Schedule.objects.filter())
25 0
        context['repositories'] = len(Repository.objects.filter())
26 0
        return context
27

28

29 6
index = IndexView.as_view()
30

31 6
urlpatterns = [
32
    url(r'^$', index, name='index'),
33
    re_path(r'^(?P<path>.*)$', views.serve),
34
]

Read our documentation on viewing source code .

Loading