chromesetting
杨树明 5 years ago
parent 5afcc19350
commit b9f25a6271

@ -9,14 +9,13 @@
import './index.scss'; import './index.scss';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import SplitPane from 'react-split-pane'; import SplitPane from 'react-split-pane';
import { Button, Modal,Drawer ,Pagination,Empty,Tooltip,Icon,message,Statistic} from 'antd'; import { Button, Modal,Drawer ,Pagination,Empty,Tooltip,Icon,message,Statistic,Spin} from 'antd';
import { import {
connect connect
} from 'react-redux'; } from 'react-redux';
import FloatButton from '../../page/component/FloatButton'; import FloatButton from '../../page/component/FloatButton';
import UserInfo from '../../developer/components/userInfo'; import UserInfo from '../../developer/components/userInfo';
import actions from '../../../redux/actions'; import actions from '../../../redux/actions';
import LeftPane from './leftPane';
import RightPane from './rightPane'; import RightPane from './rightPane';
import MyIcon from "../../../common/components/MyIcon"; import MyIcon from "../../../common/components/MyIcon";
@ -65,7 +64,9 @@ function JupyterTPI (props) {
drawervisible, drawervisible,
reset_with_tpi, reset_with_tpi,
jupytertime, jupytertime,
active_with_tpi active_with_tpi,
spinning,
updataspinning
} = props; } = props;
const emptyCtx = ( const emptyCtx = (
@ -140,6 +141,7 @@ function JupyterTPI (props) {
if (tpm_modified && updateTip && myshixun_identifier) { if (tpm_modified && updateTip && myshixun_identifier) {
setUpdateTip(false); setUpdateTip(false);
updataspinning(true)
Modal.confirm({ Modal.confirm({
title: '更新通知', title: '更新通知',
content: (<div className="update_notice"> content: (<div className="update_notice">
@ -153,6 +155,7 @@ function JupyterTPI (props) {
onOk () { onOk () {
syncJupyterCode(myshixun_identifier, '同步成功'); syncJupyterCode(myshixun_identifier, '同步成功');
},onCancel() { },onCancel() {
updataspinning(false)
stopposttpip(2) stopposttpip(2)
}, },
}) })
@ -189,6 +192,7 @@ function JupyterTPI (props) {
// 重置环境 // 重置环境
const handleEnvironmentTpi = () => { const handleEnvironmentTpi = () => {
stopposttpip(1) stopposttpip(1)
updataspinning(true)
Modal.confirm({ Modal.confirm({
title: '重置环境', title: '重置环境',
content: ( content: (
@ -207,6 +211,7 @@ function JupyterTPI (props) {
reset_with_tpi(myIdentifier, '重置成功'); reset_with_tpi(myIdentifier, '重置成功');
}, },
onCancel() { onCancel() {
updataspinning(false)
stopposttpip(2) stopposttpip(2)
}, },
}) })
@ -309,6 +314,7 @@ function JupyterTPI (props) {
} }
return ( return (
<Spin tip="加载中..." spinning={spinning}>
<div className="jupyter_area"> <div className="jupyter_area">
<div className="jupyter_header"> <div className="jupyter_header">
<UserInfo userInfo={userInfo} /> <UserInfo userInfo={userInfo} />
@ -396,6 +402,7 @@ function JupyterTPI (props) {
</Drawer> </Drawer>
</div> </div>
</div> </div>
</Spin>
); );
} }
@ -409,7 +416,7 @@ const mapStateToProps = (state) => {
jupyter_pagination, jupyter_pagination,
jupyter_identifier jupyter_identifier
} = state.jupyterReducer; } = state.jupyterReducer;
const { loading ,drawervisible,jupytertime} = state.commonReducer; const { loading ,drawervisible,jupytertime,spinning} = state.commonReducer;
return { return {
loading, loading,
jupyter_info, jupyter_info,
@ -420,7 +427,8 @@ const mapStateToProps = (state) => {
pagination: jupyter_pagination, pagination: jupyter_pagination,
jupyter_identifier, jupyter_identifier,
drawervisible, drawervisible,
jupytertime jupytertime,
spinning
}; };
} }
@ -442,6 +450,7 @@ const mapDispatchToProps = (dispatch) => ({
addjypertime: (type) => dispatch(actions.addjypertime(type)), addjypertime: (type) => dispatch(actions.addjypertime(type)),
//延时 //延时
active_with_tpi:(identifier, msg) => dispatch(actions.active_with_tpi(identifier, msg)), active_with_tpi:(identifier, msg) => dispatch(actions.active_with_tpi(identifier, msg)),
updataspinning:(identifier, msg) => dispatch(actions.updataspinning(identifier, msg)),
}); });
export default connect( export default connect(

@ -66,6 +66,7 @@ const types = {
CHANGE_SHOW_DRAWER: 'CHANGE_SHOW_DRAWER', CHANGE_SHOW_DRAWER: 'CHANGE_SHOW_DRAWER',
CHANGE_JYPYTER_TIME: 'CHANGE_JYPYTER_TIME',//增加15分钟 CHANGE_JYPYTER_TIME: 'CHANGE_JYPYTER_TIME',//增加15分钟
CHANGE_EXTENDED_TIME: 'CHANGE_EXTENDED_TIME',//延时 CHANGE_EXTENDED_TIME: 'CHANGE_EXTENDED_TIME',//延时
CHANGE_UPDETA_SPIN: 'CHANGE_UPDETA_SPIN',//加载
} }
export default types; export default types;

@ -76,7 +76,8 @@ import {
changeshowDrawer, changeshowDrawer,
reset_with_tpi, reset_with_tpi,
addjypertime, addjypertime,
active_with_tpi active_with_tpi,
updataspinning
} from './jupyter'; } from './jupyter';
export default { export default {
@ -136,5 +137,6 @@ export default {
reset_with_tpi, reset_with_tpi,
addjypertime, addjypertime,
active_with_tpi, active_with_tpi,
updataspinning
// isUpdateCodeCtx // isUpdateCodeCtx
} }

@ -105,6 +105,7 @@ export const syncJupyterCode = (identifier, msg) => {
const {status} = res.data const {status} = res.data
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
updataspinning(false)
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 300); }, 300);
@ -129,6 +130,7 @@ export const reset_with_tpi = (identifier, msg) => {
const {status} = res.data const {status} = res.data
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
updataspinning(false)
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 300); }, 300);
@ -222,4 +224,10 @@ export const addjypertime=(time)=>{
} }
} }
export const updataspinning=(type)=>{
return {
type: types.CHANGE_UPDETA_SPIN,
payload: type
}
}

@ -17,6 +17,7 @@ const initialState = {
isMySource: false, isMySource: false,
drawervisible:false, drawervisible:false,
jupytertime:Date.now() + 3600 * 1000, jupytertime:Date.now() + 3600 * 1000,
spinning:false
} }
const commonReducer = (state = initialState, action) => { const commonReducer = (state = initialState, action) => {
@ -62,6 +63,11 @@ const commonReducer = (state = initialState, action) => {
...state, ...state,
jupytertime: action.payload jupytertime: action.payload
} }
case types.CHANGE_UPDETA_SPIN:
return {
...state,
spinning: action.payload
}
default: default:
return state; return state;
} }

Loading…
Cancel
Save