|
|
|
|
@ -353,6 +353,7 @@ var CommonPractice = function CommonPractice(_ref) {
|
|
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
|
|
var skip,
|
|
|
|
|
body,
|
|
|
|
|
obj,
|
|
|
|
|
res,
|
|
|
|
|
_args3 = arguments;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
|
|
@ -362,20 +363,24 @@ var CommonPractice = function CommonPractice(_ref) {
|
|
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '新建实践项目', '全实践项目', skip ? "暂不选用镜像" : "使用当前镜像"]);
|
|
|
|
|
body = activeId && !skip ? {
|
|
|
|
|
image_id: activeId
|
|
|
|
|
} : {};
|
|
|
|
|
_context3.next = 5;
|
|
|
|
|
} : {}; //从数据集中进入 就要带上数据集id
|
|
|
|
|
obj = searchParams.get("dataSetId") ? objectSpread2_default()(objectSpread2_default()({}, body), {}, {
|
|
|
|
|
mirror_tab_type: tab,
|
|
|
|
|
data_set_ids: [Number(searchParams.get("dataSetId"))]
|
|
|
|
|
}) : objectSpread2_default()(objectSpread2_default()({}, body), {}, {
|
|
|
|
|
mirror_tab_type: tab
|
|
|
|
|
});
|
|
|
|
|
_context3.next = 6;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/choose_environment_or_skip.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: objectSpread2_default()(objectSpread2_default()({}, body), {}, {
|
|
|
|
|
mirror_tab_type: tab
|
|
|
|
|
})
|
|
|
|
|
body: obj
|
|
|
|
|
});
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
|
|
|
|
res = _context3.sent;
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(res.data.identifier, "/edit"));
|
|
|
|
|
}
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context3.stop();
|
|
|
|
|
}
|
|
|
|
|
@ -675,6 +680,9 @@ var JupyterPractice = function JupyterPractice(_ref) {
|
|
|
|
|
dispatch = _ref.dispatch,
|
|
|
|
|
is_jupyter_lab = _ref.is_jupyter_lab,
|
|
|
|
|
user = _ref.user;
|
|
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
|
|
form = _Form$useForm2[0];
|
|
|
|
|
@ -752,35 +760,50 @@ var JupyterPractice = function JupyterPractice(_ref) {
|
|
|
|
|
};
|
|
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(values) {
|
|
|
|
|
var _ref4, intro, main_type, sub_type, name, number, trainee, _ref4$jupyter_show_de, jupyter_show_description, res;
|
|
|
|
|
var _ref4, intro, main_type, sub_type, name, number, trainee, _ref4$jupyter_show_de, jupyter_show_description, obj, res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
_ref4 = values || {}, intro = _ref4.intro, main_type = _ref4.mainType, sub_type = _ref4.subType, name = _ref4.name, number = _ref4.number, trainee = _ref4.difficulty, _ref4$jupyter_show_de = _ref4.jupyter_show_description, jupyter_show_description = _ref4$jupyter_show_de === void 0 ? false : _ref4$jupyter_show_de;
|
|
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '新建实践项目', is_jupyter_lab ? 'Jupyter Notebook实践项目' : 'JupyterLab实践项目', '保存']);
|
|
|
|
|
_context.next = 4;
|
|
|
|
|
//从数据集中进入 就要带上数据集id
|
|
|
|
|
obj = searchParams.get("dataSetId") ? {
|
|
|
|
|
description: intro,
|
|
|
|
|
main_type: main_type,
|
|
|
|
|
sub_type: sub_type,
|
|
|
|
|
shixun: {
|
|
|
|
|
jupyter_show_description: jupyter_show_description,
|
|
|
|
|
name: name,
|
|
|
|
|
number: number,
|
|
|
|
|
trainee: trainee,
|
|
|
|
|
is_jupyter: is_jupyter_lab ? false : true,
|
|
|
|
|
is_jupyter_lab: is_jupyter_lab
|
|
|
|
|
},
|
|
|
|
|
data_set_ids: [Number(searchParams.get("dataSetId"))]
|
|
|
|
|
} : {
|
|
|
|
|
description: intro,
|
|
|
|
|
main_type: main_type,
|
|
|
|
|
sub_type: sub_type,
|
|
|
|
|
shixun: {
|
|
|
|
|
jupyter_show_description: jupyter_show_description,
|
|
|
|
|
name: name,
|
|
|
|
|
number: number,
|
|
|
|
|
trainee: trainee,
|
|
|
|
|
is_jupyter: is_jupyter_lab ? false : true,
|
|
|
|
|
is_jupyter_lab: is_jupyter_lab
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
_context.next = 5;
|
|
|
|
|
return dispatch({
|
|
|
|
|
type: 'newShixuns/submitShixuns',
|
|
|
|
|
payload: {
|
|
|
|
|
description: intro,
|
|
|
|
|
main_type: main_type,
|
|
|
|
|
sub_type: sub_type,
|
|
|
|
|
shixun: {
|
|
|
|
|
jupyter_show_description: jupyter_show_description,
|
|
|
|
|
name: name,
|
|
|
|
|
number: number,
|
|
|
|
|
trainee: trainee,
|
|
|
|
|
is_jupyter: is_jupyter_lab ? false : true,
|
|
|
|
|
is_jupyter_lab: is_jupyter_lab
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
payload: obj
|
|
|
|
|
});
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) !== -1) {
|
|
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(res.shixun_identifier, "/challenges"));
|
|
|
|
|
}
|
|
|
|
|
case 6:
|
|
|
|
|
case 7:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|