Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_tpm_ui
杨树林 5 years ago
commit 0d81331a6e

@ -85,7 +85,7 @@ class HackUserLastestCodesController < ApplicationController
testCase = ojEvaResult['testCase'] testCase = ojEvaResult['testCase']
# 只有编译出错时,才正则匹配错误行数 # 只有编译出错时,才正则匹配错误行数
error_line= error_line=
if params[:status] == "-4" if ojEvaResult['status'] == "4" || ojEvaResult['status'] == "5"
regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language
end end
# debug 与submit 公用的参数 # debug 与submit 公用的参数
@ -148,11 +148,12 @@ class HackUserLastestCodesController < ApplicationController
# 正则错误行数 # 正则错误行数
def regular_match_error_line content, language def regular_match_error_line content, language
content = Base64.decode64(content).force_encoding("utf-8") content = Base64.decode64(content).force_encoding("utf-8")
logger.info("######content: #{content}")
case language case language
when 'Java' when 'Java'
content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min
when 'C', 'C++' when 'C', 'C++'
content.scan(/\d:\d+: error/).map{|s| s.match(/\d+/)[0]}.min content.scan(/\d:\d+:/).map{|s| s.match(/\d+/)[0]}.min
when 'Python' when 'Python'
content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min
end end

@ -41,12 +41,14 @@ $ml: 20px;
} }
.item-desc{ .item-desc{
flex: 1; flex: 1;
margin-left: $ml; // margin-left: $ml;
margin-left: 5px;
} }
.item-header{ .item-header{
font-size: $fz14; font-size: $fz14;
line-height: $lh14; line-height: $lh14;
color: #333; color: #333;
margin-left: 15px;
.item-time{ .item-time{
font-size: $fz12; font-size: $fz12;
line-height: $lh14; line-height: $lh14;

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-03 15:20:55 * @Date: 2019-12-03 15:20:55
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 11:41:42 * @LastEditTime : 2019-12-27 22:35:14
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 14:51:42 * @LastEditTime : 2019-12-27 21:18:39
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -60,6 +60,14 @@ function RecordDetail (props) {
props.history.push(`/myproblems/${identifier}`); props.history.push(`/myproblems/${identifier}`);
} }
} }
const handleEditorCode = (identifier, code) => {
if (identifier) {
console.log(code);
saveEditorCodeForDetail(code);
props.history.push(`/myproblems/${identifier}`);
}
}
return ( return (
<div className="record_detail_area"> <div className="record_detail_area">
<div className="record_detail_header"> <div className="record_detail_header">
@ -114,9 +122,10 @@ function RecordDetail (props) {
style={{ visibility: identifier ? 'visible' : 'hidden'}} style={{ visibility: identifier ? 'visible' : 'hidden'}}
className={'header_btn'} className={'header_btn'}
type="primary" type="primary"
onClick={() => handleEditorCode(identifier, detail.code)}
> >
{/* 编辑代码 */} 编辑代码
<Link to={`/myproblems/${identifier}`}>编辑代码</Link> {/* <Link to={`/myproblems/${identifier}`}>编辑代码</Link> */}
</Button> </Button>
</div> </div>
<div className="result_code_area"> <div className="result_code_area">

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:33 * @Date: 2019-11-27 09:49:33
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 17:14:04 * @LastEditTime : 2019-12-27 22:40:32
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -96,7 +96,7 @@ const CommitRecord = (props) => {
const { const {
id, id,
// error_line, // error_line,
// error_msg, error_msg,
// execute_memory, // execute_memory,
// execute_time, // execute_time,
// input, // input,
@ -123,7 +123,7 @@ const CommitRecord = (props) => {
复制错误信息 <Icon type="copy" className={'icon_style'}/> 复制错误信息 <Icon type="copy" className={'icon_style'}/>
</span> </span>
</p> </p>
<p className={'show_detail'}> <p className={'show_detail'} style={{ visibility: id ? 'visible' : 'hidden' }}>
<Link to={`/myproblems/record_detail/${id}`}> <Link to={`/myproblems/record_detail/${id}`}>
显示详情 <Icon type="right" className={'icon_style'}/> 显示详情 <Icon type="right" className={'icon_style'}/>
</Link> </Link>

@ -168,8 +168,7 @@ function JupyterTPI (props) {
title: '更新通知', title: '更新通知',
content: (<div className="update_notice"> content: (<div className="update_notice">
{stopposttpip(1)} {stopposttpip(1)}
<p className="update_txt">该实训已更新您选择更新后之前编写的实训代码将会丢失</p> <p className="update_txt">该实训已更新您选择更新后之前编写的实训代码将会丢失如有需要请先使用jupyter中-文件-下载保存代码再进行更新</p>
<p className="update_txt">如有需要请先使用jupyter中-文件-下载保存代码再进行更新</p>
{/*<p className="update_txt">还未完成评测的任务代码,请自行保存</p>*/} {/*<p className="update_txt">还未完成评测的任务代码,请自行保存</p>*/}
</div>), </div>),
okText: '立即更新', okText: '立即更新',
@ -188,6 +187,7 @@ function JupyterTPI (props) {
// 重置实训 // 重置实训
const handleClickResetTpi = () => { const handleClickResetTpi = () => {
stopposttpip(1) stopposttpip(1)
updataspinning(true)
Modal.confirm({ Modal.confirm({
title: '重置实训', title: '重置实训',
content: ( content: (
@ -206,6 +206,7 @@ function JupyterTPI (props) {
}, },
onCancel() { onCancel() {
stopposttpip(2) stopposttpip(2)
updataspinning(false)
}, },
}) })
} }

@ -26,7 +26,7 @@ function RightPane (props) {
const loadInit = ( const loadInit = (
<div className="jupyter_loading_init"> <div className="jupyter_loading_init">
<Spin tip="加载中..."></Spin> {/*<Spin tip="加载中..."></Spin>*/}
</div> </div>
); );

@ -105,13 +105,8 @@ class Challengesjupyter extends Component {
} }
} }
componentDidMount() {
let that=this; gettimeinfo_with_tpm=(datas)=>{
setTimeout(this.ChallengesList(), 1000);
let id = this.props.match.params.shixunId;
let datas={
identifier:id,
}
let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json` let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json`
axios.get(timeinfo_with_tpm, {params: datas}).then((response) => { axios.get(timeinfo_with_tpm, {params: datas}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
@ -119,10 +114,7 @@ class Challengesjupyter extends Component {
}else{ }else{
if(response.data.status===0){ if(response.data.status===0){
if(response.data.useSeconds===null){ if(response.data.useSeconds===null){
Modal.warning({ this.handleClickResetTpi()
title: '提示',
content: '因为这个实训pod不在了请联系系统管理人员',
});
}else{ }else{
let useSeconds=response.data.useSeconds; let useSeconds=response.data.useSeconds;
let summain=3600 * 1000; let summain=3600 * 1000;
@ -141,6 +133,15 @@ class Challengesjupyter extends Component {
}).catch((error) => { }).catch((error) => {
}); });
}
componentDidMount() {
let that=this;
setTimeout(this.ChallengesList(), 1000);
let id = this.props.match.params.shixunId;
let datas={
identifier:id,
}
let ChallengesURL = `/jupyters/get_info_with_tpm.json`; let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
@ -153,6 +154,7 @@ class Challengesjupyter extends Component {
}, 600) }, 600)
}else{ }else{
if(response.data.status===0){ if(response.data.status===0){
this.gettimeinfo_with_tpm(datas)
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({
jupyter_url:response.data.url, jupyter_url:response.data.url,
@ -503,6 +505,7 @@ class Challengesjupyter extends Component {
} }
</style> </style>
<span className={"Countdowntypes"}> <span className={"Countdowntypes"}>
{/*this.state.jupytertime*/}
<Countdown value={this.state.jupytertime} format="HH:mm:ss" onFinish={this.onFinish}/> <Countdown value={this.state.jupytertime} format="HH:mm:ss" onFinish={this.onFinish}/>
</span> </span>

@ -248,10 +248,16 @@ export const timeinfo_with_tpi = (identifier, dispatch) => {
if (res.status === 200) { if (res.status === 200) {
if(res.data.status===0){ if(res.data.status===0){
if(res.data.useSeconds===null){ if(res.data.useSeconds===null){
Modal.warning({ Modal.confirm({
title: '提示', title: '重置环境',
content: '因为这个实训pod不在了无法获取倒计时请联系系统管理人员', content:" 是否确定重置环境?" ,
}); okText: '确定',
cancelText: '取消',
onOk () {
reset_with_tpi(identifier, '重置成功');
},
onCancel() {}
})
}else{ }else{
let useSeconds=res.data.useSeconds; let useSeconds=res.data.useSeconds;
let summain=3600 * 1000; let summain=3600 * 1000;

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 16:35:46 * @Date: 2019-11-20 16:35:46
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 20:13:01 * @LastEditTime : 2019-12-27 22:19:15
*/ */
import types from './actionTypes'; import types from './actionTypes';
import CONST from '../../constants'; import CONST from '../../constants';
@ -298,9 +298,14 @@ export const validateOjForm = (props, type, cb) => {
type: types.SAVE_OJ_FORM_ID, type: types.SAVE_OJ_FORM_ID,
payload: identifier payload: identifier
}); });
console.log(identifier , props.identifier);
if (identifier || props.identifier) {
dispatch(getOJFormById(identifier || props.identifier));
}
// 保存成功后,调用编辑接口并改变路 // 保存成功后,调用编辑接口并改变路
if (paramsObj['submitType'] === 'add' && identifier) { if (paramsObj['submitType'] === 'add' && identifier) {
dispatch(getOJFormById(identifier));
props.history.push(`/problems/${identifier}/edit`); props.history.push(`/problems/${identifier}/edit`);
}; };
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:41:48 * @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 20:59:00 * @LastEditTime : 2019-12-27 21:28:28
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -58,7 +58,8 @@ const ojForUserReducer = (state = initialState, action) => {
...state, ...state,
hack: Object.assign({}, hack), hack: Object.assign({}, hack),
test_case: Object.assign({}, test_case), test_case: Object.assign({}, test_case),
comment_identifier: hack.identifier comment_identifier: hack.identifier,
userCode: tempCode
} }
case types.COMMIT_RECORD_DETAIL: case types.COMMIT_RECORD_DETAIL:
let result = action.payload.data; let result = action.payload.data;

Loading…
Cancel
Save