From de6500ff0770f7d8be566a08ffc911dc0742e0f4 Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Tue, 7 Jan 2025 00:49:22 +0100 Subject: [PATCH] Add button to run hooks ad-hoc --- .../src/lib/commit/CommitDialog.svelte | 33 ++++++++++++++----- .../src/lib/vbranches/branchController.ts | 14 +++----- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/apps/desktop/src/lib/commit/CommitDialog.svelte b/apps/desktop/src/lib/commit/CommitDialog.svelte index 0e66202a8f..08f84b0cb1 100644 --- a/apps/desktop/src/lib/commit/CommitDialog.svelte +++ b/apps/desktop/src/lib/commit/CommitDialog.svelte @@ -5,6 +5,7 @@ import { persistedCommitMessage, projectRunCommitHooks } from '$lib/config/config'; import { cloudCommunicationFunctionality } from '$lib/config/uiFeatureFlags'; import { SyncedSnapshotService } from '$lib/history/syncedSnapshotService'; + import { showError } from '$lib/notifications/toasts'; import DropDownButton from '$lib/shared/DropDownButton.svelte'; import { intersectionObserver } from '$lib/utils/intersectionObserver'; import { BranchController } from '$lib/vbranches/branchController'; @@ -35,6 +36,7 @@ let commitMessageInput = $state(); let isCommitting = $state(false); + let isRunningHooks = $state(false); let commitMessageValid = $state(false); let isInViewport = $state(false); @@ -60,7 +62,14 @@ } async function runHooks() { - await branchController.runHooks(projectId, $selectedOwnership.toString()); + isRunningHooks = true; + try { + await branchController.runHooks(projectId, $selectedOwnership.toString()); + } catch (err: unknown) { + showError('Failed to run hooks', err); + } finally { + isRunningHooks = false; + } } function close() { @@ -110,6 +119,20 @@ {#if $expanded && !isCommitting}
+ {#if $expanded} + + {/if}
{/if} {#if $expanded && canShowCommitAndPublish} @@ -153,13 +176,6 @@ {/snippet} {:else} -