-
-
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 all 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
88 changes: 88 additions & 0 deletions
88
frontend/src/lib/components/compose/ComposeEditorWrapper.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,88 @@ | ||
| <script lang="ts"> | ||
| import * as Alert from '$lib/components/ui/alert/index.js'; | ||
| import { ArcaneButton } from '$lib/components/arcane-button'; | ||
| import { AlertIcon, ExternalLinkIcon } from '$lib/icons'; | ||
| import * as m from '$lib/paraglide/messages'; | ||
| import { toast } from 'svelte-sonner'; | ||
| import { invalidateAll } from '$app/navigation'; | ||
| import type { Snippet } from 'svelte'; | ||
|
|
||
| let { | ||
| projectId, | ||
| projectName, | ||
| gitOpsManagedBy = undefined, | ||
| fileTitle, | ||
| serviceName = undefined, | ||
| isDirty, | ||
| onSave, | ||
| children | ||
| }: { | ||
| projectId: string; | ||
| projectName: string; | ||
| gitOpsManagedBy?: string; | ||
| fileTitle: string; | ||
| serviceName?: string; | ||
| isDirty: boolean; | ||
| onSave: () => Promise<void>; | ||
| children: Snippet; | ||
| } = $props(); | ||
|
|
||
| const isReadOnly = $derived(!!gitOpsManagedBy); | ||
| let isSaving = $state(false); | ||
|
|
||
| async function handleSave() { | ||
| isSaving = true; | ||
| try { | ||
| await onSave(); | ||
| toast.success(m.container_compose_save_success()); | ||
| await invalidateAll(); | ||
| } catch (err: unknown) { | ||
| const message = err instanceof Error ? err.message : m.container_compose_save_failed(); | ||
| toast.error(message); | ||
| } finally { | ||
| isSaving = false; | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <div class="flex h-full min-h-0 flex-col gap-4 p-4"> | ||
| {#if gitOpsManagedBy} | ||
| <Alert.Root variant="default"> | ||
| <AlertIcon class="size-4" /> | ||
| <Alert.Title>{m.container_compose_gitops_managed_title()}</Alert.Title> | ||
| <Alert.Description> | ||
| {m.container_compose_gitops_managed_description({ provider: gitOpsManagedBy })} | ||
| </Alert.Description> | ||
| </Alert.Root> | ||
| {/if} | ||
|
|
||
| <div class="bg-muted flex items-start gap-2 rounded-lg border px-4 py-3 text-sm"> | ||
| <span> | ||
| {#if serviceName} | ||
| {isReadOnly | ||
| ? m.container_compose_viewing_info({ file: fileTitle, project: projectName, service: serviceName }) | ||
| : m.container_compose_editing_info({ file: fileTitle, project: projectName, service: serviceName })} | ||
| {:else} | ||
| {isReadOnly | ||
| ? m.compose_editor_viewing_info({ file: fileTitle, project: projectName }) | ||
| : m.compose_editor_editing_info({ file: fileTitle, project: projectName })} | ||
| {/if} | ||
| </span> | ||
| </div> | ||
|
|
||
| <div class="flex min-h-0 flex-1 flex-col"> | ||
| {@render children()} | ||
| </div> | ||
|
|
||
| <div class="flex shrink-0 items-center gap-2"> | ||
| {#if !isReadOnly} | ||
| <ArcaneButton action="save" loading={isSaving} disabled={!isDirty} onclick={handleSave} /> | ||
| {/if} | ||
| <ArcaneButton | ||
| action="base" | ||
| href="/projects/{projectId}" | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import ComposeEditorWrapper from './ComposeEditorWrapper.svelte'; | ||
|
|
||
| export { ComposeEditorWrapper }; |
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
55 changes: 55 additions & 0 deletions
55
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,55 @@ | ||
| <script lang="ts"> | ||
| import { ComposeEditorWrapper } from '$lib/components/compose'; | ||
| import CodePanel from '../../projects/components/CodePanel.svelte'; | ||
| import { projectService } from '$lib/services/project-service'; | ||
| import type { Project, IncludeFile } from '$lib/types/project.type'; | ||
|
|
||
| let { | ||
| project, | ||
| serviceName, | ||
| includeFile = null, | ||
| rootFilename = 'compose.yml' | ||
| }: { | ||
| project: Project; | ||
| serviceName: string; | ||
| includeFile?: IncludeFile | null; | ||
| rootFilename?: string; | ||
| } = $props(); | ||
|
|
||
| const sourceContent = $derived(includeFile ? includeFile.content : (project.composeContent ?? '')); | ||
|
|
||
| let composeContent = $state(includeFile ? includeFile.content : (project.composeContent ?? '')); | ||
|
|
||
| const isDirty = $derived(composeContent !== sourceContent); | ||
|
|
||
| let panelOpen = $state(true); | ||
|
|
||
| const fileTitle = $derived(includeFile ? includeFile.relativePath : rootFilename); | ||
|
|
||
| async function save() { | ||
| if (includeFile) { | ||
| await projectService.updateProjectIncludeFile(project.id, includeFile.relativePath, composeContent); | ||
| } else { | ||
| await projectService.updateProject(project.id, undefined, composeContent); | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <ComposeEditorWrapper | ||
| projectId={project.id} | ||
| projectName={project.name} | ||
| gitOpsManagedBy={project.gitOpsManagedBy} | ||
| {fileTitle} | ||
| {serviceName} | ||
| {isDirty} | ||
| onSave={save} | ||
| > | ||
| <CodePanel | ||
| title={fileTitle} | ||
| bind:open={panelOpen} | ||
| language="yaml" | ||
| bind:value={composeContent} | ||
| readOnly={!!project.gitOpsManagedBy} | ||
| fileId="container-compose-{project.id}{includeFile ? `-${includeFile.relativePath.replace(/[^a-zA-Z0-9_-]/g, '-')}` : ''}" | ||
| /> | ||
| </ComposeEditorWrapper> |
Oops, something went wrong.
Oops, something went wrong.
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.