feat(web): pause and resume jobs (#2125)

* feat(web): pause and resume jobs

* add bg color to status instead of using badge

* styling

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Michel Heusschen
2023-04-01 06:53:20 +02:00
committed by GitHub
parent 23e4449f27
commit aaaf1a6cf8
7 changed files with 219 additions and 174 deletions

View File

@@ -1,7 +1,26 @@
<script>
<script lang="ts">
import JobsPanel from '$lib/components/admin-page/jobs/jobs-panel.svelte';
import { api } from '@api';
import { onDestroy, onMount } from 'svelte';
import type { PageData } from './$types';
export let data: PageData;
let jobs = data.jobs;
let timer: NodeJS.Timer;
const load = async () => {
const { data } = await api.jobApi.getAllJobsStatus();
jobs = data;
};
onMount(async () => {
await load();
timer = setInterval(load, 5_000);
});
onDestroy(() => {
clearInterval(timer);
});
</script>
<section>
<JobsPanel />
</section>
<JobsPanel {jobs} />