Merge remote-tracking branch 'origin/jupyter' into jupyter

chromesetting
杨树明 5 years ago
commit 87816fab41

@ -541,12 +541,16 @@ class NewShixunModel extends Component{
></Checkbox> ></Checkbox>
{ {
this.props.type==='shixuns'? this.props.type==='shixuns'?
(
item.is_jupyter===true?
<div className="myysljupyter fl ml15 mt3 intermediatecenter"> <div className="myysljupyter fl ml15 mt3 intermediatecenter">
<p className="myysljupytertest"> <p className="myysljupytertest">
Jupyter Jupyter
</p> </p>
</div> </div>
:"" :""
)
:""
} }

@ -119,16 +119,19 @@ class TPMDataset extends Component {
let id=this.props.match.params.shixunId; let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`; let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
axios.get(collaborators).then((response)=> { axios.get(collaborators,{params:{
page:1,
limit:10,
}}).then((response)=> {
if(response.status===200){ if(response.status===200){
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{ }else{
let datalists=[];
for(let i=0;i<response.data.data_sets.length;i++){ for(let i=0;i<response.data.data_sets.length;i++){
const datas=response.data.data_sets; const datas=response.data.data_sets;
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm'); var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
this.state.datalist.push({ datalists.push({
timedata:timedata, timedata:timedata,
author:datas[i].author, author:datas[i].author,
filesize:datas[i].filesize, filesize:datas[i].filesize,
@ -139,7 +142,7 @@ class TPMDataset extends Component {
this.setState({ this.setState({
collaboratorList: response.data, collaboratorList: response.data,
data_sets_count:response.data.data_sets_count, data_sets_count:response.data.data_sets_count,
datalist:this.state.datalist, datalist:datalists,
}); });
} }
@ -246,6 +249,7 @@ class TPMDataset extends Component {
fileList: fileLists, fileList: fileLists,
deleteisnot: false deleteisnot: false
}); });
this.getdatas();
// } // }
} }
} }
@ -275,7 +279,7 @@ class TPMDataset extends Component {
debugger debugger
console.log("删除"); console.log("删除");
console.log(this.state.selectedRowKeysdata); console.log(this.state.selectedRowKeysdata);
const url = `/attachements/destroy_files.json`; const url = `/attachments/destroy_files.json`;
axios.delete(url, { axios.delete(url, {
id:this.state.selectedRowKeysdata, id:this.state.selectedRowKeysdata,
}) })
@ -400,7 +404,10 @@ class TPMDataset extends Component {
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}> <div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>
<div className="sortinxdirection"> <div className="sortinxdirection">
<div className="tpmwidth"><Checkbox onChange={this.mysonChange}>全选</Checkbox></div> <div className="tpmwidth">
{ data_sets_count>0?
<Checkbox onChange={this.mysonChange}>全选</Checkbox>:""}
</div>
<div className="tpmwidth xaxisreverseorder"> <div className="tpmwidth xaxisreverseorder">
<style> <style>
{ {
@ -477,9 +484,7 @@ class TPMDataset extends Component {
` `
} }
</style> </style>
:"" :
}
<div className="edu-table edu-back-white ysltableowss"> <div className="edu-table edu-back-white ysltableowss">
<Table <Table
dataSource={datalist} dataSource={datalist}
@ -490,6 +495,8 @@ class TPMDataset extends Component {
rowClassName={this.rowClassName} rowClassName={this.rowClassName}
/> />
</div> </div>
}
{ {
data_sets_count>=11? data_sets_count>=11?
<div className="edu-txt-center mt40 mb20"> <div className="edu-txt-center mt40 mb20">

@ -30,7 +30,9 @@ class Challengesjupyter extends Component {
ChallengesDataList: undefined, ChallengesDataList: undefined,
operate: true, operate: true,
startbtns: false, startbtns: false,
iFrameHeight: '0px' iFrameHeight: '0px',
jupyter_port:0,
jupyter_url:null,
} }
} }
@ -57,23 +59,13 @@ class Challengesjupyter extends Component {
componentDidMount() { componentDidMount() {
setTimeout(this.ChallengesList(), 1000); setTimeout(this.ChallengesList(), 1000);
// var iframe =
// document.getElementById('ifr1');
// console.log("iframe||||||||"); console.log("componentDidMount");
// console.log(iframe); console.log("Challengesjupyter");
// if(iframe){ console.log(this.props);
// // var headertest=test.contentWindow.document.getElementById('header');
// // console.log(headertest);
// var iwindow = iframe.contentWindow;
// var idoc = iwindow.document;
// console.log("window",iwindow);//获取iframe的window对象
// console.log("windowwindow",iwindow.document.getElementById('header'));//获取iwindow.document对象
// console.log("document",idoc); //获取iframe的document
// console.log("documentdocument",idoc.getElementById('header'));
// console.log("html",idoc.documentElement);//获取iframe的html
// console.log("head",idoc.head); //获取head
// console.log("body",idoc.body); //获取body
// }
} }
@ -129,114 +121,32 @@ class Challengesjupyter extends Component {
}; };
modifyjupyter=()=>{ modifyjupyter=(propsysl)=>{
// var ifr =window.parent.frames["frame"].document; console.log("propsysl");
// console.log(ifr); console.log(propsysl);
// var data = JSON.stringify({ let id=this.props.match.params.shixunId;
//
// 'location': window.location
//
// // etc
//
// });
// let parentDomain = window.location.hostname;
// console.log("domain",parentDomain); //localhost
// document.domain = data;
// document.domain = 'https://47519.test-jupyter.educoder.net';
// window.parent.document.contents().find("#ifr1")[0].contentWindow.iframefunction();
const iframe = document.getElementById('iframe');
console.log("modifyjupyter");
// const frameWindow = iframe.contentWindow;
const frameWindow = iframe.contentWindow.postMessage('setLocation,' + null + "," + null, '*');
console.log(frameWindow);
const frameDocument = frameWindow.document;
console.log(frameDocument);
// window.addEventListener('load', () => {
// console.log('12313页面加载好了');
// const iframe = document.getElementById('ifr1');
// if (iframe && iframe.contentWindow && this.props.iframe_src) {
// console.log('32131231yes mounted');
// console.log(iframe.contentWindow);
// } else {
// console.log('3242242not mounted')
// }
// });
// var editor;
// editor = document.getElementById("ifr1").contentWindow;
// console.log(editor);
// window.onload = () => {
// var testwindow =
// document.getElementById('ifr1').contentWindow;
//
// }
// var iframe=window.frames["ifr1"]; const url=`/shixuns/${id}/update_jupyter.json`;
// // var title =${'ifr1'} const data={
// console.log("iframe"); identifier:id,
// console.log(iframe); jupyter_port:propsysl.shixunsDetails.jupyter_port
// var frames = window.frames; // 或 // var frames = window.parent.frames; }
// for (var i = 0; i < frames.length; i++) { axios.post(url, data)
// // 在这对frames的一个frame做点什么 .then((result) => {
// // frames[i].document.body.style.background = "red"; if (result.data.status == 0) {
// console.log(frames[i]); this.props.showNotification(`应用成功`);
// }
// } }).catch((error) => {
// var idoc = iframe.document; })
// console.log(idoc); }
// var iwindow = title.contentWindow;
// console.log("iwindow");
// console.log(iwindow);
// var idoc = iwindow.document;
// console.log(idoc);
// window.addEventListener('message', receiveMessageFromParent, false);
//
// let messageButton = document.getElementById('message_button');
// /* console.log('msg button', messageButton); annoataion cannot use \/\/ */
// messageButton.addEventListener('click', function (e) {
// console.log('iframe send msg');
// console.log('parent', window.parent);
// console.log('top container', window.top);
// window.parent.postMessage('This is child', '*');
// }, false);
// var iframe = $('#ifr1');
// console.log(iframe.context.find('#save-notbook'));
// console.log("iframe");
// console.log(iframe)
// title.window.say(); //myFrame.say();也可
//
// title.window.document.getElementById("button").value="保存并检查";
//find button inside iframe
// let button = iframe.contents().find('#save-notbook');
// //trigger button click
// button.trigger("click");
// console.log("iframe||||||||");
// if(iframe){
// var iwindow = iframe.contentWindow;
// var idoc = iwindow.document;
// console.log("window",iwindow);//获取iframe的window对象
// console.log("document",idoc); //获取iframe的document
// console.log("html",idoc.documentElement);//获取iframe的html
// console.log("head",idoc.head); //获取head
// console.log("body",idoc.body); //获取body
// }
// var test =
// document.getElementById('ifr1').contentWindow.document.getElementById('header');
// test.style.background = "#333";
sendToken=()=>{
// console.log("sendToken");
// const iframe = document.getElementById('iframe');
// console.log("modifyjupyter");
// const frameWindow = iframe.contentWindow;
// console.log("frameWindow");
// console.log(frameWindow);
} }
render() { render() {
@ -316,7 +226,7 @@ class Challengesjupyter extends Component {
<div className="renwuxiangssi sortinxdirection"> <div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdivtest ml24"></p></div> <div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdivtest ml24"></p></div>
</div> </div>
<div className="renwuxiangssit xaxisreverseorder"><div className="challenbaocun" onClick={()=>this.modifyjupyter()}><p className="challenbaocuntest">保存</p></div></div> <div className="renwuxiangssit xaxisreverseorder"><div className="challenbaocun" onClick={()=>this.modifyjupyter(this.props)}><p className="challenbaocuntest">应用到实训</p></div></div>
</div> </div>
<style> <style>
{ {
@ -343,10 +253,20 @@ class Challengesjupyter extends Component {
{/*https://48888.jupyter.educoder.net/tree?*/} {/*https://48888.jupyter.educoder.net/tree?*/}
<div className="pb47"> <div className="pb47">
<iframe src="https://47524.jupyter.educoder.net/notebooks/data/workspace/myshixun_tpm3575/01.ipynb" sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" name="framename" width="100%" height="700" frameborder="0" {
this.props.shixunsDetails===null || this.props.shixunsDetails===undefined||JSON.stringify(this.props.shixunsDetails)==="{}"?
""
:
(
this.props&&this.props.shixunsDetails&&this.props.shixunsDetails.jupyter_url?
<iframe src={this.props.shixunsDetails.jupyter_url}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe> ></iframe>
:""
)
}
</div> </div>
</div> </div>
</div> </div>

@ -680,17 +680,17 @@ class Collaborators extends Component {
<div <div
className={collaboratorList.length>10&&collaboratorListsumtype===true?"":"none"} className={collaboratorList.length>10&&collaboratorListsumtype===true?"":"none"}
style={{textAlign:'center',borderTop:'1px solid #eee'}}> style={{textAlign:'center',borderTop:'1px solid #eee'}}>
{/*<a className="loadMore" onClick={this.loadMore}>加载更多</a>*/} <a className="loadMore" onClick={this.loadMore}>加载更多</a>
{ {/*{*/}
mylistansum>5? {/* mylistansum>5?*/}
<div className="edu-txt-center mt40 mb40"> {/* <div className="edu-txt-center mt40 mb40">*/}
<Pagination showQuickJumper current={page} {/* <Pagination showQuickJumper current={page}*/}
onChange={this.paginationonChanges} pageSize={limit} {/* onChange={this.paginationonChanges} pageSize={limit}*/}
total={mylistansum} {/* total={mylistansum}*/}
></Pagination> {/* ></Pagination>*/}
</div> {/* </div>*/}
:"" {/* :""*/}
} {/*}*/}
</div> </div>

@ -27,13 +27,13 @@
line-height: 25px; line-height: 25px;
} }
.challenbaocun{ .challenbaocun{
width:80px; width:103px;
height:30px; height:30px;
background:#29BD8B; background:#29BD8B;
border-radius:3px; border-radius:3px;
} }
.challenbaocuntest{ .challenbaocuntest{
width:80px; width:103px;
height:30px; height:30px;
font-size:16px; font-size:16px;
color:#FFFFFF; color:#FFFFFF;

@ -132,10 +132,14 @@ class ShixunCard extends Component {
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/} {/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div> </div>
} }
{
item.is_jupyter===true?
<div className="tag-org"> <div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p> <p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/} {/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div> </div>
:""}
<div className={item.power === false ? "closeSquare" : "none"}> <div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} <img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/> className="mt80 mb25"/>

@ -179,7 +179,19 @@ class SearchPage extends Component{
<div className="mainx"> <div className="mainx">
<style>
{
`
.maxnamewidth92{
max-width: 92%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
`
}
</style>
<div className="educontent project-packages-list mb30"> <div className="educontent project-packages-list mb30">
{data === undefined ? "" : data.map((item, key) => { {data === undefined ? "" : data.map((item, key) => {
return ( return (
@ -195,14 +207,19 @@ class SearchPage extends Component{
<div className={"font-16 color-dark fl "} style={{width:"100%"}} > <div className={"font-16 color-dark fl "} style={{width:"100%"}} >
{/*标题*/} {/*标题*/}
<div className="sortinxdirection jupytertextheig" style={{width:"100%"}}> <div className="sortinxdirection jupytertextheig" style={{width:"100%"}}>
<span className={"markdown-body fonttext maxnamewidth92"}
dangerouslySetInnerHTML={{__html:item.title}}/>
{ {
type==="shixun"? type==="shixun"?
<div className="jupytertext intermediatecenter "><p className="jupytertextp">Jupyter</p></div> (
item.is_jupyter===true?
<div className="jupytertext intermediatecenter ml15"><p className="jupytertextp">Jupyter</p></div>
:""
)
:"" :""
} }
<span className={"markdown-body fonttext ml9"}
dangerouslySetInnerHTML={{__html:item.title}}/>
</div> </div>
{/*描述*/} {/*描述*/}
@ -368,7 +385,7 @@ class SearchPage extends Component{
{ {
count && count && count> perpages ? count && count && count> perpages ?
<div className="edu-txt-center" style={{paddingBottom:"30px"}}> <div className="edu-txt-center" style={{marginBottom:"30px",paddingBottom:"30px"}}>
<Pagination showQuickJumper current={page} <Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={perpages} onChange={this.paginationonChanges} pageSize={perpages}
total={count}></Pagination> total={count}></Pagination>

Loading…
Cancel
Save