what in gods name

This commit is contained in:
Scott Chacon 2024-04-30 10:33:35 +02:00
parent 5603dbba5f
commit 2ef63bc1d9

View File

@ -23,9 +23,11 @@
const activeBranchesError = vbranchService.activeBranchesError; const activeBranchesError = vbranchService.activeBranchesError;
const activeBranches = vbranchService.activeBranches; const activeBranches = vbranchService.activeBranches;
let selectedBranch: { let selectedBranch:
name: string; | {
} | undefined; name: string;
}
| undefined;
let dragged: any; let dragged: any;
let dropZone: HTMLDivElement; let dropZone: HTMLDivElement;
@ -46,16 +48,17 @@
if (!selectedBranch) return; if (!selectedBranch) return;
// while target is setting, display loading // while target is setting, display loading
isSwitching = true; isSwitching = true;
await branchController.setTarget(selectedBranch.name) await branchController
.then((res) => { .setTarget(selectedBranch.name)
.then((res) => {
console.log('done', res); console.log('done', res);
}) })
.catch((err) => { .catch((err) => {
console.log('error', err); console.log('error', err);
}) })
.finally(() => { .finally(() => {
isSwitching = false; isSwitching = false;
showBranchSwitch = false; showBranchSwitch = false;
}); });
} }
</script> </script>
@ -65,9 +68,7 @@
{:else if !$activeBranches} {:else if !$activeBranches}
<FullviewLoading /> <FullviewLoading />
{:else if isSwitching} {:else if isSwitching}
<div class="middle-message"> <div class="middle-message">switching base branch...</div>
switching base branch...
</div>
{:else} {:else}
<div <div
class="board" class="board"
@ -159,50 +160,57 @@
</p> </p>
<div class="branch-switcher"> <div class="branch-switcher">
{#if showBranchSwitch} {#if showBranchSwitch}
{#await getRemoteBranches(project.id)} {#await getRemoteBranches(project.id)}
loading remote branches... loading remote branches...
{:then remoteBranches} {:then remoteBranches}
{#if remoteBranches.length == 0} {#if remoteBranches.length == 0}
No remote branches No remote branches
{:else} {:else}
<div class="spacer"> <div class="spacer">
<Select items={remoteBranches.filter(item => item.name != $baseBranch.branchName)} bind:value={selectedBranch} itemId="name" labelId="name"> <Select
<SelectItem slot="template" let:item let:selected {selected}> items={remoteBranches.filter(
{item.name} (item) => item.name != $baseBranch.branchName
</SelectItem> )}
</Select> bind:value={selectedBranch}
<Button itemId="name"
style="error" labelId="name"
kind="solid" >
on:click={onSetBaseBranchClick} <SelectItem slot="template" let:item let:selected {selected}>
icon="chevron-right-small" {item.name}
id="set-base-branch" </SelectItem>
> </Select>
Update Base Branch <Button
</Button> style="error"
kind="solid"
on:click={onSetBaseBranchClick}
icon="chevron-right-small"
id="set-base-branch"
>
Update Base Branch
</Button>
</div>
{/if}
{:catch}
No remote branches
{/await}
{:else}
<div>
<div class="branch-display">
<div>Your current base branch is:</div>
<div class="branch-name">{$baseBranch.branchName}</div>
</div> </div>
{/if} <Button
{:catch} style="pop"
No remote branches kind="solid"
{/await} on:click={toggleBranchSwitch}
{:else} icon="chevron-right-small"
<div> id="set-base-branch"
<div class="branch-display"> >
<div>Your current base branch is: </div> Change Base Branch
<div class="branch-name">{$baseBranch.branchName}</div> </Button>
</div> </div>
<Button {/if}
style="pop"
kind="solid"
on:click={toggleBranchSwitch}
icon="chevron-right-small"
id="set-base-branch"
>
Change Base Branch
</Button>
</div>
{/if}
</div> </div>
</div> </div>