added stop/resume on found the first item

This commit is contained in:
2026-06-30 19:20:06 +03:30
parent 42ddcdd22e
commit 78265d92ba
5 changed files with 16 additions and 2 deletions
+2
View File
@@ -86,6 +86,7 @@ class FlowConfigIn(BaseModel):
target_item_ids: list[str] = []
target_url: str = ""
scenario: str = "dynamic"
stop_on_first_click: bool = False
def _to_db_dict(body: FlowConfigIn) -> dict[str, Any]:
@@ -113,6 +114,7 @@ def _to_db_dict(body: FlowConfigIn) -> dict[str, Any]:
"target_item_ids_json": body.target_item_ids,
"target_url": body.target_url,
"scenario": body.scenario,
"stop_on_first_click": int(body.stop_on_first_click),
}
+8
View File
@@ -186,6 +186,11 @@
<input id="cfg-target-url" type="url" placeholder="https://example.com" />
</div>
<div class="fg" style="display:flex;align-items:center;gap:10px;margin-bottom:14px">
<input id="cfg-stop-on-first-click" type="checkbox" style="width:16px;height:16px;accent-color:var(--accent);cursor:pointer" />
<label for="cfg-stop-on-first-click" style="margin:0;cursor:pointer;color:var(--text)">Stop after first successful click</label>
</div>
<div class="fg" style="margin-top:6px">
<label>Search Texts <span style="color:var(--muted)">(one per line)</span></label>
<textarea id="cfg-search-texts" placeholder="shoes&#10;blue sneakers&#10;running shoes"></textarea>
@@ -1028,6 +1033,7 @@ function openNewForm() {
document.getElementById('cfg-target-url').value = '';
document.getElementById('cfg-search-texts').value = '';
document.getElementById('cfg-item-ids').value = '';
document.getElementById('cfg-stop-on-first-click').checked = false;
_resetAdvanced();
document.getElementById('adv-details').removeAttribute('open');
_applyScenario('dynamic');
@@ -1069,6 +1075,7 @@ function openEditForm(id) {
// DigiPay fields
const dpMatch = (scenario === 'digipay') ? (_ist || 'onclick') : 'onclick';
document.getElementById('cfg-digipay-match').value = dpMatch;
document.getElementById('cfg-stop-on-first-click').checked = c.stop_on_first_click !== 0;
document.getElementById('cfg-dp-max-scrolls').value = c.max_scrolls ?? 20;
document.getElementById('cfg-dp-scroll-pause').value = c.scroll_pause_ms ?? 1500;
document.getElementById('digipay-onclick-hint').style.display = dpMatch === 'onclick' ? '' : 'none';
@@ -1090,6 +1097,7 @@ function collectForm() {
target_url: document.getElementById('cfg-target-url').value.trim(),
search_texts: document.getElementById('cfg-search-texts').value.split('\n').map(s => s.trim()).filter(Boolean),
target_item_ids: document.getElementById('cfg-item-ids').value.split('\n').map(s => s.trim()).filter(Boolean),
stop_on_first_click: document.getElementById('cfg-stop-on-first-click').checked,
};
if (scenario === 'digipay') {