|
|
@ -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,18 +65,19 @@ 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 ? |
|
|
|
<GitUIButton data-id={`branches-toggle-current-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => { }}> |
|
|
|
context.currentBranch && context.currentBranch.name === branch.name ? |
|
|
|
<FontAwesomeIcon className='pointer text-success' icon={faToggleOff} ></FontAwesomeIcon> |
|
|
|
<GitUIButton data-id={`branches-toggle-current-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => { }}> |
|
|
|
</GitUIButton> |
|
|
|
<FontAwesomeIcon className='pointer text-success' icon={faToggleOff} ></FontAwesomeIcon> |
|
|
|
: |
|
|
|
</GitUIButton> |
|
|
|
<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> |
|
|
|
<GitUIButton tooltip="checkout branch" data-id={`branches-toggle-branch-${branch.name}`} className="btn btn-sm p-0 mr-1" onClick={() => checkout(branch)}> |
|
|
|
</GitUIButton> |
|
|
|
<FontAwesomeIcon icon={faToggleOn}></FontAwesomeIcon> |
|
|
|
} |
|
|
|
</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> |
|
|
|