mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
This commit is contained in:
parent
ee77606a4a
commit
a0f0f38ea6
3 changed files with 12 additions and 4 deletions
|
@ -47,7 +47,7 @@ interface Props extends RouteComponentProps<MainRouteParams> {
|
|||
repoStatus?: RepoStatus;
|
||||
tree: FileTree;
|
||||
file: FetchFileResponse | undefined;
|
||||
currentTree: FileTree | undefined;
|
||||
currentTree: FileTree | null;
|
||||
commits: CommitInfo[];
|
||||
branches: ReferenceInfo[];
|
||||
hasMoreCommits: boolean;
|
||||
|
|
|
@ -14,14 +14,16 @@ import { MainRouteParams } from '../../common/types';
|
|||
import { ShortcutsProvider } from '../shortcuts';
|
||||
import { Content } from './content';
|
||||
import { SideTabs } from './side_tabs';
|
||||
import { structureSelector } from '../../selectors';
|
||||
import { structureSelector, currentTreeSelector } from '../../selectors';
|
||||
import { RootState } from '../../reducers';
|
||||
import { FileTree } from '../../../model';
|
||||
|
||||
interface Props extends RouteComponentProps<MainRouteParams> {
|
||||
loadingFileTree: boolean;
|
||||
loadingStructureTree: boolean;
|
||||
hasStructure: boolean;
|
||||
languageServerInitializing: boolean;
|
||||
currentTree: FileTree | null;
|
||||
}
|
||||
|
||||
class CodeMain extends React.Component<Props> {
|
||||
|
@ -60,6 +62,7 @@ class CodeMain extends React.Component<Props> {
|
|||
<div className="codeContainer__rootInner">
|
||||
<React.Fragment>
|
||||
<SideTabs
|
||||
currentTree={this.props.currentTree}
|
||||
loadingFileTree={loadingFileTree}
|
||||
loadingStructureTree={loadingStructureTree}
|
||||
hasStructure={hasStructure}
|
||||
|
@ -79,6 +82,7 @@ const mapStateToProps = (state: RootState) => ({
|
|||
loadingStructureTree: state.symbol.loading,
|
||||
hasStructure: structureSelector(state).length > 0 && !state.symbol.error,
|
||||
languageServerInitializing: state.symbol.languageServerInitializing,
|
||||
currentTree: currentTreeSelector(state),
|
||||
});
|
||||
|
||||
export const Main = connect(mapStateToProps)(CodeMain);
|
||||
|
|
|
@ -9,10 +9,11 @@ import { parse as parseQuery } from 'querystring';
|
|||
import React from 'react';
|
||||
import { RouteComponentProps, withRouter } from 'react-router-dom';
|
||||
import { QueryString } from 'ui/utils/query_string';
|
||||
import { MainRouteParams, PathTypes } from '../../common/types';
|
||||
import { MainRouteParams } from '../../common/types';
|
||||
import { FileTree } from '../file_tree/file_tree';
|
||||
import { Shortcut } from '../shortcuts';
|
||||
import { SymbolTree } from '../symbol_tree/symbol_tree';
|
||||
import { FileTree as IFileTree, FileTreeItemType } from '../../../model';
|
||||
|
||||
enum Tabs {
|
||||
file = 'file',
|
||||
|
@ -24,6 +25,7 @@ interface Props extends RouteComponentProps<MainRouteParams> {
|
|||
loadingStructureTree: boolean;
|
||||
hasStructure: boolean;
|
||||
languageServerInitializing: boolean;
|
||||
currentTree: IFileTree | null;
|
||||
}
|
||||
|
||||
class CodeSideTabs extends React.PureComponent<Props> {
|
||||
|
@ -77,7 +79,9 @@ class CodeSideTabs extends React.PureComponent<Props> {
|
|||
id: Tabs.structure,
|
||||
name: 'Structure',
|
||||
content: structureTabContent,
|
||||
disabled: this.props.match.params.pathType === PathTypes.tree || !this.props.hasStructure,
|
||||
disabled:
|
||||
!(this.props.currentTree && this.props.currentTree.type === FileTreeItemType.File) ||
|
||||
!this.props.hasStructure,
|
||||
'data-test-subj': 'codeStructureTreeTab',
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue