Add note that watch restock is overriden

This commit is contained in:
dgtlmoon
2024-07-16 16:31:07 +02:00
parent c1003e8afc
commit 2ecc2ce4ec
3 changed files with 18 additions and 5 deletions
+6 -2
View File
@@ -699,8 +699,12 @@ def changedetection_app(config=None, datastore_o=None):
data=default
)
# For the form widget tag uuid lookup
form.tags.datastore = datastore # in _value
# For the form widget tag UUID back to "string name" for the field
form.tags.datastore = datastore
# Used by some forms that need to dig deeper
form.datastore = datastore
form.watch = default
for p in datastore.extra_browsers:
form.fetch_backend.choices.append(p)
@@ -62,7 +62,7 @@ class Watch(BaseWatch):
self['restock_settings'] = kw['default']['restock_settings'] if kw.get('default',{}).get('restock_settings') else {
'follow_price_changes': True,
'in_stock_processing' : 'in_stock_only'
}
} #@todo update
def clear_watch(self):
super().clear_watch()
@@ -6,7 +6,6 @@ from wtforms import (
from wtforms.fields.choices import RadioField
from wtforms.fields.form import FormField
from wtforms.form import Form
from wtforms.validators import ValidationError
from changedetectionio.forms import processor_text_json_diff_form
@@ -37,7 +36,16 @@ class processor_settings_form(processor_text_json_diff_form):
return 'Restock & Price Detection'
def extra_form_content(self):
return """
output = ""
if getattr(self, 'watch', None) and getattr(self, 'datastore'):
for tag_uuid in self.watch.get('tags'):
tag = self.datastore.data['settings']['application']['tags'].get(tag_uuid, {})
if tag.get('overrides_watch'):
# @todo - Quick and dirty, cant access 'url_for' here because its out of scope somehow
output = f"""<p><strong>Note! A Group tag overrides the restock and price detection here.</strong></p><style>#restock-fieldset-price-group {{ opacity: 0.6; }}</style>"""
output += """
{% from '_helpers.html' import render_field, render_checkbox_field, render_button %}
<script>
$(document).ready(function () {
@@ -70,3 +78,4 @@ class processor_settings_form(processor_text_json_diff_form):
</div>
</fieldset>
"""
return output