diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
new file mode 100644
index 000000000..393e0659c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
new file mode 100644
index 000000000..393e0659c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
new file mode 100644
index 000000000..060f71f9c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index 94e1ec3c1..b189cb4f3 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -1,13 +1,29 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
-import MonacoEditor from 'react-monaco-editor';
+import {
+ Input,
+ Select,
+ Radio,
+ Checkbox,
+ Popconfirm,
+ message,
+ Modal,
+ Icon,
+ DatePicker,
+ Breadcrumb,
+ Upload,
+ Button,
+ notification,
+ Tooltip,
+ Tabs
+} from 'antd';
-//MonacoDiffEditor 对比模式
-import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+import Shixuninformation from './Shixuninformation';
-// import "antd/dist/antd.css";
+import Configuration from './Configuration';
+
+import LearningSettings from './LearningSettings';
-import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
@@ -15,15 +31,13 @@ import axios from 'axios';
import './css/TPMsettings.css';
-import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
-
-let origin = getUrl();
+import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
let path = getUrl("/editormd/lib/")
const $ = window.$;
-const { TabPane } = Tabs;
+const {TabPane} = Tabs;
let timeout;
@@ -31,66 +45,65 @@ let currentValue;
const Option = Select.Option;
-const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
// 处理整点 半点
// 取传入时间往后的第一个半点
export function handleDateStrings(dateString) {
- if (!dateString) return dateString;
- const ar = dateString.split(':')
- if (ar[1] == '00' || ar[1] == '30') {
- return dateString
- }
- const miniute = parseInt(ar[1]);
- if (miniute < 30 || miniute == 60) {
- return [ar[0], '30'].join(':')
- }
- if (miniute < 60) {
- // 加一个小时
- const tempStr = [ar[0], '00'].join(':');
- const format = "YYYY-MM-DD HH:mm";
- const _moment = moment(tempStr, format)
- _moment.add(1, 'hours')
- return _moment.format(format)
- }
-
- return dateString
+ if (!dateString) return dateString;
+ const ar = dateString.split(':')
+ if (ar[1] == '00' || ar[1] == '30') {
+ return dateString
+ }
+ const miniute = parseInt(ar[1]);
+ if (miniute < 30 || miniute == 60) {
+ return [ar[0], '30'].join(':')
+ }
+ if (miniute < 60) {
+ // 加一个小时
+ const tempStr = [ar[0], '00'].join(':');
+ const format = "YYYY-MM-DD HH:mm";
+ const _moment = moment(tempStr, format)
+ _moment.add(1, 'hours')
+ return _moment.format(format)
+ }
+
+ return dateString
}
// 恢复数据
-function md_rec_data(k,mdu,id, editor){
- if(window.sessionStorage.getItem(k+mdu) !== null){
- editor.setValue(window.sessionStorage.getItem(k+mdu));
- md_clear_data(k,mdu,id);
+function md_rec_data(k, mdu, id, editor) {
+ if (window.sessionStorage.getItem(k + mdu) !== null) {
+ editor.setValue(window.sessionStorage.getItem(k + mdu));
+ md_clear_data(k, mdu, id);
}
}
// 保存数据
-function md_add_data(k,mdu,d){
- window.sessionStorage.setItem(k+mdu,d);
+function md_add_data(k, mdu, d) {
+ window.sessionStorage.setItem(k + mdu, d);
}
// 清空保存的数据
-function md_clear_data(k,mdu,id){
- window.sessionStorage.removeItem(k+mdu);
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
- if(k == 'content'){
+function md_clear_data(k, mdu, id) {
+ window.sessionStorage.removeItem(k + mdu);
+ var id1 = "#e_tip_" + id;
+ var id2 = "#e_tips_" + id;
+ if (k == 'content') {
$(id2).html("");
- }else{
+ } else {
$(id1).html("");
}
}
-function md_elocalStorage(editor,mdu,id){
- if (window.sessionStorage){
- var oc = window.sessionStorage.getItem('content'+mdu);
- if(oc !== null ){
- $("#e_tips_"+id).data('editor', editor);
- var h = '您上次有已保存的数据,是否恢复 ? / 不恢复';
- $("#e_tips_"+id).html(h);
+function md_elocalStorage(editor, mdu, id) {
+ if (window.sessionStorage) {
+ var oc = window.sessionStorage.getItem('content' + mdu);
+ if (oc !== null) {
+ $("#e_tips_" + id).data('editor', editor);
+ var h = '您上次有已保存的数据,是否恢复 ? / 不恢复';
+ $("#e_tips_" + id).html(h);
}
- setInterval(function() {
+ setInterval(function () {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
@@ -98,27 +111,27 @@ function md_elocalStorage(editor,mdu,id){
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
- if(editor.getValue().trim() != ""){
- md_add_data("content",mdu,editor.getValue());
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
+ if (editor.getValue().trim() != "") {
+ md_add_data("content", mdu, editor.getValue());
+ var id1 = "#e_tip_" + id;
+ var id2 = "#e_tips_" + id;
- $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
+ $(id1).html(" 数据已于 " + h + ':' + m + ':' + s + " 保存 ");
$(id2).html("");
}
- },10000);
+ }, 10000);
- }else{
- $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
+ } else {
+ $("#e_tip_" + id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
-function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
+function create_editorMD(id, width, high, placeholder, imageUrl, initValue, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
- markdown : initValue,
+ markdown: initValue,
syncScrolling: "single",
tex: true,
tocm: true,
@@ -173,8 +186,8 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
}
-function updatamakedown(id){
- setTimeout(()=>{
+function updatamakedown(id) {
+ setTimeout(() => {
var shixunDescr = window.editormd.markdownToHTML(id, {
htmlDecode: "style,script,iframe",
taskList: true,
@@ -182,34 +195,36 @@ function updatamakedown(id){
flowChart: true,
sequenceDiagram: true
});
- $("#"+id+" p:first").addClass("ReactMarkdown");
+ $("#" + id + " p:first").addClass("ReactMarkdown");
$('#collaborators_list_info').show()
}, 200)
}
function range(start, end) {
- const result = [];
- for (let i = start; i < end; i++) {
- result.push(i);
- }
- return result;
+ const result = [];
+ for (let i = start; i < end; i++) {
+ result.push(i);
+ }
+ return result;
}
+
function disabledDateTime() {
- return {
- // disabledHours: () => range(0, 24).splice(4, 20),
- disabledMinutes: () => range(1, 30).concat(range(31, 60)),
- // disabledSeconds: () => [0, 60],
- };
+ return {
+ // disabledHours: () => range(0, 24).splice(4, 20),
+ disabledMinutes: () => range(1, 30).concat(range(31, 60)),
+ // disabledSeconds: () => [0, 60],
+ };
}
function disabledDate(current) {
- return current && current < moment().endOf('day').subtract(1, 'days');
+ return current && current < moment().endOf('day').subtract(1, 'days');
}
+
export default class TPMsettings extends Component {
constructor(props) {
super(props)
this.state = {
- fileList: [],
+ fileList: [],
commandLine: 0,
Openpublic: 0,
settingsData: undefined,
@@ -222,7 +237,7 @@ export default class TPMsettings extends Component {
can_copy: undefined,
task_pass: undefined,
test_set_permission: undefined,
- code_edit_permission: undefined,
+ code_edit_permission: undefined,
hide_code: undefined,
code_hidden: undefined,
forbid_copy: undefined,
@@ -232,11 +247,11 @@ export default class TPMsettings extends Component {
scopetype: false,
departmentslist: undefined,
description: '',
- evaluate_script:undefined,
+ evaluate_script: undefined,
standard_scripts: undefined,
choice_main_type: "",
choice_small_type: [],
- choice_standard_scripts:undefined,
+ choice_standard_scripts: undefined,
editordescriptios: undefined,
editorevaluate_scripts: undefined,
choice_standard_scriptssum: undefined,
@@ -252,31 +267,32 @@ export default class TPMsettings extends Component {
evaluate_scripttype: false,
exec_timetype: false,
traineetype: false,
- standard_scriptsModal:false,
- standard_scriptsModals:false,
- SelectTheCommandtype:false,
- multi_webssh:false,
- status:0,
- opers:false,
- operss:false,
- testscripttiptype:false,
- opersss:false,
- operateshixunstype:false,
- opening_time:"",
- opensmail:false,
- scope_partmenttype:false,
- newuse_scope:undefined,
- scope_partments:0,
- shixun_service_configs:undefined,
- shixun_service_configlist:undefined,
+ standard_scriptsModal: false,
+ standard_scriptsModals: false,
+ SelectTheCommandtype: false,
+ multi_webssh: false,
+ status: 0,
+ opers: false,
+ operss: false,
+ testscripttiptype: false,
+ opersss: false,
+ operateshixunstype: false,
+ opening_time: "",
+ opensmail: false,
+ scope_partmenttype: false,
+ newuse_scope: undefined,
+ scope_partments: 0,
+ shixun_service_configs: undefined,
+ shixun_service_configlist: undefined,
pod_exist_time: undefined,
pod_exist_timetype: false,
- shixunmemoMDvalue:"",
- language:"",
- deleteisnot:true
+ shixunmemoMDvalue: "",
+ language: "",
+ deleteisnot: true
}
}
- descriptionMD=(initValue, id)=> {
+
+ descriptionMD = (initValue, id) => {
this.contentChanged = false;
const placeholder = "";
@@ -285,7 +301,7 @@ export default class TPMsettings extends Component {
const imageUrl = `/api/attachments.json`;
// 创建editorMd
- const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ const description_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue, () => {
setTimeout(() => {
description_editormd.resize()
description_editormd.cm && description_editormd.cm.refresh()
@@ -304,7 +320,7 @@ export default class TPMsettings extends Component {
window.description_editormd = description_editormd;
}
- evaluate_scriptMD=(initValue, id)=> {
+ evaluate_scriptMD = (initValue, id) => {
this.contentChanged = false;
const placeholder = "";
// amp;
@@ -312,7 +328,7 @@ export default class TPMsettings extends Component {
const imageUrl = `/api/attachments.json`;
// 创建editorMd
- const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ const evaluate_script_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue, () => {
setTimeout(() => {
evaluate_script_editormd.resize()
evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh()
@@ -333,16 +349,15 @@ export default class TPMsettings extends Component {
}
-
componentDidMount() {
- let id=this.props.match.params.shixunId;
+ let id = this.props.match.params.shixunId;
- let Url=`/shixuns/`+id+`/settings.json`;
+ let Url = `/shixuns/` + id + `/settings.json`;
- axios.get(Url).then((response)=> {
+ axios.get(Url).then((response) => {
// alert(response.data.shixun.choice_standard_scripts)
- if(response.status===200){
+ if (response.status === 200) {
this.setState({
shixunsID: id,
settingsData: response.data,
@@ -355,10 +370,10 @@ export default class TPMsettings extends Component {
task_pass: response.data.shixun.task_pass,
test_set_permission: response.data.shixun.test_set_permission,
hide_code: response.data.shixun.hide_code,
- code_edit_permission: response.data.shixun.code_edit_permission,
+ code_edit_permission: response.data.shixun.code_edit_permission,
code_hidden: response.data.shixun.code_hidden,
is_secret_repository: response.data.shixun.is_secret_repository,
- init_is_secret_repository: response.data.shixun.is_secret_repository,
+ init_is_secret_repository: response.data.shixun.is_secret_repository,
forbid_copy: response.data.shixun.forbid_copy,
vnc: response.data.shixun.vnc,
vnc_evaluate: response.data.shixun.vnc_evaluate,
@@ -369,15 +384,15 @@ export default class TPMsettings extends Component {
choice_main_type: response.data.shixun.choice_main_type,
choice_small_type: response.data.shixun.choice_small_type,
choice_standard_scripts: response.data.shixun.choice_standard_scripts,
- standard_scripts:response.data.shixun.standard_scripts,
- multi_webssh:response.data.shixun.multi_webssh,
- status:response.data.shixun.status,
- opening_time:response.data.shixun.opening_time,
- newuse_scope:response.data.shixun.use_scope,
+ standard_scripts: response.data.shixun.standard_scripts,
+ multi_webssh: response.data.shixun.multi_webssh,
+ status: response.data.shixun.status,
+ opening_time: response.data.shixun.opening_time,
+ newuse_scope: response.data.shixun.use_scope,
scope_partments: response.data.shixun.scope_partment.length,
- shixunmemoMDvalue:response.data.shixun.evaluate_script,
- shixun_service_configs:response.data.shixun.shixun_service_configs,
- shixun_service_configlist:response.data.shixun.shixun_service_configs,
+ shixunmemoMDvalue: response.data.shixun.evaluate_script,
+ shixun_service_configs: response.data.shixun.shixun_service_configs,
+ shixun_service_configlist: response.data.shixun.shixun_service_configs,
})
// if(response.data.status===403){
@@ -389,13 +404,13 @@ export default class TPMsettings extends Component {
// }
- if(response.data.shixun.multi_webssh===true){
+ if (response.data.shixun.multi_webssh === true) {
this.setState({
- SelectTheCommandtype:true
+ SelectTheCommandtype: true
})
- }else{
+ } else {
this.setState({
- SelectTheCommandtype:false
+ SelectTheCommandtype: false
})
}
if (response.data.shixun.scope_partment.length > 0) {
@@ -429,53 +444,52 @@ export default class TPMsettings extends Component {
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
- if (response.data.message === undefined) {
- this.setState({
- departmentslist: response.data.shools_name
- });
- }
- }
+ if (response.data.message === undefined) {
+ this.setState({
+ departmentslist: response.data.shools_name
+ });
+ }
+ }
}).catch((error) => {
console.log(error)
});
-
}
- SelectshixunCommand=(e)=>{
+ SelectshixunCommand = (e) => {
// console.log( e.target.value)
- const webssh = e.target.value
- if (webssh == 2) {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: true,
- multi_webssh:false
- });
- } else {
- if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- })
- } else {
- if (!this.state.vnc) {
- this.setState({
- is_secret_repository: false,
- })
- }
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- }
+ const webssh = e.target.value
+ if (webssh == 2) {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: true,
+ multi_webssh: false
+ });
+ } else {
+ if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh: false
+ });
+ }
+ })
+ } else {
+ if (!this.state.vnc) {
+ this.setState({
+ is_secret_repository: false,
+ })
+ }
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh: false
+ });
+ }
+ }
// this.setState({
// webssh: webssh,
@@ -493,13 +507,13 @@ export default class TPMsettings extends Component {
// }
}
- SelectOpenpublic=(e)=>{
+ SelectOpenpublic = (e) => {
this.setState({
Openpublic: e.target.value
});
}
- can_copy=(e)=>{
+ can_copy = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -512,7 +526,7 @@ export default class TPMsettings extends Component {
}
- task_pass=(e)=>{
+ task_pass = (e) => {
let sum = ""
if (e.target.checked === false) {
@@ -525,7 +539,7 @@ export default class TPMsettings extends Component {
});
}
- test_set_permission=(e)=>{
+ test_set_permission = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -538,7 +552,7 @@ export default class TPMsettings extends Component {
}
- hide_code=(e)=>{
+ hide_code = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -551,11 +565,11 @@ export default class TPMsettings extends Component {
}
code_edit_permission = (e) => {
- this.setState({
- code_edit_permission: e.target.checked
- })
+ this.setState({
+ code_edit_permission: e.target.checked
+ })
}
- code_hidden=(e)=>{
+ code_hidden = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -568,33 +582,32 @@ export default class TPMsettings extends Component {
}
confirmDeleteSecretRepo = ({title, onOk}) => {
- confirm({
- title: title ||
-
已创建的私密版本库及其内容,将在“保存”时被删除。
-
是否确认取消勾选?
-
,
- okText: '确定',
- cancelText: '取消',
- onOk: () => {
- this.setState({ is_secret_repository: false })
- onOk && onOk()
- },
- onCancel() {
- },
- });
+ confirm({
+ title: title ||
+
已创建的私密版本库及其内容,将在“保存”时被删除。
+
是否确认取消勾选?
+
,
+ okText: '确定',
+ cancelText: '取消',
+ onOk: () => {
+ this.setState({is_secret_repository: false})
+ onOk && onOk()
+ },
+ onCancel() {
+ },
+ });
}
is_secret_repository = (e) => {
- const checked = e.target.checked
- if (!checked) {
- if (this.state.init_is_secret_repository) {
- this.confirmDeleteSecretRepo({
- })
- } else {
- this.setState({ is_secret_repository: false })
- }
- } else {
- this.setState({ is_secret_repository: true })
- }
+ const checked = e.target.checked
+ if (!checked) {
+ if (this.state.init_is_secret_repository) {
+ this.confirmDeleteSecretRepo({})
+ } else {
+ this.setState({is_secret_repository: false})
+ }
+ } else {
+ this.setState({is_secret_repository: true})
+ }
}
forbid_copy = (e) => {
let sum = ""
@@ -607,48 +620,48 @@ export default class TPMsettings extends Component {
forbid_copy: sum,
});
}
- shixun_vnc_evaluate=(e) => {
- this.setState({
+ shixun_vnc_evaluate = (e) => {
+ this.setState({
vnc_evaluate: e.target.checked,
});
-
+
}
- shixun_vnc=(e)=>{
+ shixun_vnc = (e) => {
// let sum = ""
// if (e.target.checked === false) {
// sum = 0
// } else if (e.target.checked === true) {
// sum = 1
// }
- const vnc = e.target.checked;
- if (!vnc) {
- if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- })
- } else {
- if (this.state.webssh != 2) {
- this.setState({
- is_secret_repository: false
- })
- }
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- } else {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
+ const vnc = e.target.checked;
+ if (!vnc) {
+ if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ })
+ } else {
+ if (this.state.webssh != 2) {
+ this.setState({
+ is_secret_repository: false
+ })
+ }
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ } else {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
}
shixunsname = (e) => {
// let {shixunsstatus}=this.state;
@@ -657,58 +670,58 @@ export default class TPMsettings extends Component {
// }
this.setState({
name: e.target.value,
- shixunnametype:false
+ shixunnametype: false
})
}
bigClass = (value) => {
- // choice_main_type
- // choice_small_type
- let {settingsData,shixun_service_configs,choice_main_type,choice_small_type}=this.state;
-
- let list=[]
- list.push(choice_main_type)
- choice_small_type.map((item,key)=>{
- list.push(item)
- })
-
- let newshixun_service_configs=shixun_service_configs;
-
- let newshixun_service_configsagin=[]
-
- newshixun_service_configs.map((item,key)=>{
- list.map((its,index)=>{
- if(item.mirror_repository_id===its){
- newshixun_service_configsagin.push(item)
- }
- })
- })
-
-
- settingsData.shixun.main_type.some((item,key)=> {
- if (item.id === value) {
- newshixun_service_configsagin[0]={
- mirror_repository_id:value,
- name:item.type_name,
- cpu_limit:1,
- lower_cpu_limit:0.1,
- memory_limit:1024,
- request_limit:10
- }
- return true
- }
- }
- )
- let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
+ // choice_main_type
+ // choice_small_type
+ let {settingsData, shixun_service_configs, choice_main_type, choice_small_type} = this.state;
+
+ let list = []
+ list.push(choice_main_type)
+ choice_small_type.map((item, key) => {
+ list.push(item)
+ })
+
+ let newshixun_service_configs = shixun_service_configs;
+
+ let newshixun_service_configsagin = []
+
+ newshixun_service_configs.map((item, key) => {
+ list.map((its, index) => {
+ if (item.mirror_repository_id === its) {
+ newshixun_service_configsagin.push(item)
+ }
+ })
+ })
+
+
+ settingsData.shixun.main_type.some((item, key) => {
+ if (item.id === value) {
+ newshixun_service_configsagin[0] = {
+ mirror_repository_id: value,
+ name: item.type_name,
+ cpu_limit: 1,
+ lower_cpu_limit: 0.1,
+ memory_limit: 1024,
+ request_limit: 10
+ }
+ return true
+ }
+ }
+ )
+ let url = `/shixuns/get_mirror_script.json?mirror_id=` + value;
axios.get(url).then((response) => {
if (response.status === 200) {
// console.log(response.data)
this.setState({
choice_main_type: value,
- standard_scripts:response.data,
- choice_standard_scripts:null,
- shixun_service_configs:newshixun_service_configsagin,
- shixun_service_configlist:newshixun_service_configsagin,
+ standard_scripts: response.data,
+ choice_standard_scripts: null,
+ shixun_service_configs: newshixun_service_configsagin,
+ shixun_service_configlist: newshixun_service_configsagin,
})
}
}).catch((error) => {
@@ -716,98 +729,97 @@ export default class TPMsettings extends Component {
});
-
}
- Deselectlittle=(value)=>{
+ Deselectlittle = (value) => {
- let {shixun_service_configs,choice_small_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
+ let {shixun_service_configs, choice_small_type} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ let newchoice_small_type = choice_small_type;
- newshixun_service_configs.some((item,key)=> {
- if (item.mirror_repository_id === value) {
- newshixun_service_configs.splice(key, 1)
- return true
- }
- }
- )
+ newshixun_service_configs.some((item, key) => {
+ if (item.mirror_repository_id === value) {
+ newshixun_service_configs.splice(key, 1)
+ return true
+ }
+ }
+ )
- newchoice_small_type.some((item,key)=> {
- if (item === value) {
- newchoice_small_type.splice(key, 1)
- return true
- }
- }
- )
+ newchoice_small_type.some((item, key) => {
+ if (item === value) {
+ newchoice_small_type.splice(key, 1)
+ return true
+ }
+ }
+ )
- this.setState({
- choice_small_type: newchoice_small_type,
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
- }
+ this.setState({
+ choice_small_type: newchoice_small_type,
+ shixun_service_configs: newshixun_service_configs,
+ shixun_service_configlist: newshixun_service_configs,
+ })
+ }
littleClass = (value) => {
- let {settingsData,shixun_service_configs,choice_small_type,choice_main_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
- // if(Array.isArray(value)===true){
- // value.map((item,key)=>{
- // settingsData.shixun.small_type.some((items,keys)=> {
- // if (items.id === item) {
- // newshixun_service_configs.push({
- // mirror_repository_id:value,
- // name:items.type_name,
- // cpu_limit:1,
- // lower_cpu_limit:0.1,
- // memory_limit:1024,
- // request_limit:10
- // })
- // return true
- // }
- // }
- // )
- // })
- // }
-
- let list=[]
- list.push(choice_main_type)
- choice_small_type.map((item,key)=>{
- list.push(item)
- })
-
- let newshixun_service_configsagin=[]
-
- newshixun_service_configs.map((item,key)=>{
- list.map((its,index)=>{
- if(item.mirror_repository_id===its){
- newshixun_service_configsagin.push(item)
- }
- })
- })
-
- settingsData.shixun.small_type.some((items,keys)=> {
- if (items.id === value) {
- newshixun_service_configsagin.push({
- mirror_repository_id:value,
- name:items.type_name,
- cpu_limit:1,
- lower_cpu_limit:0.1,
- memory_limit:1024,
- request_limit:10
- })
- return true
- }
- }
- )
-
- newchoice_small_type.push(value)
+ let {settingsData, shixun_service_configs, choice_small_type, choice_main_type} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ let newchoice_small_type = choice_small_type;
+ // if(Array.isArray(value)===true){
+ // value.map((item,key)=>{
+ // settingsData.shixun.small_type.some((items,keys)=> {
+ // if (items.id === item) {
+ // newshixun_service_configs.push({
+ // mirror_repository_id:value,
+ // name:items.type_name,
+ // cpu_limit:1,
+ // lower_cpu_limit:0.1,
+ // memory_limit:1024,
+ // request_limit:10
+ // })
+ // return true
+ // }
+ // }
+ // )
+ // })
+ // }
+
+ let list = []
+ list.push(choice_main_type)
+ choice_small_type.map((item, key) => {
+ list.push(item)
+ })
+
+ let newshixun_service_configsagin = []
+
+ newshixun_service_configs.map((item, key) => {
+ list.map((its, index) => {
+ if (item.mirror_repository_id === its) {
+ newshixun_service_configsagin.push(item)
+ }
+ })
+ })
+
+ settingsData.shixun.small_type.some((items, keys) => {
+ if (items.id === value) {
+ newshixun_service_configsagin.push({
+ mirror_repository_id: value,
+ name: items.type_name,
+ cpu_limit: 1,
+ lower_cpu_limit: 0.1,
+ memory_limit: 1024,
+ request_limit: 10
+ })
+ return true
+ }
+ }
+ )
+
+ newchoice_small_type.push(value)
this.setState({
choice_small_type: newchoice_small_type,
- shixun_service_configs:newshixun_service_configsagin,
- shixun_service_configlist:newshixun_service_configsagin,
+ shixun_service_configs: newshixun_service_configsagin,
+ shixun_service_configlist: newshixun_service_configsagin,
})
}
onPodExistTimeChange = (e) => {
@@ -845,8 +857,8 @@ export default class TPMsettings extends Component {
shixunScopeInput = (e) => {
let {scope_partment} = this.state;
let datalist = scope_partment;
- if (datalist===undefined) {
- datalist=[]
+ if (datalist === undefined) {
+ datalist = []
}
datalist.push(e)
@@ -867,42 +879,41 @@ export default class TPMsettings extends Component {
// });
// }
submit_edit_shixun = () => {
- if (this.saving == true) return;
+ if (this.saving == true) return;
this.saving = true;
- if(this.state.status===-1){
- this.props.showSnackbar("该实训已被删除,保存失败!");
- return
- }
+ if (this.state.status === -1) {
+ this.props.showSnackbar("该实训已被删除,保存失败!");
+ return
+ }
let {
name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
- evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
- opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
+ evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc, multi_webssh,
+ opening_time, shixunmemoMDvalue, shixun_service_configlist, is_secret_repository, code_edit_permission
} = this.state;
- let newshixun_service_configlist = shixun_service_configlist.map(v => {
- let v1 = Object.assign({},v);
- delete v1.name;
- return v1
- });
+ let newshixun_service_configlist = shixun_service_configlist.map(v => {
+ let v1 = Object.assign({}, v);
+ delete v1.name;
+ return v1
+ });
// let operateauthority=
- // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
- // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
+ // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
const description_editormd = this.description_editormd.getValue();
let evaluate_script_editormd;
- if(this.state.status==0||this.state.status==1||this.state.status==2&&this.props.identity===1){
+ if (this.state.status == 0 || this.state.status == 1 || this.state.status == 2 && this.props.identity === 1) {
// evaluate_script_editormd = this.evaluate_script_editormd.getValue();
evaluate_script_editormd = shixunmemoMDvalue
- }else{
+ } else {
evaluate_script_editormd = evaluate_script;
}
-
if (name === "") {
this.setState({
shixunnametype: true
@@ -930,9 +941,9 @@ export default class TPMsettings extends Component {
}, 1000);
return
}
- if(use_scope===1){
+ if (use_scope === 1) {
- if(scope_partment===undefined||scope_partment.length===0){
+ if (scope_partment === undefined || scope_partment.length === 0) {
this.setState({
scope_partmenttype: true
})
@@ -970,50 +981,50 @@ export default class TPMsettings extends Component {
let id = this.props.match.params.shixunId;
- let newmulti_webssh=multi_webssh;
+ let newmulti_webssh = multi_webssh;
- if(newmulti_webssh===null){
- newmulti_webssh=false
+ if (newmulti_webssh === null) {
+ newmulti_webssh = false
}
- //exec_time: exec_time,
+ //exec_time: exec_time,
let Url = `/shixuns/` + id + `.json`;
let data = {
- shixun:{
-
- name: name,
- webssh: webssh,
- use_scope: use_scope,
- can_copy: can_copy,
- vnc: vnc===null?undefined:vnc,
- vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
- test_set_permission: test_set_permission,
- code_hidden: code_hidden,
- code_edit_permission: code_edit_permission,
- trainee: trainee,
- task_pass: task_pass,
- hide_code: hide_code,
- forbid_copy: forbid_copy,
- multi_webssh:newmulti_webssh,
- opening_time:opening_time,
- mirror_script_id:choice_standard_scriptssum===undefined?choice_standard_scripts:choice_standard_scriptssum,
- },
- shixun_info:{
- description: description_editormd,
- evaluate_script: evaluate_script_editormd,
- },
- is_secret_repository: is_secret_repository,
- main_type: choice_main_type,
- small_type: choice_small_type,
- scope_partment: scope_partment,
- shixun_service_configs:newshixun_service_configlist
+ shixun: {
+
+ name: name,
+ webssh: webssh,
+ use_scope: use_scope,
+ can_copy: can_copy,
+ vnc: vnc === null ? undefined : vnc,
+ vnc_evaluate: vnc_evaluate === null ? undefined : vnc_evaluate,
+ test_set_permission: test_set_permission,
+ code_hidden: code_hidden,
+ code_edit_permission: code_edit_permission,
+ trainee: trainee,
+ task_pass: task_pass,
+ hide_code: hide_code,
+ forbid_copy: forbid_copy,
+ multi_webssh: newmulti_webssh,
+ opening_time: opening_time,
+ mirror_script_id: choice_standard_scriptssum === undefined ? choice_standard_scripts : choice_standard_scriptssum,
+ },
+ shixun_info: {
+ description: description_editormd,
+ evaluate_script: evaluate_script_editormd,
+ },
+ is_secret_repository: is_secret_repository,
+ main_type: choice_main_type,
+ small_type: choice_small_type,
+ scope_partment: scope_partment,
+ shixun_service_configs: newshixun_service_configlist
}
axios.put(Url, data).then((response) => {
// console.log(response)
- this.saving = false;
- if(response.status){
+ this.saving = false;
+ if (response.status) {
if (response.data.status === -1) {
this.props.showSnackbar(response.data.message);
return
@@ -1024,7 +1035,7 @@ export default class TPMsettings extends Component {
}).catch((error) => {
console.log(error)
- this.saving = false;
+ this.saving = false;
})
@@ -1052,13 +1063,11 @@ export default class TPMsettings extends Component {
}
-
-
shixunsclose = () => {
let id = this.props.match.params.shixunId;
let cul = `/shixuns/` + id + `/close.json`;
axios.post(cul).then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
@@ -1071,12 +1080,12 @@ export default class TPMsettings extends Component {
})
}
- shixunsdel= () => {
+ shixunsdel = () => {
let id = this.props.match.params.shixunId;
- let cul = `/shixuns/` + id +`.json`;
+ let cul = `/shixuns/` + id + `.json`;
axios.delete(cul).then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
@@ -1125,7 +1134,7 @@ export default class TPMsettings extends Component {
axios.get(trl).then((response) => {
// this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD");
this.setState({
- shixunmemoMDvalue:response.data.shixun_script
+ shixunmemoMDvalue: response.data.shixun_script
})
}).catch((error) => {
console.log(error)
@@ -1158,168 +1167,168 @@ export default class TPMsettings extends Component {
})
}
- setlanguagewrite = (e)=>{
- this.setState({
- languagewrite: e.target.value
- })
- }
-
- setsystemenvironment = (e) => {
- this.setState({
- systemenvironment: e.target.value
- })
- }
-
- settestcoderunmode = (e) => {
- this.setState({
- testcoderunmode: e.target.value
- })
-
- }
-
- sendsure_apply = () => {
- let {languagewrite,systemenvironment,testcoderunmode} = this.state;
- // console.log("点击确定")
- // console.log("languagewrite"+languagewrite);
- // console.log("systemenvironment"+systemenvironment);
- // console.log("testcoderunmode"+testcoderunmode);
-
- // let attachment_ids = undefined
- // if (this.state.fileList) {
- // attachment_ids = this.state.fileList.map(item => {
- // return item.response ? item.response.id : item.id
- // })
- // }
- if(languagewrite === undefined || languagewrite === "" ){
- // this.props.showNotification(`请填写该镜像是基于什么语言`);
- this.setState({
- languagewritetype:true
- })
- return
- }
- if(systemenvironment === undefined || systemenvironment === ""){
- // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
- this.setState({
- systemenvironmenttype:true
- })
- return;
-
- }
- if(testcoderunmode === undefined || testcoderunmode === "") {
- // this.props.showNotification(`请填写该镜像中测试代码运行方式`);
- this.setState({
- testcoderunmodetype:true
- })
- return;
- }
- var attachment_ids=undefined;
- if (this.state.fileList) {
- attachment_ids = this.state.fileList.map(item => {
- return item.response ? item.response.id : item.id
- })
- }
-
- if( attachment_ids === undefined || attachment_ids.length===0){
-
- // notification.open(
- // {
- // message: '提示',
- // description:
- // '请上传附件!',
- //
- // }
- // )
- this.setState({
- attachmentidstype:true
- })
- return;
- }
- // console.log("attachment_ids"+attachment_ids);
-
- // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
-
- var data={
- language:languagewrite,
- runtime:systemenvironment,
- run_method:testcoderunmode,
- attachment_id:attachment_ids[0],
- }
- var url =`/shixuns/apply_shixun_mirror.json`;
- axios.post(url,data
- ).then((response) => {
-
- try {
- if (response.data) {
- // const { id } = response.data;
- // if (id) {
- if(this.state.file !== undefined){
- console.log("549");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- // this.props.showNotification('提交成功!');
- notification.open(
- {
- message: '提示',
- description:
- '提交成功!',
-
- }
- )
- this.sendhideModaly()
- // this.props.history.push(`/courses/${cid}/graduation_topics`);
- // }
- }
- }catch (e) {
-
- }
-
- })
-
- }
-
- sendhideModaly = () => {
- this.setState({
- postapplyvisible: false,
- })
- if(this.state.file !== undefined){
- console.log("580");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- }
+ setlanguagewrite = (e) => {
+ this.setState({
+ languagewrite: e.target.value
+ })
+ }
+
+ setsystemenvironment = (e) => {
+ this.setState({
+ systemenvironment: e.target.value
+ })
+ }
+
+ settestcoderunmode = (e) => {
+ this.setState({
+ testcoderunmode: e.target.value
+ })
+
+ }
+
+ sendsure_apply = () => {
+ let {languagewrite, systemenvironment, testcoderunmode} = this.state;
+ // console.log("点击确定")
+ // console.log("languagewrite"+languagewrite);
+ // console.log("systemenvironment"+systemenvironment);
+ // console.log("testcoderunmode"+testcoderunmode);
+
+ // let attachment_ids = undefined
+ // if (this.state.fileList) {
+ // attachment_ids = this.state.fileList.map(item => {
+ // return item.response ? item.response.id : item.id
+ // })
+ // }
+ if (languagewrite === undefined || languagewrite === "") {
+ // this.props.showNotification(`请填写该镜像是基于什么语言`);
+ this.setState({
+ languagewritetype: true
+ })
+ return
+ }
+ if (systemenvironment === undefined || systemenvironment === "") {
+ // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
+ this.setState({
+ systemenvironmenttype: true
+ })
+ return;
+
+ }
+ if (testcoderunmode === undefined || testcoderunmode === "") {
+ // this.props.showNotification(`请填写该镜像中测试代码运行方式`);
+ this.setState({
+ testcoderunmodetype: true
+ })
+ return;
+ }
+ var attachment_ids = undefined;
+ if (this.state.fileList) {
+ attachment_ids = this.state.fileList.map(item => {
+ return item.response ? item.response.id : item.id
+ })
+ }
+
+ if (attachment_ids === undefined || attachment_ids.length === 0) {
+
+ // notification.open(
+ // {
+ // message: '提示',
+ // description:
+ // '请上传附件!',
+ //
+ // }
+ // )
+ this.setState({
+ attachmentidstype: true
+ })
+ return;
+ }
+ // console.log("attachment_ids"+attachment_ids);
+
+ // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
+
+ var data = {
+ language: languagewrite,
+ runtime: systemenvironment,
+ run_method: testcoderunmode,
+ attachment_id: attachment_ids[0],
+ }
+ var url = `/shixuns/apply_shixun_mirror.json`;
+ axios.post(url, data
+ ).then((response) => {
+
+ try {
+ if (response.data) {
+ // const { id } = response.data;
+ // if (id) {
+ if (this.state.file !== undefined) {
+ console.log("549");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ } else {
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ }
+ // this.props.showNotification('提交成功!');
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '提交成功!',
+
+ }
+ )
+ this.sendhideModaly()
+ // this.props.history.push(`/courses/${cid}/graduation_topics`);
+ // }
+ }
+ } catch (e) {
+
+ }
+
+ })
+
+ }
+
+ sendhideModaly = () => {
+ this.setState({
+ postapplyvisible: false,
+ })
+ if (this.state.file !== undefined) {
+ console.log("580");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ } else {
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ }
+ }
yeshidemodel = () => {
this.setState({
@@ -1330,30 +1339,30 @@ export default class TPMsettings extends Component {
SelectScput = (value, e) => {
this.setState({
choice_standard_scriptssum: value,
- language:e.props.name,
- choice_standard_scripts: {id:e.props.value,value:""},
- standard_scriptsModal:true
+ language: e.props.name,
+ choice_standard_scripts: {id: e.props.value, value: ""},
+ standard_scriptsModal: true
})
}
- hidestandard_scriptsModal=()=>{
+ hidestandard_scriptsModal = () => {
this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:false
+ standard_scriptsModal: false,
+ standard_scriptsModals: false
})
}
- get_mirror_script=()=>{
- let {choice_standard_scriptssum}=this.state;
+ get_mirror_script = () => {
+ let {choice_standard_scriptssum} = this.state;
let id = this.props.match.params.shixunId;
let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum;
axios.get(pul).then((response) => {
- if(response.status===200){
+ if (response.status === 200) {
// this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:true,
- shixunmemoMDvalue:response.data.content
+ standard_scriptsModal: false,
+ standard_scriptsModals: true,
+ shixunmemoMDvalue: response.data.content
})
}
@@ -1363,192 +1372,192 @@ export default class TPMsettings extends Component {
}
- SelectTheCommandonChange=(e)=>{
+ SelectTheCommandonChange = (e) => {
this.setState({
- multi_webssh:e.target.checked
+ multi_webssh: e.target.checked
})
}
- bigopen=()=>{
+ bigopen = () => {
this.setState({
- opers:true
+ opers: true
})
}
- bigopens=()=>{
+ bigopens = () => {
this.setState({
- opers:false,
- operss:false,
- opersss:false,
- opensmail:false
+ opers: false,
+ operss: false,
+ opersss: false,
+ opensmail: false
})
}
- bigopensmal=(e)=>{
+ bigopensmal = (e) => {
this.setState({
- opensmail:true
+ opensmail: true
})
}
- sbigopen=(e)=>{
+ sbigopen = (e) => {
this.setState({
- operss:true
+ operss: true
})
}
- sbigopens=()=>{
+ sbigopens = () => {
this.setState({
- operss:false
+ operss: false
})
}
- sbigopenss=(e)=>{
+ sbigopenss = (e) => {
this.setState({
- opersss:true
+ opersss: true
})
}
- sbigopensss=()=>{
+ sbigopensss = () => {
this.setState({
- opersss:false
+ opersss: false
})
}
- testscripttip=(val)=>{
- if(val===0){
+ testscripttip = (val) => {
+ if (val === 0) {
this.setState({
- testscripttiptype:true
+ testscripttiptype: true
})
- }else if(val===1){
+ } else if (val === 1) {
this.setState({
- testscripttiptype:false
+ testscripttiptype: false
})
}
}
- operateshixuns=(value)=>{
+ operateshixuns = (value) => {
this.setState({
- operateshixunstype:true,
- delType:value
+ operateshixunstype: true,
+ delType: value
})
}
- hideoperateshixuns=()=>{
+ hideoperateshixuns = () => {
this.setState({
- operateshixunstype:false
+ operateshixunstype: false
})
}
- onChangeTimePicker =(value, dateString)=> {
+ onChangeTimePicker = (value, dateString) => {
+ this.setState({
+ opening_time: dateString === "" ? "" : moment(handleDateStrings(dateString))
+ })
+ }
+
+ getshixunmemoMDvalue = (value, e) => {
+
this.setState({
- opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
+ shixunmemoMDvalue: value
})
}
- getshixunmemoMDvalue=(value, e)=>{
+ setConfigsInputs = (e, keys, str) => {
+
+ let {shixun_service_configs} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ newshixun_service_configs.map((item, key) => {
+ if (key === keys) {
+ switch (str) {
+ case 1:
+ item.cpu_limit = e.target.value
+ break;
+ case 2:
+ item.lower_cpu_limit = e.target.value
+ break;
+ case 3:
+ item.memory_limit = e.target.value
+ break;
+ case 4:
+ item.request_limit = e.target.value
+ break;
+ }
+ }
+ })
this.setState({
- shixunmemoMDvalue:value
+ shixun_service_configs: newshixun_service_configs,
+ shixun_service_configlist: newshixun_service_configs,
})
+
+ }
+
+ handleChange = (info) => {
+ let {fileList} = this.state;
+
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ console.log("handleChange1");
+
+ // if(fileList.length===0){
+ let fileLists = info.fileList;
+ this.setState({
+ fileList: fileLists,
+ deleteisnot: false
+ });
+ // }
+ }
}
- setConfigsInputs=(e,keys,str)=>{
-
- let {shixun_service_configs}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- newshixun_service_configs.map((item,key)=>{
- if(key===keys){
- switch (str) {
- case 1:
- item.cpu_limit=e.target.value
- break;
- case 2:
- item.lower_cpu_limit=e.target.value
- break;
- case 3:
- item.memory_limit=e.target.value
- break;
- case 4:
- item.request_limit=e.target.value
- break;
- }
- }
- })
-
- this.setState({
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
-
- }
-
- handleChange = (info) => {
- let {fileList}=this.state;
-
- if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
- console.log("handleChange1");
-
- // if(fileList.length===0){
- let fileLists = info.fileList;
- this.setState({ fileList:fileLists,
- deleteisnot:false});
- // }
- }
- }
-
- onAttachmentRemove = (file) => {
- if(!file.percent || file.percent == 100){
- confirm({
- title: '确定要删除这个附件吗?',
- okText: '确定',
- cancelText: '取消',
- // content: 'Some descriptions',
- onOk: () => {
- console.log("665")
- this.deleteAttachment(file)
- },
- onCancel() {
- console.log('Cancel');
- },
- });
- return false;
- }
-
- }
-
- deleteAttachment = (file) => {
- console.log(file);
- let id=file.response ==undefined ? file.id : file.response.id
- const url = `/attachments/${id}.json`
- axios.delete(url, {
- })
- .then((response) => {
- if (response.data) {
- const { status } = response.data;
- if (status == 0) {
- // console.log('--- success')
-
- this.setState((state) => {
-
- const index = state.fileList.indexOf(file);
- const newFileList = state.fileList.slice();
- newFileList.splice(index, 1);
- return {
- fileList: newFileList,
- deleteisnot:true
- };
- });
- }
- }
- })
- .catch(function (error) {
- console.log(error);
- });
- }
-
-
-
- render() {
+ onAttachmentRemove = (file) => {
+ if (!file.percent || file.percent == 100) {
+ confirm({
+ title: '确定要删除这个附件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ console.log("665")
+ this.deleteAttachment(file)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ return false;
+ }
+
+ }
+
+ deleteAttachment = (file) => {
+ console.log(file);
+ let id = file.response == undefined ? file.id : file.response.id
+ const url = `/attachments/${id}.json`
+ axios.delete(url, {})
+ .then((response) => {
+ if (response.data) {
+ const {status} = response.data;
+ if (status == 0) {
+ // console.log('--- success')
+
+ this.setState((state) => {
+
+ const index = state.fileList.indexOf(file);
+ const newFileList = state.fileList.slice();
+ newFileList.splice(index, 1);
+ return {
+ fileList: newFileList,
+ deleteisnot: true
+ };
+ });
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+
+ render() {
let {
postapplyvisible,
postapplytitle,
@@ -1560,7 +1569,7 @@ export default class TPMsettings extends Component {
name,
settingsData,
webssh,
- is_secret_repository,
+ is_secret_repository,
use_scope,
shixunsID,
can_copy,
@@ -1572,10 +1581,10 @@ export default class TPMsettings extends Component {
test_set_permission,
hide_code,
forbid_copy,
- code_edit_permission,
+ code_edit_permission,
code_hidden,
vnc,
- vnc_evaluate,
+ vnc_evaluate,
scopetype,
scope_partment,
departmentslist,
@@ -1591,9 +1600,9 @@ export default class TPMsettings extends Component {
scope_partmenttype,
newuse_scope,
scope_partments,
- shixunmemoMDvalue,delType,
- shixun_service_configs,
- fileList,
+ shixunmemoMDvalue, delType,
+ shixun_service_configs,
+ fileList,
} = this.state;
let options;
@@ -1605,65 +1614,65 @@ export default class TPMsettings extends Component {
)
})
}
- const uploadProps = {
- width: 600,
- fileList,
- multiple: true,
- // https://github.com/ant-design/ant-design/issues/15505
- // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
- action: `${getUploadActionUrl()}`,
- onChange: this.handleChange,
- onRemove: this.onAttachmentRemove,
- beforeUpload: (file, fileList) => {
- if (this.state.fileList.length >= 1) {
- return false
- }
- // console.log('beforeUpload', file.name);
- const isLt150M = file.size / 1024 / 1024 < 50;
- if (!isLt150M) {
- // this.props.showNotification(`文件大小必须小于50MB`);
- notification.open(
- {
- message: '提示',
- description:
- '文件大小必须小于50MB',
-
- }
- )
- }
- if(this.state.file !== undefined){
- console.log("763")
- this.setState({
- file:file
- })
- }else {
- this.setState({
- file:file
- })
- }
-
- console.log("handleChange2");
- return isLt150M;
- },
- }
+ const uploadProps = {
+ width: 600,
+ fileList,
+ multiple: true,
+ // https://github.com/ant-design/ant-design/issues/15505
+ // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
+ // showUploadList: false,
+ action: `${getUploadActionUrl()}`,
+ onChange: this.handleChange,
+ onRemove: this.onAttachmentRemove,
+ beforeUpload: (file, fileList) => {
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
+ // console.log('beforeUpload', file.name);
+ const isLt150M = file.size / 1024 / 1024 < 50;
+ if (!isLt150M) {
+ // this.props.showNotification(`文件大小必须小于50MB`);
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '文件大小必须小于50MB',
+
+ }
+ )
+ }
+ if (this.state.file !== undefined) {
+ console.log("763")
+ this.setState({
+ file: file
+ })
+ } else {
+ this.setState({
+ file: file
+ })
+ }
+
+ console.log("handleChange2");
+ return isLt150M;
+ },
+ }
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
- let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
const operations = ;
return (
-
-
-
- Content of tab 1
-
-
- Content of tab 2
-
-
- Content of tab 3
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
}