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 1/3] 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 2/3] =?UTF-8?q?=E5=B0=86jupyter=E7=9A=84=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=94=B9=E4=B8=BAresetJupyterTpm=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 74f89610ad03952e76b6bcae5651ff02b7ce7f71 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 11:39:55 +0800 Subject: [PATCH 3/3] =?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/config/webpack.config.dev.js | 2 +- public/react/src/modules/tpm/jupyter/index.js | 39 +++++++++++----- .../react/src/modules/tpm/jupyter/index.scss | 44 +++++++++++++++++-- .../Challenges/Challengesjupyter.js | 44 ++++++++++++++++--- .../shixunchild/shixunchildCss/Challenges.css | 18 ++++++++ public/react/src/redux/actions/jupyter.js | 5 ++- .../src/redux/reducers/jupyterReducer.js | 5 ++- 7 files changed, 133 insertions(+), 24 deletions(-) diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 86938e51d..4e28af31f 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - // devtool: "cheap-module-eval-source-map", + devtool: "cheap-module-eval-source-map", // 开启调试 //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 4485cc1fe..6a61715a7 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -19,13 +19,18 @@ import actions from '../../../redux/actions'; import RightPane from './rightPane'; import MyIcon from "../../../common/components/MyIcon"; +function clearSlct() { + if("getSelection" in window){ + window.getSelection().removeAllRanges(); + }else{ + document.selection.empty(); + }; +} function jsCopy(s) { - var copyEle = document.getElementById(s); - const range = document.createRange(); // 创造range - window.getSelection().removeAllRanges(); //清除页面中已有的selection - range.selectNode(copyEle); // 选中需要复制的节点 - window.getSelection().addRange(range); // 执行选中元素 - const copyStatus = document.execCommand("Copy"); // 执行copy操作 + clearSlct(); + const copyEle = document.getElementById(s); + copyEle.select(); + const copyStatus=document.execCommand("Copy"); // 对成功与否定进行提示 copyStatuss(copyStatus) } @@ -66,7 +71,8 @@ function JupyterTPI (props) { jupytertime, active_with_tpi, spinning, - updataspinning + updataspinning, + jupyter_folder_name } = props; const emptyCtx = ( @@ -274,8 +280,8 @@ function JupyterTPI (props) { mouseLeaveDelay={0.3} >
+ 你在本文件中修改的内容将丢失,
+ 是否确定重新加载初始代码?
+
导入
-导入
+