add exact match for filter and save filter value
This commit is contained in:
parent
0f4da6e594
commit
fbe3d35c5d
@ -207,18 +207,25 @@ function buildTestResultImages(data) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function buildData(table, images, data, sort, filter) {
|
function buildData(table, images, data, sort, filter, exact_match) {
|
||||||
if (sort) {
|
if (sort) {
|
||||||
data = filterData(data);
|
data = filterData(data);
|
||||||
}
|
}
|
||||||
if (filter) {
|
if (filter) {
|
||||||
|
if (exact_match) {
|
||||||
|
data = data.filter((d) => {
|
||||||
|
const test = d.test === filter;
|
||||||
|
const channel = d.channel === filter;
|
||||||
|
return test || channel;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
data = data.filter((d) => {
|
data = data.filter((d) => {
|
||||||
const test = d.test.includes(filter);
|
const test = d.test.includes(filter);
|
||||||
const channel = d.channel.includes(filter);
|
const channel = d.channel.includes(filter);
|
||||||
return test || channel;
|
return test || channel;
|
||||||
})
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.replaceChildren(...buildTestResultsTable(data));
|
table.replaceChildren(...buildTestResultsTable(data));
|
||||||
images.replaceChildren(...buildTestResultImages(data));
|
images.replaceChildren(...buildTestResultImages(data));
|
||||||
@ -240,8 +247,8 @@ function buildData(table, images, data, sort, filter) {
|
|||||||
|
|
||||||
saveToLocalStorage("rendertest_tablesort", sort);
|
saveToLocalStorage("rendertest_tablesort", sort);
|
||||||
}
|
}
|
||||||
const buildDataSlowMode = debounce((table, images, data, sort, filter) => {
|
const buildDataSlowMode = debounce((table, images, data, sort, filter, exact_match) => {
|
||||||
buildData(table, images, data, sort, filter);
|
buildData(table, images, data, sort, filter, exact_match);
|
||||||
}, ()=>{}, 250);
|
}, ()=>{}, 250);
|
||||||
|
|
||||||
|
|
||||||
@ -319,7 +326,7 @@ window.onload = () => {
|
|||||||
saveToLocalStorage("rendertest_switchfrequency", value);
|
saveToLocalStorage("rendertest_switchfrequency", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let gridContainer, sidebarOptions, numberInput, rangeInput, table, images, vpaddin_input, filter;
|
let gridContainer, sidebarOptions, numberInput, rangeInput, table, images, vpaddin_input, filter, exactmatch_input;
|
||||||
|
|
||||||
const switchFrequency = loadFromLocalStorage("rendertest_switchfrequency", 700);
|
const switchFrequency = loadFromLocalStorage("rendertest_switchfrequency", 700);
|
||||||
const tableSort = loadFromLocalStorage("rendertest_tablesort", false);
|
const tableSort = loadFromLocalStorage("rendertest_tablesort", false);
|
||||||
@ -331,6 +338,8 @@ window.onload = () => {
|
|||||||
const diffMode = loadFromLocalStorage("rendertest_diffmode", "click");
|
const diffMode = loadFromLocalStorage("rendertest_diffmode", "click");
|
||||||
const imageCompareMode = loadFromLocalStorage("rendertest_imagecomparemode", "switch");
|
const imageCompareMode = loadFromLocalStorage("rendertest_imagecomparemode", "switch");
|
||||||
const imagePosition = loadFromLocalStorage("rendertest_imageposition", "center");
|
const imagePosition = loadFromLocalStorage("rendertest_imageposition", "center");
|
||||||
|
const filter_value = loadFromLocalStorage("rendertest_filter", "");
|
||||||
|
const exactMatch = loadFromLocalStorage("rendertest_exactmatch", false);
|
||||||
let isPaused = loadFromLocalStorage("rendertest_paused", false);
|
let isPaused = loadFromLocalStorage("rendertest_paused", false);
|
||||||
|
|
||||||
if (theme) {
|
if (theme) {
|
||||||
@ -530,13 +539,13 @@ window.onload = () => {
|
|||||||
]),
|
]),
|
||||||
Tag("label", null, null, [
|
Tag("label", null, null, [
|
||||||
Tag("input", {"type": "radio", "name": "sort_table", "value": "yes", ...uglyChecked(tableSort)}, null, null, "input", (e) => {
|
Tag("input", {"type": "radio", "name": "sort_table", "value": "yes", ...uglyChecked(tableSort)}, null, null, "input", (e) => {
|
||||||
buildData(table, images, data, true, filter.value);
|
buildData(table, images, data, true, filter.value, exactmatch_input.checked);
|
||||||
}),
|
}),
|
||||||
Text(" yes")
|
Text(" yes")
|
||||||
]),
|
]),
|
||||||
Tag("label", null, null, [
|
Tag("label", null, null, [
|
||||||
Tag("input", {"type": "radio", "name": "sort_table", "value": "no", ...uglyChecked(!tableSort)}, null, null, "input", (e) => {
|
Tag("input", {"type": "radio", "name": "sort_table", "value": "no", ...uglyChecked(!tableSort)}, null, null, "input", (e) => {
|
||||||
buildData(table, images, data, false, filter.value);
|
buildData(table, images, data, false, filter.value, exactmatch_input.checked);
|
||||||
}),
|
}),
|
||||||
Text(" no")
|
Text(" no")
|
||||||
])
|
])
|
||||||
@ -545,9 +554,17 @@ window.onload = () => {
|
|||||||
Tag("div", {"class": "panel", "id": "table"}, null, [
|
Tag("div", {"class": "panel", "id": "table"}, null, [
|
||||||
Tag("h2", null, "List of things that are not perfect"),
|
Tag("h2", null, "List of things that are not perfect"),
|
||||||
Tag("label", {"class": "filter sticky"}, "Filter", [
|
Tag("label", {"class": "filter sticky"}, "Filter", [
|
||||||
filter = Tag("input", {"type": "input", "name": "filter", "value": ""}, null, null, "input", (e) => {
|
filter = Tag("input", {"type": "input", "name": "filter", "value": filter_value}, null, null, "input", (e) => {
|
||||||
buildDataSlowMode(table, images, data, tableSort, e.target.value);
|
saveToLocalStorage("rendertest_filter", e.target.value);
|
||||||
|
buildDataSlowMode(table, images, data, tableSort, e.target.value, exactmatch_input.checked);
|
||||||
}),
|
}),
|
||||||
|
Tag("label", null, null, [
|
||||||
|
exactmatch_input = Tag("input", {"type": "checkbox", "name": "exactmatch", ...uglyChecked(exactMatch)}, null, null, "change", (e) => {
|
||||||
|
saveToLocalStorage("rendertest_exactmatch", e.target.checked);
|
||||||
|
buildDataSlowMode(table, images, data, tableSort, filter.value, exactmatch_input.checked);
|
||||||
|
}),
|
||||||
|
Text("exact match")
|
||||||
|
])
|
||||||
]),
|
]),
|
||||||
table = Tag("div", {"id": "fail_table"})
|
table = Tag("div", {"id": "fail_table"})
|
||||||
])
|
])
|
||||||
@ -564,7 +581,7 @@ window.onload = () => {
|
|||||||
])
|
])
|
||||||
document.body.appendChild(gridContainer);
|
document.body.appendChild(gridContainer);
|
||||||
|
|
||||||
buildData(table, images, data, tableSort);
|
buildData(table, images, data, tableSort, filter_value, exactmatch_input.checked);
|
||||||
|
|
||||||
// TODO: remove this
|
// TODO: remove this
|
||||||
if (sidebarPos === "right") {
|
if (sidebarPos === "right") {
|
||||||
|
Loading…
Reference in New Issue
Block a user