Show code change
This commit is contained in:
parent
2374023667
commit
a77074b29e
|
@ -5,6 +5,7 @@
|
||||||
import { getGraphs, getPermissions } from "../lib/api";
|
import { getGraphs, getPermissions } from "../lib/api";
|
||||||
|
|
||||||
let add = false;
|
let add = false;
|
||||||
|
let showCode = false;
|
||||||
let graphsPromise: ReturnType<typeof getGraphs> = new Promise(() => {});
|
let graphsPromise: ReturnType<typeof getGraphs> = new Promise(() => {});
|
||||||
$: if ($login !== undefined) {
|
$: if ($login !== undefined) {
|
||||||
graphsPromise = getGraphs($login?.token);
|
graphsPromise = getGraphs($login?.token);
|
||||||
|
@ -12,6 +13,9 @@
|
||||||
if (checkPermissions([Permissions.ADD_GRAPH], permissions)) {
|
if (checkPermissions([Permissions.ADD_GRAPH], permissions)) {
|
||||||
add = true;
|
add = true;
|
||||||
}
|
}
|
||||||
|
if (checkPermissions([Permissions.MANUAL_GRAPH], permissions)) {
|
||||||
|
showCode = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -25,8 +29,10 @@
|
||||||
{#each graphs as graph}
|
{#each graphs as graph}
|
||||||
<a class="item" href="{hrefPrefix}/graph/{graph.graph}">
|
<a class="item" href="{hrefPrefix}/graph/{graph.graph}">
|
||||||
<h2>{graph.data.name} <span>#{graph.graph}</span></h2>
|
<h2>{graph.data.name} <span>#{graph.graph}</span></h2>
|
||||||
<p>{graph.data.style}</p>
|
<p><strong>Style: </strong>{graph.data.style}</p>
|
||||||
<code>{graph.data.value}</code>
|
{#if showCode}
|
||||||
|
<code>{graph.data.value}</code>
|
||||||
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
<!-- svelte-ignore a11y-missing-content -->
|
<!-- svelte-ignore a11y-missing-content -->
|
||||||
|
|
Loading…
Reference in New Issue