From 9f09d60a83814bb794af9bc9936fae75ffc27474 Mon Sep 17 00:00:00 2001 From: Nenad Stojanovikj Date: Sun, 19 Jul 2026 14:03:55 +0200 Subject: [PATCH] Allow viewing Git stack YAML Open Git-sourced stack compose files in a read-only editor and graph while keeping repository settings separate. Co-authored-by: Cursor --- src/routes/stacks/+page.svelte | 22 ++++++--- src/routes/stacks/ComposeGraphViewer.svelte | 7 ++- src/routes/stacks/PathBarItem.svelte | 18 +++---- src/routes/stacks/StackModal.svelte | 52 ++++++++++++++------- 4 files changed, 66 insertions(+), 33 deletions(-) diff --git a/src/routes/stacks/+page.svelte b/src/routes/stacks/+page.svelte index 40de952..d8dcf7d 100644 --- a/src/routes/stacks/+page.svelte +++ b/src/routes/stacks/+page.svelte @@ -65,6 +65,7 @@ let showGitModal = $state(false); let showImportModal = $state(false); let editingStackName = $state(''); + let stackModalReadonly = $state(false); let editingGitStack = $state(null); let envId = $state(null); @@ -1048,6 +1049,13 @@ function editStack(name: string) { editingStackName = name; + stackModalReadonly = false; + showEditModal = true; + } + + function viewGitStack(name: string) { + editingStackName = name; + stackModalReadonly = true; showEditModal = true; } @@ -1593,19 +1601,17 @@ {#if column.id === 'name'} {@const systemType = getStackSystemType(stack)} - {#if source.sourceType !== 'git'} - - {:else} - - {stack.name} - {/if} {#if systemType} @@ -2515,9 +2521,11 @@ bind:open={showEditModal} mode="edit" stackName={editingStackName} + readonly={stackModalReadonly} onClose={() => { showEditModal = false; editingStackName = ''; + stackModalReadonly = false; }} onSuccess={fetchStacks} /> diff --git a/src/routes/stacks/ComposeGraphViewer.svelte b/src/routes/stacks/ComposeGraphViewer.svelte index 328bcd8..36e54f3 100644 --- a/src/routes/stacks/ComposeGraphViewer.svelte +++ b/src/routes/stacks/ComposeGraphViewer.svelte @@ -19,9 +19,10 @@ composeContent: string; class?: string; onContentChange?: (content: string) => void; + readonly?: boolean; } - let { composeContent, class: className = '', onContentChange }: Props = $props(); + let { composeContent, class: className = '', onContentChange, readonly = false }: Props = $props(); let containerEl: HTMLDivElement | null = $state(null); let cy: cytoscape.Core | null = null; @@ -2103,6 +2104,7 @@
+ {#if !readonly}
@@ -2333,7 +2336,7 @@
- {#if selectedNode || selectedEdge} + {#if !readonly && (selectedNode || selectedEdge)}
{#if selectedNode} diff --git a/src/routes/stacks/PathBarItem.svelte b/src/routes/stacks/PathBarItem.svelte index 3ac8837..a4a9b24 100644 --- a/src/routes/stacks/PathBarItem.svelte +++ b/src/routes/stacks/PathBarItem.svelte @@ -7,7 +7,7 @@ path: string | null; placeholder: string; onCopy: () => void; - onBrowse: () => void; + onBrowse?: () => void; onChangeLocation?: () => void; // Optional: relocate entire folder defaultText?: string; isSuggested?: boolean; @@ -58,13 +58,15 @@ > {displayPath.truncated || defaultText} - + {#if onBrowse} + + {/if} {#if onChangeLocation} + {#if readonly} + + {:else} + + {/if} - {#if mode === 'create'} + {#if !readonly && mode === 'create'} - {:else} + {:else if !readonly}