|
|
@ -13,10 +13,11 @@ interface BrancheDetailsNavigationProps { |
|
|
|
callback: (eventKey: string) => void; |
|
|
|
callback: (eventKey: string) => void; |
|
|
|
branch: branch; |
|
|
|
branch: branch; |
|
|
|
checkout: (branch: branch) => void; |
|
|
|
checkout: (branch: branch) => void; |
|
|
|
|
|
|
|
allowCheckout: boolean; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) => { |
|
|
|
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 context = React.useContext(gitPluginContext) |
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
const handleClick = () => { |
|
|
|
const handleClick = () => { |
|
|
@ -64,10 +65,11 @@ export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) = |
|
|
|
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
|
|
|
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
|
|
|
} |
|
|
|
} |
|
|
|
<i className="fa fa-code-branch ml-1"></i> |
|
|
|
<i className="fa fa-code-branch ml-1"></i> |
|
|
|
<div className={`ml-1 ${context.currentBranch.name === branch.name ? 'text-success' : ''}`}>{branch.name} {branch.remote ? `on ${branch.remote.name}` : ''}</div> |
|
|
|
<div className={`ml-1 ${context.currentBranch.name === branch.name && allowCheckout ? 'text-success' : ''}`}>{branch.name} {branch.remote ? `on ${branch.remote.name}` : ''}</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{context.currentBranch && context.currentBranch.name === branch.name ? |
|
|
|
{allowCheckout ? |
|
|
|
|
|
|
|
context.currentBranch && context.currentBranch.name === branch.name ? |
|
|
|
<GitUIButton data-id={`branches-toggle-current-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => { }}> |
|
|
|
<GitUIButton data-id={`branches-toggle-current-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => { }}> |
|
|
|
<FontAwesomeIcon className='pointer text-success' icon={faToggleOff} ></FontAwesomeIcon> |
|
|
|
<FontAwesomeIcon className='pointer text-success' icon={faToggleOff} ></FontAwesomeIcon> |
|
|
|
</GitUIButton> |
|
|
|
</GitUIButton> |
|
|
@ -75,7 +77,7 @@ export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) = |
|
|
|
<GitUIButton tooltip="checkout branch" data-id={`branches-toggle-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => checkout(branch)}> |
|
|
|
<GitUIButton tooltip="checkout branch" data-id={`branches-toggle-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => checkout(branch)}> |
|
|
|
<FontAwesomeIcon icon={faToggleOn}></FontAwesomeIcon> |
|
|
|
<FontAwesomeIcon icon={faToggleOn}></FontAwesomeIcon> |
|
|
|
</GitUIButton> |
|
|
|
</GitUIButton> |
|
|
|
} |
|
|
|
: null} |
|
|
|
{!branch.remote && canFetch() && <> |
|
|
|
{!branch.remote && canFetch() && <> |
|
|
|
<GitUIButton tooltip="fetch branch" className="btn btn-sm p-0 mr-1 text-muted" onClick={() => fetchBranch()}><FontAwesomeIcon icon={faSync} ></FontAwesomeIcon></GitUIButton> |
|
|
|
<GitUIButton tooltip="fetch branch" className="btn btn-sm p-0 mr-1 text-muted" onClick={() => fetchBranch()}><FontAwesomeIcon icon={faSync} ></FontAwesomeIcon></GitUIButton> |
|
|
|
<GitUIButton tooltip="open on remote" className="btn btn-sm p-0 mr-1 text-muted" onClick={() => openRemote()}><FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon></GitUIButton> |
|
|
|
<GitUIButton tooltip="open on remote" className="btn btn-sm p-0 mr-1 text-muted" onClick={() => openRemote()}><FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon></GitUIButton> |
|
|
|