File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
x-pack/legacy/plugins/code/public/components/main Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020 SearchOptions ,
2121 SearchScope ,
2222 WorkerReservedProgress ,
23+ Repository ,
2324} from '../../../model' ;
2425import { CommitInfo , ReferenceInfo } from '../../../model/commit' ;
2526import { changeSearchScope , FetchFileResponse , RepoState , RepoStatus } from '../../actions' ;
@@ -57,6 +58,7 @@ interface Props extends RouteComponentProps<MainRouteParams> {
5758 fileTreeLoadingPaths : string [ ] ;
5859 searchOptions : SearchOptions ;
5960 query : string ;
61+ currentRepository : Repository ;
6062}
6163const LANG_MD = 'markdown' ;
6264
@@ -232,6 +234,7 @@ class CodeContent extends React.PureComponent<Props> {
232234 searchOptions = { this . props . searchOptions }
233235 branches = { this . props . branches }
234236 query = { this . props . query }
237+ currentRepository = { this . props . currentRepository }
235238 />
236239 { this . renderContent ( ) }
237240 </ div >
@@ -402,6 +405,7 @@ const mapStateToProps = (state: RootState) => ({
402405 repoStatus : statusSelector ( state , repoUriSelector ( state ) ) ,
403406 searchOptions : state . search . searchOptions ,
404407 query : state . search . query ,
408+ currentRepository : state . repository . repository ,
405409} ) ;
406410
407411const mapDispatchToProps = {
Original file line number Diff line number Diff line change 66
77import { EuiFlexGroup , EuiFlexItem , EuiSelect } from '@elastic/eui' ;
88import React , { ChangeEvent } from 'react' ;
9- import { SearchOptions , SearchScope } from '../../../model' ;
9+ import { SearchOptions , SearchScope , Repository } from '../../../model' ;
1010import { ReferenceInfo } from '../../../model/commit' ;
1111import { MainRouteParams } from '../../common/types' ;
1212import { encodeRevisionString , decodeRevisionString } from '../../../common/uri_util' ;
@@ -22,6 +22,7 @@ interface Props {
2222 searchOptions : SearchOptions ;
2323 branches : ReferenceInfo [ ] ;
2424 query : string ;
25+ currentRepository ?: Repository ;
2526}
2627
2728export class TopBar extends React . Component < Props , { value : string } > {
@@ -38,6 +39,9 @@ export class TopBar extends React.Component<Props, { value: string }> {
3839
3940 getBranch = ( revision : string ) => {
4041 const r = decodeRevisionString ( revision ) ;
42+ if ( r . toUpperCase ( ) === 'HEAD' && this . props . currentRepository ) {
43+ return this . props . currentRepository . defaultBranch ;
44+ }
4145 const branch = this . props . branches . find ( b => b . name === r ) ;
4246 if ( branch ) {
4347 return branch . name ;
You can’t perform that action at this time.
0 commit comments