From d093bee6c50c3c1f6781cf88c8ee127cef278413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 27 Dec 2019 20:35:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 5 +- .../Challenges/Challengesjupyter.js | 69 +++++++++++++++++-- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 02a6c2259..c8b95095b 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -329,13 +329,14 @@ function JupyterTPI (props) { title: '倒计时截止', content: (
- Jupyter将中断服务,是否需要延长使用时间? + 服务已中断,是否确认重置实验环境?
), okText: '确定', cancelText: '取消', onOk () { - active_with_tpi(myIdentifier, '重置成功'); + reset_with_tpi(myIdentifier, '重置成功'); + // active_with_tpi(myIdentifier, '重置成功'); } }) } diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index f7cc90654..011446cf4 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -1,11 +1,12 @@ import React, { Component } from 'react'; import { Link } from "react-router-dom"; import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder' -import { Divider, Tooltip,Upload,Modal,Spin} from 'antd'; +import { Divider, Tooltip,Upload,Modal,Countdown} from 'antd'; import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; import '../shixunchildCss/Challenges.css'; import axios from 'axios'; +import {addjypertime} from "../../../../redux/actions/jupyter"; const $ = window.$; class Challengesjupyter extends Component { @@ -28,7 +29,8 @@ class Challengesjupyter extends Component { enlarge:false, fileList:[], shuaxin:false, - showtime:false + showtime:false, + jupytertime:Date.now() +3600 * 1000 } } @@ -104,13 +106,44 @@ class Challengesjupyter extends Component { } componentDidMount() { - var that=this; + let that=this; setTimeout(this.ChallengesList(), 1000); let id = this.props.match.params.shixunId; - let ChallengesURL = `/jupyters/get_info_with_tpm.json`; let datas={ identifier:id, } + let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json` + axios.get(timeinfo_with_tpm, {params: datas}).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + if(response.data.status===0){ + if(res.data.useSeconds===null){ + Modal.warning({ + title: '提示', + content: '因为这个实训pod不在了,请联系系统管理人员', + }); + }else{ + let useSeconds=res.data.useSeconds; + let summain=3600 * 1000; + let sums= useSeconds * 1000; + let sum=summain-sums; + setTimeout(()=>{ + this.setState({ + jupytertime:Date.now() +sum + }) + },500); + } + }else{ + + } + } + }).catch((error) => { + + }); + + let ChallengesURL = `/jupyters/get_info_with_tpm.json`; + axios.get(ChallengesURL, {params: datas}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { setTimeout(() => { @@ -383,6 +416,23 @@ class Challengesjupyter extends Component { }, }) } + + onFinish=()=>{ + let id=this.props.match.params.shixunId; + Modal.confirm({ + title: '倒计时截止', + content: ( ++ 服务已中断,是否确认重置实验环境? +
+ ), + okText: '确定', + cancelText: '取消', + onOk () { + this.handleClickResetTpisync_code(id) + } + }) + } render() { let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; let id = this.props.match.params.shixunId; @@ -433,7 +483,7 @@ class Challengesjupyter extends Component {