Review duration filter handling, update migration indices

This commit is contained in:
Christoph Kluge
2026-01-26 15:53:00 +01:00
parent e074bb315c
commit 836e6e4242
6 changed files with 109 additions and 34 deletions

View File

@@ -192,14 +192,14 @@
items.push({
startTime: { range: filters.startTime.range },
});
if (filters.duration.from || filters.duration.to)
if (filters.duration.from && filters.duration.to)
items.push({
duration: { from: filters.duration.from, to: filters.duration.to },
});
if (filters.duration.lessThan)
items.push({ duration: { from: 0, to: filters.duration.lessThan } });
items.push({ duration: { to: filters.duration.lessThan, from: 0 } });
if (filters.duration.moreThan)
items.push({ duration: { from: filters.duration.moreThan, to: 604800 } }); // 7 days to include special jobs with long runtimes
items.push({ duration: { to: 0, from: filters.duration.moreThan } });
if (filters.energy.from || filters.energy.to)
items.push({
energy: { from: filters.energy.from, to: filters.energy.to },
@@ -266,9 +266,9 @@
if (filters.duration.from && filters.duration.to)
opts.push(`duration=${filters.duration.from}-${filters.duration.to}`);
if (filters.duration.lessThan)
opts.push(`duration=0-${filters.duration.lessThan}`);
opts.push(`duration=lessthan-${filters.duration.lessThan}`);
if (filters.duration.moreThan)
opts.push(`duration=${filters.duration.moreThan}-604800`);
opts.push(`duration=morethan-${filters.duration.moreThan}`);
if (filters.tags.length != 0)
for (let tag of filters.tags) opts.push(`tag=${tag}`);
if (filters.numNodes.from && filters.numNodes.to)

View File

@@ -31,14 +31,16 @@
setFilter
} = $props();
/* States */
let lessState = $state({ hours:0, mins:0 });
let moreState = $state({ hours:0, mins:0 });
let fromState = $state({ hours:0, mins:0 });
let toState = $state({ hours:0, mins:0 });
/* Derived */
let pendingDuration = $derived(presetDuration);
let lessState = $derived(secsToHoursAndMins(presetDuration?.lessThan));
let moreState = $derived(secsToHoursAndMins(presetDuration?.moreThan));
let fromState = $derived(secsToHoursAndMins(presetDuration?.from));
let toState = $derived(secsToHoursAndMins(presetDuration?.to));
const lessDisabled = $derived(
let lessDisabled = $derived(
moreState.hours !== 0 ||
moreState.mins !== 0 ||
fromState.hours !== 0 ||
@@ -47,7 +49,7 @@
toState.mins !== 0
);
const moreDisabled = $derived(
let moreDisabled = $derived(
lessState.hours !== 0 ||
lessState.mins !== 0 ||
fromState.hours !== 0 ||
@@ -56,13 +58,27 @@
toState.mins !== 0
);
const betweenDisabled = $derived(
let betweenDisabled = $derived(
moreState.hours !== 0 ||
moreState.mins !== 0 ||
lessState.hours !== 0 ||
lessState.mins !== 0
)
/* Effects */
$effect(() => {
lessState = secsToHoursAndMins(pendingDuration?.lessThan);
});
$effect(() => {
moreState = secsToHoursAndMins(pendingDuration?.moreThan);
});
$effect(() => {
fromState = secsToHoursAndMins(pendingDuration?.from);
});
$effect(() => {
toState = secsToHoursAndMins(pendingDuration?.to);
});
/* Functions */
function resetPending() {
pendingDuration = {