@@ -31,8 +36,10 @@ function LeftPane (props) {
const oList = dataSets.map((item, i) => {
return (
-
- {item.title}
+
+
+ {item.title}
+
);
});
@@ -46,37 +53,30 @@ function LeftPane (props) {
setRenderCtx(oUl);
}
}, [props]);
- // 渲染数据集
- // const renderList = () => {
- // // 空数据
- // if (dataSets.length === 0) {
- // return
- //
- //
- // } else {
- // // 渲染列表
- // const oList = dataSets.map((item, i) => {
- // return (
- //
- //
- // {item.title}
- //
- // );
- // });
- // return (
- //
- // );
- // }
- // }
-
+
+ // 分页处理
+ const handleChangePage = (page) => {
+ // console.log(page, pageSize);
+ // setCurrent(page);
+ onPageChange && onPageChange(page);
+ }
return (
数据集
+ {/* 数据集 */}
{ renderCtx }
+
+
)
}
diff --git a/public/react/src/modules/tpm/jupyter/leftPane/index.scss b/public/react/src/modules/tpm/jupyter/leftPane/index.scss
index c53b46362..9c95b1aae 100644
--- a/public/react/src/modules/tpm/jupyter/leftPane/index.scss
+++ b/public/react/src/modules/tpm/jupyter/leftPane/index.scss
@@ -1,10 +1,16 @@
.jupyter_data_sets_area{
height: 100%;
+ background: #fff;
.jupyter_h2_title{
height: 44px;
line-height: 44px;
- background-color: #EEEEEE;
+ // background-color: #EEEEEE;
+ background: #fff;
padding: 0 30px;
+ font-size: 16px;
+ // box-size: border-box;
+ box-sizing: border-box;
+ border-bottom: 1px solid rgba(238,238,238,1);
.jupyter_data_icon{
// color: #7286ff;
color: #1890ff;
@@ -18,7 +24,7 @@
.jupyter_data_list,
.jupyter_empty{
- height: calc(100vh - 104px);
+ height: calc(100vh - 160px);
overflow-y: auto;
}
@@ -54,4 +60,13 @@
justify-content: center;
width: 100%;
}
+
+ .jupyter_pagination{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 56px;
+ box-sizing: border-box;
+ border-top: 1px solid rgba(238,238,238,1);
+ }
}
\ No newline at end of file
diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js
index 8831e8de1..55aa42799 100644
--- a/public/react/src/redux/actions/actionTypes.js
+++ b/public/react/src/redux/actions/actionTypes.js
@@ -57,6 +57,7 @@ const types = {
SAVE_JUPYTER_INFO: 'SAVE_JUPYTER_INFO', // 保存 jupyter 信息
CHANGE_JUPYTER_URL_STATE: 'CHANGE_JUPYTER_URL_STATE', // 获取url返回的状态值
SAVE_JUPYTER_TPI: 'SAVE_JUPYTER_TPI', // 保存 jupyter tpi
+ CHANGE_JUPYTER_CURRENT_PAGE: 'CHANGE_JUPYTER_CURRENT_PAGE'
}
export default types;
diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js
index b9cf858dd..465ab1385 100644
--- a/public/react/src/redux/actions/index.js
+++ b/public/react/src/redux/actions/index.js
@@ -68,7 +68,8 @@ import {
getJupyterInfo,
syncJupyterCode,
changeGetJupyterUrlState,
- saveJupyterTpi
+ saveJupyterTpi,
+ changeCurrentPage
} from './jupyter';
export default {
@@ -119,6 +120,7 @@ export default {
getJupyterInfo,
syncJupyterCode,
changeGetJupyterUrlState,
- saveJupyterTpi
+ saveJupyterTpi,
+ changeCurrentPage
// isUpdateCodeCtx
}
\ No newline at end of file
diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js
index 65c0e14ab..5df1babf6 100644
--- a/public/react/src/redux/actions/jupyter.js
+++ b/public/react/src/redux/actions/jupyter.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-12 09:01:30
* @LastEditors: tangjiang
- * @LastEditTime: 2019-12-12 17:58:38
+ * @LastEditTime: 2019-12-13 15:27:13
*/
import types from "./actionTypes";
import { message } from 'antd';
@@ -18,20 +18,22 @@ import {
// 获取 jupyter 相关信息
export const getJupyterInfo = (id) => {
- return (dispatch) => {
+ return (dispatch, getState) => {
+ const { jupyter_pagination } = getState().jupyterReducer;
+ console.log(jupyter_pagination);
fetchJupyterInfo(id).then(res => {
if (res.data.status === 401) return;
if (res.status === 200) {
const { data } = res;
- console.log(data);
if (data.status === 0) {
dispatch({
type: types.SAVE_JUPYTER_INFO,
payload: data
});
const { identifier, myshixun_identifier } = data;
+ dispatch(saveJupyterIdentifier(identifier));
// 调用获取数据集接口
- dispatch(getJupyterTpiDataSet(identifier));
+ dispatch(getJupyterTpiDataSet(identifier, jupyter_pagination));
// 调用获取url接口
dispatch(getJupyterTpiUrl({identifier: myshixun_identifier}));
}
@@ -40,16 +42,21 @@ export const getJupyterInfo = (id) => {
}
}
// 获取 jupyter tpi 数据集
-export const getJupyterTpiDataSet = (identifier) => {
- return (dispatch) => {
- fetchJupyterTpiDataSet(identifier).then(res => {
+export const getJupyterTpiDataSet = (identifier, params) => {
+ return (dispatch, getState) => {
+ if (!params) {
+ params = getState().jupyterReducer.jupyter_pagination;
+ }
+ fetchJupyterTpiDataSet(identifier, params).then(res => {
if (res.data.status === 401) return; // 用户未登录
- console.log('数据集:', res);
if (res.status === 200) {
- const {data_sets} = res.data;
+ const {data_sets, data_sets_count} = res.data;
dispatch({
type: types.GET_JUPYTER_DATA_SETS,
- payload: data_sets
+ payload: {
+ data_sets,
+ data_sets_count
+ }
});
}
});
@@ -59,7 +66,6 @@ export const getJupyterTpiDataSet = (identifier) => {
export const getJupyterTpiUrl = (obj) => {
return (dispatch, getState) => {
const {jupyter_info} = getState().jupyterReducer;
- console.log(obj.identifier, jupyter_info.myshixun_identifier);
if (!obj.identifier && !jupyter_info.myshixun_identifier) return;
const id = obj.identifier || jupyter_info.myshixun_identifier;
fetchJupyterTpiUrl({identifier: id}).then(res => {
@@ -136,4 +142,11 @@ export const saveJupyterTpi = () => {
});
});
}
+}
+// 改变当前页数
+export const changeCurrentPage = (current) => {
+ return {
+ type: types.CHANGE_JUPYTER_CURRENT_PAGE,
+ payload: current
+ }
}
\ No newline at end of file
diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js
index aca8bf647..f8825fb36 100644
--- a/public/react/src/redux/reducers/jupyterReducer.js
+++ b/public/react/src/redux/reducers/jupyterReducer.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-12 09:01:39
* @LastEditors: tangjiang
- * @LastEditTime: 2019-12-12 17:23:54
+ * @LastEditTime: 2019-12-13 15:28:45
*/
import types from "../actions/actionTypes";
@@ -14,15 +14,22 @@ const initState = {
jupyter_data_set: [],
jupyter_identifier: '',
jupyter_tpi_url_state: -1, // 获取 url 状态值: 0 成功, 其它 失败
- jupyter_tpi_code: '' // 端口号
+ jupyter_tpi_code: '', // 端口号
+ jupyter_data_set_count: 1, // 数据集总数
+ jupyter_pagination: {
+ page: 1,
+ limit: 20 // 默认加载20条
+ }
};
const JupyterReducer = (state = initState, action) => {
switch (action.type) {
case types.GET_JUPYTER_DATA_SETS:
+ const { data_sets, data_sets_count } = action.payload;
return {
...state,
- jupyter_data_set: action.payload
+ jupyter_data_set: data_sets,
+ jupyter_data_set_count: data_sets_count
}
case types.GET_JUPYTER_TPI_URL:
const {url, status, port} = action.payload;
@@ -33,6 +40,7 @@ const JupyterReducer = (state = initState, action) => {
jupyter_tpi_code: port
}
case types.SAVE_JUPYTER_IDENTIFIER:
+ console.log('保存的jupyter_identifier', action.payload);
return {
...state,
jupyter_identifier: action.payload
@@ -47,6 +55,11 @@ const JupyterReducer = (state = initState, action) => {
...state,
jupyter_tpi_url_state: action.payload
}
+ case types.CHANGE_JUPYTER_CURRENT_PAGE:
+ return {
+ ...state,
+ jupyter_pagination: Object.assign({}, state.jupyter_pagination, { page: action.payload })
+ }
default:
return {
...state
diff --git a/public/react/src/services/jupyterServer.js b/public/react/src/services/jupyterServer.js
index bfc8788f8..3c14b4b45 100644
--- a/public/react/src/services/jupyterServer.js
+++ b/public/react/src/services/jupyterServer.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-12 09:07:07
* @LastEditors: tangjiang
- * @LastEditTime: 2019-12-12 17:46:17
+ * @LastEditTime: 2019-12-13 14:30:51
*/
import axios from 'axios';
@@ -14,9 +14,9 @@ export async function fetchJupyterInfo (identifier) {
return axios.get(url);
}
// 获取数据集
-export async function fetchJupyterTpiDataSet (identifier) {
+export async function fetchJupyterTpiDataSet (identifier, params) {
const url = `/shixuns/${identifier}/jupyter_data_sets.json`;
- return axios.get(url);
+ return axios.get(url, { params });
}
// 获取 tpi url
export async function fetchJupyterTpiUrl (params) {