Commit 5a1d9029722ab313b1f8fc0e9a320f4cf13e69cd

Authored by haribo
1 parent e5189e4f
Exists in master and in 1 other branch dev

Date: 20/06/2016

By: Paul Carensac
Version: 0.7.6
Colors + buttons submit on request list, and fixed a redirection bug in
request building
Issues (closed): https://projects.irap.omp.eu/issues/3838
Major current version (0.7): https://projects.irap.omp.eu/versions/117
README.md
... ... @@ -62,9 +62,9 @@ CURRENT VERSION
62 62  
63 63 Date: 20/06/2016
64 64 By: Paul Carensac
65   -Version: 0.7.5
66   -Durations are now printed in seconds, and saved in JD
67   -Issues (closed): https://projects.irap.omp.eu/issues/3835
  65 +Version: 0.7.6
  66 +Colors + buttons submit on request list, and fixed a redirection bug in request building
  67 +Issues (closed): https://projects.irap.omp.eu/issues/3838
68 68 Major current version (0.7): https://projects.irap.omp.eu/versions/117
69 69  
70 70 ROADMAP: https://projects.irap.omp.eu/projects/pyros/roadmap
... ...
src/routine_manager/templates/routine_manager/edit_base.html
... ... @@ -34,7 +34,7 @@
34 34 <div class="row col-lg-4">
35 35 {% if req.submitted == False %}
36 36 {% if req.complete == True %}
37   - <a href="{% url "submit_request" req.id %}" class="btn btn-info" onclick="return confirm('The request will be validated, and the sequences scheduled')"
  37 + <a href="{% url "submit_request" req.id "action_request" %}" class="btn btn-info" onclick="return confirm('The request will be validated, and the sequences scheduled')"
38 38 title="The request will be validated, and the sequences scheduled">Submit request for scheduling</a>
39 39 {% else %}
40 40 <a class="btn btn-info" onclick="return confirm('The request must be complete to be submitted')"
... ...
src/routine_manager/templates/routine_manager/requests_list.html
... ... @@ -54,14 +54,14 @@
54 54 <th>Total sequences<i class="fa fa-sort"></i></th>
55 55 <th>Executed sequences<i class="fa fa-sort"></i></th>
56 56 <th>Cancelled sequences<i class="fa fa-sort"></i></th>
57   - <th>Actions</th>
  57 + <th style="text-align:center">Actions</th>
58 58 </tr>
59 59 </thead>
60 60  
61 61  
62 62 <tbody>
63 63 {% for row in requests %}
64   - <tr>
  64 + <tr class={% if row.req.submitted %}"success"{% else %} {% if row.req.complete %}"info"{% else %}"warning"{% endif %} {% endif %}>
65 65 <td><a href="{% url "action_request" row.req.id 'view' %}">{{ row.req.name }}</a></td>
66 66 <td>{{ row.req.created }}</td>
67 67 <td>{{ row.req.updated }}</td>
... ... @@ -75,6 +75,10 @@
75 75 <a href="{% url "action_request" row.req.id 'edit' %}" class="btn btn-primary">Edit</a>
76 76 {% endif %}
77 77 <a href="{% url "action_request" row.req.id 'view' %}" class="btn btn-primary">View</a>
  78 + {% if row.req.submitted == False and row.req.complete == True %}
  79 + <a href="{% url "submit_request" row.req.id "requests_list" %}" class="btn btn-success" onclick="return confirm('The request will be validated, and the sequences scheduled')"
  80 + title="The request will be validated, and the sequences scheduled">Submit</a>
  81 + {% endif %}
78 82 <a href="{% url "action_request" row.req.id 'delete' %}" class="btn btn-danger"
79 83 onclick="return confirm('Are you sure you want to delete this request ?')">Delete</a>
80 84 </center>
... ...
src/routine_manager/urls.py
... ... @@ -27,7 +27,7 @@ urlpatterns = [
27 27 url(r'^create_album/(?P<seq_id>\d+)$', views.create_album, name="create_album"),
28 28 url(r'^create_plan/(?P<alb_id>\d+)$', views.create_plan, name="create_plan"),
29 29  
30   - url(r'^submit_request/(?P<req_id>\d+)$', views.submit_request, name="submit_request"),
  30 + url(r'^submit_request/(?P<req_id>\d+)/(?P<redir>[a-z_]{1,20})$', views.submit_request, name="submit_request"),
31 31 url(r'^unsubmit_request/(?P<req_id>\d+)$', views.unsubmit_request, name="unsubmit_request"),
32 32  
33 33 url(r'^export_request/(?P<req_id>\d+)$', views.export_request, name="export_request"),
... ...
src/routine_manager/views.py
... ... @@ -25,7 +25,7 @@ def requests_list(request, status=0, message=&quot;&quot;):
25 25 elif status == "1":
26 26 success = True
27 27  
28   - # uncomment for alert filter
  28 + # TODO: uncomment for alert filter
29 29 # requests_objs = Request.objects.filter(pyros_user=request.user.pyros_user).filter(is_alert=False).order_by("-updated")
30 30 requests_objs = Request.objects.filter(pyros_user=request.user.pyros_user).order_by("-updated")
31 31  
... ... @@ -250,6 +250,7 @@ def album_validate(request, alb_id):
250 250 req = alb.sequence.request
251 251 req_id = req.id
252 252 seq_id = alb.sequence.id
  253 + action = "edit"
253 254 return render(request, "routine_manager/view_album.html", locals())
254 255  
255 256 @login_required
... ... @@ -365,7 +366,7 @@ def create_plan(request, alb_id):
365 366 return redirect(action_plan, plan.id, "edit")
366 367  
367 368 @login_required
368   -def submit_request(request, req_id):
  369 +def submit_request(request, req_id, redir):
369 370 """
370 371 Submits a request and its sequences for scheduling
371 372 """
... ... @@ -387,10 +388,13 @@ def submit_request(request, req_id):
387 388 seq.save()
388 389 req.submitted = True
389 390 req.save()
390   - # only commented for tests
  391 + # TODO: only commented for tests
391 392 # scheduler.tasks.scheduling.delay(first_schedule=True, alert=False) # TODO : changer le first_schedule ...
392 393 message = "The request was submitted"
393   - return redirect(action_request, req_id=req_id, action="view", status=1, message=message)
  394 + if redir == "action_request":
  395 + return redirect(action_request, req_id=req_id, action="view", status=1, message=message)
  396 + else:
  397 + return redirect(requests_list, status=1, message=message)
394 398  
395 399 @login_required
396 400 def unsubmit_request(request, req_id):
... ...