8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 20:03:11 +00:00

Merge branch 'regen_services_on_demand' into 'dev'

bouton de regen des services

See merge request federez/re2o!246
This commit is contained in:
chirac 2018-08-12 19:19:26 +02:00
commit cddb442b8e
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 minimum avant nouvelle régénération</th>
<th>Temps avant nouvelle génération obligatoire (max)</th> <th>Temps avant nouvelle génération obligatoire (max)</th>
<th>Serveurs inclus</th> <th>Serveurs inclus</th>
<th></th> <th>Demander la regeneration</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -41,7 +41,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ service.service_type }}</td> <td>{{ service.service_type }}</td>
<td>{{ service.min_time_regen }}</td> <td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_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"> <td class="text-right">
{% can_edit service %} {% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %} {% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}

View file

@ -124,6 +124,7 @@ urlpatterns = [
views.edit_service, views.edit_service,
name='edit-service'), name='edit-service'),
url(r'^del_service/$', views.del_service, name='del-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'^index_service/$', views.index_service, name='index-service'),
url(r'^add_role/$', views.add_role, name='add-role'), url(r'^add_role/$', views.add_role, name='add-role'),
url(r'^edit_role/(?P<roleid>[0-9]+)$', 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 __future__ import unicode_literals
from django.urls import reverse from django.urls import reverse
from django.http import HttpResponse from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
@ -128,6 +128,7 @@ from .models import (
Role, Role,
Service, Service,
Service_link, Service_link,
regen,
Vlan, Vlan,
Nas, Nas,
Txt, Txt,
@ -1261,6 +1262,15 @@ def del_service(request, instances):
request 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 @login_required
@can_create(Vlan) @can_create(Vlan)