diff --git a/libs/remix-ui/git/src/components/branchHeader.tsx b/libs/remix-ui/git/src/components/branchHeader.tsx index c58d9360d7..0113b79a85 100644 --- a/libs/remix-ui/git/src/components/branchHeader.tsx +++ b/libs/remix-ui/git/src/components/branchHeader.tsx @@ -66,6 +66,7 @@ export const BranchHeader = () => { {getName() ? ( {getName() ?? ''} + {context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name ? ` on ${context.currentBranch.remote.name}` : ''} ) : null } diff --git a/libs/remix-ui/git/src/components/navigation/branchedetails.tsx b/libs/remix-ui/git/src/components/navigation/branchedetails.tsx index 80dabe0780..c909d0cdd7 100644 --- a/libs/remix-ui/git/src/components/navigation/branchedetails.tsx +++ b/libs/remix-ui/git/src/components/navigation/branchedetails.tsx @@ -13,10 +13,11 @@ interface BrancheDetailsNavigationProps { callback: (eventKey: string) => void; branch: branch; checkout: (branch: branch) => void; + allowCheckout: boolean; } export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) => { - const { eventKey, activePanel, callback, branch, checkout } = props; + const { eventKey, activePanel, callback, branch, checkout, allowCheckout } = props; const context = React.useContext(gitPluginContext) const actions = React.useContext(gitActionsContext) const handleClick = () => { @@ -64,18 +65,19 @@ export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) = activePanel === eventKey ? : } -
{branch.name} {branch.remote ? `on ${branch.remote.name}` : ''}
+
{branch.name} {branch.remote ? `on ${branch.remote.name}` : ''}
- {context.currentBranch && context.currentBranch.name === branch.name ? - { }}> - - - : - checkout(branch)}> - - - } + {allowCheckout ? + context.currentBranch && context.currentBranch.name === branch.name ? + { }}> + + + : + checkout(branch)}> + + + : null} {!branch.remote && canFetch() && <> fetchBranch()}> openRemote()}> diff --git a/libs/remix-ui/git/src/components/panels/branches.tsx b/libs/remix-ui/git/src/components/panels/branches.tsx index b3b6becef2..b371785425 100644 --- a/libs/remix-ui/git/src/components/panels/branches.tsx +++ b/libs/remix-ui/git/src/components/panels/branches.tsx @@ -35,7 +35,7 @@ export const Branches = () => { {context.branches && context.branches.filter((branch, index) => branch.remote && branch.remote.name === context.upstream.name).map((branch, index) => { return ( - + ); })} { diff --git a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx index c3fe63e752..d3a7a9465f 100644 --- a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx +++ b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx @@ -63,7 +63,7 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => { } return ( - + <>
diff --git a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx index 1b21e1eb76..bd6b0b51f1 100644 --- a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx +++ b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx @@ -12,10 +12,11 @@ import GitUIButton from "../../buttons/gituibutton"; export interface BrancheDetailsProps { branch: branch; + allowCheckout: boolean } export const RemoteBranchDetails = (props: BrancheDetailsProps) => { - const { branch } = props; + const { branch, allowCheckout } = props; const actions = React.useContext(gitActionsContext) const context = React.useContext(gitPluginContext) const [activePanel, setActivePanel] = useState(""); @@ -89,7 +90,7 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => { } return ( - + <>
diff --git a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx index d0ac0daf05..00c6408472 100644 --- a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx +++ b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx @@ -58,6 +58,7 @@ export const PushPull = () => { const remote: remote = context.remotes.find(r => r.name === value) if (remote) { actions.setUpstreamRemote(remote) + actions.setDefaultRemote(remote) } } @@ -119,15 +120,19 @@ export const PushPull = () => { }) setLocalBranchOptions(localBranches) + if(!context.upstream){ + setRemoteBranchOptions([]) + return + } const remoteBranches = context.branches && context.branches.length > 0 && context.branches - .filter(branch => branch.remote) + .filter(branch => branch.remote && branch.remote.name === context.upstream.name) .map(repo => { return { value: repo.name, label: repo.name } } ) setRemoteBranchOptions(remoteBranches) - }, [context.branches]) + }, [context.branches, context.upstream]) useEffect(() => { diff --git a/libs/remix-ui/git/src/components/panels/remoteselect.tsx b/libs/remix-ui/git/src/components/panels/remoteselect.tsx index bd554f70ca..1bff2867b9 100644 --- a/libs/remix-ui/git/src/components/panels/remoteselect.tsx +++ b/libs/remix-ui/git/src/components/panels/remoteselect.tsx @@ -34,7 +34,7 @@ export const Remoteselect = (props: RemoteSelectProps) => { <> {context.branches && context.branches.filter((branch, index) => branch.remote && branch.remote.name === remote.name).map((branch, index) => { return ( - + ); })} {