-
-
Notifications
You must be signed in to change notification settings - Fork 165
feat(containers): compose editor + compose tab improvements #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kmendell
merged 29 commits into
getarcaneapp:main
from
mkaltner:feat/container-compose-editor
Mar 21, 2026
Merged
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a0e1dcb
feat(containers): add read-only compose tab for compose-managed conta…
mkaltner 6813d19
feat(containers): add compose editor tab with project lookup and Cont…
mkaltner fe66c2d
feat(containers): hide Compose tab when service is in an included sub…
mkaltner f420641
fix(containers): fix showComposeTab reactivity — use IIFE inside $der…
mkaltner 5833a61
feat(containers): show and edit the specific service's compose file (…
mkaltner 788ba6c
style(containers): apply prettier formatting to compose panel files
mkaltner 678f8f2
refactor(containers): move compose detection to backend and add i18n
mkaltner ae3c39a
Merge upstream main into feat/container-compose-editor
1d802f1
fix(containers): address code review feedback on compose panel
14078fb
Merge branch 'main' into feat/container-compose-editor
mkaltner 75c6c62
Fix Greptile feedback: use $derived for isDirty and escape HTML in us…
74864d8
fix: address Greptile security and code quality feedback
5ae992b
fix: wire up i18n messages and add cache invalidation (greptile)
b26d63e
fix: remove dead ConfigFile code and prevent stale content on contain…
mkaltner 8a91378
Merge branch 'main' into feat/container-compose-editor
mkaltner 63bd939
fix: sanitize fileId and memoize YAML parsing
2521a72
fix: remove XSS vector and fix $state mutations in $effect
78ddf74
fix: resolve Svelte 5 reactivity rule violations
ba62a3d
fix: include project.id in {#key} to prevent cross-project collision
623ad66
Merge branch 'main' into feat/container-compose-editor
mkaltner c844b33
fix: disable save when !isDirty + cache project list query
9a52e52
Merge branch 'main' into feat/container-compose-editor
mkaltner fe0cbbc
Merge branch 'main' into feat/container-compose-editor
mkaltner bb6fd79
fix(containers): address Greptile review feedback
mkaltner 436e0a1
Merge branch 'main' into feat/container-compose-editor
mkaltner e9e3605
Merge branch 'main' into feat/container-compose-editor
kmendell b52ac45
refactor(frontend): extract shared ComposeEditorWrapper component (#6)
mkaltner f2829a7
Merge branch 'main' into feat/container-compose-editor
mkaltner 5dfa342
Merge branch 'main' into feat/container-compose-editor
kmendell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
frontend/src/routes/(app)/containers/components/ContainerComposePanel.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| <script lang="ts"> | ||
| import * as Alert from '$lib/components/ui/alert/index.js'; | ||
| import { ArcaneButton } from '$lib/components/arcane-button'; | ||
| import CodePanel from '../../projects/components/CodePanel.svelte'; | ||
| import { projectService } from '$lib/services/project-service'; | ||
| import { toast } from 'svelte-sonner'; | ||
| import type { Project, IncludeFile } from '$lib/types/project.type'; | ||
| import { AlertIcon, ExternalLinkIcon } from '$lib/icons'; | ||
| import * as m from '$lib/paraglide/messages'; | ||
|
|
||
| let { | ||
| project, | ||
| serviceName, | ||
| includeFile = null | ||
| }: { | ||
| project: Project; | ||
| serviceName: string; | ||
| includeFile?: IncludeFile | null; | ||
| } = $props(); | ||
|
|
||
| const sourceContent = $derived(includeFile ? includeFile.content : (project.composeContent ?? '')); | ||
|
|
||
| let composeContent = $state(sourceContent); | ||
| let isDirty = $state(false); | ||
|
|
||
| // Update composeContent when source changes (e.g., switching containers) | ||
| // Only if there are no unsaved edits | ||
| let prevSourceContent = $state(sourceContent); | ||
| $effect(() => { | ||
| if (sourceContent !== prevSourceContent && !isDirty) { | ||
| composeContent = sourceContent; | ||
| prevSourceContent = sourceContent; | ||
| } | ||
| }); | ||
greptile-apps[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Track dirty state when content changes | ||
| $effect(() => { | ||
| isDirty = composeContent !== sourceContent; | ||
| }); | ||
mkaltner marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| let panelOpen = $state(true); | ||
| let isSaving = $state(false); | ||
|
|
||
| const isReadOnly = $derived(!!project.gitOpsManagedBy); | ||
| const fileTitle = $derived(includeFile ? includeFile.relativePath : 'compose.yml'); | ||
mkaltner marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| async function handleSave() { | ||
| isSaving = true; | ||
| try { | ||
| if (includeFile) { | ||
| await projectService.updateProjectIncludeFile(project.id, includeFile.relativePath, composeContent); | ||
| } else { | ||
| await projectService.updateProject(project.id, undefined, composeContent); | ||
| } | ||
| toast.success(m.container_compose_save_success()); | ||
| isDirty = false; | ||
| } catch (err: any) { | ||
| toast.error(err?.message ?? m.container_compose_save_failed()); | ||
| } finally { | ||
| isSaving = false; | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <div class="flex h-full min-h-0 flex-col gap-4 p-4"> | ||
| {#if project.gitOpsManagedBy} | ||
| <Alert.Root variant="default"> | ||
| <AlertIcon class="size-4" /> | ||
| <Alert.Title>{m.container_compose_gitops_managed_title()}</Alert.Title> | ||
| <Alert.Description> | ||
| {@html m.container_compose_gitops_managed_description({ provider: `<strong>${project.gitOpsManagedBy}</strong>` })} | ||
| </Alert.Description> | ||
| </Alert.Root> | ||
| {/if} | ||
|
|
||
| <div class="bg-muted flex items-start gap-2 rounded-lg border px-4 py-3 text-sm"> | ||
| <span> | ||
| {@html isReadOnly | ||
| ? m.container_compose_viewing_info({ | ||
| file: `<strong>${fileTitle}</strong>`, | ||
| project: `<a href="/projects/${project.id}" class="text-primary font-medium hover:underline">${project.name}</a>`, | ||
| service: `<strong>${serviceName}</strong>` | ||
| }) | ||
| : m.container_compose_editing_info({ | ||
| file: `<strong>${fileTitle}</strong>`, | ||
| project: `<a href="/projects/${project.id}" class="text-primary font-medium hover:underline">${project.name}</a>`, | ||
| service: `<strong>${serviceName}</strong>` | ||
| })} | ||
| </span> | ||
| </div> | ||
mkaltner marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <div class="flex min-h-0 flex-1 flex-col"> | ||
| <CodePanel | ||
| title={fileTitle} | ||
| bind:open={panelOpen} | ||
| language="yaml" | ||
| bind:value={composeContent} | ||
| readOnly={isReadOnly} | ||
| fileId="container-compose-{project.id}{includeFile ? `-${includeFile.relativePath}` : ''}" | ||
greptile-apps[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /> | ||
| </div> | ||
|
|
||
| <div class="flex shrink-0 items-center gap-2"> | ||
| {#if !isReadOnly} | ||
| <ArcaneButton action="save" loading={isSaving} onclick={handleSave} /> | ||
| {/if} | ||
greptile-apps[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <ArcaneButton | ||
| action="base" | ||
| href="/projects/{project.id}" | ||
| icon={ExternalLinkIcon} | ||
| customLabel={m.container_compose_view_project()} | ||
| /> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.