出现重试时,显示头部

dev_newshixunModel
hjm 6 years ago
parent 026b0a8f66
commit 552a01b2ee

@ -144,11 +144,7 @@ class MainContent extends Component {
{/* readRepoTimeout 如果读取代码超时,显示重新加载按钮,重新拉取代码 */} {/* readRepoTimeout 如果读取代码超时,显示重新加载按钮,重新拉取代码 */}
{ {
st === 0 st === 0
? ?
readRepoTimeout === true ? <div className="readRepoFailed">
代码加载失败<a className="retry"
onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true, true)}>重试</a>
</div> :
<React.Fragment> <React.Fragment>
<div style={{display: (codeLoading ? 'block' : 'none'), textAlign: 'center'}}> <div style={{display: (codeLoading ? 'block' : 'none'), textAlign: 'center'}}>
<CircularProgress size={40} thickness={3} <CircularProgress size={40} thickness={3}

@ -319,7 +319,8 @@ class MainContentContainer extends Component {
readingRepoTimes = readingRepoTimes + 1; readingRepoTimes = readingRepoTimes + 1;
if(readingRepoTimes > 9) { if(readingRepoTimes > 9) {
this.setState({ this.setState({
readRepoTimeout: true readRepoTimeout: true,
codeLoading: false
}) })
readingRepoTimes = 0; readingRepoTimes = 0;
showSnackbar(`网络异常,请稍后重试。`); showSnackbar(`网络异常,请稍后重试。`);

@ -510,6 +510,10 @@ class CodeRepositoryView extends Component {
<div className="cl"></div> <div className="cl"></div>
</ul> </ul>
<div className="cl"></div> <div className="cl"></div>
{this.props.readRepoTimeout === true ? <div className="readRepoFailed">
代码加载失败<a className="retry"
onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true, true)}>重试</a>
</div> :
<div id="codetab_con_1" style={{display: 'block', flex: 'auto'}} style={ tabIndex === 0 ? {display: 'block'} : {display: 'none'} }> <div id="codetab_con_1" style={{display: 'block', flex: 'auto'}} style={ tabIndex === 0 ? {display: 'block'} : {display: 'none'} }>
{/* 没必要显示这个,注释掉了 */} {/* 没必要显示这个,注释掉了 */}
{/* { !isEditablePath && {/* { !isEditablePath &&
@ -526,7 +530,7 @@ class CodeRepositoryView extends Component {
{/* cm monaco 切换 */} {/* cm monaco 切换 */}
{/* <TPICodeMirror {...this.props} ></TPICodeMirror> */} {/* <TPICodeMirror {...this.props} ></TPICodeMirror> */}
<TPIMonaco {...this.props}></TPIMonaco> <TPIMonaco {...this.props}></TPIMonaco>
</div> </div>}
<div id="codetab_con_81" className="undis -relative" <div id="codetab_con_81" className="undis -relative"
style={ { color: '#fff', display: tabIndex === STABLE_SSH_TAB_ID ? 'block' : 'none', 'marginLeft': '2px'} }> style={ { color: '#fff', display: tabIndex === STABLE_SSH_TAB_ID ? 'block' : 'none', 'marginLeft': '2px'} }>
{/* { tabIndex === STABLE_SSH_TAB_ID && this.state.sshData && <Webssh {...this.state.sshData} ></Webssh> } */} {/* { tabIndex === STABLE_SSH_TAB_ID && this.state.sshData && <Webssh {...this.state.sshData} ></Webssh> } */}

Loading…
Cancel
Save