This commit is contained in:
jarek committed 2026-02-16 08:46:56 +01:00
1 parent d83ca684d7
commit 8ee4fe4d68
49 files changed
+2126 -261

No files matched your search

@@ -4,7 +4,9 @@
import * as Tabs from '$lib/components/ui/tabs';
import { Button } from '$lib/components/ui/button';
import { Badge } from '$lib/components/ui/badge';
import { Loader2, Box, Info, Layers, Cpu, MemoryStick, HardDrive, Network, Shield, Settings2, Code, Copy, Check, Activity, Wifi, Pencil, RefreshCw, X, FolderOpen, Moon, Tags, ExternalLink, Gpu } from 'lucide-svelte';
import { Loader2, Box, Info, Layers, Cpu, MemoryStick, HardDrive, Network, Shield, Settings2, Code, Copy, Check, XCircle, Activity, Wifi, Pencil, RefreshCw, X, FolderOpen, Moon, Tags, ExternalLink, Gpu } from 'lucide-svelte';
import * as Tooltip from '$lib/components/ui/tooltip';
import { copyToClipboard } from '$lib/utils/clipboard';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
import { currentEnvironment, appendEnvParam, environments } from '$lib/stores/environment';
@@ -41,18 +43,20 @@
// Raw JSON modal state
let showRawJson = $state(false);
let jsonCopied = $state(false);
let jsonCopied = $state<'ok' | 'error' | null>(null);
// Label copy state
let copiedLabel = $state<string | null>(null);
let copyLabelFailed = $state(false);
async function copyLabel(key: string, value: string) {
try {
await navigator.clipboard.writeText(`${key}=${value}`);
const ok = await copyToClipboard(`${key}=${value}`);
if (ok) {
copiedLabel = key;
setTimeout(() => copiedLabel = null, 2000);
} catch (err) {
console.error('Failed to copy:', err);
} else {
copyLabelFailed = true;
setTimeout(() => copyLabelFailed = false, 2000);
}
}
@@ -391,13 +395,9 @@
async function copyJson() {
if (containerData) {
try {
await navigator.clipboard.writeText(JSON.stringify(containerData, null, 2));
jsonCopied = true;
setTimeout(() => jsonCopied = false, 2000);
} catch (err) {
console.error('Failed to copy:', err);
}
const ok = await copyToClipboard(JSON.stringify(containerData, null, 2));
jsonCopied = ok ? 'ok' : 'error';
setTimeout(() => jsonCopied = null, 2000);
}
}
@@ -1368,9 +1368,17 @@
variant="outline"
size="sm"
onclick={copyJson}
title={jsonCopied ? 'Copied!' : 'Copy to clipboard'}
title={jsonCopied === 'ok' ? 'Copied!' : 'Copy to clipboard'}
>
{#if jsonCopied}
{#if jsonCopied === 'error'}
<Tooltip.Root open>
<Tooltip.Trigger>
<XCircle class="w-4 h-4 mr-1.5 text-red-500" />
</Tooltip.Trigger>
<Tooltip.Content>Copy requires HTTPS</Tooltip.Content>
</Tooltip.Root>
<span class="text-red-500">Failed</span>
{:else if jsonCopied === 'ok'}
<Check class="w-4 h-4 mr-1.5 text-green-500" />
<span class="text-green-500">Copied!</span>
{:else}