1.0.15
This commit is contained in:
1 parent
9d2266dffe
commit
188ba1967d
87 files changed
+2103
-1774
No files matched your search
@@ -257,7 +257,7 @@
|
||||
onclick={handleCancel}
|
||||
disabled={saving}
|
||||
>
|
||||
<X class="w-4 h-4 mr-2" />
|
||||
<X class="w-4 h-4" />
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
@@ -265,7 +265,7 @@
|
||||
onclick={handleSave}
|
||||
disabled={saving || !imageLoaded}
|
||||
>
|
||||
<Check class="w-4 h-4 mr-2" />
|
||||
<Check class="w-4 h-4" />
|
||||
{saving ? 'Uploading...' : !imageLoaded ? 'Loading...' : 'Save avatar'}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -314,14 +314,15 @@
|
||||
for (const marker of markers) {
|
||||
// Find all occurrences of this variable in the text
|
||||
// Match ${VAR_NAME} or ${VAR_NAME:-...} or $VAR_NAME patterns
|
||||
// Use negative lookbehind (?<!\$) to skip escaped $$ (Docker Compose escape syntax)
|
||||
const patterns = [
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}:-([^}]*)\\}`, 'g'), hasDefault: true },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}-([^}]*)\\}`, 'g'), hasDefault: true },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}:\\?[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}\\?[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}:\\+[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`\\$\\{${marker.name}\\+[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}:-([^}]*)\\}`, 'g'), hasDefault: true },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}-([^}]*)\\}`, 'g'), hasDefault: true },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}:\\?[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}\\?[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}:\\+[^}]*\\}`, 'g'), hasDefault: false },
|
||||
{ regex: new RegExp(`(?<!\\$)\\$\\{${marker.name}\\+[^}]*\\}`, 'g'), hasDefault: false },
|
||||
];
|
||||
|
||||
for (const { regex, hasDefault } of patterns) {
|
||||
@@ -395,18 +396,19 @@
|
||||
// Check if this line contains any of our marked variables
|
||||
for (const marker of markers) {
|
||||
// Match ${VAR_NAME} or ${VAR_NAME:-...} patterns
|
||||
const patterns = [
|
||||
`\${${marker.name}}`,
|
||||
`\${${marker.name}:-`,
|
||||
`\${${marker.name}-`,
|
||||
`\${${marker.name}:?`,
|
||||
`\${${marker.name}?`,
|
||||
`\${${marker.name}:+`,
|
||||
`\${${marker.name}+`,
|
||||
`$${marker.name}`
|
||||
// Use regex with negative lookbehind to skip escaped $$ (Docker Compose escape syntax)
|
||||
const varPatterns = [
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}\\}`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}:-`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}-`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}:\\?`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}\\?`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}:\\+`),
|
||||
new RegExp(`(?<!\\$)\\$\\{${marker.name}\\+`),
|
||||
new RegExp(`(?<!\\$)\\$${marker.name}(?![a-zA-Z0-9_])`)
|
||||
];
|
||||
|
||||
const hasVariable = patterns.some(p => line.includes(p));
|
||||
const hasVariable = varPatterns.some(p => p.test(line));
|
||||
if (hasVariable) {
|
||||
gutterMarkers.push({
|
||||
from: pos,
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
onclick={resetToDefaults}
|
||||
title="Reset to defaults"
|
||||
>
|
||||
<RotateCcw class="w-3 h-3 mr-1" />
|
||||
<RotateCcw class="w-3 h-3" />
|
||||
Reset
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -428,7 +428,7 @@
|
||||
<Loader2 class="w-4 h-4 mr-2 animate-spin" />
|
||||
Removing...
|
||||
{:else}
|
||||
<Trash2 class="w-4 h-4 mr-2" />
|
||||
<Trash2 class="w-4 h-4" />
|
||||
Remove image
|
||||
{/if}
|
||||
</Button>
|
||||
@@ -437,7 +437,7 @@
|
||||
onclick={handleClose}
|
||||
disabled={isDeleting}
|
||||
>
|
||||
<CheckCircle2 class="w-4 h-4 mr-2" />
|
||||
<CheckCircle2 class="w-4 h-4" />
|
||||
Keep image
|
||||
</Button>
|
||||
{:else if showDeleteButton && pullStatus === 'complete' && !envHasScanning}
|
||||
@@ -451,7 +451,7 @@
|
||||
<Loader2 class="w-4 h-4 mr-2 animate-spin" />
|
||||
Removing...
|
||||
{:else}
|
||||
<Trash2 class="w-4 h-4 mr-2" />
|
||||
<Trash2 class="w-4 h-4" />
|
||||
Remove image
|
||||
{/if}
|
||||
</Button>
|
||||
@@ -460,7 +460,7 @@
|
||||
onclick={handleClose}
|
||||
disabled={isDeleting}
|
||||
>
|
||||
<CheckCircle2 class="w-4 h-4 mr-2" />
|
||||
<CheckCircle2 class="w-4 h-4" />
|
||||
Keep image
|
||||
</Button>
|
||||
{:else}
|
||||
@@ -476,7 +476,7 @@
|
||||
onclick={startPullFromConfigure}
|
||||
disabled={!configImageName.trim()}
|
||||
>
|
||||
<Download class="w-4 h-4 mr-2" />
|
||||
<Download class="w-4 h-4" />
|
||||
Pull
|
||||
</Button>
|
||||
{:else if pullStatus === 'complete' || scanStatus === 'complete'}
|
||||
|
||||
@@ -339,7 +339,7 @@
|
||||
<Loader2 class="w-4 h-4 mr-2 animate-spin" />
|
||||
Pulling...
|
||||
{:else}
|
||||
<Download class="w-4 h-4 mr-2" />
|
||||
<Download class="w-4 h-4" />
|
||||
Pull
|
||||
{/if}
|
||||
</Button>
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
<Shield class="w-12 h-12 opacity-50" />
|
||||
<p class="text-sm">Scan <code class="bg-muted px-1.5 py-0.5 rounded">{imageName}</code> for vulnerabilities</p>
|
||||
<Button onclick={startScan}>
|
||||
<Shield class="w-4 h-4 mr-2" />
|
||||
<Shield class="w-4 h-4" />
|
||||
Start scan
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
<p class="text-sm">No environment variables defined.</p>
|
||||
{#if !readonly}
|
||||
<Button type="button" variant="link" onclick={addVariable} class="mt-1 text-xs">
|
||||
<Plus class="w-3 h-3 mr-1" />
|
||||
<Plus class="w-3 h-3" />
|
||||
Add your first variable
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import StackEnvVarsEditor, { type EnvVar, type ValidationResult } from '$lib/components/StackEnvVarsEditor.svelte';
|
||||
import CodeEditor from '$lib/components/CodeEditor.svelte';
|
||||
import ConfirmPopover from '$lib/components/ConfirmPopover.svelte';
|
||||
import { Plus, Upload, Trash2, List, FileText, AlertTriangle, ShieldAlert, HelpCircle } from 'lucide-svelte';
|
||||
import { Plus, Upload, Trash2, List, FileText, AlertTriangle, ShieldAlert, HelpCircle, Info } from 'lucide-svelte';
|
||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||
|
||||
interface Props {
|
||||
@@ -18,6 +18,7 @@
|
||||
placeholder?: { key: string; value: string };
|
||||
infoText?: string;
|
||||
existingSecretKeys?: Set<string>;
|
||||
showInterpolationHint?: boolean;
|
||||
theme?: 'light' | 'dark';
|
||||
class?: string;
|
||||
onchange?: () => void;
|
||||
@@ -35,6 +36,7 @@
|
||||
placeholder = { key: 'VARIABLE_NAME', value: 'value' },
|
||||
infoText,
|
||||
existingSecretKeys = new Set<string>(),
|
||||
showInterpolationHint = false,
|
||||
theme = 'dark',
|
||||
class: className = '',
|
||||
onchange,
|
||||
@@ -54,6 +56,17 @@
|
||||
// Count of secrets (for display in hint)
|
||||
const secretCount = $derived(variables.filter(v => v.isSecret && v.key.trim()).length);
|
||||
|
||||
// Generate text representation from variables (non-secrets only)
|
||||
// This is used for text view display
|
||||
const generatedRawContent = $derived.by(() => {
|
||||
const nonSecrets = variables.filter(v => v.key.trim() && !v.isSecret);
|
||||
if (nonSecrets.length === 0) return '';
|
||||
return nonSecrets.map(v => `${v.key.trim()}=${v.value}`).join('\n') + '\n';
|
||||
});
|
||||
|
||||
// Text editor content - either from file (rawContent prop) or generated from variables
|
||||
const textEditorContent = $derived(rawContent.trim() ? rawContent : generatedRawContent);
|
||||
|
||||
/**
|
||||
* Sync variables with rawContent after initial load.
|
||||
* Pass the loaded data directly to avoid timing issues with bindable props.
|
||||
@@ -61,7 +74,7 @@
|
||||
*/
|
||||
export function syncAfterLoad(loadedVars: EnvVar[], loadedRaw: string) {
|
||||
if (!loadedRaw.trim()) {
|
||||
// No raw content - just use the loaded variables as-is
|
||||
// No raw content from file - just set variables, text view will use generatedRawContent
|
||||
variables = loadedVars;
|
||||
rawContent = '';
|
||||
return;
|
||||
@@ -298,7 +311,7 @@
|
||||
<HelpCircle class="w-3.5 h-3.5 text-muted-foreground cursor-help shrink-0" />
|
||||
</Tooltip.Trigger>
|
||||
<Tooltip.Content>
|
||||
<div class="w-64">
|
||||
<div class="w-80">
|
||||
<p class="text-xs text-left">{@html infoText}</p>
|
||||
</div>
|
||||
</Tooltip.Content>
|
||||
@@ -351,12 +364,12 @@
|
||||
{@render headerActions()}
|
||||
{/if}
|
||||
<Button type="button" size="sm" variant="ghost" onclick={handleLoadFromFile} class="h-6 text-xs px-2">
|
||||
<Upload class="w-3.5 h-3.5 mr-1" />
|
||||
<Upload class="w-3.5 h-3.5" />
|
||||
Load
|
||||
</Button>
|
||||
{#if viewMode === 'form'}
|
||||
<Button type="button" size="sm" variant="ghost" onclick={addEnvVariable} class="h-6 text-xs px-2">
|
||||
<Plus class="w-3.5 h-3.5 mr-1" />
|
||||
<Plus class="w-3.5 h-3.5" />
|
||||
Add
|
||||
</Button>
|
||||
{/if}
|
||||
@@ -377,7 +390,7 @@
|
||||
class="h-6 text-xs px-2 {hasContent ? 'text-destructive hover:text-destructive' : 'text-muted-foreground/50 cursor-not-allowed'}"
|
||||
disabled={!hasContent}
|
||||
>
|
||||
<Trash2 class="w-3.5 h-3.5 mr-1" />
|
||||
<Trash2 class="w-3.5 h-3.5" />
|
||||
Clear
|
||||
</Button>
|
||||
{/snippet}
|
||||
@@ -394,11 +407,47 @@
|
||||
</div>
|
||||
<!-- Help text -->
|
||||
{#if viewMode === 'form'}
|
||||
{#if showInterpolationHint}
|
||||
<div class="flex items-start gap-2 px-2.5 py-2 rounded bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800/50">
|
||||
<Info class="w-4 h-4 text-blue-500 shrink-0 mt-0.5" />
|
||||
<p class="text-xs text-blue-700 dark:text-blue-300">
|
||||
These variables are available for <strong>compose file interpolation</strong> using <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">${'{VAR_NAME}'}</code> syntax.
|
||||
To pass them to containers, reference them in the compose file's <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">environment:</code> section.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-wrap gap-x-3 gap-y-0.5 text-2xs text-zinc-400 dark:text-zinc-500 font-mono">
|
||||
<span><span class="text-zinc-500 dark:text-zinc-400">${`{VAR}`}</span> required</span>
|
||||
<span><span class="text-zinc-500 dark:text-zinc-400">${`{VAR:-default}`}</span> optional</span>
|
||||
<span><span class="text-zinc-500 dark:text-zinc-400">${`{VAR:?error}`}</span> required w/ error</span>
|
||||
</div>
|
||||
{:else if showInterpolationHint && secretCount > 0}
|
||||
<!-- Interpolation hint + secrets hint combined for text view -->
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<div class="flex items-start gap-2 px-2.5 py-2 rounded bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800/50">
|
||||
<Info class="w-4 h-4 text-blue-500 shrink-0 mt-0.5" />
|
||||
<p class="text-xs text-blue-700 dark:text-blue-300">
|
||||
These variables are available for <strong>compose file interpolation</strong> using <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">${'{VAR_NAME}'}</code> syntax.
|
||||
To pass them to containers, reference them in the compose file's <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">environment:</code> section.
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-start gap-2 px-2.5 py-2 rounded bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50">
|
||||
<ShieldAlert class="w-4 h-4 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div class="text-xs text-amber-700 dark:text-amber-300">
|
||||
<span class="font-medium">{secretCount} secret{secretCount === 1 ? '' : 's'} not shown.</span>
|
||||
<span class="text-amber-600 dark:text-amber-400">Secrets are never written to disk and are injected via shell environment when the stack starts.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if showInterpolationHint}
|
||||
<!-- Interpolation hint only (no secrets) -->
|
||||
<div class="flex items-start gap-2 px-2.5 py-2 rounded bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800/50">
|
||||
<Info class="w-4 h-4 text-blue-500 shrink-0 mt-0.5" />
|
||||
<p class="text-xs text-blue-700 dark:text-blue-300">
|
||||
These variables are available for <strong>compose file interpolation</strong> using <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">${'{VAR_NAME}'}</code> syntax.
|
||||
To pass them to containers, reference them in the compose file's <code class="bg-blue-100 dark:bg-blue-800/40 px-1 rounded">environment:</code> section.
|
||||
</p>
|
||||
</div>
|
||||
{:else if secretCount > 0}
|
||||
<!-- Text view hint about secrets (only shown when secrets exist) -->
|
||||
<div class="flex items-start gap-2 px-2.5 py-2 rounded bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50">
|
||||
@@ -459,7 +508,7 @@
|
||||
/>
|
||||
{:else}
|
||||
<CodeEditor
|
||||
value={rawContent}
|
||||
value={textEditorContent}
|
||||
language="dotenv"
|
||||
theme={theme}
|
||||
readonly={readonly}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { Label } from '$lib/components/ui/label';
|
||||
import { lightThemes, darkThemes, fonts, monospaceFonts } from '$lib/themes';
|
||||
import { themeStore, applyTheme, type FontSize } from '$lib/stores/theme';
|
||||
import { authStore } from '$lib/stores/auth';
|
||||
|
||||
// Preload all monospace Google Fonts so dropdown previews render correctly
|
||||
let monoFontsLoaded = $state(false);
|
||||
@@ -25,9 +26,12 @@
|
||||
|
||||
let { userId }: Props = $props();
|
||||
|
||||
// When editing global settings (no userId), skip applying theme visually
|
||||
// This prevents global theme changes from affecting the current user's session
|
||||
const skipApply = !userId;
|
||||
// Only skip applying theme visually when:
|
||||
// 1. Auth is enabled (there's a user session to protect)
|
||||
// 2. AND we're editing global settings (no userId - these are for login page)
|
||||
// When auth is disabled, always apply immediately since there's no user session
|
||||
// Default to skip during loading to avoid race conditions
|
||||
const skipApply = $derived($authStore.loading ? true : ($authStore.authEnabled && !userId));
|
||||
|
||||
// Local state bound to selects - initialized with defaults, will be populated on mount
|
||||
let selectedLightTheme = $state('default');
|
||||
|
||||
@@ -24,6 +24,22 @@
|
||||
let open = $state(false);
|
||||
let searchQuery = $state('');
|
||||
|
||||
/** Map of modern IANA names to canonical equivalents (for search matching) */
|
||||
const TIMEZONE_ALIASES: Record<string, string> = {
|
||||
'Europe/Kyiv': 'Europe/Kiev',
|
||||
'Asia/Ho_Chi_Minh': 'Asia/Saigon',
|
||||
'America/Nuuk': 'America/Godthab',
|
||||
'Pacific/Kanton': 'Pacific/Enderbury'
|
||||
};
|
||||
|
||||
// Reverse map: canonical → modern alias names (for display hints)
|
||||
const TIMEZONE_DISPLAY_HINTS: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(TIMEZONE_ALIASES).map(([modern, canonical]) => {
|
||||
const city = modern.split('/').pop()!.replace(/_/g, ' ');
|
||||
return [canonical, city];
|
||||
})
|
||||
);
|
||||
|
||||
// Common timezones to show at the top
|
||||
const commonTimezones = [
|
||||
'UTC',
|
||||
@@ -47,16 +63,26 @@
|
||||
// Other timezones (excluding common ones)
|
||||
const otherTimezones = allTimezones.filter((tz) => !commonTimezones.includes(tz));
|
||||
|
||||
// Check if a timezone matches the search query (including alias names)
|
||||
function matchesSearch(tz: string, query: string): boolean {
|
||||
const q = query.toLowerCase();
|
||||
if (tz.toLowerCase().includes(q)) return true;
|
||||
// Check if any alias points to this timezone
|
||||
const hint = TIMEZONE_DISPLAY_HINTS[tz];
|
||||
if (hint && hint.toLowerCase().includes(q)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter based on search query
|
||||
const filteredCommon = $derived(
|
||||
searchQuery
|
||||
? commonTimezones.filter((tz) => tz.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
? commonTimezones.filter((tz) => matchesSearch(tz, searchQuery))
|
||||
: commonTimezones
|
||||
);
|
||||
|
||||
const filteredOther = $derived(
|
||||
searchQuery
|
||||
? otherTimezones.filter((tz) => tz.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
? otherTimezones.filter((tz) => matchesSearch(tz, searchQuery))
|
||||
: otherTimezones
|
||||
);
|
||||
|
||||
@@ -78,7 +104,9 @@
|
||||
const parts = formatter.formatToParts(now);
|
||||
const offsetPart = parts.find((p) => p.type === 'timeZoneName');
|
||||
if (offsetPart) {
|
||||
return `${tz} (${offsetPart.value})`;
|
||||
const hint = TIMEZONE_DISPLAY_HINTS[tz];
|
||||
const extra = hint ? `, ${hint}` : '';
|
||||
return `${tz} (${offsetPart.value}${extra})`;
|
||||
}
|
||||
} catch {
|
||||
// If formatting fails, just return the timezone name
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
description="Add a Docker environment in Settings to get started"
|
||||
>
|
||||
<Button variant="secondary" onclick={() => goto('/settings?tab=environments')}>
|
||||
<Settings class="w-4 h-4 mr-2" />
|
||||
<Settings class="w-4 h-4" />
|
||||
Go to Settings
|
||||
</Button>
|
||||
</EmptyState>
|
||||
|
||||
Reference in new issue
Block a user