From dcb8308f35a3c32a18fc7463dd785d8be496df44 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Mon, 30 Sep 2024 12:27:32 +0200 Subject: [PATCH] add icons to energySummary component --- internal/graph/schema.resolvers.go | 2 +- web/frontend/src/job/EnergySummary.svelte | 34 +++++++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go index 8c5ee0d..bde7013 100644 --- a/internal/graph/schema.resolvers.go +++ b/internal/graph/schema.resolvers.go @@ -99,7 +99,7 @@ func (r *jobResolver) EnergyFootprint(ctx context.Context, obj *schema.Job) ([]* case matchCore.MatchString(test): hwType = "Core" default: - hwType = "Hardware" + hwType = "Other" } res = append(res, &model.EnergyFootprintValue{ diff --git a/web/frontend/src/job/EnergySummary.svelte b/web/frontend/src/job/EnergySummary.svelte index 70e419f..e614865 100644 --- a/web/frontend/src/job/EnergySummary.svelte +++ b/web/frontend/src/job/EnergySummary.svelte @@ -15,6 +15,7 @@ Tooltip, Row, Col, + Icon } from "@sveltestrap/sveltestrap"; import { round } from "mathjs"; @@ -34,7 +35,22 @@ {#each job.energyFootprint as efp} -
{efp.hardware}: {efp.value} Wh ({efp.metric})
+
+ {#if efp.hardware === 'CPU'} + + {:else if efp.hardware === 'Accelerator'} + + {:else if efp.hardware === 'Memory'} + + {:else if efp.hardware === 'Core'} + + {:else} + + {/if} + +
+
+
{efp.hardware}: {efp.value} Wh ({efp.metric})
Estimated energy consumption based on metric {efp.metric} and job runtime. {/each} - -
Total Energy: {job?.energy? job.energy : 0} Wh
+ +
+ +
+
+
Total Energy: {job?.energy? job.energy : 0} Wh
{#if carbonPerkWh} - -
Carbon Emission: {carbonMass} kg
+ +
+ +
+
+
Carbon Emission: {carbonMass} kg
{/if}