Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions desktop/js/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,26 @@ if (!jeeFrontEnd.log) {

//searching
document.getElementById('in_searchLogFilter')?.addEventListener('keyup', function(event) {
let search = event.target.value
if (search == '') {
const raw = event.target.value
if (raw == '') {
jeeP.logListButtons.seen()
return
}
const not = search.startsWith(":not(")
if (not) {
search = search.replace(':not(', '')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to handle also ), currently if we do :not(toto), search will search toto) and not toto

Copy link
Copy Markdown
Contributor Author

@limad limad May 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document.getElementById('in_searchLogFilter')?.addEventListener('keyup', function(event) {
  const raw = event.target.value
  if (raw == '') {
    jeeP.logListButtons.seen()
    return
  }

  const terms = raw.split(',').map(t => t.trim()).filter(t => t.length > 0)
  const positive = terms.filter(t => !t.startsWith(':not('))
  const negative = terms.filter(t => t.startsWith(':not(')).map(t => jeedomUtils.normTextLower(t.slice(5, -1)))

  jeeP.logListButtons.unseen()
  jeeP.logListButtons.forEach(_bt => {
    const text = jeedomUtils.normTextLower(_bt.textContent)
    //const text = jeedomUtils.normTextLower(_bt.getAttribute('data-log'))
    const passNeg = negative.every(s => !text.includes(s))
    const passPos = positive.length === 0 || positive.some(t => text.includes(jeedomUtils.normTextLower(t)))
    if (passNeg && passPos) _bt.seen()
  })
})

Don’t know if this could help or if it’s the intended use ?
Working examples:

  • error, warning
  • :not(ai_assistant),:not(alexaapiv2)
  • error,:not(api)

}
search = jeedomUtils.normTextLower(search)

// Multi-term: comma-separated terms, each term can be prefixed with :not()
// e.g. "error,warning" → show entries matching either
// "error,:not(daemon)" → show entries matching "error" but not "daemon"
const terms = raw.split(',').map(function(t) { return t.trim() }).filter(function(t) { return t.length > 0 })

jeeP.logListButtons.unseen()
jeeP.logListButtons.forEach(_bt => {
let match = false
const text = jeedomUtils.normTextLower(_bt.textContent)
if (text.includes(search)) {
match = true
}
if (not) match = !match
if (match) {
_bt.seen()
}
const match = terms.some(function(term) {
const not = term.startsWith(':not(')
const search = jeedomUtils.normTextLower(not ? term.slice(5, -1) : term)
return not ? !text.includes(search) : text.includes(search)
})
if (match) _bt.seen()
})
})

Expand Down
Loading