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

chromesetting
杨树林 5 years ago
commit 358510a832

@ -408,16 +408,14 @@ class ShixunsController < ApplicationController
smr.update_attributes(service)
end
# 添加第二仓库(管理员权限)
if current_user.admin_or_business?
if params[:is_secret_repository]
add_secret_repository if @shixun.shixun_secret_repository.blank?
else
# 如果有仓库,就要删
if @shixun.shixun_secret_repository&.repo_name
@shixun.shixun_secret_repository.lock!
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
@shixun.shixun_secret_repository.destroy
end
if params[:is_secret_repository]
add_secret_repository if @shixun.shixun_secret_repository.blank?
else
# 如果有仓库,就要删
if @shixun.shixun_secret_repository&.repo_name
@shixun.shixun_secret_repository.lock!
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
@shixun.shixun_secret_repository.destroy
end
end
end

@ -20,8 +20,10 @@ module JupyterService
logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port']
return "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
jupyter_service = edu_setting('jupyter_service')
return "https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
end
@ -62,7 +64,9 @@ module JupyterService
repo_save_path = myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
jupyter_service = edu_setting('jupyter_service')
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
end
@ -85,8 +89,10 @@ module JupyterService
tpiID = "tpm#{shixun.id}"
jupyter_service = edu_setting('jupyter_service')
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
src_url = "https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
@ -113,8 +119,9 @@ module JupyterService
tpiID = myshixun.id
repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service')
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
src_url = "https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200

@ -529,6 +529,7 @@ class YslDetailCards extends Component{
{
this.props.isAdmin()===true?
<DetailCardsEditAndEdit
{...this.props}
idsum={idsum}
keys={key}
pathCardsedittype={pathCardsedittype}

@ -355,11 +355,15 @@ class ShixunhomeWorkItem extends Component{
.homepagePostSettingbox{
width:139px !important;
}
.colorfff{
color:#fff !important;
}
`
}
</style>
{this.props.isAdmin?<span onClick={(event)=>this.stopPro(event)} className={this.props.isAdminOrCreator()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"6px","display":"block"}}>
{discussMessage&&discussMessage.shixun_status>1?<Link className="btn colorblue font-16 fontweight400" to={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</Link>:""}
{discussMessage&&discussMessage.shixun_status>1?<Link className="btn colorblue font-16 fontweight400" to={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</Link>:
<a className={"btn colorfff font-16 fontweight400"}>实训详情</a>}
{this.props.isAdminOrCreator()?<a onClick={(event)=>this.editname(discussMessage.name,discussMessage.homework_id,event)} className={"btn colorblue ml20 font-16 fontweight400"}>重命名</a>:""}
{/*<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn>*/}
<WordsBtn className="btn colorblue font-16 ml15 fontweight400" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn>

@ -69,6 +69,7 @@ class Addshixuns extends Component {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
};
console.log(this.props)
return(
<Modal
className={this.props.className}
@ -92,14 +93,14 @@ class Addshixuns extends Component {
</style>:""}
<div className="task-popup-content">
<Form {...formItemLayout}>
<Form.Item label="实训类型">
<Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>
<Radio value="1">普通实训</Radio>
<Radio value="2">jupyter实训</Radio>
</Radio.Group>
</Form.Item>
</Form>
{/*<Form {...formItemLayout}>*/}
{/* <Form.Item label="实训类型">*/}
{/* <Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>*/}
{/* <Radio value="1">普通实训</Radio>*/}
{/* <Radio value="2">jupyter实训</Radio>*/}
{/* </Radio.Group>*/}
{/* </Form.Item>*/}
{/*</Form>*/}
<p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span>
<span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} />

@ -121,8 +121,9 @@ export default class Shixuninformation extends Component {
}
onSubmits = () => {
let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state;
if(this.state.opentime===true){
if(opening_time===null){
this.setState({
@ -143,9 +144,7 @@ export default class Shixuninformation extends Component {
let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/update_permission_setting.json`;
this.setState({
loading: true
})
axios.post(url,
{
scope_partment: list,
@ -168,14 +167,10 @@ export default class Shixuninformation extends Component {
this.props.getdatas("3")
}
}).catch((error) => {
this.setState({
loading: false
})
})
this.setState({
loading: false
})
}
CheckboxonChange = (e) => {
this.setState({

@ -96,8 +96,8 @@ export default class TPMsettings extends Component {
operateshixunstype: false,
});
// window.location.href = "/shixuns";
this.props.history.replace( "/shixuns/");
window.location.href = "/shixuns";
// this.props.history.replace( "/shixuns/");
}
}).catch((error) => {
console.log(error)
@ -114,8 +114,8 @@ export default class TPMsettings extends Component {
operateshixunstype: false,
});
// window.location.href = "/shixuns/" + id + "/challenges";
this.props.history.replace( "/shixuns/" + id + "/challenges");
window.location.href = "/shixuns/" + id + "/challenges";
// this.props.history.replace( "/shixuns/" + id + "/challenges");
}
}).catch((error) => {
console.log(error)

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-12 10:34:03
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 16:28:33
* @LastEditTime: 2019-12-13 22:46:51
*/
import './index.scss';
import React, { useState, useEffect } from 'react';

@ -431,6 +431,7 @@ class Newshixuns extends Component {
return isLt150M;
},
}
return (
<div className="newMain clearfix">
<style>
@ -455,14 +456,14 @@ class Newshixuns extends Component {
</div>
<div className="padding10-20 color-grey-3 clearfix">
<Form>
<Form.Item label="实训类型">
{this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Form.Item label="实训类型">
{getFieldDecorator('is_jupyter')(
<Radio.Group onChange={this.RadiovalueonChange}>
<Radio value="1">普通实训</Radio>
<Radio value="2">Jupyter实训</Radio>
</Radio.Group>,
)}
</Form.Item>
</Form.Item>:""}
<Form.Item
label="名称"
className="mt15"

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-12 09:01:30
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 15:27:13
* @LastEditTime: 2019-12-13 21:02:48
*/
import types from "./actionTypes";
import { message } from 'antd';
@ -25,18 +25,18 @@ export const getJupyterInfo = (id) => {
if (res.data.status === 401) return;
if (res.status === 200) {
const { data } = res;
if (data.status === 0) {
dispatch({
type: types.SAVE_JUPYTER_INFO,
payload: data
});
const { identifier, myshixun_identifier } = data;
dispatch(saveJupyterIdentifier(identifier));
// 调用获取数据集接口
dispatch(getJupyterTpiDataSet(identifier, jupyter_pagination));
// 调用获取url接口
dispatch(getJupyterTpiUrl({identifier: myshixun_identifier}));
}
// if (data.status === 0) {
dispatch({
type: types.SAVE_JUPYTER_INFO,
payload: data
});
const { identifier, myshixun_identifier } = data;
dispatch(saveJupyterIdentifier(identifier));
// 调用获取数据集接口
dispatch(getJupyterTpiDataSet(identifier, jupyter_pagination));
// 调用获取url接口
dispatch(getJupyterTpiUrl({identifier: myshixun_identifier}));
// }
}
})
}

Loading…
Cancel
Save