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 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 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/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 { }
-
评测脚本生成成功!
已根据您的选择,生成新的评测脚本!
*/} + {/*您之前使用的脚本已复制到剪贴板,可通过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 23/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}") From 251030d4a59d416e69d3c0e67d36edf8e0c50f9f Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Wed, 25 Dec 2019 15:05:22 +0800 Subject: [PATCH 24/30] update comment style --- .../common/components/comment/CommentIcon.js | 8 +- .../common/components/comment/CommentItem.js | 17 ++-- .../src/common/components/comment/index.scss | 14 ++- .../developer/components/errorResult/index.js | 5 +- .../developer/components/execResult/index.js | 6 +- .../developer/components/textNumber/index.js | 14 ++- public/react/src/modules/developer/index.scss | 5 + .../modules/developer/split_pane_resizer.scss | 2 +- .../studentStudy/leftpane/comment/index.js | 47 +++++++-- .../studentStudy/leftpane/comment/index.scss | 8 ++ .../leftpane/commitRecord/index.js | 97 ++++++++++++------- .../leftpane/commitRecord/index.scss | 15 ++- .../developer/studentStudy/leftpane/index.js | 14 ++- .../studentStudy/leftpane/index.scss | 4 +- .../leftpane/taskDescription/index.js | 6 +- public/react/src/redux/actions/actionTypes.js | 4 +- public/react/src/redux/actions/comment.js | 17 +++- public/react/src/redux/actions/index.js | 8 +- public/react/src/redux/actions/ojForUser.js | 17 +++- .../src/redux/reducers/commentReducer.js | 17 +++- .../src/redux/reducers/ojForUserReducer.js | 18 +++- public/react/src/services/commentService.js | 6 +- public/react/src/services/ojService.js | 8 +- 23 files changed, 258 insertions(+), 99 deletions(-) diff --git a/public/react/src/common/components/comment/CommentIcon.js b/public/react/src/common/components/comment/CommentIcon.js index 97a57da5e..9e9650b47 100644 --- a/public/react/src/common/components/comment/CommentIcon.js +++ b/public/react/src/common/components/comment/CommentIcon.js @@ -4,11 +4,11 @@ * @Github: * @Date: 2019-12-18 10:49:46 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 18:04:52 + * @LastEditTime : 2019-12-25 10:03:21 */ import './index.scss'; import React from 'react'; -import { Icon } from 'antd'; +// import { Icon } from 'antd'; // import MyIcon from '../MyIcon'; function CommentIcon ({ type, // 图标类型 @@ -25,13 +25,15 @@ function CommentIcon ({ } const _className = [undefined, null, ''].includes(count) ? 'comment_count_none' : 'comment_count'; + const _classIcon = `iconfont icon-${type} icon_font_size_14 comment_icon `; return ( -系统繁忙,请稍后重试
- {error_msg} + 系统繁忙,请稍后重试
) } else if (state === -1) { diff --git a/public/react/src/modules/developer/components/textNumber/index.js b/public/react/src/modules/developer/components/textNumber/index.js index 77a58c3e8..a8f743d16 100644 --- a/public/react/src/modules/developer/components/textNumber/index.js +++ b/public/react/src/modules/developer/components/textNumber/index.js @@ -4,11 +4,11 @@ * @Github: * @Date: 2019-11-27 10:58:37 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 16:48:56 + * @LastEditTime : 2019-12-25 10:02:03 */ import './index.scss'; import React from 'react'; -import { Icon } from 'antd'; +// import { Icon } from 'antd'; const numberal = require('numeral'); const TextNumber = (props) => { @@ -47,14 +47,18 @@ const TextNumber = (props) => { const renderCtx = (className, theme) => { if (type === 'icon') { // 图标加文字时 const _className = `text_number_area text_icon_numb flex_${position} ${className}`; + const _classIcon = `iconfont icon-${text} numb_icon`; return (@@ -112,7 +116,7 @@ const LeftPane = (props) => {
{ renderComp }
-
+
@@ -125,10 +129,10 @@ const LeftPane = (props) => {
/>
-
+
{
diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js
index deeb8fa93..0420a0af4 100644
--- a/public/react/src/redux/actions/actionTypes.js
+++ b/public/react/src/redux/actions/actionTypes.js
@@ -55,6 +55,7 @@ const types = {
CLICK_OPERATE_TYPE: 'CLICK_OPERATE_TYPE', // 点击类型
CLEAR_OJ_FOR_USER_REDUCER: 'CLEAR_OJ_FOR_USER_REDUCER', // 退出时清空 ojForUserReducer保存内容
ADD_OJ_LIKE_COUNT: 'ADD_OJ_LIKE_COUNT', // 增加点赞数
+ CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页
/*** jupyter */
GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集
GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url
@@ -74,7 +75,8 @@ const types = {
GET_COMMENT_LISTS: 'GET_COMMENT_LISTS', // 获取评论列表
REPLAY_CHILD_COMMENTS: 'REPLAY_CHILD_COMMENTS', // 子回复
DELETE_COMMENTS: 'DELETE_COMMENTS', // 删除评论
- SAVE_COMMENT_IDENTIFIER: 'SAVE_COMMENT_IDENTIFIER' // 评论时的identifier
+ SAVE_COMMENT_IDENTIFIER: 'SAVE_COMMENT_IDENTIFIER', // 评论时的identifier
+ CHANGE_COMMENT_PAGINATION_PARAMS: 'CHANGE_COMMENT_PAGINATION_PARAMS', // 改变分页
}
export default types;
diff --git a/public/react/src/redux/actions/comment.js b/public/react/src/redux/actions/comment.js
index 7927e3cd6..a247daf56 100644
--- a/public/react/src/redux/actions/comment.js
+++ b/public/react/src/redux/actions/comment.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-23 10:53:25
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-24 16:17:00
+ * @LastEditTime : 2019-12-25 10:55:27
*/
import types from "./actionTypes";
@@ -31,8 +31,12 @@ export const addComment = (identifier, comments) => {
// 获取评论列表
export const getCommentLists = (identifier) => {
- return (dispatch) => {
- fetchCommentLists(identifier).then(res => {
+ return (dispatch, getState) => {
+ const {pages: {limit, page}} = getState().commentReducer;
+ fetchCommentLists(identifier, {
+ limit,
+ page
+ }).then(res => {
console.log('获取评论列表: ====>>>>', res);
if (res.status === 200) {
const {data} = res;
@@ -112,3 +116,10 @@ export const showOrHideComment = (identifier, id, params) => {
}
}
+// 改变分页条件
+export const changePagination = (page) => {
+ return {
+ type: types.CHANGE_COMMENT_PAGINATION_PARAMS,
+ payload: page
+ };
+}
diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js
index 197673f80..6086c2b32 100644
--- a/public/react/src/redux/actions/index.js
+++ b/public/react/src/redux/actions/index.js
@@ -49,7 +49,8 @@ import {
saveUserCodeForInterval,
saveEditorCodeForDetail,
saveOpacityType,
- clearOjForUserReducer
+ clearOjForUserReducer,
+ changeRecordPagination
// isUpdateCodeCtx
} from './ojForUser';
@@ -71,7 +72,8 @@ import {
replayChildComment,
deleteComment,
likeComment,
- showOrHideComment
+ showOrHideComment,
+ changePagination
} from './comment';
import {
@@ -134,6 +136,7 @@ export default {
saveEditorCodeForDetail,
saveOpacityType,
clearOjForUserReducer,
+ changeRecordPagination,
// jupyter
getJupyterTpiDataSet,
getJupyterTpiUrl,
@@ -155,4 +158,5 @@ export default {
deleteComment,
likeComment,
showOrHideComment,
+ changePagination
}
\ No newline at end of file
diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js
index db2b7c300..783c41e6a 100644
--- a/public/react/src/redux/actions/ojForUser.js
+++ b/public/react/src/redux/actions/ojForUser.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-23 11:55:48
+ * @LastEditTime : 2019-12-25 14:27:58
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
@@ -315,8 +315,12 @@ export const debuggerCode = (identifier,value, type) => {
// 获取提交记录
export const getUserCommitRecord = (identifier) => {
- return (dispatch) => {
- fetchUserCommitRecord(identifier).then(res => {
+ return (dispatch, getState) => {
+ const { pages: { limit, page } } = getState().ojForUserReducer;
+ fetchUserCommitRecord(identifier, {
+ limit,
+ page
+ }).then(res => {
const {status, data} = res;
if (status === 200) {
dispatch({
@@ -477,5 +481,10 @@ export const clearOjForUserReducer = () => {
};
}
+export const changeRecordPagination = (page) => {
+ return {
+ type: types.CHANGE_RECORD_PAGINATION_PAGE,
+ payload: page
+ }
+}
// 更新通知状态
-
diff --git a/public/react/src/redux/reducers/commentReducer.js b/public/react/src/redux/reducers/commentReducer.js
index cf56f1965..6fad98a55 100644
--- a/public/react/src/redux/reducers/commentReducer.js
+++ b/public/react/src/redux/reducers/commentReducer.js
@@ -6,7 +6,7 @@ import types from "../actions/actionTypes";
* @Github:
* @Date: 2019-12-23 10:35:31
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-23 14:51:42
+ * @LastEditTime : 2019-12-25 10:56:10
*/
const initialState = {
comments: {
@@ -14,8 +14,9 @@ const initialState = {
},
commentLists: {}, // 评论列表
pages: {
- limit: 20,
- page: 1
+ limit: 15,
+ page: 1,
+ total: 1
}
};
@@ -28,9 +29,17 @@ const commentReducer = (state = initialState, action) => {
...state
}
case types.GET_COMMENT_LISTS:
+ const {disscuss_count} = payload;
return {
...state,
- commentLists: Object.assign({}, payload)
+ commentLists: Object.assign({}, payload),
+ pages: Object.assign({}, state.pages, { total: disscuss_count })
+ }
+ case types.CHANGE_COMMENT_PAGINATION_PARAMS:
+ const _pages = Object.assign({}, state.pages, { page: payload });
+ return {
+ ...state,
+ pages: _pages
}
default:
return {
diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js
index 0950d7442..8d82b8307 100644
--- a/public/react/src/redux/reducers/ojForUserReducer.js
+++ b/public/react/src/redux/reducers/ojForUserReducer.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-24 16:35:09
+ * @LastEditTime : 2019-12-25 14:45:47
*/
import types from "../actions/actionTypes";
import { Base64 } from 'js-base64';
@@ -27,7 +27,12 @@ const initialState = {
notice: false, // 通知
hadCodeUpdate: false, // 更新代码
operateType: '', // 点击类型: 调度或提交
- comment_identifier: '' // 用户评论时使用的 identifier
+ comment_identifier: '', // 用户评论时使用的 identifier
+ pages: {
+ limit: 15,
+ page: 1,
+ total: 1
+ }
};
const ojForUserReducer = (state = initialState, action) => {
@@ -81,9 +86,11 @@ const ojForUserReducer = (state = initialState, action) => {
}
case types.COMMIT_RECORD:
+ const {records, records_count} = action.payload;
return {
...state,
- commitRecord: [...action.payload]
+ commitRecord: records,
+ pages: Object.assign({}, state.pages, { total: records_count })
}
case types.SAVE_USER_CODE:
let curCode = Base64.encode(action.payload);
@@ -199,6 +206,11 @@ const ojForUserReducer = (state = initialState, action) => {
...state,
hack: _hack
}
+ case types.CHANGE_RECORD_PAGINATION_PAGE:
+ return {
+ ...state,
+ pages: Object.assign({}, state.pages, { page: action.payload})
+ }
default:
return state;
}
diff --git a/public/react/src/services/commentService.js b/public/react/src/services/commentService.js
index 47eb347d2..2860a5b60 100644
--- a/public/react/src/services/commentService.js
+++ b/public/react/src/services/commentService.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-23 10:43:27
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-24 17:10:49
+ * @LastEditTime : 2019-12-25 10:50:24
*/
import axios from 'axios';
@@ -15,9 +15,9 @@ export async function fetchAddComment (identifier, params) {
}
// 获取评论列表
-export async function fetchCommentLists (identifier) {
+export async function fetchCommentLists (identifier, params) {
const url = `/problems/${identifier}/comments.json`;
- return axios.get(url);
+ return axios.get(url, {params});
}
// 添加子评论
diff --git a/public/react/src/services/ojService.js b/public/react/src/services/ojService.js
index aeeb212a2..8831f8c11 100644
--- a/public/react/src/services/ojService.js
+++ b/public/react/src/services/ojService.js
@@ -3,8 +3,8 @@
* @Author: tangjiang
* @Github:
* @Date: 2019-11-20 10:55:38
- * @LastEditors: tangjiang
- * @LastEditTime: 2019-12-20 10:10:53
+ * @LastEditors : tangjiang
+ * @LastEditTime : 2019-12-25 14:27:30
*/
import axios from 'axios';
@@ -70,10 +70,10 @@ export async function fetchUserProgramDetail (identifier) {
}
// 获取提交记录
-export async function fetchUserCommitRecord (identifier) {
+export async function fetchUserCommitRecord (identifier, params) {
console.log('identifier=====', identifier);
const url = `/myproblems/${identifier}/submit_records.json`;
- return axios.get(url);
+ return axios.get(url, { params });
}
// 获取提交记录详情
From e8d9e26f8e4acb5212aaeb3bc6a2209a13cc2c6b 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 15:13:14 +0800
Subject: [PATCH 25/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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index ee8bfd740..c11d95ffb 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -1338,7 +1338,7 @@ class TPMBanner extends Component {
{this.state.Radiovalue === 4 ?
出题者: - {username} + {username}