From cff3df6c6faac0fde2a55cab8ddb4e767f941fa0 Mon Sep 17 00:00:00 2001 From: Alexander Petric Date: Tue, 18 Nov 2025 18:02:04 -0500 Subject: [PATCH] feat: support secondary promotion repos in git sync settings (#7173) --- .../git_sync/GitSyncContext.svelte.ts | 4 +- .../git_sync/GitSyncRepositoryCard.svelte | 17 +++- .../components/git_sync/GitSyncSection.svelte | 91 +++++++++++++------ 3 files changed, 76 insertions(+), 36 deletions(-) diff --git a/frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts b/frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts index c23ccf590e..33c2f2fa5c 100644 --- a/frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts +++ b/frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts @@ -595,7 +595,7 @@ export function createGitSyncContext(workspace: string) { return result } - function getLegacyPromotionRepositories(): { repo: GitSyncRepository, idx: number }[] { + function getSecondaryPromotionRepositories(): { repo: GitSyncRepository, idx: number }[] { const result: { repo: GitSyncRepository, idx: number }[] = [] let foundFirst = false repositories.forEach((repo, idx) => { @@ -736,7 +736,7 @@ export function createGitSyncContext(workspace: string) { getPrimarySyncRepository, getPrimaryPromotionRepository, getSecondarySyncRepositories, - getLegacyPromotionRepositories, + getSecondaryPromotionRepositories, // Helper methods getTargetBranch, diff --git a/frontend/src/lib/components/git_sync/GitSyncRepositoryCard.svelte b/frontend/src/lib/components/git_sync/GitSyncRepositoryCard.svelte index 85c19362d7..c5700622d4 100644 --- a/frontend/src/lib/components/git_sync/GitSyncRepositoryCard.svelte +++ b/frontend/src/lib/components/git_sync/GitSyncRepositoryCard.svelte @@ -94,10 +94,19 @@ : isLegacy ? 'Legacy promotion repository' : isSecondary - ? 'Secondary sync repository' + ? repo?.use_individual_branch + ? 'Secondary promotion repository' + : 'Secondary sync repository' : `Repository #${(idx ?? 0) + 1}` ) + // Determine the actual mode based on repository configuration + const repoMode = $derived<'sync' | 'promotion'>( + variant === 'primary-promotion' || variant === 'legacy' || repo?.use_individual_branch + ? 'promotion' + : 'sync' + ) + // Determine display description based on variant and mode const displayDescription = $derived( variant === 'primary-sync' || variant === 'primary-promotion' @@ -353,7 +362,7 @@ {#if repo.isUnsavedConnection && !emptyString(repo.git_repo_resource_path) && idx !== null} {:else}
diff --git a/frontend/src/lib/components/git_sync/GitSyncSection.svelte b/frontend/src/lib/components/git_sync/GitSyncSection.svelte index 41269a82bd..52b4b4326d 100644 --- a/frontend/src/lib/components/git_sync/GitSyncSection.svelte +++ b/frontend/src/lib/components/git_sync/GitSyncSection.svelte @@ -30,14 +30,15 @@ const primarySync = $derived(gitSyncContext?.getPrimarySyncRepository() || null) const primaryPromotion = $derived(gitSyncContext?.getPrimaryPromotionRepository() || null) const secondarySync = $derived(gitSyncContext?.getSecondarySyncRepositories() || []) - const legacyPromotion = $derived(gitSyncContext?.getLegacyPromotionRepositories() || []) + const secondaryPromotion = $derived(gitSyncContext?.getSecondaryPromotionRepositories() || []) // State for collapsible sections let secondarySyncExpanded = $state(false) - let legacyPromotionExpanded = $state(false) + let secondaryPromotionExpanded = $state(false) // Check if any secondary repositories are unsaved const hasUnsavedSecondary = $derived(secondarySync.some((s) => s.repo.isUnsavedConnection)) + const hasUnsavedSecondaryPromotion = $derived(secondaryPromotion.some((s) => s.repo.isUnsavedConnection)) {#if !gitSyncContext} @@ -169,38 +170,70 @@ isCollapsible={false} showEmptyState={primaryPromotion?.repo === null} /> -
- - {#if legacyPromotion.length > 0} - - Multiple promotion repositories are no longer supported. Please reduce to a single - promotion repository. Only deletion is allowed for the additional repositories below. - -
- + + {#if primaryPromotion && !primaryPromotion.repo?.isUnsavedConnection} + {#if secondaryPromotion.length > 0 || secondaryPromotionExpanded} +
+ - {#if legacyPromotionExpanded} -
- {#each legacyPromotion as { repo, idx } (repo.git_repo_resource_path)} -
- + {#if secondaryPromotionExpanded} +
+ {#if secondaryPromotion.length === 0} +
+ No secondary promotion repositories configured +
+ {:else} + {#each secondaryPromotion as { repo, idx } (repo.git_repo_resource_path)} +
+ +
+ {/each} + {/if} + + {#if !hasUnsavedSecondaryPromotion} +
+ +
+ {/if}
- {/each} + {/if}
+ {:else} + + {#if !hasUnsavedSecondaryPromotion} +
+ +
+ {/if} {/if} -
- {/if} + {/if} +