UI - Filters live preview - improvements to layout

pull/2690/head
dgtlmoon 1 month ago
parent 2842ffb205
commit fd00453e6d

@ -1450,7 +1450,8 @@ def changedetection_app(config=None, datastore_o=None):
{ {
'after_filter': text_after_filter, 'after_filter': text_after_filter,
'before_filter': text_before_filter.decode('utf-8') if isinstance(text_before_filter, bytes) else text_before_filter, 'before_filter': text_before_filter.decode('utf-8') if isinstance(text_before_filter, bytes) else text_before_filter,
'trigger_line_numbers': trigger_line_numbers 'duration': time.time() - now,
'trigger_line_numbers': trigger_line_numbers,
} }
) )

@ -25,15 +25,15 @@ function request_textpreview_update() {
const name = $element.attr('name'); // Get the name attribute of the element const name = $element.attr('name'); // Get the name attribute of the element
data[name] = $element.is(':checkbox') ? ($element.is(':checked') ? $element.val() : false) : $element.val(); data[name] = $element.is(':checkbox') ? ($element.is(':checked') ? $element.val() : false) : $element.val();
}); });
$('#text-preview-spinner').show();
$.abortiveSingularAjax({ $.abortiveSingularAjax({
type: "POST", type: "POST",
url: preview_text_edit_filters_url, url: preview_text_edit_filters_url,
data: data, data: data,
namespace: 'watchEdit' namespace: 'watchEdit'
}).done(function (data) { }).done(function (data) {
$('#text-preview-spinner').fadeOut();
$('#filters-and-triggers #text-preview-before-inner').text(data['before_filter']); $('#filters-and-triggers #text-preview-before-inner').text(data['before_filter']);
$('#filters-and-triggers #text-preview-inner') $('#filters-and-triggers #text-preview-inner')
.text(data['after_filter']) .text(data['after_filter'])
.highlightLines([ .highlightLines([
@ -42,10 +42,8 @@ function request_textpreview_update() {
'lines': data['trigger_line_numbers'] 'lines': data['trigger_line_numbers']
} }
]); ]);
}).fail(function (error) { }).fail(function (error) {
$('#text-preview-spinner').fadeOut();
if (error.statusText === 'abort') { if (error.statusText === 'abort') {
console.log('Request was aborted due to a new request being fired.'); console.log('Request was aborted due to a new request being fired.');
} else { } else {

@ -7,6 +7,16 @@
border-top: none; border-top: none;
} }
.minitabs-content {
width: 100%;
display: flex;
> div {
flex: 1 1 auto;
min-width: 0;
overflow: scroll;
}
}
.minitabs { .minitabs {
display: flex; display: flex;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;

@ -42,9 +42,8 @@ body.preview-text-enabled {
color: var(--color-text-input); color: var(--color-text-input);
font-family: "Courier New", Courier, monospace; /* Sets the font to a monospace type */ font-family: "Courier New", Courier, monospace; /* Sets the font to a monospace type */
font-size: 70%; font-size: 70%;
overflow-x: scroll; word-break: break-word;
white-space: pre-wrap; /* Preserves whitespace and line breaks like <pre> */ white-space: pre-wrap; /* Preserves whitespace and line breaks like <pre> */
overflow-wrap: break-word; /* Allows long words to break and wrap to the next line */
} }
} }

@ -434,6 +434,13 @@ html[data-darkmode="true"] #toggle-light-mode .icon-dark {
padding: 20px; padding: 20px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-top: none; } border-top: none; }
.minitabs-wrapper .minitabs-content {
width: 100%;
display: flex; }
.minitabs-wrapper .minitabs-content > div {
flex: 1 1 auto;
min-width: 0;
overflow: scroll; }
.minitabs-wrapper .minitabs { .minitabs-wrapper .minitabs {
display: flex; display: flex;
border-bottom: 1px solid #ccc; } border-bottom: 1px solid #ccc; }
@ -488,11 +495,9 @@ body.preview-text-enabled {
font-family: "Courier New", Courier, monospace; font-family: "Courier New", Courier, monospace;
/* Sets the font to a monospace type */ /* Sets the font to a monospace type */
font-size: 70%; font-size: 70%;
overflow-x: scroll; word-break: break-word;
white-space: pre-wrap; white-space: pre-wrap;
/* Preserves whitespace and line breaks like <pre> */ /* Preserves whitespace and line breaks like <pre> */ }
overflow-wrap: break-word;
/* Allows long words to break and wrap to the next line */ }
#activate-text-preview { #activate-text-preview {
right: 0; right: 0;

@ -424,8 +424,8 @@ Unavailable") }}
</script> </script>
<br> <br>
{#<div id="text-preview-controls"><span id="text-preview-refresh" class="pure-button button-xsmall">Refresh</span></div>#} {#<div id="text-preview-controls"><span id="text-preview-refresh" class="pure-button button-xsmall">Refresh</span></div>#}
<div class="minitabs-wrapper"> <div class="minitabs-wrapper">
<div class="minitabs-content">
<div id="text-preview-inner" class="monospace-preview"> <div id="text-preview-inner" class="monospace-preview">
<p>Loading...</p> <p>Loading...</p>
</div> </div>
@ -434,6 +434,8 @@ Unavailable") }}
</div> </div>
</div> </div>
</div> </div>
<div class="spinner" style="display: none;" id="text-preview-spinner"></div>
</div>
</div> </div>
</div> </div>

Loading…
Cancel
Save