async function prime_rules()

in webui/js/blocky4.js [452:491]


async function prime_rules(target, state) {
    let main = document.getElementById('main');
    main.innerHTML = '';
    let title = _h1("Block rules");
    main.appendChild(title);

    let t = _table();
    t.style.tableLayout = 'fixed';
    main.appendChild(t);

    let btheader = _tr();
    btheader.appendChild(_th('Description', 500));
    btheader.appendChild(_th('Aggregation Type', 160));
    btheader.appendChild(_th('Limit', 140));
    btheader.appendChild(_th('Timespan', 80));
    btheader.appendChild(_th('Filters', 360));
    btheader.appendChild(_th('Actions', 150));
    t.appendChild(btheader);

    let rules = await GET('rules');

    for (let rule of rules) {
        let tr = rule_tr(rule);
        t.appendChild(tr);
    }

    let tr = _tr();
    let td = _td();
    td.appendChild(_hr());
    td.colSpan = 6;
    tr.appendChild(td);
    t.appendChild(tr);

    let new_rule = rule_tr({id: 9999, duration: "24h", limit: 100});
    t.appendChild(new_rule);

    let p = _p("Filters support regular Lucene match (foo = bar), exact terms match (foo == bar), regexp (foo ~= ba[rz]). All matches can be negated with !, such as !=, !==, !~= etc")
    main.appendChild(p);

}