mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-22 02:34:33 +03:00
stuff
This commit is contained in:
parent
41e8cc8ed3
commit
f3b8ff60fe
@ -5,9 +5,10 @@
|
||||
import { getColorFromBranchType } from './stackingUtils';
|
||||
import { PromptService } from '$lib/ai/promptService';
|
||||
import { AIService } from '$lib/ai/service';
|
||||
import { Project } from '$lib/backend/projects';
|
||||
import { Project, ProjectService } from '$lib/backend/projects';
|
||||
import { BaseBranch } from '$lib/baseBranch/baseBranch';
|
||||
import StackingSeriesHeaderContextMenu from '$lib/branch/StackingSeriesHeaderContextMenu.svelte';
|
||||
import { CloudBranchCreationService } from '$lib/branch/cloudBranchCreationService';
|
||||
import ContextMenu from '$lib/components/contextmenu/ContextMenu.svelte';
|
||||
import { projectAiGenEnabled } from '$lib/config/config';
|
||||
import { stackingFeatureMultipleSeries } from '$lib/config/uiFeatureFlags';
|
||||
@ -21,6 +22,7 @@
|
||||
import { openExternalUrl } from '$lib/utils/url';
|
||||
import { BranchController } from '$lib/vbranches/branchController';
|
||||
import { PatchSeries, VirtualBranch, type CommitStatus } from '$lib/vbranches/types';
|
||||
import { CloudBranchesService } from '@gitbutler/shared/cloud/stacks/service';
|
||||
import { getContext, getContextStore } from '@gitbutler/shared/context';
|
||||
import Button from '@gitbutler/ui/Button.svelte';
|
||||
import PopoverActionsContainer from '@gitbutler/ui/popoverActions/PopoverActionsContainer.svelte';
|
||||
@ -80,6 +82,18 @@
|
||||
$pr?.sourceBranch ? $gitHost?.checksMonitor($pr.sourceBranch) : undefined
|
||||
);
|
||||
|
||||
const projectService = getContext(ProjectService);
|
||||
const cloudEnabled = projectService.cloudEnabled;
|
||||
|
||||
const cloudBranchCreationService = getContext(CloudBranchCreationService);
|
||||
const cloudBranchesService = getContext(CloudBranchesService);
|
||||
const cloudBranch = $derived(cloudBranchesService.branchForBranchId(branch.id));
|
||||
const showCreateCloudBranch = $derived(
|
||||
$cloudEnabled &&
|
||||
cloudBranchCreationService.canCreateBranch &&
|
||||
$cloudBranch.state === 'not-found'
|
||||
);
|
||||
|
||||
async function handleReloadPR() {
|
||||
await Promise.allSettled([prMonitor?.refresh(), checksMonitor?.update()]);
|
||||
}
|
||||
@ -205,32 +219,50 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $prService && !hasNoCommits}
|
||||
{#if ($prService && !hasNoCommits) || showCreateCloudBranch}
|
||||
<div class="branch-action">
|
||||
<div class="branch-action__line" style:--bg-color={lineColor}></div>
|
||||
<div class="branch-action__body">
|
||||
{#if $pr}
|
||||
<StackingPullRequestCard
|
||||
upstreamName={currentSeries.name}
|
||||
reloadPR={handleReloadPR}
|
||||
pr={$pr}
|
||||
{checksMonitor}
|
||||
/>
|
||||
{:else}
|
||||
{#if $prService && !hasNoCommits}
|
||||
{#if $pr}
|
||||
<StackingPullRequestCard
|
||||
upstreamName={currentSeries.name}
|
||||
reloadPR={handleReloadPR}
|
||||
pr={$pr}
|
||||
{checksMonitor}
|
||||
/>
|
||||
{:else}
|
||||
<Button
|
||||
style="ghost"
|
||||
wide
|
||||
outline
|
||||
disabled={currentSeries.patches.length === 0 || !$gitHost || !$prService}
|
||||
onclick={() => handleOpenPR(!gitHostBranch)}
|
||||
>
|
||||
Create pull request
|
||||
</Button>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if showCreateCloudBranch}
|
||||
<Button
|
||||
style="ghost"
|
||||
wide
|
||||
outline
|
||||
disabled={currentSeries.patches.length === 0 || !$gitHost || !$prService}
|
||||
onclick={() => handleOpenPR(!gitHostBranch)}
|
||||
disabled={branch.commits.length === 0}
|
||||
onclick={() => {
|
||||
cloudBranchCreationService.createBranch(branch.id);
|
||||
}}>Publish Branch</Button
|
||||
>
|
||||
Create pull request
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="branch-action">
|
||||
<div class="branch-action__line" style:--bg-color={lineColor}></div>
|
||||
<div class="branch-action__body"></div>
|
||||
</div>
|
||||
|
||||
{#if $pr}
|
||||
<PrDetailsModal bind:this={prDetailsModal} type="display" pr={$pr} />
|
||||
{:else}
|
||||
|
@ -3,7 +3,7 @@
|
||||
</script>
|
||||
|
||||
<div class="series-container">
|
||||
<h2 class="text-head-24 heading">Your patch stacks:</h2>
|
||||
<h2 class="text-head-24 heading">Your branches:</h2>
|
||||
<CloudBranchIndex />
|
||||
</div>
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
import { page } from '$app/stores';
|
||||
|
||||
const cloudBranchId = $derived($page.params.cloudBranchId);
|
||||
$inspect(cloudBranchId);
|
||||
</script>
|
||||
|
||||
<div class="patch-stack-container">
|
@ -13,6 +13,7 @@
|
||||
}
|
||||
|
||||
function login() {
|
||||
console.log(env.PUBLIC_APP_HOST);
|
||||
window.location.href = `${env.PUBLIC_APP_HOST}cloud/login`;
|
||||
}
|
||||
</script>
|
||||
|
@ -94,7 +94,7 @@
|
||||
<div>{project.name}</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<h2>Patch Stacks</h2>
|
||||
<h2>Branches</h2>
|
||||
{#each patchStacks as stack}
|
||||
<div>
|
||||
{stack.title}<br />
|
||||
|
@ -47,7 +47,7 @@
|
||||
{:else}
|
||||
<div><a href="/projects/{data.projectId}">project</a></div>
|
||||
|
||||
<h1>Patch Stack</h1>
|
||||
<h1>Branch</h1>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
Title: <strong>{stackData.title}</strong><br />
|
||||
|
@ -221,7 +221,7 @@
|
||||
{:else if state === 'unauthorized'}
|
||||
<p>Unauthorized</p>
|
||||
{:else}
|
||||
<h2>Patch Stack: <a href="../stack">{stack.title}</a></h2>
|
||||
<h2>Branch: <a href="../stack">{stack.title}</a></h2>
|
||||
{#each stack.patches as stackPatch}
|
||||
<div>
|
||||
<code
|
||||
|
Loading…
Reference in New Issue
Block a user