mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
Remove virtual flag from front end
This commit is contained in:
parent
2d0dc3a9ff
commit
5b42e6e9e6
@ -15,16 +15,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !remoteExists}
|
{#if !remoteExists}
|
||||||
{#if !$branch.active}
|
{#if hasIntegratedCommits}
|
||||||
<Button
|
|
||||||
clickable={false}
|
|
||||||
size="tag"
|
|
||||||
icon="virtual-branch-small"
|
|
||||||
style="neutral"
|
|
||||||
help="These changes are stashed away from your working directory."
|
|
||||||
reversedDirection>unapplied</Button
|
|
||||||
>
|
|
||||||
{:else if hasIntegratedCommits}
|
|
||||||
<Button
|
<Button
|
||||||
clickable={false}
|
clickable={false}
|
||||||
size="tag"
|
size="tag"
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
<div
|
<div
|
||||||
class="branch-card hide-native-scrollbar"
|
class="branch-card hide-native-scrollbar"
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
class:target-branch={branch.active && branch.selectedForChanges}
|
class:target-branch={branch.selectedForChanges}
|
||||||
>
|
>
|
||||||
<ScrollableContainer
|
<ScrollableContainer
|
||||||
wide
|
wide
|
||||||
@ -148,7 +148,7 @@
|
|||||||
showCheckboxes={$commitBoxOpen}
|
showCheckboxes={$commitBoxOpen}
|
||||||
allowMultiple
|
allowMultiple
|
||||||
/>
|
/>
|
||||||
{#if branch.active && branch.conflicted}
|
{#if branch.conflicted}
|
||||||
<div class="card-notifications">
|
<div class="card-notifications">
|
||||||
<InfoMessage filled outlined={false} style="error">
|
<InfoMessage filled outlined={false} style="error">
|
||||||
<svelte:fragment slot="title">
|
<svelte:fragment slot="title">
|
||||||
@ -164,7 +164,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Dropzones>
|
</Dropzones>
|
||||||
|
|
||||||
{#if branch.active}
|
|
||||||
<CommitDialog
|
<CommitDialog
|
||||||
projectId={project.id}
|
projectId={project.id}
|
||||||
expanded={commitBoxOpen}
|
expanded={commitBoxOpen}
|
||||||
@ -175,7 +174,6 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{:else if branch.commits.length === 0}
|
{:else if branch.commits.length === 0}
|
||||||
<Dropzones>
|
<Dropzones>
|
||||||
|
@ -182,7 +182,6 @@
|
|||||||
|
|
||||||
<div class="header__actions">
|
<div class="header__actions">
|
||||||
<div class="header__buttons">
|
<div class="header__buttons">
|
||||||
{#if branch.active}
|
|
||||||
{#if branch.selectedForChanges}
|
{#if branch.selectedForChanges}
|
||||||
<Button
|
<Button
|
||||||
style="pop"
|
style="pop"
|
||||||
@ -209,7 +208,6 @@
|
|||||||
Set as default
|
Set as default
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
|
@ -191,8 +191,7 @@
|
|||||||
}}
|
}}
|
||||||
disabled={isUnapplied ||
|
disabled={isUnapplied ||
|
||||||
!($aiGenEnabled && aiConfigurationValid) ||
|
!($aiGenEnabled && aiConfigurationValid) ||
|
||||||
branch.files?.length === 0 ||
|
branch.files?.length === 0}
|
||||||
!branch.active}
|
|
||||||
/>
|
/>
|
||||||
</ContextMenuSection>
|
</ContextMenuSection>
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ function mergeBranchesAndPrs(
|
|||||||
|
|
||||||
// This should be everything considered a branch in one list
|
// This should be everything considered a branch in one list
|
||||||
const filtered = contributions
|
const filtered = contributions
|
||||||
.filter((b) => !b.vbranch || !b.vbranch.active)
|
.filter((b) => !b.vbranch)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return (a.modifiedAt || new Date(0)) < (b.modifiedAt || new Date(0)) ? 1 : -1;
|
return (a.modifiedAt || new Date(0)) < (b.modifiedAt || new Date(0)) ? 1 : -1;
|
||||||
});
|
});
|
||||||
|
@ -64,10 +64,9 @@ export class CombinedBranch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GH colors reference https://github.blog/changelog/2021-06-08-new-issue-and-pull-request-state-icons
|
// GH colors reference https://github.blog/changelog/2021-06-08-new-issue-and-pull-request-state-icons
|
||||||
get color(): 'neutral' | 'success' | 'pop' | 'purple' | undefined {
|
get color(): 'neutral' | 'success' | 'purple' | undefined {
|
||||||
if (this.pr?.mergedAt) return 'purple'; // merged PR
|
if (this.pr?.mergedAt) return 'purple'; // merged PR
|
||||||
if (this.pr) return 'success'; // open PR
|
if (this.pr) return 'success'; // open PR
|
||||||
if (this.vbranch && this.vbranch.active === false) return 'pop'; // stashed virtual branches
|
|
||||||
// if (this.remoteBranch?.isMergeable) return 'success'; // remote branches
|
// if (this.remoteBranch?.isMergeable) return 'success'; // remote branches
|
||||||
return 'neutral';
|
return 'neutral';
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
branchController.undoCommit(branch.id, commit.id);
|
branchController.undoCommit(branch.id, commit.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
let isUndoable = !!branch?.active && commit instanceof Commit;
|
let isUndoable = commit instanceof Commit;
|
||||||
|
|
||||||
const hasCommitUrl = !commit.isLocal && commitUrl;
|
const hasCommitUrl = !commit.isLocal && commitUrl;
|
||||||
|
|
||||||
|
@ -70,20 +70,9 @@
|
|||||||
`refs/remotes/${remoteName}/${pullrequest.sourceBranch}`
|
`refs/remotes/${remoteName}/${pullrequest.sourceBranch}`
|
||||||
);
|
);
|
||||||
await virtualBranchService.reload();
|
await virtualBranchService.reload();
|
||||||
const vbranch = await virtualBranchService.getByUpstreamSha(pullrequest.sha);
|
|
||||||
|
|
||||||
// This is a little absurd, but it makes it soundly typed
|
// This is a little absurd, but it makes it soundly typed
|
||||||
if (!vbranch) {
|
|
||||||
goto(`/${project.id}/board`);
|
goto(`/${project.id}/board`);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Active seems to be a more reliable metric to determine whether to go to the branch page
|
|
||||||
if (vbranch.active) {
|
|
||||||
goto(`/${project.id}/board`);
|
|
||||||
} else {
|
|
||||||
goto(`/${project.id}/stashed/${vbranch.id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
createRemoteModal?.close();
|
createRemoteModal?.close();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
export let branch: CombinedBranch;
|
export let branch: CombinedBranch;
|
||||||
|
|
||||||
function getBranchLink(b: CombinedBranch): string | undefined {
|
function getBranchLink(b: CombinedBranch): string | undefined {
|
||||||
if (b.vbranch?.active) return `/${projectId}/board/`;
|
if (b.vbranch) return `/${projectId}/board/`;
|
||||||
if (b.vbranch) return `/${projectId}/stashed/${b.vbranch.id}`;
|
|
||||||
if (b.remoteBranch) return `/${projectId}/remote/${branch?.remoteBranch?.displayName}`;
|
if (b.remoteBranch) return `/${projectId}/remote/${branch?.remoteBranch?.displayName}`;
|
||||||
if (b.pr) return `/${projectId}/pull/${b.pr.number}`;
|
if (b.pr) return `/${projectId}/pull/${b.pr.number}`;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@ export const file1 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const virtualBranch = {
|
export const virtualBranch = {
|
||||||
active: true,
|
|
||||||
baseCurrent: true,
|
baseCurrent: true,
|
||||||
commits: [],
|
commits: [],
|
||||||
conflicted: false,
|
conflicted: false,
|
||||||
|
@ -99,8 +99,6 @@ export class Branch {
|
|||||||
id!: string;
|
id!: string;
|
||||||
name!: string;
|
name!: string;
|
||||||
notes!: string;
|
notes!: string;
|
||||||
// Active means the branch has been applied to the workspace
|
|
||||||
active!: boolean;
|
|
||||||
@Type(() => LocalFile)
|
@Type(() => LocalFile)
|
||||||
files!: LocalFile[];
|
files!: LocalFile[];
|
||||||
@Type(() => Commit)
|
@Type(() => Commit)
|
||||||
|
@ -24,7 +24,6 @@ import { writable, type Readable } from 'svelte/store';
|
|||||||
|
|
||||||
export class VirtualBranchService {
|
export class VirtualBranchService {
|
||||||
branches$: Observable<Branch[] | undefined>;
|
branches$: Observable<Branch[] | undefined>;
|
||||||
stashedBranches$: Observable<Branch[] | undefined>;
|
|
||||||
activeBranches$: Observable<Branch[] | undefined>;
|
activeBranches$: Observable<Branch[] | undefined>;
|
||||||
branchesError = writable<any>();
|
branchesError = writable<any>();
|
||||||
private reload$ = new BehaviorSubject<void>(undefined);
|
private reload$ = new BehaviorSubject<void>(undefined);
|
||||||
@ -67,10 +66,6 @@ export class VirtualBranchService {
|
|||||||
shareReplay(1)
|
shareReplay(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.stashedBranches$ = this.branches$.pipe(
|
|
||||||
map((branches) => branches?.filter((b) => !b.active))
|
|
||||||
);
|
|
||||||
|
|
||||||
// We need upstream data to be part of the branch without delay since the way we render
|
// We need upstream data to be part of the branch without delay since the way we render
|
||||||
// commits depends on it.
|
// commits depends on it.
|
||||||
// TODO: Move this async behavior into the rust code.
|
// TODO: Move this async behavior into the rust code.
|
||||||
@ -80,9 +75,7 @@ export class VirtualBranchService {
|
|||||||
switchMap((branches) => {
|
switchMap((branches) => {
|
||||||
if (!branches) return of();
|
if (!branches) return of();
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
branches
|
branches.map(async (b) => {
|
||||||
.filter((b) => b.active)
|
|
||||||
.map(async (b) => {
|
|
||||||
const upstreamName = b.upstream?.name;
|
const upstreamName = b.upstream?.name;
|
||||||
if (upstreamName) {
|
if (upstreamName) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
// This page is displayed when:
|
|
||||||
// - A vbranch is found
|
|
||||||
// It may also display details about a cooresponding remote and/or pr if they exist
|
|
||||||
import BranchLane from '$lib/branch/BranchLane.svelte';
|
|
||||||
import FullviewLoading from '$lib/components/FullviewLoading.svelte';
|
|
||||||
import Button from '$lib/shared/Button.svelte';
|
|
||||||
import Modal from '$lib/shared/Modal.svelte';
|
|
||||||
import type { PageData } from './$types';
|
|
||||||
import { goto } from '$app/navigation';
|
|
||||||
import { page } from '$app/stores';
|
|
||||||
|
|
||||||
export let data: PageData;
|
|
||||||
|
|
||||||
let applyConflictedModal: Modal;
|
|
||||||
let deleteBranchModal: Modal;
|
|
||||||
|
|
||||||
$: ({ projectId, branchController, vbranchService } = data);
|
|
||||||
$: branches$ = vbranchService.branches$;
|
|
||||||
$: error = vbranchService.branchesError;
|
|
||||||
|
|
||||||
$: branch = $branches$?.find((b) => b.id === $page.params.branchId);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if $error}
|
|
||||||
<p>{JSON.stringify($error)}</p>
|
|
||||||
{:else if !$branches$}
|
|
||||||
<FullviewLoading />
|
|
||||||
{:else if branch}
|
|
||||||
<BranchLane {branch} isUnapplied={!branch.active} />
|
|
||||||
{:else}
|
|
||||||
<p>Branch no longer exists</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<Modal width="small" title="Merge conflicts" bind:this={applyConflictedModal}>
|
|
||||||
<p>Applying this branch will introduce merge conflicts.</p>
|
|
||||||
{#snippet controls(close, item)}
|
|
||||||
<Button style="ghost" outline on:click={close}>Cancel</Button>
|
|
||||||
<Button
|
|
||||||
style="pop"
|
|
||||||
kind="solid"
|
|
||||||
on:click={() => {
|
|
||||||
branchController.applyBranch(item.id);
|
|
||||||
close();
|
|
||||||
goto(`/${projectId}/board`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Update
|
|
||||||
</Button>
|
|
||||||
{/snippet}
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<Modal width="small" title="Delete branch" bind:this={deleteBranchModal}>
|
|
||||||
{#snippet children(item)}
|
|
||||||
Deleting <code class="code-string">{item.name}</code> cannot be undone.
|
|
||||||
{/snippet}
|
|
||||||
{#snippet controls(close, item)}
|
|
||||||
<Button style="ghost" outline on:mousedown={close}>Cancel</Button>
|
|
||||||
<Button
|
|
||||||
style="error"
|
|
||||||
kind="solid"
|
|
||||||
on:click={() => {
|
|
||||||
branchController.deleteBranch(item.id);
|
|
||||||
close();
|
|
||||||
goto(`/${projectId}/board`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Delete
|
|
||||||
</Button>
|
|
||||||
{/snippet}
|
|
||||||
</Modal>
|
|
Loading…
Reference in New Issue
Block a user