From f8735c56fd274e466447f02f25be7a39c4f0e42d Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 23 Dec 2019 21:27:12 +0800
Subject: [PATCH 01/30] add get pod timeinfo
---
app/controllers/jupyters_controller.rb | 13 +++++++++++++
app/services/jupyter_service.rb | 23 +++++++++++++++++++++++
bin/bundle | 0
bin/rails | 0
bin/rake | 0
bin/setup | 0
bin/update | 0
bin/yarn | 0
config/routes.rb | 2 ++
9 files changed, 38 insertions(+)
mode change 100644 => 100755 bin/bundle
mode change 100644 => 100755 bin/rails
mode change 100644 => 100755 bin/rake
mode change 100644 => 100755 bin/setup
mode change 100644 => 100755 bin/update
mode change 100644 => 100755 bin/yarn
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 988cef01a..6cc78536a 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -80,4 +80,17 @@ class JupytersController < ApplicationController
render json: {status: 0}
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
diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb
index bff9b5dc6..29f54cb02 100644
--- a/app/services/jupyter_service.rb
+++ b/app/services/jupyter_service.rb
@@ -213,4 +213,27 @@ module JupyterService
_jupyter_active(tpiID)
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
diff --git a/bin/bundle b/bin/bundle
old mode 100644
new mode 100755
diff --git a/bin/rails b/bin/rails
old mode 100644
new mode 100755
diff --git a/bin/rake b/bin/rake
old mode 100644
new mode 100755
diff --git a/bin/setup b/bin/setup
old mode 100644
new mode 100755
diff --git a/bin/update b/bin/update
old mode 100644
new mode 100755
diff --git a/bin/yarn b/bin/yarn
old mode 100644
new mode 100755
diff --git a/config/routes.rb b/config/routes.rb
index 73756ece3..fc281f0d3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -35,6 +35,8 @@ Rails.application.routes.draw do
get :reset_with_tpm
get :active_with_tpm
get :active_with_tpi
+ get :timeinfo_with_tpm
+ get :timeinfo_with_tpi
post :import_with_tpm
end
From 28a7698475c2be38ad06f026db067e0cefcc5bb9 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Tue, 24 Dec 2019 15:58:49 +0800
Subject: [PATCH 02/30] =?UTF-8?q?=E5=B0=86jupyter=E7=9A=84=E9=87=8D?=
=?UTF-8?q?=E7=BD=AE=E6=8E=A5=E5=8F=A3=E6=94=B9=E4=B8=BAresetJupyterTpm?=
=?UTF-8?q?=E3=80=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/myshixuns_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index 0e9ba477a..255c0f42e 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -376,7 +376,7 @@ class MyshixunsController < ApplicationController
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
identifier: "xinhu1ji2qu3"}
- uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository"
+ uri = "#{shixun_tomcat}/bridge/game/resetJupyterTpm"
res = uri_post uri, params
if (res && res['code'] != 0)
tip_exception("实训云平台繁忙(繁忙等级:95)")
From c38d9f290f36a072573e9e7ad92c348b769b7097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 24 Dec 2019 16:42:56 +0800
Subject: [PATCH 03/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/public/css/css_min_all.css | 4 ++--
public/react/public/css/edu-all.css | 6 ++++++
.../shixunHomework/Listofworksstudentone.js | 15 +++++++++------
public/stylesheets/educoder/edu-all.css | 5 +++++
public/stylesheets/educoder/edu-main.css | 4 ++++
5 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/public/react/public/css/css_min_all.css b/public/react/public/css/css_min_all.css
index cf453ac21..431a4da8e 100755
--- a/public/react/public/css/css_min_all.css
+++ b/public/react/public/css/css_min_all.css
@@ -1883,9 +1883,8 @@ a:hover.task_icons_close{background: url(../images/popup/sy_icons_close.png) -40
.newupload_nav li:last-child{ border-right: none;}
.newupload_nav li a{font-size:12px; color:#444;}
.newupload_nav_hover{ background: #3498db; }
-.newupload_nav_nomal { }
.newupload_nav_hover a{color: #fff !important; }
-
+.markdown-body { text-align: justify;word-break: break-all;}
.bor-reds{
border:1px solid #FF0000!important;
border-radius: 4px;
@@ -1894,6 +1893,7 @@ a:hover.task_icons_close{background: url(../images/popup/sy_icons_close.png) -40
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
+
@charset "UTF-8";
/*!
diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css
index 5988709eb..141f5b8e1 100644
--- a/public/react/public/css/edu-all.css
+++ b/public/react/public/css/edu-all.css
@@ -3478,3 +3478,9 @@ a.singlepublishtwo{
/*width: auto !important;*/
/*max-width: 600px !important;*/
/*}*/
+
+
+.markdown-body {
+ text-align: justify;
+ word-break: break-all;
+}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 459421dcd..1111dcb12 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -1667,7 +1667,7 @@ class Listofworksstudentone extends Component {
],
yslpros: false,
datajs: [],
- homework_status: [],
+ homework_status: undefined,
}
}
@@ -3597,7 +3597,14 @@ class Listofworksstudentone extends Component {
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/> : ""}
- {
+ {homework_status===undefined?
+
-
-
-
-
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index cc8e28bf7..f72c4ac94 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('
')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('
')
- .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`));
+ .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?66`));
$('head').append($('
')
- .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`));
+ .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?66`));
// index.html有加载
$('head').append($('
')
- .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`));
+ .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?66`));
// $('head').append($('
')
diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
index 34f71fb1e..83d8fb15d 100644
--- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
+++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
@@ -1,5 +1,5 @@
.editormd-html-preview, .editormd-preview-container {
- width: 95% !important;
+ width: 100% !important;
}
.Finish_button{
height: 30px;
diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css
index 2832f226f..562ba09c2 100644
--- a/public/stylesheets/educoder/edu-all.css
+++ b/public/stylesheets/educoder/edu-all.css
@@ -2939,7 +2939,7 @@ a.singlepublishtwo{
padding: 40px !important;
}
.editormd-html-preview{
- width: 94% !important;
+ width:100% !important;
color: #323232 !important;
}
#homework_editorMd_description hr{
From a4f872bf49dab6ff14e35374bb10e0fb3348637d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 24 Dec 2019 19:02:58 +0800
Subject: [PATCH 06/30] =?UTF-8?q?=E8=B0=83=E6=95=B4fork?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/TPMBanner.js | 29 +++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index 884efd4c2..73a09bb45 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -59,7 +59,8 @@ class TPMBanner extends Component {
openknow:false,
openshowpublictype:false,
Radiovalue:1,
- TextAreaintshow:false
+ TextAreaintshow:false,
+
}
}
@@ -112,6 +113,15 @@ class TPMBanner extends Component {
componentDidUpdate(prevProps, prevState) {
if (prevProps != this.props) {
+
+ if(prevProps.user != this.props.user){
+ if(this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true){
+ this.setState({
+ TextArea:"云上实验室使用"
+ })
+ }
+ }
+
let shixunopenprocess=window.localStorage.shixunopenprocess;
let openopenpublictype=window.localStorage.openopenpublictype;
if(this.props.status===0&&this.props.openknows===false){
@@ -173,8 +183,12 @@ class TPMBanner extends Component {
})
}
+ if (this.props.user && this.props.user.admin === true || this.props.user && this.props.user.business === true) {
+ this.setState({
+ TextArea: "云上实验室使用"
+ })
+ }
}
-
/*
* Fork
* */
@@ -736,6 +750,11 @@ class TPMBanner extends Component {
this.setState({
Radiovalue:e.target.value
})
+ if(e.target.value!=4){
+ this.setState({
+ TextAreaintshow:false
+ })
+ }
}
render() {
@@ -827,7 +846,7 @@ class TPMBanner extends Component {
};
//
// console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter)
- // console.log(this.props)
+
// console.log(this.state)
return (
@@ -1318,7 +1337,9 @@ class TPMBanner extends Component {
其它原因
{this.state.Radiovalue === 4 ?
-
From 971484792650f3c9ae5ed834a424051224eaf4b2 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 24 Dec 2019 19:32:36 +0800
Subject: [PATCH 07/30] =?UTF-8?q?Jupyter=E5=AE=9E=E8=AE=ADfork=E4=B8=8E?=
=?UTF-8?q?=E4=BA=91=E4=B8=8A=E5=AE=9E=E9=AA=8C=E5=AE=A4=E9=80=89=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 12 +++++++++++
app/services/subjects/copy_subject_service.rb | 21 ++++++++++++++++++-
.../result.json.jbuilder | 2 +-
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 190892730..940955e93 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -266,8 +266,20 @@ class ShixunsController < ApplicationController
# 如果是jupyter,先创建一个目录,为了挂载(因为后续数据集,开启Pod后环境在没销毁前,你上传数据集是挂载不上目录的,因此要先创建目录,方便中间层挂载)
if @new_shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
+ raise "存储目录未定义" unless folder.present?
path = "#{folder}/#{@new_shixun.identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
+ # 复制数据集
+ save_path = File.join(folder, @shixun.identifier)
+ @shixun.data_sets.each do |set|
+ new_date_set = Attachment.new
+ new_date_set.attributes = set.attributes.dup.except("id", "container_id", "disk_directory")
+ new_date_set.container_id = @new_shixun.id
+ new_date_set.disk_directory = @new_shixun.identifier
+ new_date_set.save!
+ FileUtils.cp("#{save_path}/#{set.relative_path_filename}", path)
+ end
+
end
# 同步复制关卡
if @shixun.challenges.present?
diff --git a/app/services/subjects/copy_subject_service.rb b/app/services/subjects/copy_subject_service.rb
index f44191fda..4715a8bad 100644
--- a/app/services/subjects/copy_subject_service.rb
+++ b/app/services/subjects/copy_subject_service.rb
@@ -79,7 +79,7 @@ class Subjects::CopySubjectService < ApplicationService
copy_shixun_service_configs_data!(shixun, to_shixun)
copy_challenges_data!(shixun, to_shixun)
copy_shixun_members_data!(to_shixun)
-
+ copy_jupyter_data_sets(shixun, to_shixun) if shixun.is_jupyter?
# 云上实验室
if laboratory
laboratory.laboratory_shixuns.create(shixun: to_shixun)
@@ -87,6 +87,25 @@ class Subjects::CopySubjectService < ApplicationService
to_shixun
end
+ # 复制jupyter的数据集
+ def copy_jupyter_data_sets(shixun, to_shixun)
+ return unless shixun.is_jupyter?
+ folder = EduSetting.get('shixun_folder')
+ raise "存储目录未定义" unless folder.present?
+ path = "#{folder}/#{to_shixun.identifier}"
+ FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
+ # 复制数据集
+ save_path = File.join(folder, shixun.identifier)
+ shixun.data_sets.each do |set|
+ new_date_set = Attachment.new
+ new_date_set.attributes = set.attributes.dup.except("id", "container_id", "disk_directory")
+ new_date_set.container_id = to_shixun.id
+ new_date_set.disk_directory = to_shixun.identifier
+ new_date_set.save!
+ FileUtils.cp("#{save_path}/#{set.relative_path_filename}", path)
+ end
+ end
+
# 创建实训长字段内容
def copy_shixun_info_data!(shixun, to_shixun)
to_shixun_info = ShixunInfo.new
diff --git a/app/views/hack_user_lastest_codes/result.json.jbuilder b/app/views/hack_user_lastest_codes/result.json.jbuilder
index 2561d4ecd..d8f010cc3 100644
--- a/app/views/hack_user_lastest_codes/result.json.jbuilder
+++ b/app/views/hack_user_lastest_codes/result.json.jbuilder
@@ -1,5 +1,5 @@
json.status 0
-json.message "评测成功"
+json.message "评测完成"
json.data do
json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory)
From 19fe97dadee6b4353fc68432348cf8a74e8d7b48 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 24 Dec 2019 20:15:34 +0800
Subject: [PATCH 08/30] 1
---
app/controllers/jupyters_controller.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 988cef01a..2f2591470 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -53,7 +53,8 @@ class JupytersController < ApplicationController
shixun = Shixun.find_by(identifier: params[:identifier])
url = jupyter_url_with_shixun(shixun)
port = jupyter_port_with_shixun(shixun)
- render json: {status: 0, url: url, port: port}
+ #render json: {status: 0, url: url, port: port}
+ render json: {status: 0}
end
def reset_with_tpi
From 1347f3c0eb02eaee6931cb887ecb512c1af3bf7a Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 24 Dec 2019 20:20:59 +0800
Subject: [PATCH 09/30] =?UTF-8?q?=E5=9B=9E=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/jupyters_controller.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 2f2591470..988cef01a 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -53,8 +53,7 @@ class JupytersController < ApplicationController
shixun = Shixun.find_by(identifier: params[:identifier])
url = jupyter_url_with_shixun(shixun)
port = jupyter_port_with_shixun(shixun)
- #render json: {status: 0, url: url, port: port}
- render json: {status: 0}
+ render json: {status: 0, url: url, port: port}
end
def reset_with_tpi
From 3b6daa3d7bd803ed5dc0f529f6045d6421ddcc75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 25 Dec 2019 09:28:03 +0800
Subject: [PATCH 10/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/TPMBanner.js | 8 ++++----
.../modules/tpm/TPMsettings/Configuration.js | 8 +++++---
.../tpm/TPMsettings/Shixuninformation.js | 6 +++++-
.../modules/tpm/component/TPMRightSection.js | 14 ++++++-------
.../src/modules/tpm/component/TPMright.css | 7 ++++---
public/react/src/modules/tpm/jupyter/index.js | 12 +++++------
.../Collaborators/Collaborators.css | 14 ++++++++-----
.../Collaborators/Collaborators.js | 20 +++++++++----------
.../shixunchild/Ranking_list/Ranking_list.js | 2 +-
9 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index 73a09bb45..fa8a4b222 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -857,7 +857,7 @@ class TPMBanner extends Component {
`
.shixunDetail_top{
height: 180px !important;
- padding-top:35px !important;
+ padding-top:50px !important;
}
.ant-popover{
z-index:1000 !important;
@@ -900,9 +900,9 @@ class TPMBanner extends Component {
}
-
+
-
+
{shixunsDetails&&shixunsDetails.stu_num===0?"":-
学习人数
{shixunsDetails.stu_num}
@@ -973,7 +973,7 @@ class TPMBanner extends Component {
}>
-
评测脚本生成成功!
已根据您的选择,生成新的评测脚本!
*/} + {/*您之前使用的脚本已复制到剪贴板,可通过Ctrl+C贴贴
*/} +评测脚本生成成功!
+{/*sync | poweroff */} - {/**/} +
{/*sync | poweroff */} -重置实训
+ {/*重置实训 */}
导入
非试用内容,需要授权
- + {item.name}
From 14c69a8ed02417fac3470a12dae26665600ca393 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 15:04:41 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/comments_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 3b0ac86a7..c5d3082ba 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -23,7 +23,6 @@ class CommentsController < ApplicationController @discuss.hidden = false @discuss.user_id = current_user.id @discuss.root_id = params[:comments][:parent_id] - @discusses.parent_container_id = @discuss.save! rescue Exception => e uid_logger_error("reply discuss failed : #{e.message}")