|
|
|
@ -190,7 +190,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
evaluate_script:undefined,
|
|
|
|
|
standard_scripts: undefined,
|
|
|
|
|
choice_main_type: "",
|
|
|
|
|
choice_small_type: [""],
|
|
|
|
|
choice_small_type: [],
|
|
|
|
|
choice_standard_scripts:undefined,
|
|
|
|
|
editordescriptios: undefined,
|
|
|
|
|
editorevaluate_scripts: undefined,
|
|
|
|
@ -222,7 +222,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
scope_partmenttype:false,
|
|
|
|
|
newuse_scope:undefined,
|
|
|
|
|
scope_partments:0,
|
|
|
|
|
|
|
|
|
|
shixun_service_configs:undefined,
|
|
|
|
|
pod_exist_time: undefined,
|
|
|
|
|
pod_exist_timetype: false,
|
|
|
|
|
shixunmemoMDvalue:"",
|
|
|
|
@ -325,6 +325,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// if(response.data.status===403){
|
|
|
|
@ -513,6 +514,23 @@ export default class TPMsettings extends Component {
|
|
|
|
|
|
|
|
|
|
bigClass = (value) => {
|
|
|
|
|
|
|
|
|
|
let {settingsData,shixun_service_configs}=this.state;
|
|
|
|
|
let newshixun_service_configs=shixun_service_configs;
|
|
|
|
|
|
|
|
|
|
settingsData.shixun.main_type.some((item,key)=> {
|
|
|
|
|
if (item.id === value) {
|
|
|
|
|
newshixun_service_configs[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) {
|
|
|
|
@ -520,7 +538,8 @@ export default class TPMsettings extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
choice_main_type: value,
|
|
|
|
|
standard_scripts:response.data,
|
|
|
|
|
choice_standard_scripts:null
|
|
|
|
|
choice_standard_scripts:null,
|
|
|
|
|
shixun_service_configs:newshixun_service_configs
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -530,10 +549,78 @@ export default class TPMsettings extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Deselectlittle=(value)=>{
|
|
|
|
|
|
|
|
|
|
let {settingsData,shixun_service_configs,choice_small_type}=this.state;
|
|
|
|
|
let newshixun_service_configs=shixun_service_configs;
|
|
|
|
|
let newchoice_small_type=choice_small_type;
|
|
|
|
|
newchoice_small_type.some((items,keys)=> {
|
|
|
|
|
if (items === value) {
|
|
|
|
|
newchoice_small_type.splice(keys, 1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settingsData.shixun.small_type.some((items,keys)=> {
|
|
|
|
|
if (items.id === value) {
|
|
|
|
|
newshixun_service_configs.splice(keys+1, 1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
choice_small_type: newchoice_small_type,
|
|
|
|
|
shixun_service_configs:newshixun_service_configs
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
littleClass = (value) => {
|
|
|
|
|
|
|
|
|
|
let {settingsData,shixun_service_configs,choice_small_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
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// )
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
settingsData.shixun.small_type.some((items,keys)=> {
|
|
|
|
|
if (items.id === value) {
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
newchoice_small_type.push(value)
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
choice_small_type: value
|
|
|
|
|
choice_small_type: newchoice_small_type,
|
|
|
|
|
shixun_service_configs:newshixun_service_configs
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onPodExistTimeChange = (e) => {
|
|
|
|
@ -596,7 +683,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
let {
|
|
|
|
|
name, description, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum,
|
|
|
|
|
evaluate_script, exec_time, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
|
|
|
|
|
opening_time, pod_exist_time,shixunmemoMDvalue
|
|
|
|
|
opening_time, pod_exist_time,shixunmemoMDvalue,shixun_service_configs
|
|
|
|
|
} = this.state;
|
|
|
|
|
let operateauthority=this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
|
|
|
|
|
|
|
|
|
@ -689,31 +776,35 @@ export default class TPMsettings extends Component {
|
|
|
|
|
if(newmulti_webssh===null){
|
|
|
|
|
newmulti_webssh=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//exec_time: exec_time,
|
|
|
|
|
let Url = `/shixuns/` + id + `.json`;
|
|
|
|
|
let data = {
|
|
|
|
|
name: name,
|
|
|
|
|
description: description_editormd,
|
|
|
|
|
main_type: choice_main_type,
|
|
|
|
|
small_type: choice_small_type,
|
|
|
|
|
webssh: webssh,
|
|
|
|
|
user_scope: use_scope,
|
|
|
|
|
scope_partment: scope_partment,
|
|
|
|
|
can_copy: can_copy,
|
|
|
|
|
vnc: vnc,
|
|
|
|
|
test_set_permission: test_set_permission,
|
|
|
|
|
code_hidden: code_hidden,
|
|
|
|
|
trainee: trainee,
|
|
|
|
|
task_pass: task_pass,
|
|
|
|
|
standard_scripts: choice_standard_scripts,
|
|
|
|
|
hide_code: hide_code,
|
|
|
|
|
forbid_copy: forbid_copy,
|
|
|
|
|
exec_time: exec_time,
|
|
|
|
|
evaluate_script: evaluate_script_editormd,
|
|
|
|
|
multi_webssh:newmulti_webssh,
|
|
|
|
|
opening_time:opening_time,
|
|
|
|
|
mirror_script_id:choice_standard_scriptssum,
|
|
|
|
|
delType:1
|
|
|
|
|
shixun:{
|
|
|
|
|
name: name,
|
|
|
|
|
webssh: webssh,
|
|
|
|
|
user_scope: use_scope,
|
|
|
|
|
can_copy: can_copy,
|
|
|
|
|
vnc: vnc,
|
|
|
|
|
test_set_permission: test_set_permission,
|
|
|
|
|
code_hidden: code_hidden,
|
|
|
|
|
trainee: trainee,
|
|
|
|
|
task_pass: task_pass,
|
|
|
|
|
standard_scripts: choice_standard_scripts,
|
|
|
|
|
hide_code: hide_code,
|
|
|
|
|
forbid_copy: forbid_copy,
|
|
|
|
|
multi_webssh:newmulti_webssh,
|
|
|
|
|
opening_time:opening_time,
|
|
|
|
|
mirror_script_id:choice_standard_scriptssum,
|
|
|
|
|
delType:1
|
|
|
|
|
},
|
|
|
|
|
shixun_info:{
|
|
|
|
|
description: description_editormd,
|
|
|
|
|
evaluate_script: evaluate_script_editormd,
|
|
|
|
|
},
|
|
|
|
|
main_type: choice_main_type,
|
|
|
|
|
small_type: choice_small_type,
|
|
|
|
|
scope_partment: scope_partment,
|
|
|
|
|
shixun_service_configs:shixun_service_configs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
axios.put(Url, data).then((response) => {
|
|
|
|
@ -941,7 +1032,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
opers:true
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bigopens=(e)=>{
|
|
|
|
@ -951,19 +1042,19 @@ export default class TPMsettings extends Component {
|
|
|
|
|
opersss:false,
|
|
|
|
|
opensmail:false
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bigopensmal=(e)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
opensmail:true
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sbigopen=(e)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
operss:true
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sbigopens=()=>{
|
|
|
|
@ -975,7 +1066,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
opersss:true
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sbigopensss=()=>{
|
|
|
|
@ -1020,7 +1111,9 @@ export default class TPMsettings extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inputs=()=>{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let {
|
|
|
|
@ -1075,7 +1168,8 @@ export default class TPMsettings extends Component {
|
|
|
|
|
scope_partmenttype,
|
|
|
|
|
newuse_scope,
|
|
|
|
|
scope_partments,
|
|
|
|
|
shixunmemoMDvalue,delType
|
|
|
|
|
shixunmemoMDvalue,delType,
|
|
|
|
|
shixun_service_configs
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
let options;
|
|
|
|
@ -1259,9 +1353,10 @@ export default class TPMsettings extends Component {
|
|
|
|
|
value={choice_small_type.length===0||choice_small_type[0]===""||choice_small_type===[]?undefined:choice_small_type}
|
|
|
|
|
style={{width: 180}}
|
|
|
|
|
disabled={operateauthority?false:true}
|
|
|
|
|
onChange={operateauthority?this.littleClass:""}
|
|
|
|
|
// onChange={operateauthority?this.littleClass:""}
|
|
|
|
|
onDeselect={operateauthority?this.Deselectlittle:""}
|
|
|
|
|
onMouseEnter={operateauthority?this.bigopensmal:""}
|
|
|
|
|
onSelect={operateauthority?this.bigopens:""}
|
|
|
|
|
onSelect={operateauthority?this.littleClass:""}
|
|
|
|
|
defaultOpen={false}
|
|
|
|
|
open={opensmail}
|
|
|
|
|
>
|
|
|
|
@ -1700,6 +1795,58 @@ export default class TPMsettings extends Component {
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
{/*"name": "我是镜像名", # 镜像名称*/}
|
|
|
|
|
{/*"cpu_limit": 1, # cpu核*/}
|
|
|
|
|
{/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/}
|
|
|
|
|
{/*"memory_limit": 1024 ,#内存限制*/}
|
|
|
|
|
{/*"request_limit": 10, # 内存要求*/}
|
|
|
|
|
{/*"mirror_repository_id": 12, # 镜像id*/}
|
|
|
|
|
<div className="edu-back-white padding40-20 mb20">
|
|
|
|
|
{this.props.identity<2?shixun_service_configs&&shixun_service_configs.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<div key={key}>
|
|
|
|
|
<p className="color-grey-6 font-16 mb30">服务配置</p>
|
|
|
|
|
<div id="5">
|
|
|
|
|
<p className="color-grey-6 font-16 mt30 mb10" id="shixun_scenario_type_name">{item.name}</p>
|
|
|
|
|
<div className="clearfix mb5">
|
|
|
|
|
<label className="panel-form-label fl">CPU(核):</label>
|
|
|
|
|
<div className="pr fl with80 status_con">
|
|
|
|
|
<input type="text" name="cpu_limit[]" value={item.cpu_limit} onInput={this.inputs}
|
|
|
|
|
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="clearfix mb5">
|
|
|
|
|
<label className="panel-form-label fl">最低CPU(核):</label>
|
|
|
|
|
<div className="pr fl with80 status_con">
|
|
|
|
|
<input type="text" name="lower_cpu_limit[]" value={item.lower_cpu_limit} onInput={this.inputs}
|
|
|
|
|
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="clearfix mb5">
|
|
|
|
|
<label className="panel-form-label fl">内存限制(M):</label>
|
|
|
|
|
<div className="pr fl with80 status_con">
|
|
|
|
|
<input type="text" name="memory_limit[]" value={item.memory_limit} onInput={this.inputs}
|
|
|
|
|
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="clearfix mb5">
|
|
|
|
|
<label className="panel-form-label fl">内存要求(M):</label>
|
|
|
|
|
<div className="pr fl with20 status_con">
|
|
|
|
|
<input type="text" name="request_limit[]" value={item.request_limit} onInput={this.inputs}
|
|
|
|
|
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
|
|
|
|
|
</div>
|
|
|
|
|
<label className="panel-form-label fl" style={{width: '48%'}}>温馨提示:纯编程类型实训建议使用默认值,对于大数据等建议使用最大内存的30%</label>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}) :""}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
{
|
|
|
|
@ -1711,49 +1858,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>
|
|
|
|
|
</div> :""
|
|
|
|
|
}
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/*this.props.identity===1&&this.props.status==2?*/}
|
|
|
|
|
{/*<div className="clearfix mt30">*/}
|
|
|
|
|
{/*<a className="defalutSubmitbtn fl mr20"*/}
|
|
|
|
|
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
|
|
|
|
|
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
|
|
|
|
|
{/*/!*<a className="edu-default-btn edu-blueline-btn fl ml20"*!/*/}
|
|
|
|
|
{/*/!*id="challenge_begin"*!/*/}
|
|
|
|
|
{/*/!*onClick={this.operateshixuns}>*!/*/}
|
|
|
|
|
{/*/!*永久关闭*!/*/}
|
|
|
|
|
{/*/!*</a>*!/*/}
|
|
|
|
|
{/*</div> :""*/}
|
|
|
|
|
{/*}*/}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/*this.props.identity===1||this.props.power==true?*/}
|
|
|
|
|
{/*<div className="clearfix mt30">*/}
|
|
|
|
|
{/*<a className="defalutSubmitbtn fl mr20"*/}
|
|
|
|
|
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
|
|
|
|
|
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
|
|
|
|
|
{/*<Popconfirm title={status===0?"删除实训后,用户不能再开始挑战了是否确认删除?":"关闭实训后,用户不能再开始挑战了是否确认关闭?"} onConfirm={this.shixunsclose} okText="确定"*/}
|
|
|
|
|
{/*cancelText="取消"*/}
|
|
|
|
|
{/*style={{display:status===0?"none":"block"}}*/}
|
|
|
|
|
{/*>*/}
|
|
|
|
|
{/*<a*/}
|
|
|
|
|
{/*className="edu-default-btn edu-blueline-btn fl ml20"*/}
|
|
|
|
|
{/*id="challenge_begin"*/}
|
|
|
|
|
{/*style={{display:status===0?"none":"block"}}*/}
|
|
|
|
|
{/*>*/}
|
|
|
|
|
{/*{status===0?"":"永久关闭"}*/}
|
|
|
|
|
{/*</a>*/}
|
|
|
|
|
{/*</Popconfirm>*/}
|
|
|
|
|
{/*</div> :""*/}
|
|
|
|
|
|
|
|
|
|
{/*}*/}
|
|
|
|
|
{/*<div className="clearfix mt30">*/}
|
|
|
|
|
{/*<a className="defalutSubmitbtn fl mr20"*/}
|
|
|
|
|
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
|
|
|
|
|
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|