Skip to content

Commit

Permalink
Merge pull request #542 from guidow/keep_filters_order_in_agents_ui
Browse files Browse the repository at this point in the history
Keep filters and order on single agent action
  • Loading branch information
opalmer committed Sep 25, 2015
2 parents 289c51e + bce76c0 commit 2262dfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyfarm/master/templates/pyfarm/user_interface/agents.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@
<tr>
<td><input type="checkbox" name="jobid" value="{{ agent.id }}" title="Select agent" class="agent-selector"></td>
<td>
<form style="display: inline;" role="form" method="POST" action="{{ url_for('delete_single_agent_ui', agent_id=agent.id) }}">
<form style="display: inline;" role="form" method="POST" action="{{ url_for('delete_single_agent_ui', agent_id=agent.id, next=url_for('agents_index_ui', **filters_and_order)) }}">
<label for="delete-agent-{{agent.id}}-submit" class="clickable-icon" title="Delete agent"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></label>
<input id="delete-agent-{{agent.id}}-submit" type="submit" class="hidden" onclick="return confirm('Are you sure you want to delete this agent?');"/>
</form>
{% if not agent.is_offline() %}
<form style="display: inline;" role="form" method="POST" action="{{ url_for('restart_single_agent_ui', agent_id=agent.id) }}">
<form style="display: inline;" role="form" method="POST" action="{{ url_for('restart_single_agent_ui', agent_id=agent.id, next=url_for('agents_index_ui', **filters_and_order) ) }}">
<label for="restart-agent-{{agent.id}}-submit" class="clickable-icon" title="Restart agent"><span class="glyphicon glyphicon-repeat" aria-hidden="true"></span></label>
<input id="restart-agent-{{agent.id}}-submit" type="submit" class="hidden" onclick="return confirm('Are you sure you want to restart this agent?');"/>
</form>
Expand Down
10 changes: 8 additions & 2 deletions pyfarm/master/user_interface/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ def restart_single_agent(agent_id):

flash("Agent %s will be restarted" % agent.hostname)

return redirect(url_for("agents_index_ui"), SEE_OTHER)
if "next" in request.args:
return redirect(request.args.get("next"), SEE_OTHER)
else:
return redirect(url_for("agents_index_ui"), SEE_OTHER)

def restart_multiple_agents():
agent_ids = request.form.getlist("agent_id")
Expand Down Expand Up @@ -327,7 +330,10 @@ def delete_single_agent(agent_id):

flash("Agent %s has been deleted" % agent.hostname)

return redirect(url_for("agents_index_ui"), SEE_OTHER)
if "next" in request.args:
return redirect(request.args.get("next"), SEE_OTHER)
else:
return redirect(url_for("agents_index_ui"), SEE_OTHER)

def delete_multiple_agents():
agent_ids = request.form.getlist("agent_id")
Expand Down

0 comments on commit 2262dfd

Please sign in to comment.