this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

label app: Add search

+20 -1
+5
src/review_app.py
··· 151 151 async def list_items( 152 152 split: Annotated[str | None, Query()] = None, 153 153 filter: Annotated[str, Query()] = "pending", 154 + search: Annotated[str | None, Query()] = None, 154 155 after: Annotated[int, Query()] = 0, 155 156 limit: Annotated[int, Query()] = 20, 156 157 ): ··· 163 164 if split: 164 165 clauses.append("i.split = :split") 165 166 params["split"] = split 167 + 168 + if search: 169 + clauses.append("(i.typst LIKE :search OR e.typst_edited LIKE :search)") 170 + params["search"] = f"%{search}%" 166 171 167 172 if filter == "pending": 168 173 clauses.append("r.image_path IS NULL")
+15 -1
src/static/review.html
··· 117 117 <option value="edited">Edited</option> 118 118 <option value="all">All</option> 119 119 </select> 120 + <input id="search-inp" type="text" placeholder="search labels…" 121 + style="background:#222;color:#ccc;border:1px solid #444;padding:0.3rem 0.6rem; 122 + font-family:monospace;font-size:0.82rem;border-radius:3px;width:18rem;"> 120 123 <span id="stats"></span> 121 124 </div> 122 125 ··· 130 133 const state = { 131 134 split: '', 132 135 filter: 'pending', 136 + search: '', 133 137 items: [], // each item: {id, split, typst, typst_orig, reviewed, flagged, edited, _editing, _draft} 134 138 nextCursor: null, 135 139 loading: false, ··· 255 259 256 260 async function _fetchPage(after) { 257 261 const p = new URLSearchParams({ filter: state.filter, after, limit: 20 }); 258 - if (state.split) p.set('split', state.split); 262 + if (state.split) p.set('split', state.split); 263 + if (state.search) p.set('search', state.search); 259 264 return api(`/items?${p}`); 260 265 } 261 266 ··· 411 416 document.getElementById('filter-sel').addEventListener('change', e => { 412 417 state.filter = e.target.value; 413 418 actions.reload(); 419 + }); 420 + 421 + let _searchTimer = null; 422 + document.getElementById('search-inp').addEventListener('input', e => { 423 + clearTimeout(_searchTimer); 424 + _searchTimer = setTimeout(() => { 425 + state.search = e.target.value.trim(); 426 + actions.reload(); 427 + }, 300); 414 428 }); 415 429 416 430 document.getElementById('load-more').addEventListener('click', () => actions.loadMore());