I would like this filter to work, for option "pattern" field description should have params [ok] && field process should have params [pattern]. For option "fast" field description should have params [ok] && field process should have params []. The problem is that the filter is not working when for option "fast" when field description should have params [ok] && field process should have params []. Dont know if the problem is the empty array.
filterConfig() {
return [
{
name: "description",
field: "description",
type: "term",
label: "description",
options: [
{ label: "pattern", value: "true" },
{ label: "fast", value: "false" },
],
onBeforeLoad(filters, filter) {
const memo = filters.filter((f) => f.field !== "description");
if (filter?.params?.length !== 1) return memo;
if (filter?.params?.includes("true")) {
memo.push({
type: "term",
field: "description",
params: ["OK"],
});
memo.push({
type: "term",
field: "process",
params: ["pattern"],
});
}
if (filter?.params?.includes("false")) {
memo.push({
type: "term",
field: "description",
params: ["OK"],
});
memo.push({
type: "term",
field: "process",
params: [],
});
}
return memo;
},
},
];
},