1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-31 18:29:28 +00:00

46 lines
927 B
Svelte
Raw Normal View History

2023-06-07 21:52:43 +02:00
<script>
import Icon from '$components/icon.svelte';
import ObjectGrid from '$components/objectgrid.svelte';
export let host;
let copySucceeded = false;
async function copy() {
2023-06-11 09:34:00 +02:00
const json = JSON.stringify(host.systemInfo, undefined, '\t');
2023-06-07 21:52:43 +02:00
await navigator.clipboard.writeText(json);
copySucceeded = true;
setTimeout(() => copySucceeded = false, 1500);
}
</script>
<div class="stats">
<!-- <CodeExample code="db.stats()" /> -->
<div class="grid">
<ObjectGrid data={host.systemInfo} />
</div>
<div class="buttons">
<button class="btn secondary" on:click={copy}>
<Icon name={copySucceeded ? 'check' : 'clipboard'} />
Copy JSON
</button>
</div>
</div>
<style>
.stats {
display: grid;
gap: 0.5rem;
grid-template: 1fr auto / 1fr;
}
.stats .grid {
overflow: auto;
min-height: 0;
min-width: 0;
border: 1px solid #ccc;
}
</style>