Skip to content

Commit

Permalink
UI - Make 'tag' sticky - redirect to current tag on edit or add watch (
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtlmoon authored Dec 4, 2024
1 parent 1fb0add commit c5fe188
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions changedetectionio/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def edit_page(uuid):
if request.args.get("next") and request.args.get("next") == 'diff':
return redirect(url_for('diff_history_page', uuid=uuid))

return redirect(url_for('index'))
return redirect(url_for('index', tag=request.args.get("tag",'')))

else:
if request.method == 'POST' and not form.validate():
Expand Down Expand Up @@ -1395,13 +1395,13 @@ def form_quick_watch_add():
if new_uuid:
if add_paused:
flash('Watch added in Paused state, saving will unpause.')
return redirect(url_for('edit_page', uuid=new_uuid, unpause_on_save=1))
return redirect(url_for('edit_page', uuid=new_uuid, unpause_on_save=1, tag=request.args.get('tag')))
else:
# Straight into the queue.
update_q.put(queuedWatchMetaData.PrioritizedItem(priority=1, item={'uuid': new_uuid}))
flash("Watch added.")

return redirect(url_for('index'))
return redirect(url_for('index', tag=request.args.get('tag','')))



Expand Down
2 changes: 1 addition & 1 deletion changedetectionio/templates/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

<div class="box-wrap inner">
<form class="pure-form pure-form-stacked"
action="{{ url_for('edit_page', uuid=uuid, next = request.args.get('next'), unpause_on_save = request.args.get('unpause_on_save')) }}" method="POST">
action="{{ url_for('edit_page', uuid=uuid, next = request.args.get('next'), unpause_on_save = request.args.get('unpause_on_save'), tag = request.args.get('tag')) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

<div class="tab-pane-inner" id="general">
Expand Down
4 changes: 2 additions & 2 deletions changedetectionio/templates/watch-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="box">

<form class="pure-form" action="{{ url_for('form_quick_watch_add') }}" method="POST" id="new-watch-form">
<form class="pure-form" action="{{ url_for('form_quick_watch_add', tag=active_tag_uuid) }}" method="POST" id="new-watch-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
<fieldset>
<legend>Add a new change detection watch</legend>
Expand Down Expand Up @@ -187,7 +187,7 @@
<td>
<a {% if watch.uuid in queued_uuids %}disabled="true"{% endif %} href="{{ url_for('form_watch_checknow', uuid=watch.uuid, tag=request.args.get('tag')) }}"
class="recheck pure-button pure-button-primary">{% if watch.uuid in queued_uuids %}Queued{% else %}Recheck{% endif %}</a>
<a href="{{ url_for('edit_page', uuid=watch.uuid)}}#general" class="pure-button pure-button-primary">Edit</a>
<a href="{{ url_for('edit_page', uuid=watch.uuid, tag=active_tag_uuid)}}#general" class="pure-button pure-button-primary">Edit</a>
{% if watch.history_n >= 2 %}

{% if is_unviewed %}
Expand Down

0 comments on commit c5fe188

Please sign in to comment.