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

chromesetting
daiao 5 years ago
commit fe49357aa6

@ -80,4 +80,17 @@ class JupytersController < ApplicationController
render json: {status: 0} render json: {status: 0}
end end
def timeinfo_with_tpm
shixun = Shixun.find_by(identifier: params[:identifier])
info = jupyter_timeinfo_tpm(shixun)
render json: {status: 0}.merge(info)
end
def timeinfo_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier])
info = jupyter_timeinfo_tpi(shixun)
render json: {status: 0}.merge(info)
end
end end

@ -376,7 +376,7 @@ class MyshixunsController < ApplicationController
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改. # todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}", params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
identifier: "xinhu1ji2qu3"} identifier: "xinhu1ji2qu3"}
uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository" uri = "#{shixun_tomcat}/bridge/game/resetJupyterTpm"
res = uri_post uri, params res = uri_post uri, params
if (res && res['code'] != 0) if (res && res['code'] != 0)
tip_exception("实训云平台繁忙繁忙等级95") tip_exception("实训云平台繁忙繁忙等级95")

@ -213,4 +213,27 @@ module JupyterService
_jupyter_active(tpiID) _jupyter_active(tpiID)
end end
def _jupyter_timeinfo(tpiID)
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/getTimeInfo"
params = {:tpiID => tpiID}
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级130")
end
res['data']
end
# 获取时间参数
def jupyter_timeinfo_tpm(shixun)
tpiID = "tpm#{shixun.id}"
_jupyter_timeinfo(tpiID)
end
# 获取时间参数
def jupyter_timeinfo_tpi(myshixun)
tpiID = myshixun.id
_jupyter_timeinfo(tpiID)
end
end end

@ -35,6 +35,8 @@ Rails.application.routes.draw do
get :reset_with_tpm get :reset_with_tpm
get :active_with_tpm get :active_with_tpm
get :active_with_tpi get :active_with_tpi
get :timeinfo_with_tpm
get :timeinfo_with_tpi
post :import_with_tpm post :import_with_tpm
end end

@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl);
module.exports = { module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools. // You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map", devtool: "cheap-module-eval-source-map",
// 开启调试 // 开启调试
//devtool: "source-map", // 开启调试 //devtool: "source-map", // 开启调试
// These are the "entry points" to our application. // These are the "entry points" to our application.

@ -19,13 +19,18 @@ import actions from '../../../redux/actions';
import RightPane from './rightPane'; import RightPane from './rightPane';
import MyIcon from "../../../common/components/MyIcon"; import MyIcon from "../../../common/components/MyIcon";
function clearSlct() {
if("getSelection" in window){
window.getSelection().removeAllRanges();
}else{
document.selection.empty();
};
}
function jsCopy(s) { function jsCopy(s) {
var copyEle = document.getElementById(s); clearSlct();
const range = document.createRange(); // 创造range const copyEle = document.getElementById(s);
window.getSelection().removeAllRanges(); //清除页面中已有的selection copyEle.select();
range.selectNode(copyEle); // 选中需要复制的节点 const copyStatus=document.execCommand("Copy");
window.getSelection().addRange(range); // 执行选中元素
const copyStatus = document.execCommand("Copy"); // 执行copy操作
// 对成功与否定进行提示 // 对成功与否定进行提示
copyStatuss(copyStatus) copyStatuss(copyStatus)
} }
@ -66,7 +71,8 @@ function JupyterTPI (props) {
jupytertime, jupytertime,
active_with_tpi, active_with_tpi,
spinning, spinning,
updataspinning updataspinning,
jupyter_folder_name
} = props; } = props;
const emptyCtx = ( const emptyCtx = (
@ -274,8 +280,8 @@ function JupyterTPI (props) {
mouseLeaveDelay={0.3} mouseLeaveDelay={0.3}
> >
<div className="sortinxdirection"> <div className="sortinxdirection">
<Icon type="file-text" className="jupyter_icon fl lineheighttaj" /> <Icon type="file-text" className="jupyter_icon fl lineheighttaj filestyles" />
<a className="jupyter_name ml10 maxnamewidth150 lineheighttaj colorlineheighttaj" title={item.title}>{item.title}</a> <a className="jupyter_name ml10 maxnamewidth181 lineheighttaj colorlineheighttaj" title={item.title}>{item.title}</a>
<a className={"fr color-blue lineheighttaj"} <a className={"fr color-blue lineheighttaj"}
onClick={() => { onClick={() => {
jsCopy("file_path"+i) jsCopy("file_path"+i)
@ -382,11 +388,22 @@ function JupyterTPI (props) {
> >
{/*<p className={"RightPaneDrawertop"}></p>*/} {/*<p className={"RightPaneDrawertop"}></p>*/}
<div className="jupyter_data_sets_area newjupyter_data_sets_area"> <div className="jupyter_data_sets_area newjupyter_data_sets_area">
<h2 className="jupyter_h2_title"> <h2 className="jupyter_h2_title bortop17212F">
{/*<MyIcon type="iconwenti" className="jupyter_data_icon"/>*/} {/*<MyIcon type="iconwenti" className="jupyter_data_icon"/>*/}
<i className={"iconfont icon-base"}></i> <i className={"iconfont icon-base"}></i>
{/* <span className="iconfont icon-java jupyter_data_icon"></span>数据集 */} {/* <span className="iconfont icon-java jupyter_data_icon"></span>数据集 */}
</h2> </h2>
<h2 className="borbottom17212F jupyterfilepaths">
<span className={"ml50"}>文件路径</span>
<div className="sortinxdirection">
<a className="jupyter_name ml50 maxnamewidth200 lineheighttaj colorlineheighttaj">{jupyter_folder_name}</a>
<a className={"fr color-blue lineheighttaj font-14"}
onClick={() => {
jsCopy("jupyter_folder_name")
}}>复制地址</a>
</div>
<input id="jupyter_folder_name" className={"file_path_input"} value={jupyter_folder_name}/>
</h2>
{ renderCtx } { renderCtx }
<div className='jupyter_pagination'> <div className='jupyter_pagination'>
{total<20?"":<Pagination {total<20?"":<Pagination
@ -413,6 +430,7 @@ const mapStateToProps = (state) => {
jupyter_data_set, jupyter_data_set,
jupyter_tpi_url_state, jupyter_tpi_url_state,
jupyter_data_set_count, jupyter_data_set_count,
jupyter_folder_name,
jupyter_pagination, jupyter_pagination,
jupyter_identifier jupyter_identifier
} = state.jupyterReducer; } = state.jupyterReducer;
@ -425,6 +443,7 @@ const mapStateToProps = (state) => {
jupyter_tpi_url_state, jupyter_tpi_url_state,
total: jupyter_data_set_count, total: jupyter_data_set_count,
pagination: jupyter_pagination, pagination: jupyter_pagination,
jupyter_folder_name:jupyter_folder_name,
jupyter_identifier, jupyter_identifier,
drawervisible, drawervisible,
jupytertime, jupytertime,

@ -23,7 +23,11 @@
cursor: row-resize; cursor: row-resize;
width: 100%; width: 100%;
} }
.filestyles{
color: #28b887 !important;
font-size: 25px !important;
margin-left:20px;
}
.Resizer.horizontal:hover { .Resizer.horizontal:hover {
border-top: 5px solid rgba(0, 0, 0, 0.5); border-top: 5px solid rgba(0, 0, 0, 0.5);
border-bottom: 5px solid rgba(0, 0, 0, 0.5); border-bottom: 5px solid rgba(0, 0, 0, 0.5);
@ -138,9 +142,9 @@
height:49px; height:49px;
line-height: 49px; line-height: 49px;
background: #070F1A !important; background: #070F1A !important;
border-bottom: 1px solid #17212F !important; //border-bottom: 1px solid #17212F !important;
color:#FFFFFF !important; color:#FFFFFF !important;
border-top: 1px solid #17212F !important; //border-top: 1px solid #17212F !important;
} }
.iconfont{ .iconfont{
color:#28b887!important; color:#28b887!important;
@ -193,4 +197,38 @@ line-height: 50px !important;
.jupyter_data_list{ .jupyter_data_list{
padding-left: 20px; padding-left: 20px;
}
.bortop17212F{
border-top: 1px solid #17212F !important;
}
.borbottom17212F{
border-bottom: 1px solid #17212F !important;
}
.jupyterfilepaths{
color: #888 !important;
font-size: 16px !important;
padding-left: 20px;
background: #070F1A !important;
}
.maxnamewidth200{
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
width: 200px;
}
.maxnamewidth181{
max-width:181px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
width: 181px;
} }

@ -1,14 +1,23 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder' import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder'
import { Divider, Tooltip,Upload,Spin} from 'antd'; import { Divider, Tooltip,Upload,Modal} from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin'; import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css'; import 'antd/lib/pagination/style/index.css';
import '../shixunchildCss/Challenges.css'; import '../shixunchildCss/Challenges.css';
import axios from 'axios'; import axios from 'axios';
const $ = window.$; const $ = window.$;
function handleClickResetTpisync_code(id){
const url = `/jupyters/reset_with_tpm.json`;
axios.post(url,{
identifier:id
}).then((response) => {
if(response.data.status===0){
return response
}
})
}
class Challengesjupyter extends Component { class Challengesjupyter extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -316,6 +325,28 @@ class Challengesjupyter extends Component {
} }
} }
// 重置实训
handleClickResetTpi = () => {
let id=this.props.match.params.shixunId;
Modal.confirm({
title: '重置实训',
content: (
<p style={{ lineHeight: '24px' }}>
你在本文件中修改的内容将丢失,<br />
是否确定重新加载初始代码
</p>
),
okText: '确定',
cancelText: '取消',
onOk () {
console.log(handleClickResetTpisync_code(id))
},
onCancel() {
},
})
}
render() { render() {
let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
@ -514,11 +545,12 @@ class Challengesjupyter extends Component {
} }
</style> </style>
<Upload {...uploadProps}> <Upload {...uploadProps}>
<div className="challenbaocun" type="upload"> <div className="challenbaocun" type="upload">
<p <p className="challenbaocuntest" type="upload" >导入</p>
className="challenbaocuntest" type="upload" >导入</p> </div>
</div>
</Upload> </Upload>
<button type="button" className="ant-btn deletebuttom chongzhistyles" onClick={this.handleClickResetTpi}><span>重置实训</span></button>
</div> </div>
</div> </div>

@ -217,3 +217,21 @@
.jupyterswidth{ .jupyterswidth{
width: 1140px; width: 1140px;
} }
.chongzhistyles{
color: #fff;
width: 85px !important;
height: 32px !important;
margin-right: 20px;
}
.chongzhistyles:hover, .chongzhistyles:focus{
color: #fff !important;
background-color: #29BD8B !important;
border-color: transparent;
}
.chongzhistyles:active, .chongzhistyles:active{
color: #fff !important;
background-color: #29BD8B !important;
border-color: transparent ;
}

@ -52,12 +52,13 @@ export const getJupyterTpiDataSet = (identifier, params) => {
fetchJupyterTpiDataSet(identifier, params).then(res => { fetchJupyterTpiDataSet(identifier, params).then(res => {
if (res.data.status === 401) return; // 用户未登录 if (res.data.status === 401) return; // 用户未登录
if (res.status === 200) { if (res.status === 200) {
const {data_sets, data_sets_count} = res.data; const {data_sets, data_sets_count,folder_name} = res.data;
dispatch({ dispatch({
type: types.GET_JUPYTER_DATA_SETS, type: types.GET_JUPYTER_DATA_SETS,
payload: { payload: {
data_sets, data_sets,
data_sets_count data_sets_count,
folder_name,
} }
}); });
} }

@ -25,11 +25,12 @@ const initState = {
const JupyterReducer = (state = initState, action) => { const JupyterReducer = (state = initState, action) => {
switch (action.type) { switch (action.type) {
case types.GET_JUPYTER_DATA_SETS: case types.GET_JUPYTER_DATA_SETS:
const { data_sets, data_sets_count } = action.payload; const { data_sets, data_sets_count,folder_name} = action.payload;
return { return {
...state, ...state,
jupyter_data_set: data_sets, jupyter_data_set: data_sets,
jupyter_data_set_count: data_sets_count jupyter_data_set_count: data_sets_count,
jupyter_folder_name:folder_name,
} }
case types.GET_JUPYTER_TPI_URL: case types.GET_JUPYTER_TPI_URL:
const {url, status, port} = action.payload; const {url, status, port} = action.payload;

Loading…
Cancel
Save