From b05c7aef1cd324600f2a2263e24da1a528c985d7 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 9 Jul 2024 17:35:55 +0200 Subject: [PATCH] Make the option to select a processor easier to understand/find --- changedetectionio/forms.py | 11 +++++++---- changedetectionio/templates/edit.html | 13 +++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 9cab2ffc..b01e1f25 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -422,15 +422,18 @@ class quickWatchForm(Form): # Common to a single watch and the global settings class commonSettingsForm(Form): + from . import processors - notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers(), ValidateJinja2Template()]) - notification_title = StringField('Notification Title', default='ChangeDetection.io Notification - {{ watch_url }}', validators=[validators.Optional(), ValidateJinja2Template()]) + extract_title_as_title = BooleanField('Extract from document and use as watch title', default=False) + fetch_backend = RadioField(u'Fetch Method', choices=content_fetchers.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) notification_body = TextAreaField('Notification Body', default='{{ watch_url }} had a change.', validators=[validators.Optional(), ValidateJinja2Template()]) notification_format = SelectField('Notification format', choices=valid_notification_formats.keys()) - fetch_backend = RadioField(u'Fetch Method', choices=content_fetchers.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) - extract_title_as_title = BooleanField('Extract <title> from document and use as watch title', default=False) + notification_title = StringField('Notification Title', default='ChangeDetection.io Notification - {{ watch_url }}', validators=[validators.Optional(), ValidateJinja2Template()]) + notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers(), ValidateJinja2Template()]) + processor = RadioField( label=u"Processor - What do you want to achieve?", choices=processors.available_processors(), default="text_json_diff") webdriver_delay = IntegerField('Wait seconds before extracting text', validators=[validators.Optional(), validators.NumberRange(min=1, message="Should contain one or more seconds")]) + class importForm(Form): from . import processors processor = RadioField(u'Processor', choices=processors.available_processors(), default="text_json_diff") diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 3baf4603..0c3dfecb 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -67,16 +67,9 @@ {{ render_field(form.url, placeholder="https://...", required=true, class="m-d") }} <span class="pure-form-message-inline">Some sites use JavaScript to create the content, for this you should <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver">use the Chrome/WebDriver Fetcher</a></span><br> <span class="pure-form-message-inline">You can use variables in the URL, perfect for inserting the current date and other logic, <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Handling-variables-in-the-watched-URL">help and examples here</a></span><br> - <span class="pure-form-message-inline"> - {% if watch['processor'] == 'text_json_diff' %} - Current mode: <strong>Webpage Text/HTML, JSON and PDF changes.</strong><br> - <a href="{{url_for('edit_page', uuid=uuid)}}?switch_processor=restock_diff" class="pure-button button-xsmall">Switch to re-stock & Price detection mode for single product pages</a> - {% else %} - Current mode: <strong>Re-stock detection.</strong><br> - <a href="{{url_for('edit_page', uuid=uuid)}}?switch_processor=text_json_diff" class="pure-button button-xsmall">Switch to Webpage Text/HTML, JSON and PDF changes mode.</a> - {% endif %} - </span> - + </div> + <div class="pure-control-group inline-radio"> + {{ render_field(form.processor) }} </div> <div class="pure-control-group"> {{ render_field(form.title, class="m-d") }}