mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 16:11:46 +03:00
Show the push button when there are differences after undoing commits and the branch requires force pushing
This commit is contained in:
parent
f708c1568e
commit
5740c16ee8
@ -25,10 +25,13 @@
|
||||
$: headCommit = branch.commits[0];
|
||||
|
||||
$: commits = type == 'upstream' ? [] : branch.commits.filter((c) => c.status == type);
|
||||
$: hasCommits = commits && commits.length > 0;
|
||||
$: remoteRequiresForcePush = type === 'remote' && branch.requiresForce;
|
||||
|
||||
let expanded = true;
|
||||
</script>
|
||||
|
||||
{#if commits && commits.length > 0}
|
||||
{#if hasCommits || remoteRequiresForcePush }
|
||||
<div
|
||||
class="commit-list card"
|
||||
class:upstream={type == 'upstream'}
|
||||
|
@ -75,7 +75,9 @@
|
||||
<PushButton
|
||||
wide
|
||||
isLoading={isPushing || $githubServiceState$?.busy}
|
||||
isPushed={type == 'remote'}
|
||||
isPushed={type == 'remote' && !branch.requiresForce}
|
||||
requiresForcePush={branch.requiresForce}
|
||||
isPr={$pr$}
|
||||
{projectId}
|
||||
githubEnabled={$githubEnabled$}
|
||||
on:trigger={async (e) => {
|
||||
|
@ -7,6 +7,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import DropDownButton from '$lib/components/DropDownButton.svelte';
|
||||
import ContextMenu from '$lib/components/contextmenu/ContextMenu.svelte';
|
||||
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
|
||||
@ -20,6 +21,8 @@
|
||||
export let isLoading = false;
|
||||
export let githubEnabled: boolean;
|
||||
export let wide = false;
|
||||
export let requiresForcePush = false;
|
||||
export let isPr = false;
|
||||
|
||||
function defaultAction(projectId: string): Persisted<BranchAction> {
|
||||
const key = 'projectDefaultAction_';
|
||||
@ -49,9 +52,22 @@
|
||||
}
|
||||
return preferredAction;
|
||||
}
|
||||
|
||||
$: pushLabel = requiresForcePush ? 'Force push to remote' : 'Push to remote'
|
||||
</script>
|
||||
|
||||
<DropDownButton
|
||||
{#if isPr && requiresForcePush }
|
||||
<Button
|
||||
color="primary"
|
||||
kind="outlined"
|
||||
{wide}
|
||||
disabled={isPushed}
|
||||
on:click={() => {
|
||||
dispatch('trigger', { action: BranchAction.Push });
|
||||
}}>{pushLabel}</Button
|
||||
>
|
||||
{:else if !isPr }
|
||||
<DropDownButton
|
||||
color="primary"
|
||||
kind="outlined"
|
||||
loading={isLoading}
|
||||
@ -61,7 +77,7 @@
|
||||
on:click={() => {
|
||||
dispatch('trigger', { action });
|
||||
}}
|
||||
>
|
||||
>
|
||||
{$selection$?.label}
|
||||
<ContextMenu
|
||||
type="select"
|
||||
@ -88,7 +104,7 @@
|
||||
<ContextMenuSection>
|
||||
<ContextMenuItem
|
||||
id="push"
|
||||
label="Push to remote"
|
||||
label={pushLabel}
|
||||
selected={action == BranchAction.Push}
|
||||
disabled={isPushed}
|
||||
/>
|
||||
@ -106,4 +122,5 @@
|
||||
/>
|
||||
</ContextMenuSection>
|
||||
</ContextMenu>
|
||||
</DropDownButton>
|
||||
</DropDownButton>
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user