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

chromesetting
杨树明 5 years ago
commit 87816fab41

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

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

@ -30,7 +30,9 @@ class Challengesjupyter extends Component {
ChallengesDataList: undefined,
operate: true,
startbtns: false,
iFrameHeight: '0px'
iFrameHeight: '0px',
jupyter_port:0,
jupyter_url:null,
}
}
@ -57,23 +59,13 @@ class Challengesjupyter extends Component {
componentDidMount() {
setTimeout(this.ChallengesList(), 1000);
// var iframe =
// document.getElementById('ifr1');
// console.log("iframe||||||||");
// console.log(iframe);
// if(iframe){
// // 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
// }
console.log("componentDidMount");
console.log("Challengesjupyter");
console.log(this.props);
}
@ -129,114 +121,32 @@ class Challengesjupyter extends Component {
};
modifyjupyter=()=>{
// var ifr =window.parent.frames["frame"].document;
// console.log(ifr);
// var data = JSON.stringify({
//
// '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"];
// // var title =${'ifr1'}
// console.log("iframe");
// console.log(iframe);
// var frames = window.frames; // 或 // var frames = window.parent.frames;
// for (var i = 0; i < frames.length; i++) {
// // 在这对frames的一个frame做点什么
// // frames[i].document.body.style.background = "red";
// console.log(frames[i]);
//
// }
// 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";
modifyjupyter=(propsysl)=>{
console.log("propsysl");
console.log(propsysl);
let id=this.props.match.params.shixunId;
const url=`/shixuns/${id}/update_jupyter.json`;
const data={
identifier:id,
jupyter_port:propsysl.shixunsDetails.jupyter_port
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`应用成功`);
}
}).catch((error) => {
})
}
sendToken=()=>{
// console.log("sendToken");
// const iframe = document.getElementById('iframe');
// console.log("modifyjupyter");
// const frameWindow = iframe.contentWindow;
// console.log("frameWindow");
// console.log(frameWindow);
}
render() {
@ -316,7 +226,7 @@ class Challengesjupyter extends Component {
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdivtest ml24"></p></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>
<style>
{
@ -343,10 +253,20 @@ class Challengesjupyter extends Component {
{/*https://48888.jupyter.educoder.net/tree?*/}
<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>
:""
)
}
</div>
</div>
</div>

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

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

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

@ -179,7 +179,19 @@ class SearchPage extends Component{
<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">
{data === undefined ? "" : data.map((item, key) => {
return (
@ -195,14 +207,19 @@ class SearchPage extends Component{
<div className={"font-16 color-dark fl "} style={{width:"100%"}} >
{/*标题*/}
<div className="sortinxdirection jupytertextheig" style={{width:"100%"}}>
<span className={"markdown-body fonttext maxnamewidth92"}
dangerouslySetInnerHTML={{__html:item.title}}/>
{
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>
{/*描述*/}
@ -368,7 +385,7 @@ class SearchPage extends Component{
{
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}
onChange={this.paginationonChanges} pageSize={perpages}
total={count}></Pagination>

Loading…
Cancel
Save