Merge branch 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter
commit
a5eccb6a8a
After Width: | Height: | Size: 112 KiB |
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* @Description: jupyter tpi 相关内容
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-12-12 09:01:30
|
||||
* @LastEditors: tangjiang
|
||||
* @LastEditTime: 2019-12-12 09:30:53
|
||||
*/
|
||||
import types from "./actionTypes";
|
||||
import { fetchJupyterTpiDataSet, fetchJupyterTpiUrl } from "../../services/jupyterServer";
|
||||
|
||||
// 获取 jupyter tpi 数据集
|
||||
export const getJupyterTpiDataSet = (identifier) => {
|
||||
return (dispatch) => {
|
||||
fetchJupyterTpiDataSet(identifier).then(res => {
|
||||
if (res.data.status === 401) return; // 用户未登录
|
||||
console.log('数据集:', res);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 获取 jupyter tpi 地址
|
||||
export const getJupyterTpiUrl = (identifier) => {
|
||||
return (dispatch) => {
|
||||
fetchJupyterTpiUrl(identifier).then(res => {
|
||||
if (res.data.status === 401) return; // 用户未登录
|
||||
console.log('获取url', res);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 保存 jupyter identifer
|
||||
export const saveJupyterIdentifier = (identifier) => {
|
||||
return {
|
||||
type: types.SAVE_JUPYTER_IDENTIFIER,
|
||||
payload: identifier
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* @Description:
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-12-12 09:01:39
|
||||
* @LastEditors: tangjiang
|
||||
* @LastEditTime: 2019-12-12 09:29:49
|
||||
*/
|
||||
import types from "../actions/actionTypes";
|
||||
|
||||
const initState = {
|
||||
jupyter_tpi_url: '',
|
||||
jupyter_data_set: [],
|
||||
jupyter_identifier: ''
|
||||
};
|
||||
|
||||
const JupyterReducer = (state = initState, action) => {
|
||||
switch (action.type) {
|
||||
case types.GET_JUPYTER_DATA_SETS:
|
||||
return {
|
||||
...state,
|
||||
jupyter_data_set: action.payload
|
||||
}
|
||||
case types.GET_JUPYTER_TPI_URL:
|
||||
return {
|
||||
...state,
|
||||
jupyter_tpi_url: action.payload
|
||||
}
|
||||
case types.SAVE_JUPYTER_IDENTIFIER:
|
||||
return {
|
||||
...state,
|
||||
jupyter_identifier: action.payload
|
||||
}
|
||||
default:
|
||||
return {
|
||||
...state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default JupyterReducer;
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* @Description: jupyter相关接口
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-12-12 09:07:07
|
||||
* @LastEditors: tangjiang
|
||||
* @LastEditTime: 2019-12-12 09:10:58
|
||||
*/
|
||||
import axios from 'axios';
|
||||
|
||||
// 获取数据集
|
||||
export async function fetchJupyterTpiDataSet (identifier) {
|
||||
const url = `/shixuns/${identifier}/jupyter_data_sets.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
// 获取 tpi url
|
||||
export async function fetchJupyterTpiUrl (params) {
|
||||
const url = `/jupyters/get_info_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
Loading…
Reference in new issue