|
|
@ -15,6 +15,7 @@ export const PushPull = () => { |
|
|
|
const [localBranchOptions, setLocalBranchOptions] = useState<any>([]); |
|
|
|
const [localBranchOptions, setLocalBranchOptions] = useState<any>([]); |
|
|
|
const [remoteBranchOptions, setRemoteBranchOptions] = useState<any>([]); |
|
|
|
const [remoteBranchOptions, setRemoteBranchOptions] = useState<any>([]); |
|
|
|
const [localRemotesOptions, setLocalRemotesOptions] = useState<any>([]); |
|
|
|
const [localRemotesOptions, setLocalRemotesOptions] = useState<any>([]); |
|
|
|
|
|
|
|
const [disabled, setDisabled] = useState(false) |
|
|
|
const [force, setForce] = useState(false) |
|
|
|
const [force, setForce] = useState(false) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -25,11 +26,14 @@ export const PushPull = () => { |
|
|
|
if (!context.upstream || !currentUpstreamIsInRemotes) { |
|
|
|
if (!context.upstream || !currentUpstreamIsInRemotes) { |
|
|
|
if (context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name) { |
|
|
|
if (context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name) { |
|
|
|
actions.setUpstreamRemote(context.currentBranch.remote) |
|
|
|
actions.setUpstreamRemote(context.currentBranch.remote) |
|
|
|
|
|
|
|
setDisabled(false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (context.remotes && context.remotes.length > 0) { |
|
|
|
if (context.remotes && context.remotes.length > 0) { |
|
|
|
actions.setUpstreamRemote(context.remotes[0]) |
|
|
|
actions.setUpstreamRemote(context.remotes[0]) |
|
|
|
|
|
|
|
setDisabled(false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
actions.setUpstreamRemote(null) |
|
|
|
actions.setUpstreamRemote(null) |
|
|
|
|
|
|
|
setDisabled(true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -136,7 +140,9 @@ export const PushPull = () => { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
|
|
|
|
{disabled? <div data-id='disabled' className='text-sm w-100 alert alert-warning mt-1'> |
|
|
|
|
|
|
|
You cannot push or pull because you haven't connected to or selected a remote. |
|
|
|
|
|
|
|
</div>: null} |
|
|
|
<div className="btn-group w-100 mt-2" role="group"> |
|
|
|
<div className="btn-group w-100 mt-2" role="group"> |
|
|
|
|
|
|
|
|
|
|
|
<GitUIButton data-id='sourcecontrol-pull' disabledCondition={pushPullIsDisabled()} type="button" onClick={async () => pull()} className="btn btn-primary mr-1">Pull</GitUIButton> |
|
|
|
<GitUIButton data-id='sourcecontrol-pull' disabledCondition={pushPullIsDisabled()} type="button" onClick={async () => pull()} className="btn btn-primary mr-1">Pull</GitUIButton> |
|
|
|