mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Added copy button to error messages
This commit is contained in:
parent
58dd9de4ba
commit
a12417d4e9
@ -18,7 +18,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<p class="title">{title}</p>
|
<p class="title">{title}</p>
|
||||||
<p>{label}</p>
|
<p class="label">{label}</p>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
height: 150px;
|
height: 150px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
.content :global(svg) {
|
.content > :global(svg) {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onDestroy } from 'svelte';
|
||||||
import BlankState from './blankstate.svelte';
|
import BlankState from './blankstate.svelte';
|
||||||
import GridItems from './grid-items.svelte';
|
import GridItems from './grid-items.svelte';
|
||||||
|
import Icon from './icon.svelte';
|
||||||
|
|
||||||
export let columns = [];
|
export let columns = [];
|
||||||
export let items = [];
|
export let items = [];
|
||||||
@ -16,6 +18,17 @@
|
|||||||
export let errorTitle = '';
|
export let errorTitle = '';
|
||||||
export let errorDescription = '';
|
export let errorDescription = '';
|
||||||
export let busy = false;
|
export let busy = false;
|
||||||
|
|
||||||
|
let copySucceeded = false;
|
||||||
|
let timeout;
|
||||||
|
|
||||||
|
async function copyErrorDescription() {
|
||||||
|
await navigator.clipboard.writeText(errorDescription);
|
||||||
|
copySucceeded = true;
|
||||||
|
timeout = setTimeout(() => copySucceeded = false, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
onDestroy(() => clearTimeout(timeout));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
@ -33,7 +46,11 @@
|
|||||||
{#if busy}
|
{#if busy}
|
||||||
<BlankState label={(busy === true) ? 'Loading…' : busy} icon="loading" />
|
<BlankState label={(busy === true) ? 'Loading…' : busy} icon="loading" />
|
||||||
{:else if errorTitle || errorDescription}
|
{:else if errorTitle || errorDescription}
|
||||||
<BlankState title={errorTitle} label={errorDescription} icon="!" />
|
<BlankState title={errorTitle} label={errorDescription} icon="!">
|
||||||
|
<button class="button-small" on:click={copyErrorDescription}>
|
||||||
|
<Icon name={copySucceeded ? 'check' : 'clipboard'} /> Copy error message
|
||||||
|
</button>
|
||||||
|
</BlankState>
|
||||||
{:else}
|
{:else}
|
||||||
<table>
|
<table>
|
||||||
{#if showHeaders && columns.some(col => col.title)}
|
{#if showHeaders && columns.some(col => col.title)}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
}
|
}
|
||||||
li {
|
li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
flex-grow: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +101,7 @@
|
|||||||
border-color: #00008b;
|
border-color: #00008b;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.tabs.multiline button.tab .label {
|
nav.tabs.multiline button.tab .label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
|
Loading…
Reference in New Issue
Block a user