Commit b455de0d authored by grisel-davy's avatar grisel-davy Committed by chirac

bouton de regen des services

parent f983a8c2
......@@ -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 %}
......
......@@ -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]+)$',
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment