remove undocumented minRunningFor filter, add short jobs quick selection instead

This commit is contained in:
Christoph Kluge
2026-02-09 12:23:21 +01:00
parent 1980ef5f43
commit 7dd3ee3084
7 changed files with 54 additions and 15 deletions

View File

@@ -142,6 +142,8 @@
<Filters <Filters
bind:this={filterComponent} bind:this={filterComponent}
{filterPresets} {filterPresets}
shortJobQuickSelect
shortJobCutoff={ccconfig?.jobList_hideShortRunningJobs}
showFilter={!showCompare} showFilter={!showCompare}
matchedJobs={showCompare? matchedCompareJobs: matchedListJobs} matchedJobs={showCompare? matchedCompareJobs: matchedListJobs}
applyFilters={(detail) => { applyFilters={(detail) => {

View File

@@ -119,7 +119,7 @@
const filter = $derived([ const filter = $derived([
{ cluster: { eq: cluster } }, { cluster: { eq: cluster } },
{ node: { contains: hostname } }, { node: { eq: hostname } },
{ state: ["running"] }, { state: ["running"] },
]); ]);

View File

@@ -219,9 +219,10 @@
<Filters <Filters
bind:this={filterComponent} bind:this={filterComponent}
{filterPresets} {filterPresets}
shortJobQuickSelect
shortJobCutoff={ccconfig?.jobList_hideShortRunningJobs}
showFilter={!showCompare} showFilter={!showCompare}
matchedJobs={showCompare? matchedCompareJobs: matchedListJobs} matchedJobs={showCompare? matchedCompareJobs: matchedListJobs}
startTimeQuickSelect
applyFilters={(detail) => { applyFilters={(detail) => {
jobFilters = [...detail.filters, { user: { eq: user.username } }]; jobFilters = [...detail.filters, { user: { eq: user.username } }];
selectedCluster = jobFilters[0]?.cluster selectedCluster = jobFilters[0]?.cluster

View File

@@ -6,6 +6,8 @@
- `filterPresets Object?`: Optional predefined filter values [Default: {}] - `filterPresets Object?`: Optional predefined filter values [Default: {}]
- `disableClusterSelection Bool?`: Is the selection disabled [Default: false] - `disableClusterSelection Bool?`: Is the selection disabled [Default: false]
- `startTimeQuickSelect Bool?`: Render startTime quick selections [Default: false] - `startTimeQuickSelect Bool?`: Render startTime quick selections [Default: false]
- `shortJobQuickSelect Bool?`: Render short job quick selections [Default: false]
- `shortJobCutoff Int?`: Time in seconds for jobs to be considered short [Default: null]
- `matchedJobs Number?`: Number of jobs matching the filter [Default: -2] - `matchedJobs Number?`: Number of jobs matching the filter [Default: -2]
- `showFilter Func`: If the filter component should be rendered in addition to total count info [Default: true] - `showFilter Func`: If the filter component should be rendered in addition to total count info [Default: true]
- `applyFilters Func`: The callback function to apply current filter selection - `applyFilters Func`: The callback function to apply current filter selection
@@ -25,6 +27,7 @@
ButtonGroup, ButtonGroup,
ButtonDropdown, ButtonDropdown,
Icon, Icon,
Tooltip
} from "@sveltestrap/sveltestrap"; } from "@sveltestrap/sveltestrap";
import Info from "./filters/InfoBox.svelte"; import Info from "./filters/InfoBox.svelte";
import Cluster from "./filters/Cluster.svelte"; import Cluster from "./filters/Cluster.svelte";
@@ -36,6 +39,7 @@
import Resources from "./filters/Resources.svelte"; import Resources from "./filters/Resources.svelte";
import Energy from "./filters/Energy.svelte"; import Energy from "./filters/Energy.svelte";
import Statistics from "./filters/Stats.svelte"; import Statistics from "./filters/Stats.svelte";
import { formatDurationTime } from "./units.js";
/* Svelte 5 Props */ /* Svelte 5 Props */
let { let {
@@ -43,6 +47,8 @@
filterPresets = {}, filterPresets = {},
disableClusterSelection = false, disableClusterSelection = false,
startTimeQuickSelect = false, startTimeQuickSelect = false,
shortJobQuickSelect = false,
shortJobCutoff = 0,
matchedJobs = -2, matchedJobs = -2,
showFilter = true, showFilter = true,
applyFilters applyFilters
@@ -335,6 +341,44 @@
<DropdownItem onclick={() => (isStatsOpen = true)}> <DropdownItem onclick={() => (isStatsOpen = true)}>
<Icon name="bar-chart" onclick={() => (isStatsOpen = true)} /> Statistics <Icon name="bar-chart" onclick={() => (isStatsOpen = true)} /> Statistics
</DropdownItem> </DropdownItem>
{#if shortJobQuickSelect && shortJobCutoff > 0}
<DropdownItem divider />
<DropdownItem header>
Short Jobs Selection
<Icon id="shortjobsfilter-info" style="cursor:help; padding-right: 8px;" size="sm" name="info-circle"/>
<Tooltip target={`shortjobsfilter-info`} placement="right">
Job duration less than {formatDurationTime(shortJobCutoff)}
</Tooltip>
</DropdownItem>
<DropdownItem
onclick={() => {
filters.duration = {
moreThan: null,
lessThan: shortJobCutoff,
from: null,
to: null
}
updateFilters();
}}
>
<Icon name="stopwatch" />
Only Short Jobs
</DropdownItem>
<DropdownItem
onclick={() => {
filters.duration = {
moreThan: shortJobCutoff,
lessThan: null,
from: null,
to: null
}
updateFilters();
}}
>
<Icon name="stopwatch" />
Exclude Short Jobs
</DropdownItem>
{/if}
{#if startTimeQuickSelect} {#if startTimeQuickSelect}
<DropdownItem divider /> <DropdownItem divider />
<DropdownItem header>Start Time Quick Selection</DropdownItem> <DropdownItem header>Start Time Quick Selection</DropdownItem>

View File

@@ -112,11 +112,7 @@
// (Re-)query and optionally set new filters; Query will be started reactively. // (Re-)query and optionally set new filters; Query will be started reactively.
export function queryJobs(filters) { export function queryJobs(filters) {
if (filters != null) { if (filters != null) {
let minRunningFor = ccconfig.jobList_hideShortRunningJobs; filter = [...filters];
if (minRunningFor && minRunningFor > 0) {
filters.push({ minRunningFor });
}
filter = filters;
} }
} }

View File

@@ -180,10 +180,6 @@
// (Re-)query and optionally set new filters; Query will be started reactively. // (Re-)query and optionally set new filters; Query will be started reactively.
export function queryJobs(filters) { export function queryJobs(filters) {
if (filters != null) { if (filters != null) {
let minRunningFor = ccconfig.jobList_hideShortRunningJobs;
if (minRunningFor && minRunningFor > 0) {
filters.push({ minRunningFor });
}
filter = [...filters]; filter = [...filters];
} }
}; };

View File

@@ -14,10 +14,10 @@
<script module> <script module>
export const startTimeSelectOptions = [ export const startTimeSelectOptions = [
{ range: "", rangeLabel: "No Selection"}, { range: "", rangeLabel: "No Selection"},
{ range: "last6h", rangeLabel: "Last 6hrs"}, { range: "last6h", rangeLabel: "Job Start: Last 6hrs"},
{ range: "last24h", rangeLabel: "Last 24hrs"}, { range: "last24h", rangeLabel: "Job Start: Last 24hrs"},
{ range: "last7d", rangeLabel: "Last 7 days"}, { range: "last7d", rangeLabel: "Job Start: Last 7 days"},
{ range: "last30d", rangeLabel: "Last 30 days"} { range: "last30d", rangeLabel: "Job Start: Last 30 days"}
]; ];
</script> </script>