</div>
</div>
<div class="card ro-hide" style="display: none;">
- <div class="card-header text-secondary py-2">
+ <div class="card-header text-secondary py-1 d-flex">
<span class="icon mr-3"><i class="fas fa-graduation-cap"></i></span>
<span class="h6 font-weight-bolder my-2">Learn Rspamd</span>
+ <div id="learnServers" class="form-inline card-header-form input-group-sm align-self-center ml-auto mr-1">
+ <label for="selLearnServers">Learn servers:</label>
+ <select id="selLearnServers" class="form-control ml-1">
+ <option value="random" selected>random</option>
+ <option value="all">all</option>
+ </select>
+ </div>
</div>
<div class="card-body">
<div class="row">
$("#selSrv").change(function () {
checked_server = this.value;
$("#selSrv [value=\"" + checked_server + "\"]").prop("checked", true);
+ if (checked_server === "All SERVERS") {
+ $("#learnServers").show();
+ } else {
+ $("#learnServers").hide();
+ }
tabClick("#" + $("#navBar > ul > .nav-item > .nav-link.active").attr("id"));
});
} else if (source === "scan") {
url = "checkv2";
}
+
+ function server() {
+ if (rspamd.getSelector("selSrv") === "All SERVERS" &&
+ rspamd.getSelector("selLearnServers") === "random") {
+ const servers = $("#selSrv option").slice(1).map(function (_, o) { return o.value; });
+ return servers[Math.floor(Math.random() * servers.length)];
+ }
+ return null;
+ }
+
rspamd.query(url, {
data: data,
params: {
if (jqXHR.status !== 200) {
rspamd.alertMessage("alert-info", jqXHR.statusText);
}
- }
+ },
+ server: server()
});
}