8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-18 16:48:55 +00:00

bouton de regen des services

This commit is contained in:
grisel-davy 2018-08-09 11:39:44 +02:00 committed by chirac
parent f983a8c22a
commit b455de0de2
3 changed files with 15 additions and 3 deletions

View file

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Temps minimum avant nouvelle régénération</th>
<th>Temps avant nouvelle génération obligatoire (max)</th>
<th>Serveurs inclus</th>
<th></th>
<th>Demander la regeneration</th>
<th></th>
</tr>
</thead>
@ -41,7 +41,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ service.service_type }}</td>
<td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fas fa-sync"></i></a></td>
<td class="text-right">
{% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}

View file

@ -124,6 +124,7 @@ urlpatterns = [
views.edit_service,
name='edit-service'),
url(r'^del_service/$', views.del_service, name='del-service'),
url(r'^regen_service/(?P<serviceid>[0-9]+)$', views.regen_service, name='regen-service'),
url(r'^index_service/$', views.index_service, name='index-service'),
url(r'^add_role/$', views.add_role, name='add-role'),
url(r'^edit_role/(?P<roleid>[0-9]+)$',

View file

@ -33,7 +33,7 @@ The views for the Machines app
from __future__ import unicode_literals
from django.urls import reverse
from django.http import HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
@ -128,6 +128,7 @@ from .models import (
Role,
Service,
Service_link,
regen,
Vlan,
Nas,
Txt,
@ -1261,6 +1262,15 @@ def del_service(request, instances):
request
)
@login_required
@can_edit(Service)
def regen_service(request,service, **_kwargs):
"""Ask for a regen of the service"""
regen(service)
return index_service(request)
@login_required
@can_create(Vlan)