Merge remote-tracking branch 'origin/dev_jupyter' into dev_jupyter

chromesetting
杨树明 5 years ago
commit 15fba38772

@ -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

@ -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

@ -183,6 +183,7 @@ Rails.application.routes.draw do
post :html_content
get :open_webssh
get :challenges
post :sync_code
end
collection do
get :sigle_mul_test

@ -53,6 +53,7 @@ export function initAxiosInterceptors(props) {
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制
@ -88,7 +89,6 @@ export function initAxiosInterceptors(props) {
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) {

@ -69,12 +69,13 @@ class Challengesjupyter extends Component {
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
if (response.status === 200) {
debugger
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
// console.log("componentDidMountChallengesjupyter");
// console.log(response.data);
debugger
if(response.data.status===0){
this.setState({
jupyter_url:response.data.url,
@ -86,7 +87,6 @@ class Challengesjupyter extends Component {
}
}
}
}).catch((error) => {
console.log(error)
});
@ -146,7 +146,7 @@ class Challengesjupyter extends Component {
};
modifyjupyter=(propsysl)=>{
modifyjupyter=()=>{
// console.log("propsysl");
// console.log(propsysl);
let id=this.props.match.params.shixunId;
@ -253,16 +253,16 @@ class Challengesjupyter extends Component {
}
</style>
{
this.props.jupyter_url === null || this.props.jupyter_url === undefined ?
this.state.jupyter_url === null || this.state.jupyter_url === undefined ?
""
:
<div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div>
<div><p className="renwuxiangqdivtest ml24">示例</p></div>
<div><p className="renwuxiangqdivtest ml24">请将实训题目写在下方</p></div>
</div>
<div className="renwuxiangssit xaxisreverseorder">
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.props)}><p
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p
className="challenbaocuntest">应用到实训</p></div>
</div>
</div>
@ -294,10 +294,10 @@ class Challengesjupyter extends Component {
<div className="pb47">
{
this.props.jupyter_url===null || this.props.jupyter_url===undefined?
this.state.jupyter_url===null || this.state.jupyter_url===undefined?
""
:
<iframe src={this.props.jupyter_url}
<iframe src={this.state.jupyter_url}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe>

@ -52,8 +52,6 @@
width:32px;
height:30px;
font-size:16px;
font-family:MicrosoftYaHei;
color:#4CACFF;
line-height:30px;
}

Loading…
Cancel
Save