Files
windmill/frontend/src/lib/components/git_sync/GitSyncModalManager.svelte
T
Diego ImbertandClaude Opus 5 504d01a563 feat: rework the git sync setup into a guided flow (#11308)
* feat: rework git sync settings into a flat repo list and setup modal

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: add the connect step for gitlab and github in git sync setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: open the github app install page from the git sync setup next step

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: let git sync setup set the repository folder

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: add the configure sync step to git sync setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: even out the git sync filter settings columns

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: pin the filter input to the bottom of the filter list

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: frame the git sync path filters in a box with an empty hint

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor: use a multiselect for the git sync path filters

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: grey out the skipped connect step in git sync setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: move the check job line to the bottom of the setup modal

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: hide the check job line once the repository check resolved

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: center the repository check loader in the setup modal

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: stop the setup modal shifting when the check job id arrives

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: move the existing resource hint to the setup modal footer

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: always show the existing resource option when one exists

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: drop the card and collapse from the git sync filter settings

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: use a success alert for the pull from git notice

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: make initializing the repository a step of the git sync setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: hide the push job lines once they succeed

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: reword the push step intro

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: copy button on the cli snippet and a taller changes list

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: match the push step loading to the check step

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: stop the push step shifting when a job id arrives

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: let the changes list fill the push step

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: end the git sync setup on a done step instead of a modal

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: delete a git sync repository from a row menu with a confirmation

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: lift the git sync done message off the notices

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: restore github app installation transfer between instances

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: address regressions from the git sync setup rework

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the overlay z-index floor in step with the ai chat

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: hold the push state in the setup dialog, not in the step it destroys

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: block every dismissal while setup work is in flight and keep sync reachable

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: regenerate the resource path when the repository changes

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: configure the resource the connect step actually created

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep a modal open when a drawer above it takes the click

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: snapshot the topmost surface for keyboard clicks too

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: size the add repository buttons and explain git promotion

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* revert: drop the promotion-first action from the empty state

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: shrink the test connection result line

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: offer the fork sync and fork pull request toggles during setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: group promotion repositories under their own label

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: offer the deploy branch pull request toggle during setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: wait for the repository credential before saving the setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: ignore a superseded credential load and drop the bindable default

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: key setup readiness to the repository it was loaded for

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: tie setup readiness to the attempt that asked for it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: link to where the access token is created

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: say plainly how each provider connects

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: sync resources, variables, schedules and triggers by default

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: use the accent colour for the token help link

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* style: move the CI/CD deploy hint next to the pull toggle

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep setup gated when the connection could not be read

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: only explain pull-from-git where the workspace can turn it on

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: offer a save retry once the repository is initialized

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: say when pulling fell back to polling on the last setup step

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: clear the initialized flag when a new draft starts

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-24 11:54:25 +02:00

118 lines
3.9 KiB
Svelte

<script lang="ts">
import { getGitSyncContext } from './GitSyncContext.svelte'
import PushWorkspaceModal from '$lib/components/git_sync/PushWorkspaceModal.svelte'
import PullWorkspaceModal from '$lib/components/git_sync/PullWorkspaceModal.svelte'
import GitSyncSuccessModal from '$lib/components/git_sync/GitSyncSuccessModal.svelte'
import { sendUserToast } from '$lib/toast'
import { apiErrorMessage } from '$lib/utils'
const gitSyncContext = $state(getGitSyncContext())
function handlePushSuccess() {
const pushModal = gitSyncContext.activeModals.push
if (!pushModal) return
const { idx, repo } = pushModal
// If this was a repository initialization, auto-save the connection
if (repo.isUnsavedConnection && repo.detectionState === 'no-wmill') {
gitSyncContext
.saveRepository(idx)
.then(() => {
sendUserToast('Repository initialized and connection saved successfully')
})
.catch((error) => {
sendUserToast(
'Repository initialized but failed to save connection: ' + apiErrorMessage(error),
true
)
})
} else {
sendUserToast('Successfully pushed to git repository')
}
gitSyncContext.closePushModal()
}
function handlePullSuccess() {
sendUserToast('Successfully pulled from git repository')
gitSyncContext.closePullModal()
}
function handleFilterUpdate(idx: number, filters: any) {
// Update the repository settings in the context
const repo = gitSyncContext.getRepository(idx)
if (repo) {
repo.settings = filters
}
}
function handleSettingsSaved() {
// Update initial state to reflect that current state has been saved externally
gitSyncContext.initialRepositories.splice(0, gitSyncContext.initialRepositories.length, ...gitSyncContext.repositories.map(repo => ({ ...repo })))
sendUserToast('Settings applied successfully')
}
async function handleSaveWithoutInit(idx: number) {
try {
await gitSyncContext.saveRepository(idx, true)
sendUserToast('Connection saved successfully without initializing repository')
gitSyncContext.closePushModal()
} catch (error: any) {
sendUserToast('Failed to save connection: ' + apiErrorMessage(error), true)
}
}
</script>
<!-- Push Modal -->
{#if gitSyncContext.activeModals.push}
{@const { idx, repo } = gitSyncContext.activeModals.push}
{@const isNewConnection = repo.isUnsavedConnection && repo.detectionState === 'no-wmill'}
<PushWorkspaceModal
bind:open={gitSyncContext.activeModals.push.open}
gitRepoResourcePath={repo.git_repo_resource_path}
uiState={{
include_path: repo.settings.include_path,
exclude_path: repo.settings.exclude_path,
extra_include_path: repo.settings.extra_include_path,
include_type: repo.settings.include_type
}}
isNewConnection={isNewConnection}
onSuccess={handlePushSuccess}
onSaveWithoutInit={isNewConnection ? () => handleSaveWithoutInit(idx) : undefined}
/>
{/if}
<!-- Pull Modal -->
{#if gitSyncContext.activeModals.pull}
{@const { idx, repo, settingsOnly } = gitSyncContext.activeModals.pull}
<PullWorkspaceModal
bind:open={gitSyncContext.activeModals.pull.open}
gitRepoResourcePath={repo.git_repo_resource_path}
repoIndex={idx}
currentGitSyncSettings={gitSyncContext}
uiState={{
include_path: repo.settings.include_path,
exclude_path: repo.settings.exclude_path,
extra_include_path: repo.settings.extra_include_path,
include_type: repo.settings.include_type
}}
onFilterUpdate={(filters) => handleFilterUpdate(idx, filters)}
onSettingsSaved={handleSettingsSaved}
onSuccess={handlePullSuccess}
{settingsOnly}
/>
{/if}
<!-- Success Modal -->
{#if gitSyncContext.activeModals.success}
<GitSyncSuccessModal
bind:open={gitSyncContext.activeModals.success.open}
savedWithoutInit={gitSyncContext.activeModals.success.savedWithoutInit}
autoPullOn={gitSyncContext.activeModals.success.autoPullOn}
explainAutoPullOff={gitSyncContext.activeModals.success.ownsAutoPull ?? false}
webhookError={gitSyncContext.activeModals.success.webhookError}
/>
{/if}