Move concurrentJobs as field to main job query

This commit is contained in:
Christoph Kluge
2023-05-16 12:42:06 +02:00
parent a337482fa2
commit 270750a78d
7 changed files with 153 additions and 184 deletions

View File

@@ -12,11 +12,9 @@
<script>
import Tag from '../Tag.svelte';
import { Badge, Icon } from 'sveltestrap';
import { operationStore, query} from '@urql/svelte'
export let job;
export let jobTags = job.tags;
export let showParallelJobs = false
function formatDuration(duration) {
const hours = Math.floor(duration / 3600);
@@ -27,26 +25,6 @@
return `${hours}:${('0' + minutes).slice(-2)}:${('0' + seconds).slice(-2)}`;
}
const filter = [
{exclusive: job.exclusive},
{sharedNode: {contains: job.resources[0].hostname }},
{selfJobId: {neq: job.jobId }},
{selfStartTime: job.startTime, selfDuration: job.duration}
]
const parallelJobs = operationStore(`
query($filter: [JobFilter!]!){
jobsParallel(filter: $filter) {
items { id, jobId }
count
}
}`, {
filter
})
if (showParallelJobs) {
query(parallelJobs)
}
</script>
<div>
@@ -80,19 +58,6 @@
{scrambleNames ? scramble(job.project) : job.project}
</a>
{/if}
{#if showParallelJobs && $parallelJobs.data != null}
<br/>
<Icon name="diagram-3-fill"/>
{#if $parallelJobs.data.jobsParallel.count == 0}
No Parallel Jobs
{:else}
{#each $parallelJobs.data.jobsParallel.items as pjob, index}
<a href="/monitoring/job/{pjob.id}" target="_blank">
{pjob.jobId}{#if index != $parallelJobs.data.jobsParallel.count - 1},{/if}
</a>
{/each}
{/if}
{/if}
</p>
<p>