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

chromesetting
杨树林 5 years ago
commit c641189d49

@ -96,6 +96,12 @@ class GamesController < ApplicationController
# Jupyter没有challenge
@myshixun = Myshixun.find_by_identifier params[:identifier]
@shixun = @myshixun.shixun
# 判断tpm是否修改了
begin
@tpm_modified = @myshixun.repository_is_modified(@shixun.repo_path) # 判断TPM和TPI的版本库是否被改了
rescue
uid_logger("实训平台繁忙繁忙等级81")
end
end
def reset_vnc_link

@ -365,6 +365,31 @@ class MyshixunsController < ApplicationController
end
end
def sync_code
shixun_tomcat = edu_setting('cloud_bridge')
begin
git_myshixun_url = repo_ip_url @myshixun.repo_path
git_shixun_url = repo_ip_url @myshixun.shixun.try(:repo_path)
git_myshixun_url = Base64.urlsafe_encode64(git_myshixun_url)
git_shixun_url = Base64.urlsafe_encode64(git_shixun_url)
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
identifier: "xinhu1ji2qu3"}
uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository"
res = uri_post uri, params
if (res && res['code'] != 0)
tip_exception("实训云平台繁忙繁忙等级95")
end
shixun_new_commit = GitService.commits(repo_path: @myshixun.shixun.repo_path).first["id"]
@myshixun.update_attributes!(commit_id: shixun_new_commit, reset_time: @myshixun.shixun.try(:reset_time))
# 更新完成后,弹框则隐藏不再提示
@myshixun.update_column(:system_tip, false)
render_ok
rescue Exception => e
tip_exception("立即更新代码失败!#{e.message}")
end
end
# -----End

@ -91,7 +91,7 @@ module JupyterService
content = response.body
c = GitService.update_file(repo_path: @shixun.repo_path,
c = GitService.update_file(repo_path: shixun.repo_path,
file_path: "01.ipynb",
message: message,
content: content,
@ -130,4 +130,4 @@ module JupyterService
end
end
end

@ -2,4 +2,6 @@ json.user do
json.partial! 'users/user', user: current_user
end
json.(@shixun, :id, :identifier, :status, :name)
json.(@shixun, :id, :identifier, :status, :name)
json.myshixun_identifier @myshixun.identifier
json.tpm_modified @tpm_modified

@ -9,14 +9,6 @@ Rails.application.routes.draw do
get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure'
resources :jupyters do
collection do
get :save_with_tpi
get :save_with_tpm
get :get_info_with_tpi
get :get_info_with_tpm
end
end
resources :edu_settings
@ -33,6 +25,15 @@ Rails.application.routes.draw do
put 'commons/unhidden', to: 'commons#unhidden'
delete 'commons/delete', to: 'commons#delete'
resources :jupyters do
collection do
get :save_with_tpi
get :save_with_tpm
get :get_info_with_tpi
get :get_info_with_tpm
end
end
resources :memos do
member do
post :sticky_or_cancel
@ -183,6 +184,7 @@ Rails.application.routes.draw do
post :html_content
get :open_webssh
get :challenges
post :sync_code
end
collection do
get :sigle_mul_test

@ -46,7 +46,9 @@ class Shixuninformation extends Component {
testscripttiptype:false,
shixunName:'',
trainee:undefined,
choice_small_type:[]
choice_small_type:[],
simichecked:false,
}
}
@ -56,7 +58,6 @@ class Shixuninformation extends Component {
componentDidUpdate(prevProps, prevState) {
if(prevProps.data!=this.props.data){
console.log(this.props.data)
if(this.props.data){
this.setState({
shixunName:this.props.data.shixun.name,
@ -65,6 +66,7 @@ class Shixuninformation extends Component {
choice_small_type:this.props.data.shixun.choice_small_type,
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts,
shixunmemoMDvalue:this.props.data.shixun.evaluate_script,
simichecked:this.props.data.shixun.is_secret_repository,
})
this.props.form.setFieldsValue({
@ -312,15 +314,56 @@ class Shixuninformation extends Component {
})
}
SelectScput = (value, e) => {
this.setState({
choice_standard_scriptssum: value,
language:e.props.name,
choice_standard_scripts: {id:e.props.value,value:""},
standard_scriptsModal:true
})
}
hidestandard_scriptsModal=()=>{
this.setState({
standard_scriptsModal:false,
standard_scriptsModals:false
})
}
get_mirror_script=()=>{
let {choice_standard_scriptssum}=this.state;
let id = this.props.match.params.shixunId;
let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum;
axios.get(pul).then((response) => {
if(response.status===200){
// this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
this.setState({
standard_scriptsModal:false,
standard_scriptsModals:true,
shixunmemoMDvalue:response.data.content
})
}
}).catch((error) => {
console.log(error)
})
}
simionChange=(e)=>{
this.setState({
simichecked:e.target.checked
})
}
render() {
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
console.log(operateauthority)
// console.log(operateauthority)
const {getFieldDecorator} = this.props.form;
const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
console.log("1222")
console.log(choice_standard_scripts)
// console.log("1222")
// console.log(choice_standard_scripts)
const {shixun_service_configs}=this.props;
const uploadProps = {
width: 600,
@ -621,7 +664,7 @@ class Shixuninformation extends Component {
<span className="ant-form-text mt20" >私密版本库
<Checkbox>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
<Checkbox onChange={this.simionChange} value={this.state.simichecked}>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
</span>
{this.props.identity<3?<div className="edu-back-white padding40-20 mb20">
@ -686,6 +729,38 @@ class Shixuninformation extends Component {
}
</style> : ""}
<Modal
keyboard={false}
title="提示"
visible={this.state.standard_scriptsModal}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16">原有脚本将被新的脚本覆盖无法撤销</p>
<p className="task-popup-text-center font-16">是否确认执行覆盖操作</p>
</div>
<div className="task-popup-submit clearfix mt10">
<a onClick={()=>this.hidestandard_scriptsModal()} className="task-btn fl">取消</a>
<a className="task-btn task-btn-orange fr" onClick={()=>this.get_mirror_script()}>确定</a>
</div>
</Modal>
<Modal
keyboard={false}
title="提示"
visible={this.state.standard_scriptsModals}
closable={false}
footer={null}
>
<div className="task-popup-content"><p className="task-popup-text-center font-16">评测脚本生成成功</p></div>
<div className="task-popup-sure clearfix">
<a className="task-btn task-btn-orange" onClick={()=>this.hidestandard_scriptsModal()} >确定</a>
</div>
</Modal>
<Modal
keyboard={false}
title="申请新建"

Loading…
Cancel
Save