Migrate JobSummary and subcomponents

This commit is contained in:
Christoph Kluge 2025-06-13 15:49:51 +02:00
parent b7823cec16
commit 6dde2a1e59
3 changed files with 96 additions and 81 deletions

View File

@ -18,9 +18,12 @@
import JobFootprintPolar from "./jobsummary/JobFootprintPolar.svelte"; import JobFootprintPolar from "./jobsummary/JobFootprintPolar.svelte";
export let job; /* Svelte 5 Props */
export let width = "auto"; let {
export let height = "400px"; job,
width = "auto",
height = "400px",
} = $props();
const showFootprintTab = !!getContext("cc-config")[`job_view_showFootprint`]; const showFootprintTab = !!getContext("cc-config")[`job_view_showFootprint`];
</script> </script>

View File

@ -17,10 +17,16 @@
} from "@sveltestrap/sveltestrap"; } from "@sveltestrap/sveltestrap";
import { findJobFootprintThresholds } from "../../generic/utils.js"; import { findJobFootprintThresholds } from "../../generic/utils.js";
export let job; /* Svelte 5 Props */
let {job} = $props();
/* Derived */
// Prepare Job Footprint Data Based On Values Saved In Database // Prepare Job Footprint Data Based On Values Saved In Database
const jobFootprintData = job?.footprint?.map((jf) => { const jobFootprintData = $derived(buildFootprint(job?.footprint));
/* Functions */
function buildFootprint(input) {
let result = input?.map((jf) => {
const fmc = getContext("getMetricConfig")(job.cluster, job.subCluster, jf.name); const fmc = getContext("getMetricConfig")(job.cluster, job.subCluster, jf.name);
if (fmc) { if (fmc) {
// Unit // Unit
@ -91,6 +97,9 @@
return a.impact - b.impact || ((a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0)); return a.impact - b.impact || ((a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0));
});; });;
return result
};
function evalFootprint(value, thresholds, lowerIsBetter, level) { function evalFootprint(value, thresholds, lowerIsBetter, level) {
// Handle Metrics in which less value is better // Handle Metrics in which less value is better
switch (level) { switch (level) {
@ -161,7 +170,7 @@
>{fpd.message}</Tooltip >{fpd.message}</Tooltip
> >
</div> </div>
<Row cols={12} class="{(jobFootprintData.length == (index + 1)) ? 'mb-0' : 'mb-2'}"> <Row cols={12} class={(jobFootprintData.length == (index + 1)) ? 'mb-0' : 'mb-2'}>
{#if fpd.dir} {#if fpd.dir}
<Col xs="1"> <Col xs="1">
<Icon name="caret-left-fill" /> <Icon name="caret-left-fill" />

View File

@ -20,8 +20,10 @@
import Polar from "../../generic/plots/Polar.svelte"; import Polar from "../../generic/plots/Polar.svelte";
import { findJobFootprintThresholds } from "../../generic/utils.js"; import { findJobFootprintThresholds } from "../../generic/utils.js";
export let job; /* Svelte 5 Props */
let { job } = $props();
/* Const Init */
// Metric Names Configured To Be Footprints For (sub)Cluster // Metric Names Configured To Be Footprints For (sub)Cluster
const clusterFootprintMetrics = getContext("clusters") const clusterFootprintMetrics = getContext("clusters")
.find((c) => c.name == job.cluster)?.subClusters .find((c) => c.name == job.cluster)?.subClusters
@ -51,11 +53,12 @@
} }
`; `;
$: polarData = queryStore({ /* Derived */
const polarData = $derived(queryStore({
client: client, client: client,
query: polarQuery, query: polarQuery,
variables:{ dbid: job.id, selectedMetrics: clusterFootprintMetrics }, variables:{ dbid: job.id, selectedMetrics: clusterFootprintMetrics },
}); }));
</script> </script>
<CardBody> <CardBody>