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/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)") 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 45bd13680..7a68ed5e2 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 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} >
- - {item.title} + + {item.title} { jsCopy("file_path"+i) @@ -382,11 +388,22 @@ function JupyterTPI (props) { > {/*

*/}
-

+

{/**/} 数据集 {/* 数据集 */}

+

+ 文件路径 + + +

{ renderCtx }
{total<20?"": { jupyter_data_set, jupyter_tpi_url_state, jupyter_data_set_count, + jupyter_folder_name, jupyter_pagination, jupyter_identifier } = state.jupyterReducer; @@ -425,6 +443,7 @@ const mapStateToProps = (state) => { jupyter_tpi_url_state, total: jupyter_data_set_count, pagination: jupyter_pagination, + jupyter_folder_name:jupyter_folder_name, jupyter_identifier, drawervisible, jupytertime, diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss index 932b0c89f..c056f019b 100644 --- a/public/react/src/modules/tpm/jupyter/index.scss +++ b/public/react/src/modules/tpm/jupyter/index.scss @@ -23,7 +23,11 @@ cursor: row-resize; width: 100%; } - +.filestyles{ + color: #28b887 !important; + font-size: 25px !important; + margin-left:20px; +} .Resizer.horizontal:hover { border-top: 5px solid rgba(0, 0, 0, 0.5); border-bottom: 5px solid rgba(0, 0, 0, 0.5); @@ -138,9 +142,9 @@ height:49px; line-height: 49px; background: #070F1A !important; - border-bottom: 1px solid #17212F !important; + //border-bottom: 1px solid #17212F !important; color:#FFFFFF !important; - border-top: 1px solid #17212F !important; + //border-top: 1px solid #17212F !important; } .iconfont{ color:#28b887!important; @@ -193,4 +197,38 @@ line-height: 50px !important; .jupyter_data_list{ padding-left: 20px; + +} + +.bortop17212F{ + border-top: 1px solid #17212F !important; +} + +.borbottom17212F{ + border-bottom: 1px solid #17212F !important; +} + +.jupyterfilepaths{ + color: #888 !important; + font-size: 16px !important; + padding-left: 20px; + background: #070F1A !important; +} + +.maxnamewidth200{ + max-width: 200px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; + width: 200px; +} + +.maxnamewidth181{ + max-width:181px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; + width: 181px; } \ No newline at end of file diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 684e24bc1..6eb9c128b 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -1,14 +1,23 @@ import React, { Component } from 'react'; import { Link } from "react-router-dom"; import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder' -import { Divider, Tooltip,Upload,Spin} from 'antd'; +import { Divider, Tooltip,Upload,Modal} from 'antd'; import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; import '../shixunchildCss/Challenges.css'; import axios from 'axios'; const $ = window.$; - + function handleClickResetTpisync_code(id){ + const url = `/jupyters/reset_with_tpm.json`; + axios.post(url,{ + identifier:id + }).then((response) => { + if(response.data.status===0){ + return response + } + }) +} class Challengesjupyter extends Component { constructor(props) { super(props) @@ -316,6 +325,28 @@ class Challengesjupyter extends Component { } } + + // 重置实训 + handleClickResetTpi = () => { + let id=this.props.match.params.shixunId; + Modal.confirm({ + title: '重置实训', + content: ( +

+ 你在本文件中修改的内容将丢失,
+ 是否确定重新加载初始代码? +

+ ), + okText: '确定', + cancelText: '取消', + onOk () { + console.log(handleClickResetTpisync_code(id)) + }, + onCancel() { + + }, + }) + } render() { let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; let id = this.props.match.params.shixunId; @@ -514,11 +545,12 @@ class Challengesjupyter extends Component { } -
-

导入

-
+
+

导入

+
+ +
diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css index 83d8fb15d..6b055be56 100644 --- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css +++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css @@ -217,3 +217,21 @@ .jupyterswidth{ width: 1140px; } + +.chongzhistyles{ + color: #fff; + width: 85px !important; + height: 32px !important; + margin-right: 20px; +} + +.chongzhistyles:hover, .chongzhistyles:focus{ + color: #fff !important; + background-color: #29BD8B !important; + border-color: transparent; +} +.chongzhistyles:active, .chongzhistyles:active{ + color: #fff !important; + background-color: #29BD8B !important; + border-color: transparent ; +} diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index 6afdea7b7..1cd6c2f11 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -52,12 +52,13 @@ export const getJupyterTpiDataSet = (identifier, params) => { fetchJupyterTpiDataSet(identifier, params).then(res => { if (res.data.status === 401) return; // 用户未登录 if (res.status === 200) { - const {data_sets, data_sets_count} = res.data; + const {data_sets, data_sets_count,folder_name} = res.data; dispatch({ type: types.GET_JUPYTER_DATA_SETS, payload: { data_sets, - data_sets_count + data_sets_count, + folder_name, } }); } diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js index f8825fb36..75c9d374f 100644 --- a/public/react/src/redux/reducers/jupyterReducer.js +++ b/public/react/src/redux/reducers/jupyterReducer.js @@ -25,11 +25,12 @@ const initState = { const JupyterReducer = (state = initState, action) => { switch (action.type) { case types.GET_JUPYTER_DATA_SETS: - const { data_sets, data_sets_count } = action.payload; + const { data_sets, data_sets_count,folder_name} = action.payload; return { ...state, jupyter_data_set: data_sets, - jupyter_data_set_count: data_sets_count + jupyter_data_set_count: data_sets_count, + jupyter_folder_name:folder_name, } case types.GET_JUPYTER_TPI_URL: const {url, status, port} = action.payload;