- 左侧内容
+
- 右侧内容
+
@@ -44,4 +171,35 @@ function JupyterTPI (props) {
);
}
-export default JupyterTPI;
+const mapStateToProps = (state) => {
+ const {
+ jupyter_info,
+ jupyter_tpi_url,
+ jupyter_data_set,
+ jupyter_tpi_url_state
+ } = state.jupyterReducer;
+ const { loading } = state.commonReducer;
+ return {
+ loading,
+ jupyter_info,
+ url: jupyter_tpi_url,
+ dataSets: jupyter_data_set,
+ jupyter_tpi_url_state
+ };
+}
+
+const mapDispatchToProps = (dispatch) => ({
+ changeGetJupyterUrlState: (status) => dispatch(actions.changeGetJupyterUrlState(status)),
+ getJupyterInfo: (identifier) => dispatch(actions.getJupyterInfo(identifier)),
+ // 重置代码
+ syncJupyterCode: (identifier, msg) => dispatch(actions.syncJupyterCode(identifier, msg)),
+ // getJupyterTpiDataSet: (identifier) => dispatch(actions.getJupyterTpiDataSet(identifier)),
+ getJupyterTpiUrl: (identifier) => dispatch(actions.getJupyterTpiUrl(identifier)),
+ saveJupyterTpi: () => dispatch(actions.saveJupyterTpi()),
+ changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag))
+});
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(JupyterTPI);
diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss
index 7ec98f3b0..a174c5be5 100644
--- a/public/react/src/modules/tpm/jupyter/index.scss
+++ b/public/react/src/modules/tpm/jupyter/index.scss
@@ -55,7 +55,7 @@
height: 60px;
line-height: 60px;
background-color: #070F1A;
-
+ padding-left: 30px;
.jupyter_title{
display: flex;
flex-direction: column;
@@ -90,4 +90,12 @@
position: relative;
height: calc(100vh - 60px);
}
+
+ .update_notice{
+ text-align: center;
+ .update_txt{
+ line-height: 18px;
+ font-size: 14px;
+ }
+ }
}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/jupyter/leftPane/index.js b/public/react/src/modules/tpm/jupyter/leftPane/index.js
new file mode 100644
index 000000000..f8cbbeccd
--- /dev/null
+++ b/public/react/src/modules/tpm/jupyter/leftPane/index.js
@@ -0,0 +1,84 @@
+/*
+ * @Description:
+ * @Author: tangjiang
+ * @Github:
+ * @Date: 2019-12-12 10:34:03
+ * @LastEditors: tangjiang
+ * @LastEditTime: 2019-12-12 20:18:46
+ */
+import './index.scss';
+import React, { useState, useEffect } from 'react';
+import {Icon, Empty} from 'antd';
+import MyIcon from '../../../../common/components/MyIcon';
+
+function LeftPane (props) {
+
+ // 获取数据集
+ const { dataSets = [] } = props;
+
+ const emptyCtx = (
+
+
+
+ );
+
+ // const listCtx = ;
+ const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
+
+ useEffect(() => {
+ if (dataSets.length > 0) {
+ console.log('数据集的个数: ', dataSets.length);
+ const oList = dataSets.map((item, i) => {
+ return (
+
+
+ {item.title}
+
+ );
+ });
+
+ const oUl = (
+
+ );
+
+ setRenderCtx(oUl);
+ }
+ }, [props]);
+ // 渲染数据集
+ // const renderList = () => {
+ // // 空数据
+ // if (dataSets.length === 0) {
+ // return
+ //
+ //
+ // } else {
+ // // 渲染列表
+ // const oList = dataSets.map((item, i) => {
+ // return (
+ //
+ //
+ // {item.title}
+ //
+ // );
+ // });
+ // return (
+ //
+ // );
+ // }
+ // }
+
+ return (
+
+
+ 数据集
+
+ { renderCtx }
+
+ )
+}
+
+export default LeftPane;
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/jupyter/leftPane/index.scss b/public/react/src/modules/tpm/jupyter/leftPane/index.scss
new file mode 100644
index 000000000..dfd9f121d
--- /dev/null
+++ b/public/react/src/modules/tpm/jupyter/leftPane/index.scss
@@ -0,0 +1,55 @@
+.jupyter_data_sets_area{
+ height: 100%;
+ .jupyter_h2_title{
+ height: 50px;
+ line-height: 50px;
+ background-color: #EEEEEE;
+ padding: 0 30px;
+ .jupyter_data_icon{
+ color: #7286ff;
+ font-size: 24px;
+ position: relative;
+ top: 2px;
+ transform: scale(1.5);
+ }
+ }
+
+ .jupyter_data_list,
+ .jupyter_empty{
+ height: calc(100vh - 110px);
+ overflow-y: auto;
+ }
+
+ .jupyter_data_list{
+ .jupyter_item{
+ line-height:45px;
+ border-bottom: 1px solid rgba(238,238,238, 1);
+ padding: 0 30px 0 60px;
+ overflow: hidden;
+ text-overflow:ellipsis;
+ white-space: nowrap;
+ cursor: pointer;
+ transition: .3s;
+ &:hover{
+ background-color: rgba(235, 235, 235, .3);
+ }
+ .jupyter_icon{
+ color: rgb(74, 188, 125);
+ font-size: 16px;
+ transform: scale(1.2);
+ margin-right: 5px;
+ }
+ .jupyter_name{
+ color: #000;
+ font-size: 16px;
+ }
+ }
+ }
+
+ .jupyter_empty{
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ }
+}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/jupyter/rightPane/index.js b/public/react/src/modules/tpm/jupyter/rightPane/index.js
new file mode 100644
index 000000000..1282732f4
--- /dev/null
+++ b/public/react/src/modules/tpm/jupyter/rightPane/index.js
@@ -0,0 +1,90 @@
+/*
+ * @Description:
+ * @Author: tangjiang
+ * @Github:
+ * @Date: 2019-12-12 15:04:20
+ * @LastEditors: tangjiang
+ * @LastEditTime: 2019-12-12 17:41:41
+ */
+import './index.scss';
+import React, { useEffect, useState } from 'react';
+import { Spin, Button } from 'antd';
+function RightPane (props) {
+ const {
+ status,
+ url,
+ onReloadUrl,
+ onSave,
+ loading
+ } = props;
+
+ const [renderCtx, setRenderCtx] = useState(() => loadInit);
+ // 重新获取 url
+ const handleClickReload = () => {
+ onReloadUrl && onReloadUrl();
+ }
+
+ const loadInit = (
+
+
+
+ );
+
+ const loadError = (
+
+ );
+
+ // 保存
+ const handleClickSubmit = () => {
+ console.log('调用了保存接口....');
+ onSave && onSave();
+ }
+
+ useEffect(() => {
+ if (status === -1) {
+ setRenderCtx(() => loadInit);
+ } else if (status === 0 && url) {
+ setRenderCtx(() => (
+
+
+
+ ));
+ } else {
+ setRenderCtx(() => loadError);
+ }
+ }, [status, url, loading]);
+
+ return (
+
+ { renderCtx }
+
+ )
+}
+
+export default RightPane;
+
diff --git a/public/react/src/modules/tpm/jupyter/rightPane/index.scss b/public/react/src/modules/tpm/jupyter/rightPane/index.scss
new file mode 100644
index 000000000..edf305623
--- /dev/null
+++ b/public/react/src/modules/tpm/jupyter/rightPane/index.scss
@@ -0,0 +1,62 @@
+.jupyter_right_pane_area{
+ position: relative;
+ height: calc(100vh - 60px);
+ // background: pink;
+
+ .jupyter_load_url_error,
+ .jupyter_loading_init{
+ display: flex;
+ position: relative;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ &::before{
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ content: '';
+
+ }
+ }
+
+ .jupyter_loading_init{
+ &::before{
+ background-color: rgba(0,0,0,.2);
+ }
+ }
+
+ .jupyter_load_url_error{
+ // &::before{
+ // background-color: rgba(0,0,0,.2);
+ // }
+ .jupyter_error_txt{
+ position: relative;
+ z-index: 1;
+ .jupyter_reload{
+ cursor: pointer;
+ color: #1890ff;
+ }
+ }
+ }
+
+ .jupyter_result{
+ height: 100%;
+ .jupyter_iframe{
+ height: calc(100% - 56px);
+ // background: pink;
+ .jupyter_iframe_style{
+ border: none;
+ outline: none;
+ }
+ }
+ .jupyter_submit{
+ display: flex;
+ align-items: center;
+ height: 56px;
+ justify-content: flex-end;
+ padding-right: 30px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index 8a1be807b..7621a82ca 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -4,7 +4,7 @@ import {TPMIndexHOC} from '../TPMIndexHOC';
import {SnackbarHOC} from 'educoder';
-import {Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon,notification} from 'antd';
+import {Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon, notification} from 'antd';
import axios from 'axios';
@@ -145,7 +145,7 @@ class Newshixuns extends Component {
});
let newlist = ""
e.map((item, key) => {
- if(item.props.name!=""){
+ if (item.props.name != "") {
newlist = newlist + `${item.props.name}`
}
})
@@ -316,7 +316,7 @@ class Newshixuns extends Component {
// 附件相关 START
handleChange = (info) => {
- if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
@@ -334,7 +334,7 @@ class Newshixuns extends Component {
}
onAttachmentRemove = (file) => {
- if(!file.percent || file.percent == 100){
+ if (!file.percent || file.percent == 100) {
Modal.confirm({
title: '确定要删除这个附件吗?',
okText: '确定',
@@ -355,13 +355,12 @@ class Newshixuns extends Component {
deleteAttachment = (file) => {
console.log(file);
- let id=file.response ==undefined ? file.id : file.response.id
+ let id = file.response == undefined ? file.id : file.response.id
const url = `/attachments/${id}.json`
- axios.delete(url, {
- })
+ axios.delete(url, {})
.then((response) => {
if (response.data) {
- const { status } = response.data;
+ const {status} = response.data;
if (status == 0) {
// console.log('--- success')
@@ -372,7 +371,7 @@ class Newshixuns extends Component {
newFileList.splice(index, 1);
return {
fileList: newFileList,
- deleteisnot:true
+ deleteisnot: true
};
});
}
@@ -503,8 +502,8 @@ class Newshixuns extends Component {
>
-
-
+
+
@@ -567,7 +566,7 @@ class Newshixuns extends Component {