From a77074b29e85bac97d99c5d0172c3b0666d5e745 Mon Sep 17 00:00:00 2001 From: cyclane Date: Mon, 19 Jul 2021 01:24:09 +0100 Subject: [PATCH] Show code change --- src/components/Graphs.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Graphs.svelte b/src/components/Graphs.svelte index ab4ec33..7a00f27 100644 --- a/src/components/Graphs.svelte +++ b/src/components/Graphs.svelte @@ -5,6 +5,7 @@ import { getGraphs, getPermissions } from "../lib/api"; let add = false; + let showCode = false; let graphsPromise: ReturnType = new Promise(() => {}); $: if ($login !== undefined) { graphsPromise = getGraphs($login?.token); @@ -12,6 +13,9 @@ if (checkPermissions([Permissions.ADD_GRAPH], permissions)) { add = true; } + if (checkPermissions([Permissions.MANUAL_GRAPH], permissions)) { + showCode = true; + } }); } @@ -25,8 +29,10 @@ {#each graphs as graph}

{graph.data.name} #{graph.graph}

-

{graph.data.style}

- {graph.data.value} +

Style: {graph.data.style}

+ {#if showCode} + {graph.data.value} + {/if}
{/each}