mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-03 15:06:01 +03:00
Show busy indicator when updating base branch
- make update button its own component - show busy while updating - remove unnecessary log statement
This commit is contained in:
parent
26fdfdbc39
commit
6a56fa582c
@ -3,12 +3,11 @@
|
||||
import DomainButton from './DomainButton.svelte';
|
||||
import Footer from './Footer.svelte';
|
||||
import ProjectSelector from './ProjectSelector.svelte';
|
||||
import UpdateBaseButton from './UpdateBaseButton.svelte';
|
||||
import BaseBranchCard from '$lib/components/BaseBranchCard.svelte';
|
||||
import Resizer from '$lib/components/Resizer.svelte';
|
||||
import Tag from '$lib/components/Tag.svelte';
|
||||
import { persisted } from '$lib/persisted/persisted';
|
||||
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import { getContext } from 'svelte';
|
||||
import type { User } from '$lib/backend/cloud';
|
||||
import type { Project, ProjectService } from '$lib/backend/projects';
|
||||
@ -66,23 +65,7 @@
|
||||
|
||||
<span>Workspace</span>
|
||||
{#if ($base$?.behind || 0) > 0}
|
||||
<Tag
|
||||
color="error"
|
||||
help="Merge upstream commits into common base"
|
||||
filled
|
||||
clickable
|
||||
on:click={async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
try {
|
||||
await branchController.updateBaseBranch();
|
||||
} catch {
|
||||
toasts.error('Failed update working directory');
|
||||
}
|
||||
}}
|
||||
>
|
||||
Update
|
||||
</Tag>
|
||||
<UpdateBaseButton {branchController} />
|
||||
{/if}
|
||||
</DomainButton>
|
||||
</div>
|
||||
|
32
gitbutler-ui/src/lib/components/UpdateBaseButton.svelte
Normal file
32
gitbutler-ui/src/lib/components/UpdateBaseButton.svelte
Normal file
@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import Tag from './Tag.svelte';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import type { BranchController } from '$lib/vbranches/branchController';
|
||||
|
||||
export let branchController: BranchController;
|
||||
|
||||
let loading = false;
|
||||
</script>
|
||||
|
||||
<Tag
|
||||
color="error"
|
||||
help="Merge upstream commits into common base"
|
||||
filled
|
||||
clickable
|
||||
on:click={async () => {
|
||||
loading = true;
|
||||
try {
|
||||
await branchController.updateBaseBranch();
|
||||
} catch {
|
||||
toasts.error('Failed update workspace');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if loading}
|
||||
busy...
|
||||
{:else}
|
||||
Update
|
||||
{/if}
|
||||
</Tag>
|
@ -200,8 +200,6 @@ export class BranchController {
|
||||
async updateBaseBranch() {
|
||||
try {
|
||||
await invoke<object>('update_base_branch', { projectId: this.projectId });
|
||||
} catch (err) {
|
||||
toasts.error('Failed to update target');
|
||||
} finally {
|
||||
this.targetBranchService.reload();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user