|
|
|
@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
|
|
|
|
import MonacoEditor from 'react-monaco-editor';
|
|
|
|
|
|
|
|
|
|
//MonacoDiffEditor 对比模式
|
|
|
|
|
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb} from 'antd';
|
|
|
|
|
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification} from 'antd';
|
|
|
|
|
|
|
|
|
|
// import "antd/dist/antd.css";
|
|
|
|
|
|
|
|
|
@ -207,6 +207,7 @@ export default class TPMsettings extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props)
|
|
|
|
|
this.state = {
|
|
|
|
|
fileList: [],
|
|
|
|
|
commandLine: 0,
|
|
|
|
|
Openpublic: 0,
|
|
|
|
|
settingsData: undefined,
|
|
|
|
@ -268,7 +269,8 @@ export default class TPMsettings extends Component {
|
|
|
|
|
pod_exist_time: undefined,
|
|
|
|
|
pod_exist_timetype: false,
|
|
|
|
|
shixunmemoMDvalue:"",
|
|
|
|
|
language:""
|
|
|
|
|
language:"",
|
|
|
|
|
deleteisnot:true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
descriptionMD=(initValue, id)=> {
|
|
|
|
@ -1011,32 +1013,160 @@ 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 {sendsure_applyvalue} = this.state;
|
|
|
|
|
let url = "/shixuns/apply_shixun_mirror.json";
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
note: sendsure_applyvalue
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
if (response.data.status == 1) {
|
|
|
|
|
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({
|
|
|
|
|
postapplyvisible: false,
|
|
|
|
|
postapplytitle: true
|
|
|
|
|
languagewritetype:true
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(systemenvironment === undefined || systemenvironment === ""){
|
|
|
|
|
// this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
|
|
|
|
|
this.setState({
|
|
|
|
|
systemenvironmenttype:true
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
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,
|
|
|
|
|
languagewrite:"",
|
|
|
|
|
systemenvironment:"",
|
|
|
|
|
testcoderunmode:"",
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
this.setState({
|
|
|
|
|
file:undefined,
|
|
|
|
|
languagewrite:"",
|
|
|
|
|
systemenvironment:"",
|
|
|
|
|
testcoderunmode:"",
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// this.props.showNotification('提交成功!');
|
|
|
|
|
notification.open(
|
|
|
|
|
{
|
|
|
|
|
message: '提示',
|
|
|
|
|
description:
|
|
|
|
|
'提交成功!',
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
this.sendhideModaly()
|
|
|
|
|
// this.props.history.push(`/courses/${cid}/graduation_topics`);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendhideModaly = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
postapplyvisible: false
|
|
|
|
|
postapplyvisible: false,
|
|
|
|
|
})
|
|
|
|
|
if(this.state.file !== undefined){
|
|
|
|
|
console.log("580");
|
|
|
|
|
// this.deleteAttachment(this.state.file);
|
|
|
|
|
this.setState({
|
|
|
|
|
file:undefined,
|
|
|
|
|
languagewrite:"",
|
|
|
|
|
systemenvironment:"",
|
|
|
|
|
testcoderunmode:"",
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
this.setState({
|
|
|
|
|
file:undefined,
|
|
|
|
|
languagewrite:"",
|
|
|
|
|
systemenvironment:"",
|
|
|
|
|
testcoderunmode:"",
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yeshidemodel = () => {
|
|
|
|
|
this.setState({
|
|
|
|
@ -1198,29 +1328,76 @@ export default class TPMsettings extends Component {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
handleChange = (info) => {
|
|
|
|
|
console.log("handleChange1");
|
|
|
|
|
let fileList = info.fileList;
|
|
|
|
|
this.setState({ fileList:fileList,
|
|
|
|
|
deleteisnot:false});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
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,
|
|
|
|
|
sendsure_applyvalue,
|
|
|
|
|
postapplytitle,
|
|
|
|
|
shixunnametype,
|
|
|
|
|
shixunmaintype,
|
|
|
|
|
evaluate_scripttype,
|
|
|
|
|
exec_timetype,
|
|
|
|
|
traineetype,
|
|
|
|
|
standard_scripts,
|
|
|
|
|
description,
|
|
|
|
|
evaluate_script,
|
|
|
|
|
name,
|
|
|
|
|
settingsData,
|
|
|
|
|
webssh,
|
|
|
|
|
use_scope,
|
|
|
|
|
shixunsstatus,
|
|
|
|
|
shixunsID,
|
|
|
|
|
exec_time,
|
|
|
|
|
pod_exist_time,
|
|
|
|
|
pod_exist_timetype,
|
|
|
|
|
can_copy,
|
|
|
|
|
choice_standard_scripts,
|
|
|
|
|
Executiveordervalue,
|
|
|
|
@ -1241,19 +1418,15 @@ export default class TPMsettings extends Component {
|
|
|
|
|
standard_scriptsModal,
|
|
|
|
|
standard_scriptsModals,
|
|
|
|
|
SelectTheCommandtype,
|
|
|
|
|
status,
|
|
|
|
|
opers,
|
|
|
|
|
operss,
|
|
|
|
|
opersss,
|
|
|
|
|
testscripttiptype,
|
|
|
|
|
operateshixunstype,
|
|
|
|
|
opening_time,
|
|
|
|
|
opensmail,
|
|
|
|
|
scope_partmenttype,
|
|
|
|
|
newuse_scope,
|
|
|
|
|
scope_partments,
|
|
|
|
|
shixunmemoMDvalue,delType,
|
|
|
|
|
shixun_service_configs
|
|
|
|
|
shixun_service_configs,
|
|
|
|
|
fileList,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
let options;
|
|
|
|
@ -1265,7 +1438,46 @@ 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: `${getUrl()}/api/attachments.json`,
|
|
|
|
|
onChange: this.handleChange,
|
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
|
// console.log('beforeUpload', file.name);
|
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 50;
|
|
|
|
|
if (!isLt150M) {
|
|
|
|
|
// this.props.showNotification(`文件大小必须小于50MB`);
|
|
|
|
|
notification.open(
|
|
|
|
|
{
|
|
|
|
|
message: '提示',
|
|
|
|
|
description:
|
|
|
|
|
'文件大小必须小于50MB',
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
if(thiss.state.file !== undefined){
|
|
|
|
|
console.log("763")
|
|
|
|
|
// thiss.deleteAttachment(thiss.state.file);
|
|
|
|
|
thiss.setState({
|
|
|
|
|
file:file
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
thiss.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;
|
|
|
|
|
|
|
|
|
@ -1391,13 +1603,13 @@ export default class TPMsettings extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Select>
|
|
|
|
|
{/*<p*/}
|
|
|
|
|
{/*className="edu-txt-left font-12"*/}
|
|
|
|
|
{/*style={{display:operateauthority?"block":'none'}}*/}
|
|
|
|
|
{/*>*/}
|
|
|
|
|
{/*列表中没有?*/}
|
|
|
|
|
{/*<a className="color-blue" onClick={this.post_apply}>申请新建</a>*/}
|
|
|
|
|
{/*</p>*/}
|
|
|
|
|
<p
|
|
|
|
|
className="edu-txt-left font-12"
|
|
|
|
|
style={{display:operateauthority?"block":'none'}}
|
|
|
|
|
>
|
|
|
|
|
列表中没有?
|
|
|
|
|
<a className="color-blue" onClick={this.post_apply}>申请新建</a>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
keyboard={false}
|
|
|
|
@ -1405,26 +1617,86 @@ export default class TPMsettings extends Component {
|
|
|
|
|
visible={postapplyvisible}
|
|
|
|
|
closable={false}
|
|
|
|
|
footer={null}
|
|
|
|
|
width={850}
|
|
|
|
|
heigth={720}
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<li className="clearfix mb15">
|
|
|
|
|
<label className="panel-form-label fl"><span
|
|
|
|
|
className="color-red fl mt3">*</span>详细描述: </label>
|
|
|
|
|
<li className="clearfix ml82" >
|
|
|
|
|
<label className="fl mt10 "><span
|
|
|
|
|
className="color-red fl mt3">*</span>语言: </label>
|
|
|
|
|
<textarea className="fl task-form-80 task-height-150"
|
|
|
|
|
style={{width:'100%'}}
|
|
|
|
|
onInput={this.sendsure_applyvalues}
|
|
|
|
|
value={sendsure_applyvalue}
|
|
|
|
|
placeholder="请输入新增镜像需要安装的软件及版本等信息" id="demand_info"></textarea>
|
|
|
|
|
style={{width:'89%',height:'100px'}}
|
|
|
|
|
onInput={this.setlanguagewrite}
|
|
|
|
|
value={this.state.languagewrite}
|
|
|
|
|
placeholder="请填写该镜像是基于什么语言:示例:Python"
|
|
|
|
|
id="demand_info"></textarea>
|
|
|
|
|
</li>
|
|
|
|
|
<a onClick={() => this.sendsure_apply()}
|
|
|
|
|
className="task-btn task-btn-orange fr mr12">确定</a>
|
|
|
|
|
<a className="pop_close task-btn fr mr10"
|
|
|
|
|
<div className={"color-red shixunspanred"}>{this.state.languagewritetype===true?"请填写该镜像语言":""}</div>
|
|
|
|
|
<li className="clearfix ml1">
|
|
|
|
|
<label className="panel-form-label fl ml50"><span
|
|
|
|
|
className="color-red fl mt3">*</span>系统环境: </label>
|
|
|
|
|
<textarea className="fl task-form-80 task-height-150 "
|
|
|
|
|
onInput={this.setsystemenvironment}
|
|
|
|
|
style={{height:'100px'}}
|
|
|
|
|
value={this.state.systemenvironment}
|
|
|
|
|
placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境"
|
|
|
|
|
id="demand_info"></textarea>
|
|
|
|
|
</li>
|
|
|
|
|
<div className={"color-red shixunspanred"}>{this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}</div>
|
|
|
|
|
<li className="clearfix">
|
|
|
|
|
<label className="fl mt10" ><span
|
|
|
|
|
className="color-red fl mt3">*</span>测试代码运行方式: </label>
|
|
|
|
|
|
|
|
|
|
<textarea className="fl task-form-80 task-height-150 "
|
|
|
|
|
onInput={this.settestcoderunmode}
|
|
|
|
|
value={this.state.testcoderunmode}
|
|
|
|
|
style={{height:'100px'}}
|
|
|
|
|
placeholder="请填写该镜像中测试代码运行方式"
|
|
|
|
|
id="demand_info"></textarea>
|
|
|
|
|
</li>
|
|
|
|
|
<div className={"color-red shixunspanred"}>{this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}</div>
|
|
|
|
|
<li className="clearfix ml50">
|
|
|
|
|
<label className="panel-form-label fl mt-5"><span
|
|
|
|
|
className="color-red fl">*</span>测试代码: </label>
|
|
|
|
|
<div className="mt10" style={{
|
|
|
|
|
display: "inline-block"
|
|
|
|
|
}}>
|
|
|
|
|
{
|
|
|
|
|
this.state.deleteisnot=== true?
|
|
|
|
|
<Upload {...uploadProps} >
|
|
|
|
|
<Icon type="upload" className="fl mt3" > </Icon>
|
|
|
|
|
<span className="color-blue fl cdefault">上传附件</span>
|
|
|
|
|
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
|
|
|
|
|
|
|
|
|
|
</Upload>
|
|
|
|
|
:
|
|
|
|
|
<Upload {...uploadProps} disabled={true} >
|
|
|
|
|
<Icon type="upload" className="fl mt3" > </Icon>
|
|
|
|
|
<span className="color-grey-c fl">上传附件</span>
|
|
|
|
|
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
|
|
|
|
|
|
|
|
|
|
</Upload>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<div className={"color-red shixunspanred"}>
|
|
|
|
|
{this.state.attachmentidstype===true?"请上传附件":""}
|
|
|
|
|
</div>
|
|
|
|
|
<li className="edu-txt-center clearfix ">
|
|
|
|
|
<a className="pop_close task-btn mr30"
|
|
|
|
|
onClick={() => this.sendhideModaly()}
|
|
|
|
|
>取消</a>
|
|
|
|
|
<Button type="primary" onClick={()=>this.sendsure_apply()}
|
|
|
|
|
className="task-btn task-btn-orange">确定</Button>
|
|
|
|
|
</li>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
keyboard={false}
|
|
|
|
|
title="提示"
|
|
|
|
|