mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-10-27 22:55:07 +01:00
Migrate job list view and filter components
- filters now inactive in user jobs, lists and analysis due to missing dispatch
This commit is contained in:
@@ -8,22 +8,21 @@
|
||||
- `refresh`: When fired, the upstream component refreshes its contents
|
||||
-->
|
||||
<script>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { Button, Icon, Input, InputGroup } from "@sveltestrap/sveltestrap";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let refreshInterval = null;
|
||||
let refreshInterval = $state(null);
|
||||
let refreshIntervalId = null;
|
||||
|
||||
function refreshIntervalChanged() {
|
||||
if (refreshIntervalId != null) clearInterval(refreshIntervalId);
|
||||
|
||||
if (refreshInterval == null) return;
|
||||
|
||||
refreshIntervalId = setInterval(() => dispatch("refresh"), refreshInterval);
|
||||
}
|
||||
|
||||
export let initially = null;
|
||||
let {
|
||||
initially = null,
|
||||
onRefresh
|
||||
} = $props();
|
||||
|
||||
if (initially != null) {
|
||||
refreshInterval = initially * 1000;
|
||||
@@ -36,7 +35,7 @@
|
||||
type="select"
|
||||
title="Periodic refresh interval"
|
||||
bind:value={refreshInterval}
|
||||
on:change={refreshIntervalChanged}
|
||||
onchange={refreshIntervalChanged}
|
||||
>
|
||||
<option value={null}>No Interval</option>
|
||||
<option value={30 * 1000}>30 Seconds</option>
|
||||
@@ -46,7 +45,7 @@
|
||||
</Input>
|
||||
<Button
|
||||
outline
|
||||
on:click={() => dispatch("refresh")}
|
||||
onclick={() => onRefresh()}
|
||||
disabled={refreshInterval != null}
|
||||
>
|
||||
<Icon name="arrow-clockwise" /> Refresh
|
||||
|
||||
Reference in New Issue
Block a user