chromesetting
杨树明 5 years ago
parent 1f2b57ab47
commit 3ea0a3fe97

@ -18,7 +18,7 @@ import UserInfo from '../../developer/components/userInfo';
import actions from '../../../redux/actions';
import LeftPane from './leftPane';
import RightPane from './rightPane';
const { Countdown } = Statistic;
import MyIcon from "../../../common/components/MyIcon";
function jsCopy(s) {
var copyEle = document.getElementById(s);
@ -64,6 +64,8 @@ function JupyterTPI (props) {
changeshowDrawer,
drawervisible,
reset_with_tpi,
jupytertime,
active_with_tpi
} = props;
const emptyCtx = (
@ -71,6 +73,7 @@ function JupyterTPI (props) {
<Empty />
</div>
);
const { Countdown } = Statistic;
const {identifier} = params;
const [userInfo, setUserInfo] = useState({});
const [jupyterInfo, setJupyterInfo] = useState({});
@ -198,9 +201,10 @@ function JupyterTPI (props) {
cancelText: '取消',
onOk () {
console.log('调用重置代码....', myIdentifier);
if (myIdentifier) {
reset_with_tpi(myIdentifier, '重置成功');
}
// if (myIdentifier) {
//
// }
reset_with_tpi(myIdentifier, '重置成功');
},
onCancel() {
stopposttpip(2)
@ -249,7 +253,7 @@ function JupyterTPI (props) {
// 分页处理
const handleChangePage = (page) => {
// console.log(page, pageSize);
handlePageChange(page);
}
// const listCtx = ;
@ -288,7 +292,21 @@ function JupyterTPI (props) {
}
}, [props]);
const deadline = Date.now() + 7200 * 1000; // Moment is also OK
const onFinish= () =>{
Modal.confirm({
title: '倒计时截止',
content: (
<p style={{ lineHeight: '24px' }}>
Jupyter将中断服务是否需要延长使用时间
</p>
),
okText: '确定',
cancelText: '取消',
onOk () {
active_with_tpi(myIdentifier, '重置成功');
}
})
}
return (
<div className="jupyter_area">
@ -297,7 +315,7 @@ function JupyterTPI (props) {
<p className="jupyter_title">
<span className="title_desc" style={{ marginTop: '10px' }}>{jupyterInfo.name}</span>
<span className="title_time jupytertitle_time">
<Countdown value={deadline} format="HH:mm:ss" />
<Countdown value={jupytertime} format="HH:mm:ss" onFinish={onFinish}/>
</span>
</p>
<p className="jupyter_btn">
@ -391,7 +409,7 @@ const mapStateToProps = (state) => {
jupyter_pagination,
jupyter_identifier
} = state.jupyterReducer;
const { loading ,drawervisible} = state.commonReducer;
const { loading ,drawervisible,jupytertime} = state.commonReducer;
return {
loading,
jupyter_info,
@ -402,6 +420,7 @@ const mapStateToProps = (state) => {
pagination: jupyter_pagination,
jupyter_identifier,
drawervisible,
jupytertime
};
}
@ -418,7 +437,11 @@ const mapDispatchToProps = (dispatch) => ({
changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag)),
changeCurrentPage: (current) => dispatch(actions.changeCurrentPage(current)),
//展开Drawer
changeshowDrawer: (type) => dispatch(actions.changeshowDrawer(type))
changeshowDrawer: (type) => dispatch(actions.changeshowDrawer(type)),
//倒计时增加
addjypertime: (type) => dispatch(actions.addjypertime(type)),
//延时
active_with_tpi:(identifier, msg) => dispatch(actions.active_with_tpi(identifier, msg)),
});
export default connect(

@ -64,6 +64,8 @@ const types = {
SAVE_NOTICE_COUNT: 'SAVE_NOTICE_COUNT', // 保存代码块是否更新
AUTO_UPDATE_CODE: 'AUTO_UPDATE_CODE', // 自动更新代码
CHANGE_SHOW_DRAWER: 'CHANGE_SHOW_DRAWER',
CHANGE_JYPYTER_TIME: 'CHANGE_JYPYTER_TIME',//增加15分钟
CHANGE_EXTENDED_TIME: 'CHANGE_EXTENDED_TIME',//延时
}
export default types;

@ -75,6 +75,8 @@ import {
changeCurrentPage,
changeshowDrawer,
reset_with_tpi,
addjypertime,
active_with_tpi
} from './jupyter';
export default {
@ -131,6 +133,8 @@ export default {
saveJupyterTpi,
changeCurrentPage,
changeshowDrawer,
reset_with_tpi
reset_with_tpi,
addjypertime,
active_with_tpi,
// isUpdateCodeCtx
}

@ -14,7 +14,8 @@ import {
fetchJupyterInfo,
fetchSyncJupyterCode,
fetchreset_with_tpi,
fetchSaveJupyterTpi
fetchSaveJupyterTpi,
fetactive_with_tpi
} from "../../services/jupyterServer";
// 获取 jupyter 相关信息
@ -135,6 +136,30 @@ export const reset_with_tpi = (identifier, msg) => {
})
}
}
// 延时
export const active_with_tpi = (identifier, msg) => {
return (dispatch,getState) => {
const {jupyter_info }= getState().jupyterReducer;
if (!jupyter_info.myshixun_identifier) return;
const params = {
identifier: jupyter_info.myshixun_identifier,
};
fetactive_with_tpi(params).then(res => {
// console.log('同步代码成功: ', res);
if (res.data.status === 401) return;
if (res.status === 200) {
const {status} = res.data
if (status === 0) {
message.success(msg);
addjypertime(Date.now() + 900 * 1000);
}
}
})
}
}
// 改变状态值
export const changeGetJupyterUrlState = (status) => {
return {
@ -187,4 +212,13 @@ export const changeshowDrawer = (type) => {
type: types.CHANGE_SHOW_DRAWER,
payload: type
}
}
}
//增加倒计时
export const addjypertime=(time)=>{
return {
type: types.CHANGE_JYPYTER_TIME,
payload: time
}
}

@ -15,7 +15,8 @@ const initialState = {
submitLoading: false, // 提交按钮状态
publishLoading: false, // 发布
isMySource: false,
drawervisible:false
drawervisible:false,
jupytertime:Date.now() + 3600 * 1000,
}
const commonReducer = (state = initialState, action) => {
@ -56,6 +57,11 @@ const commonReducer = (state = initialState, action) => {
...state,
drawervisible: action.payload
}
case types.CHANGE_JYPYTER_TIME:
return {
...state,
jupytertime: action.payload
}
default:
return state;
}

@ -38,4 +38,10 @@ export async function fetchSaveJupyterTpi (params) {
export async function fetchreset_with_tpi (params) {
const url = `/jupyters/reset_with_tpi.json`;
return axios.get(url, { params });
}
//延时jupyter
export async function fetactive_with_tpi(params) {
const url = `/jupyters/active_with_tpi.json`;
return axios.get(url, { params });
}
Loading…
Cancel
Save