diff --git a/apps/ui/src/lib/components/CopyVolumeField.svelte b/apps/ui/src/lib/components/CopyVolumeField.svelte new file mode 100644 index 000000000..d5e6b30c2 --- /dev/null +++ b/apps/ui/src/lib/components/CopyVolumeField.svelte @@ -0,0 +1,29 @@ + + +
+

{value}

+
+
+ + + + + +
+
+
diff --git a/apps/ui/src/routes/applications/[id]/_Storage.svelte b/apps/ui/src/routes/applications/[id]/_Storage.svelte index 6e91c7d8f..0e0e13b8b 100644 --- a/apps/ui/src/routes/applications/[id]/_Storage.svelte +++ b/apps/ui/src/routes/applications/[id]/_Storage.svelte @@ -7,12 +7,23 @@ import { del, post } from '$lib/api'; import { page } from '$app/stores'; import { createEventDispatcher } from 'svelte'; - + import { browser } from '$app/env'; import { t } from '$lib/translations'; import { errorNotification } from '$lib/common'; import { addToast } from '$lib/store'; + import CopyVolumeField from '$lib/components/CopyVolumeField.svelte'; const { id } = $page.params; - + let isHttps = browser && window.location.protocol === 'https:'; + export let value: string; + function copyToClipboard() { + if (isHttps && navigator.clipboard) { + navigator.clipboard.writeText(value); + addToast({ + message: 'Copied to clipboard.', + type: 'success' + }); + } + } const dispatch = createEventDispatcher(); async function saveStorage(newStorage = false) { try { @@ -69,18 +80,14 @@
{#if storage.applicationId} {#if storage.oldPath} - + /> {:else} - {/if} {/if}