mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-23 20:54:50 +03:00
Use the exposed state of the integrate upstream modal
Export the state of whether the modal is open or not. Use it in the base branch page and the update base button.
This commit is contained in:
parent
6ce77554fe
commit
adc6357a80
@ -30,7 +30,6 @@
|
||||
|
||||
let updateTargetModal: Modal;
|
||||
let integrateUpstreamModal: IntegrateUpstreamModal | undefined;
|
||||
let integrateUpstreamModalOpen = false;
|
||||
let mergeUpstreamWarningDismissedCheckbox = false;
|
||||
|
||||
$: multiple = base ? base.upstreamCommits.length > 1 || base.upstreamCommits.length === 0 : false;
|
||||
@ -42,13 +41,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function closeIntegrateUpstreamModal() {
|
||||
integrateUpstreamModalOpen = false;
|
||||
}
|
||||
|
||||
function mergeUpstream() {
|
||||
if (project.succeedingRebases) {
|
||||
integrateUpstreamModalOpen = true;
|
||||
integrateUpstreamModal?.show();
|
||||
} else {
|
||||
if (mergeUpstreamWarningDismissedCheckbox) {
|
||||
@ -68,16 +62,13 @@
|
||||
</div>
|
||||
|
||||
{#if base.upstreamCommits?.length > 0}
|
||||
<IntegrateUpstreamModal
|
||||
bind:this={integrateUpstreamModal}
|
||||
onClose={closeIntegrateUpstreamModal}
|
||||
/>
|
||||
<IntegrateUpstreamModal bind:this={integrateUpstreamModal} />
|
||||
<Button
|
||||
style="pop"
|
||||
kind="solid"
|
||||
tooltip={`Merges the commits from ${base.branchName} into the base of all applied virtual branches`}
|
||||
disabled={$mode?.type !== 'OpenWorkspace' || integrateUpstreamModalOpen}
|
||||
loading={integrateUpstreamModalOpen}
|
||||
disabled={$mode?.type !== 'OpenWorkspace' || integrateUpstreamModal.imports.open}
|
||||
loading={integrateUpstreamModal.imports.open}
|
||||
onclick={mergeUpstream}
|
||||
>
|
||||
Merge into common base
|
||||
|
@ -85,6 +85,12 @@
|
||||
await tick();
|
||||
modal?.show();
|
||||
}
|
||||
|
||||
export const imports = {
|
||||
get open() {
|
||||
return modal?.imports.open;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:this={modal} title="Integrate upstream changes" {onClose} width="small" noPadding>
|
||||
|
@ -20,16 +20,11 @@
|
||||
|
||||
let modal = $state<IntegrateUpstreamModal>();
|
||||
|
||||
let modalOpen = $state<boolean>(false);
|
||||
|
||||
function openModal() {
|
||||
modalOpen = true;
|
||||
modal?.show();
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
modalOpen = false;
|
||||
}
|
||||
function onClose() {}
|
||||
|
||||
async function updateBaseBranch() {
|
||||
let infoText = await branchController.updateBaseBranch();
|
||||
@ -54,7 +49,7 @@
|
||||
updateBaseBranch();
|
||||
}
|
||||
}}
|
||||
loading={modalOpen}
|
||||
loading={modal?.imports.open}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user