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) smr.update_attributes(service)
end end
# 添加第二仓库(管理员权限) # 添加第二仓库(管理员权限)
if current_user.admin_or_business? if params[:is_secret_repository]
if params[:is_secret_repository] add_secret_repository if @shixun.shixun_secret_repository.blank?
add_secret_repository if @shixun.shixun_secret_repository.blank? else
else # 如果有仓库,就要删
# 如果有仓库,就要删 if @shixun.shixun_secret_repository&.repo_name
if @shixun.shixun_secret_repository&.repo_name @shixun.shixun_secret_repository.lock!
@shixun.shixun_secret_repository.lock! GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path) @shixun.shixun_secret_repository.destroy
@shixun.shixun_secret_repository.destroy
end
end end
end end
end end

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

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

@ -355,11 +355,15 @@ class ShixunhomeWorkItem extends Component{
.homepagePostSettingbox{ .homepagePostSettingbox{
width:139px !important; width:139px !important;
} }
.colorfff{
color:#fff !important;
}
` `
} }
</style> </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"}}> {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>:""} {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 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> <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 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
}; };
console.log(this.props)
return( return(
<Modal <Modal
className={this.props.className} className={this.props.className}
@ -92,14 +93,14 @@ class Addshixuns extends Component {
</style>:""} </style>:""}
<div className="task-popup-content"> <div className="task-popup-content">
<Form {...formItemLayout}> {/*<Form {...formItemLayout}>*/}
<Form.Item label="实训类型"> {/* <Form.Item label="实训类型">*/}
<Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}> {/* <Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>*/}
<Radio value="1">普通实训</Radio> {/* <Radio value="1">普通实训</Radio>*/}
<Radio value="2">jupyter实训</Radio> {/* <Radio value="2">jupyter实训</Radio>*/}
</Radio.Group> {/* </Radio.Group>*/}
</Form.Item> {/* </Form.Item>*/}
</Form> {/*</Form>*/}
<p className="task-popup-text-center font-16"> <p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span> <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} /> <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 = () => { onSubmits = () => {
let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state; let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state;
if(this.state.opentime===true){ if(this.state.opentime===true){
if(opening_time===null){ if(opening_time===null){
this.setState({ this.setState({
@ -143,9 +144,7 @@ export default class Shixuninformation extends Component {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/update_permission_setting.json`; let url = `/shixuns/${id}/update_permission_setting.json`;
this.setState({
loading: true
})
axios.post(url, axios.post(url,
{ {
scope_partment: list, scope_partment: list,
@ -168,14 +167,10 @@ export default class Shixuninformation extends Component {
this.props.getdatas("3") this.props.getdatas("3")
} }
}).catch((error) => { }).catch((error) => {
this.setState({
loading: false
})
}) })
this.setState({
loading: false
})
} }
CheckboxonChange = (e) => { CheckboxonChange = (e) => {
this.setState({ this.setState({

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

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

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

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

Loading…
Cancel
Save