feedback: add jobID copy btn to jobInfo

This commit is contained in:
Christoph Kluge 2024-10-21 15:45:27 +02:00
parent ca9fd96baa
commit 82e28f26d7

View File

@ -7,7 +7,7 @@
--> -->
<script> <script>
import { Badge, Icon } from "@sveltestrap/sveltestrap"; import { Badge, Button, Icon } from "@sveltestrap/sveltestrap";
import { scrambleNames, scramble } from "../utils.js"; import { scrambleNames, scramble } from "../utils.js";
import Tag from "../helper/Tag.svelte"; import Tag from "../helper/Tag.svelte";
import TagManagement from "../helper/TagManagement.svelte"; import TagManagement from "../helper/TagManagement.svelte";
@ -38,16 +38,35 @@
return "danger"; return "danger";
} }
} }
let displayCheck = false;
function clipJobId(jid) {
displayCheck = true;
navigator.clipboard
.writeText(jid)
.catch((reason) => console.error(reason));
setTimeout(function () {
displayCheck = false;
}, 1500);
}
</script> </script>
<div> <div>
<p class="mb-2"> <p class="mb-2">
<span class="fw-bold" <span class="d-flex justify-content-between">
><a href="/monitoring/job/{job.id}" target="_blank">{job.jobId}</a> <span class="align-self-center fw-bold mr-2">
({job.cluster})</span <a href="/monitoring/job/{job.id}" target="_blank">{job.jobId}</a>
> ({job.cluster})
</span>
<Button outline color="secondary" size="sm" title="Copy JobID to Clipboard" on:click={clipJobId(job.jobId)} >
{#if displayCheck}
<Icon name="clipboard2-check-fill"/> Copied
{:else}
<Icon name="clipboard2"/> Job ID
{/if}
</Button>
</span>
{#if job.metaData?.jobName} {#if job.metaData?.jobName}
<br />
{#if job.metaData?.jobName.length <= 25} {#if job.metaData?.jobName.length <= 25}
<div>{job.metaData.jobName}</div> <div>{job.metaData.jobName}</div>
{:else} {:else}