|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[83141],{
|
|
|
|
|
|
/***/ 36579:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ PreviewAll; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/style/index.js + 1 modules
|
|
|
var tooltip_style = __webpack_require__(38390);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(84908);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var PreviewAllmodules = ({"wrp":"wrp___dq7YK","bgBlack":"bgBlack___ARIUV","monaco":"monaco___VnZC3","darkBlue":"darkBlue___UprA9","close":"close___LKoWu","embed":"embed___hvpEJ"});
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
|
|
|
var ArrowDownOutlined = __webpack_require__(77171);
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(8691);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(51412);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var PreviewAll = (function (_ref) {
|
|
|
var _data, _data2, _data3, _data4, _data5, _data6;
|
|
|
var _ref$editOffice = _ref.editOffice,
|
|
|
editOffice = _ref$editOffice === void 0 ? 'view' : _ref$editOffice,
|
|
|
data = _ref.data,
|
|
|
theme = _ref.theme,
|
|
|
type = _ref.type,
|
|
|
filename = _ref.filename,
|
|
|
monacoEditor = _ref.monacoEditor,
|
|
|
className = _ref.className,
|
|
|
style = _ref.style,
|
|
|
close = _ref.close,
|
|
|
onClose = _ref.onClose,
|
|
|
hasMask = _ref.hasMask,
|
|
|
disabledDownload = _ref.disabledDownload,
|
|
|
onImgDimensions = _ref.onImgDimensions;
|
|
|
var _useState = (0,react.useState)('https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
src = _useState2[0],
|
|
|
setSrc = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(""),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
token = _useState4[0],
|
|
|
setToken = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
officeData = _useState6[0],
|
|
|
setOfficeData = _useState6[1];
|
|
|
var officePath = window.ENV === "build" ? "/react/build" : "";
|
|
|
var apiServer = location.host.startsWith("localhost") ? env/* default.PROXY_SERVER */.Z.PROXY_SERVER : env/* default.API_SERVER */.Z.API_SERVER;
|
|
|
var size;
|
|
|
var unit = 1024 * 1024;
|
|
|
var maxSize = 10 * unit;
|
|
|
var closeRef = (0,react.useRef)();
|
|
|
if ((_data = data) !== null && _data !== void 0 && _data.startsWith("/api") && type !== "txt") {
|
|
|
data = env/* default.API_SERVER */.Z.API_SERVER + data;
|
|
|
}
|
|
|
if (type === "office") {
|
|
|
size = (0,util/* parseUrl */.en)(data).filesize;
|
|
|
if (size > maxSize) {
|
|
|
type = "other";
|
|
|
}
|
|
|
}
|
|
|
if (filename) monacoEditor.filename = filename;
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _document$cookie, _document$cookie$repl;
|
|
|
var cookies = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : (_document$cookie$repl = _document$cookie.replace(/\s/g, "")) === null || _document$cookie$repl === void 0 ? void 0 : _document$cookie$repl.split(";");
|
|
|
cookies === null || cookies === void 0 ? void 0 : cookies.map(function (item) {
|
|
|
var i = item.split("=");
|
|
|
if (i[0] === '_educoder_session') {
|
|
|
setToken(i[1]);
|
|
|
}
|
|
|
});
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (type === "office") getData();
|
|
|
}, [type, data]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _url, _id, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
console.log("data:", data);
|
|
|
_url = data;
|
|
|
if (!data.startsWith("http")) {
|
|
|
_url = location.origin + _url;
|
|
|
}
|
|
|
_id = new URL(_url).pathname.split("/").pop();
|
|
|
_context.next = 6;
|
|
|
return (0,exercise/* setEcsAttachment */.gJ)({
|
|
|
attachment_id: _id
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
setOfficeData(res);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleClick = function handleClick() {
|
|
|
if (data.startsWith("http") || data.startsWith('blob:')) {
|
|
|
handleDown();
|
|
|
return;
|
|
|
}
|
|
|
(0,util/* downloadFile */.Sv)(filename || 'educoder', data, filename);
|
|
|
};
|
|
|
var handleDown = function handleDown() {
|
|
|
(0,util/* downLoadLink */.Nd)(filename || 'educoder', decodeURIComponent(data));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: objectSpread2_default()({}, style || {}),
|
|
|
className: "".concat(hasMask && PreviewAllmodules.bgBlack, " ").concat(!!type ? PreviewAllmodules.wrp : "hide"),
|
|
|
children: [close && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: PreviewAllmodules.close,
|
|
|
ref: closeRef,
|
|
|
children: [!!onImgDimensions && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
onClose();
|
|
|
onImgDimensions();
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-yulanpizhu"
|
|
|
})
|
|
|
})
|
|
|
}), !disabledDownload && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: handleDown,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-quxiaozhiding"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5173\u95ED",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "",
|
|
|
onClick: onClose,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-guanbi1"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(PreviewAllmodules[className], " ").concat(className, " ").concat(PreviewAllmodules.monaco, " ").concat(type === "txt" ? "show" : "hide"),
|
|
|
children: type === "txt" && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, monacoEditor))
|
|
|
}), type === "audio" && /*#__PURE__*/(0,jsx_runtime.jsx)("audio", {
|
|
|
src: "".concat(((_data2 = data) === null || _data2 === void 0 ? void 0 : _data2.indexOf("http://")) > -1 || ((_data3 = data) === null || _data3 === void 0 ? void 0 : _data3.indexOf("https://")) > -1 ? "" : "data:audio/mp3;base64,").concat(data),
|
|
|
autoPlay: true
|
|
|
}), type === "video" && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.indexOf("http")) > -1 ? /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "".concat(data),
|
|
|
autoPlay: true
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "data:video/mp4;base64,".concat(data),
|
|
|
autoPlay: true
|
|
|
})
|
|
|
}), type === 'office' && officeData && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/office.html?key=").concat(officeData.key, "&url=").concat(apiServer + officeData.url, "&callbackUrl=").concat(apiServer + officeData.callbackUrl, "&fileType=").concat(officeData.fileType, "&title=").concat(officeData.title, "&model=").concat(editOffice, "&officeServer=").concat(env/* default.ONLYOFFICE */.Z.ONLYOFFICE, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}), type === 'html' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: data + '&disposition=inline'
|
|
|
}), type === 'pdf' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/js/pdfview/index.html?url=").concat(data, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}) //<embed className={styles.embed + "#toolbar=0"} src={data} />
|
|
|
, type === "image" && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: "".concat(((_data5 = data) === null || _data5 === void 0 ? void 0 : _data5.indexOf("http://")) > -1 || ((_data6 = data) === null || _data6 === void 0 ? void 0 : _data6.indexOf("https://")) > -1 ? "" : "data:image/png;base64,").concat(data)
|
|
|
}), type === "other" && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: handleClick,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
|
|
|
})
|
|
|
}), type === "download" && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: handleClick,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 97501:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
|
|
|
\*************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "h": function() { return /* binding */ MyCodeMirror; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectSpread2.js */ 42122);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/button/style */ 29913);
|
|
|
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd/es/button */ 71577);
|
|
|
/* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/form/style */ 75627);
|
|
|
/* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd/es/form */ 51018);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/select/style */ 95985);
|
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd/es/select */ 34041);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 67294);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! codemirror */ 4631);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 71749);
|
|
|
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 30483);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_10__/* ["default"].Option */ .Z.Option;
|
|
|
|
|
|
//https://github.com/codemirror/CodeMirror/issues/4838
|
|
|
var formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
}
|
|
|
};
|
|
|
var LanguageDesc = {
|
|
|
asp: ['ASP', 'vbscript'],
|
|
|
actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'],
|
|
|
bash: ['Bash/Bat', 'shell'],
|
|
|
css: ['CSS', 'css'],
|
|
|
c: ['C', 'clike'],
|
|
|
cpp: ['C++', 'clike'],
|
|
|
csharp: ['C#', 'clike'],
|
|
|
coffeescript: ['CoffeeScript', 'coffeescript'],
|
|
|
d: ['D', 'd'],
|
|
|
dart: ['Dart', 'dart'],
|
|
|
delphi: ['Delphi/Pascal', 'pascal'],
|
|
|
erlang: ['Erlang', 'erlang'],
|
|
|
go: ['Golang', 'go'],
|
|
|
groovy: ['Groovy', 'groovy'],
|
|
|
html: ['HTML', 'text/html'],
|
|
|
java: ['Java', 'clike'],
|
|
|
json: ['JSON', 'text/json'],
|
|
|
javascript: ['Javascript', 'javascript'],
|
|
|
lua: ['Lua', 'lua'],
|
|
|
less: ['LESS', 'css'],
|
|
|
markdown: ['Markdown', 'gfm'],
|
|
|
'objective-c': ['Objective-C', 'clike'],
|
|
|
php: ['PHP', 'php'],
|
|
|
perl: ['Perl', 'perl'],
|
|
|
python: ['Python', 'python'],
|
|
|
r: ['R', 'r'],
|
|
|
rst: ['reStructedText', 'rst'],
|
|
|
ruby: ['Ruby', 'ruby'],
|
|
|
sql: ['SQL', 'sql'],
|
|
|
sass: ['SASS/SCSS', 'sass'],
|
|
|
shell: ['Shell', 'shell'],
|
|
|
scala: ['Scala', 'clike'],
|
|
|
swift: ['Swift', 'clike'],
|
|
|
vb: ['VB/VBScript', 'vb'],
|
|
|
xml: ['XML', 'text/xml'],
|
|
|
yaml: ['YAML', 'yaml']
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)('python'),
|
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
mode = _useState2[0],
|
|
|
setMode = _useState2[1];
|
|
|
function onSetMode(value) {
|
|
|
setMode(LanguageDesc[value][1]);
|
|
|
}
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
|
|
|
className: "code-block-panel",
|
|
|
initialValues: {
|
|
|
language: 'python',
|
|
|
content: ''
|
|
|
},
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"].Item */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u8BED\u8A00",
|
|
|
name: "language",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_select__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
onChange: onSetMode,
|
|
|
children: Object.keys(LanguageDesc).map(function (item) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(Option, {
|
|
|
value: item,
|
|
|
children: LanguageDesc[item][0]
|
|
|
}, item);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"].Item */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u5185\u5BB9",
|
|
|
name: "content",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入代码内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(MyCodeMirror, {
|
|
|
mode: mode
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function MyCodeMirror(_ref2) {
|
|
|
var value = _ref2.value,
|
|
|
onChange = _ref2.onChange,
|
|
|
mode = _ref2.mode,
|
|
|
_ref2$options = _ref2.options,
|
|
|
options = _ref2$options === void 0 ? {} : _ref2$options;
|
|
|
var el = (0,react__WEBPACK_IMPORTED_MODULE_5__.useRef)();
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),
|
|
|
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
cm = _useState4[0],
|
|
|
setCm = _useState4[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm) {
|
|
|
var content = cm.getValue();
|
|
|
onChange && onChange(content);
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
cm.setOption('mode', mode);
|
|
|
}
|
|
|
}, [cm, mode]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
if (value !== cm.getValue() || value === '') {
|
|
|
setTimeout(function () {
|
|
|
cm.setValue(value || ' ');
|
|
|
}, 300);
|
|
|
}
|
|
|
}
|
|
|
}, [cm, value]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (el.current && !cm) {
|
|
|
var instance = codemirror__WEBPACK_IMPORTED_MODULE_6___default().fromTextArea(el.current, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
mode: mode,
|
|
|
lineNumbers: true,
|
|
|
lineWrapping: true,
|
|
|
autoCloseBrackets: true,
|
|
|
tabSize: 4,
|
|
|
autofocus: true,
|
|
|
autoCloseTags: true,
|
|
|
matchBrackets: true,
|
|
|
styleActiveLine: true
|
|
|
}, options));
|
|
|
setCm(instance);
|
|
|
}
|
|
|
}, [el.current, cm]);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
|
className: "my-codemirror-container",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("textarea", {
|
|
|
ref: el
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 93175:
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./src/pages/Innovation/Detail/index.tsx + 19 modules ***!
|
|
|
\************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ Detail; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(22536);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/index.js
|
|
|
var spin = __webpack_require__(11382);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js + 1 modules
|
|
|
var input_number_style = __webpack_require__(25359);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js + 9 modules
|
|
|
var input_number = __webpack_require__(87799);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
|
|
|
var message_style = __webpack_require__(14934);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
|
var message = __webpack_require__(12461);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
|
|
|
var modal_style = __webpack_require__(35611);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
|
var modal = __webpack_require__(85402);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/style/index.js + 1 modules
|
|
|
var divider_style = __webpack_require__(98541);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/index.js
|
|
|
var divider = __webpack_require__(27049);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
|
|
|
var row_style = __webpack_require__(13062);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
|
var row = __webpack_require__(71230);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js
|
|
|
var col_style = __webpack_require__(89032);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
|
|
|
var col = __webpack_require__(15746);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var button_style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js + 1 modules
|
|
|
var form_style = __webpack_require__(75627);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 17 modules
|
|
|
var es_form = __webpack_require__(51018);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tabs/style/index.js + 1 modules
|
|
|
var tabs_style = __webpack_require__(99558);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tabs/index.js + 22 modules
|
|
|
var tabs = __webpack_require__(3381);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/typography/style/index.js + 1 modules
|
|
|
var typography_style = __webpack_require__(59988);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/typography/index.js + 16 modules
|
|
|
var typography = __webpack_require__(80254);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ForkOutlined.js + 1 modules
|
|
|
var ForkOutlined = __webpack_require__(9641);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownOutlined.js
|
|
|
var DownOutlined = __webpack_require__(39300);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Detailmodules = ({"project_detail_wrapper":"project_detail_wrapper___ywzyI","nav":"nav___fxBLI","title":"title___NfoQH","fork_btn":"fork_btn___gBhDb","desc":"desc___SryMB","info":"info___fzlio","create_time":"create_time___JaeKJ","operation":"operation___N7pLK","delete_btn":"delete_btn___xrcwe","fork_modal":"fork_modal___nz1Xg","huanj":"huanj___EHzUt","divtitle":"divtitle___XmviM"});
|
|
|
// EXTERNAL MODULE: ./src/service/innovation.ts
|
|
|
var service_innovation = __webpack_require__(33265);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(7);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
|
|
|
var input_style = __webpack_require__(69463);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(75008);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/ForkFormModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ForkFormModal = function ForkFormModal(_ref) {
|
|
|
var dispatch = _ref.dispatch,
|
|
|
innovation = _ref.innovation,
|
|
|
detail = _ref.detail;
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
formInstance = _Form$useForm2[0];
|
|
|
var _useState = (0,react.useState)('notyet'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
forkingState = _useState2[0],
|
|
|
setForkingState = _useState2[1];
|
|
|
var newProjectIdRef = (0,react.useRef)();
|
|
|
var handleForkProject = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var name, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.prev = 0;
|
|
|
_context.next = 3;
|
|
|
return formInstance.validateFields();
|
|
|
case 3:
|
|
|
name = formInstance.getFieldValue('name');
|
|
|
setForkingState('forking');
|
|
|
_context.next = 7;
|
|
|
return (0,service_innovation/* forkProject */.M3)("".concat(detail.id), {
|
|
|
name: name
|
|
|
});
|
|
|
case 7:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default.success */.ZP.success('fork成功');
|
|
|
newProjectIdRef.current = res.sci_project_id;
|
|
|
//如果是从启动环境提示弹窗打开的fork弹窗,则在localStorage中记录提示弹窗的显隐flag
|
|
|
if (innovation.openForkModalPosition === 'remindModal') {
|
|
|
window.localStorage.setItem('hideRemindModal', "".concat(innovation.hideRemindModal));
|
|
|
}
|
|
|
}
|
|
|
setForkingState('success');
|
|
|
_context.next = 15;
|
|
|
break;
|
|
|
case 12:
|
|
|
_context.prev = 12;
|
|
|
_context.t0 = _context["catch"](0);
|
|
|
setForkingState('fail');
|
|
|
case 15:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee, null, [[0, 12]]);
|
|
|
}));
|
|
|
return function handleForkProject() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var goToForkRepo = function goToForkRepo() {
|
|
|
_umi_production_exports.history.push("/innovation/project/detail/".concat(newProjectIdRef.current));
|
|
|
location.reload();
|
|
|
};
|
|
|
var handleCancel = function handleCancel() {
|
|
|
setForkingState('notyet');
|
|
|
formInstance.resetFields();
|
|
|
dispatch({
|
|
|
type: 'innovation/closeModal'
|
|
|
});
|
|
|
};
|
|
|
var handleOk = function handleOk() {
|
|
|
if (forkingState === 'success') {
|
|
|
goToForkRepo();
|
|
|
} else {
|
|
|
handleForkProject();
|
|
|
}
|
|
|
};
|
|
|
var ForkForm = /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
autoComplete: "off",
|
|
|
form: formInstance
|
|
|
// preserve={false}
|
|
|
,
|
|
|
initialValues: {
|
|
|
name: detail.sci_project.name
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u65B0\u9879\u76EE\u540D\u79F0",
|
|
|
name: "name",
|
|
|
required: true,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入项目名称'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
|
maxLength: 60
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
var childrenMap = {
|
|
|
notyet: ForkForm,
|
|
|
forking: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
height: 40
|
|
|
}
|
|
|
}),
|
|
|
success: /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u9879\u76EE\u5DF2\u7ECFFork\u5B8C\u6210\uFF0C\u73B0\u5728\u5C31\u53BB\u67E5\u770B\u9879\u76EE\u5417\uFF1F"
|
|
|
}),
|
|
|
fail: ForkForm
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: "Fork\u9879\u76EE",
|
|
|
width: 600,
|
|
|
open: innovation.visibleModalName === 'fork-project',
|
|
|
className: "".concat(Detailmodules.fork_modal),
|
|
|
destroyOnClose: true,
|
|
|
centered: true,
|
|
|
onCancel: handleCancel,
|
|
|
onOk: handleOk,
|
|
|
okText: forkingState === 'success' ? '查看项目' : '确定',
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
tip: "\u9879\u76EEFork\u4E2D",
|
|
|
spinning: forkingState === 'forking',
|
|
|
children: childrenMap[forkingState]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_ForkFormModal = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var innovation = _ref3.innovation;
|
|
|
return {
|
|
|
innovation: innovation
|
|
|
};
|
|
|
})(ForkFormModal));
|
|
|
// EXTERNAL MODULE: ./node_modules/moment/moment.js
|
|
|
var moment = __webpack_require__(30381);
|
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/QRCode.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var QRCode = function QRCode() {
|
|
|
var _useState = (0,react.useState)(moment_default()().valueOf()),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
timeStamp = _useState2[0],
|
|
|
setTimeStamp = _useState2[1];
|
|
|
var imgSrc = (0,react.useMemo)(function () {
|
|
|
return "".concat(env/* default.API_SERVER */.Z.API_SERVER, "/rucaptcha?t=").concat(timeStamp);
|
|
|
}, [timeStamp]);
|
|
|
var handleClick = function handleClick() {
|
|
|
setTimeStamp(moment_default()().valueOf());
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: imgSrc,
|
|
|
alt: ""
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: handleClick,
|
|
|
style: {
|
|
|
fontSize: 12,
|
|
|
fontWeight: 400,
|
|
|
color: '#165DFF',
|
|
|
marginLeft: 10,
|
|
|
cursor: 'pointer'
|
|
|
},
|
|
|
children: "\u770B\u4E0D\u6E05\u6362\u4E00\u5F20"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_QRCode = (QRCode);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/DeleteFormModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DelelteFormModal = function DelelteFormModal(_ref) {
|
|
|
var dispatch = _ref.dispatch,
|
|
|
innovation = _ref.innovation,
|
|
|
projectId = _ref.projectId;
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
formInstance = _Form$useForm2[0];
|
|
|
var handleDelete = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var formValues, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.prev = 0;
|
|
|
_context.next = 3;
|
|
|
return formInstance.validateFields();
|
|
|
case 3:
|
|
|
formValues = formInstance.getFieldsValue();
|
|
|
_context.next = 6;
|
|
|
return (0,service_innovation/* deleteProject */.th)(projectId, {
|
|
|
code: formValues.code
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default.success */.ZP.success('删除成功');
|
|
|
dispatch({
|
|
|
type: 'innovation/closeModal'
|
|
|
});
|
|
|
_umi_production_exports.history.replace('/innovation/project');
|
|
|
}
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
case 10:
|
|
|
_context.prev = 10;
|
|
|
_context.t0 = _context["catch"](0);
|
|
|
dispatch({
|
|
|
type: 'innovation/closeModal'
|
|
|
});
|
|
|
case 13:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee, null, [[0, 10]]);
|
|
|
}));
|
|
|
return function handleDelete() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: "\u5220\u9664\u9879\u76EE",
|
|
|
width: 600,
|
|
|
okText: "\u786E\u5B9A\u5220\u9664",
|
|
|
okButtonProps: {
|
|
|
type: 'primary',
|
|
|
danger: true
|
|
|
},
|
|
|
centered: true,
|
|
|
open: innovation.visibleModalName === 'delete-project',
|
|
|
destroyOnClose: true,
|
|
|
onCancel: function onCancel() {
|
|
|
return dispatch({
|
|
|
type: 'innovation/closeModal'
|
|
|
});
|
|
|
},
|
|
|
onOk: handleDelete,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
autoComplete: "off",
|
|
|
form: formInstance,
|
|
|
preserve: false,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u9A8C\u8BC1\u7801",
|
|
|
required: true,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "code",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入验证码'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#FA6400'
|
|
|
},
|
|
|
children: "\u5220\u9664\u9879\u76EE\u540E\uFF0C\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_QRCode, {})]
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var DeleteFormModal = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var innovation = _ref3.innovation;
|
|
|
return {
|
|
|
innovation: innovation
|
|
|
};
|
|
|
})(DelelteFormModal));
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/style/index.js + 1 modules
|
|
|
var dropdown_style = __webpack_require__(68018);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/index.js
|
|
|
var dropdown = __webpack_require__(13013);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/style/index.js + 1 modules
|
|
|
var menu_style = __webpack_require__(83736);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 5 modules
|
|
|
var es_menu = __webpack_require__(66516);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/style/index.js + 1 modules
|
|
|
var tooltip_style = __webpack_require__(38390);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(84908);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(70215);
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var CodePanemodules = ({"flex_box_center":"flex_box_center___Qw6EI","flex_space_between":"flex_space_between___Ck1De","flex_box_vertical_center":"flex_box_vertical_center___wF0Km","flex_box_center_end":"flex_box_center_end___lwH1m","flex_box_column":"flex_box_column___GXFqw","menu":"menu___UnLMr","warehouse":"warehouse___P7f6U","header":"header___u00_W","title":"title____S1YG","content":"content___p_SoR","left":"left___hSMYA","right":"right___ZQk8Z","loading":"loading___W3zy1","empty":"empty___fievZ","tabs":"tabs___QW8es","line":"line___Jpj9w","footer":"footer___gn3O8","commit":"commit___xEz6h","blueLight":"blueLight___w_apJ","filePathWrp":"filePathWrp___H9erP","filePath":"filePath___TdyXm","bottom0":"bottom0___pV48E"});
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(861);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tree/style/index.js + 1 modules
|
|
|
var tree_style = __webpack_require__(62216);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tree/index.js + 9 modules
|
|
|
var tree = __webpack_require__(54205);
|
|
|
// EXTERNAL MODULE: ./node_modules/react-copy-to-clipboard/lib/index.js
|
|
|
var lib = __webpack_require__(74855);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/AddFile.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var AddFilemodules = ({"wrap":"wrap___Bmme7","modal":"modal___AMeuc","title":"title___gcQ15","path":"path___Z2shU","colorBlue":"colorBlue___G_a7d","width240":"width240___AU6VN","filePath":"filePath___YkFWz"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/AddFolder.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["shixunsDetail", "globalSetting", "loading", "user", "dispatch", "isRepository"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddFile = function AddFile(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isRepository = _ref.isRepository,
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var shixunId = (0,react.useRef)();
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState3 = (0,react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
filePath = _useState4[0],
|
|
|
setFilePath = _useState4[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (props.visible) {
|
|
|
form.resetFields();
|
|
|
}
|
|
|
}, [props.visible]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var pathArray = sessionStorage.getItem('pathArray');
|
|
|
if (pathArray) {
|
|
|
// 拼接成绝对路径
|
|
|
var joinPath = pathArray.split(',').join('/');
|
|
|
var path = joinPath.indexOf('/') === 0 ? joinPath.substr(1) : joinPath;
|
|
|
setFilePath(path);
|
|
|
}
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _location$pathname, _location$pathname$sp;
|
|
|
shixunId.current = (_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : (_location$pathname$sp = _location$pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[2];
|
|
|
}, []);
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var values,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
values = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
|
_context.next = 3;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/addRepositoryFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
message: values.commitMessage,
|
|
|
content: '',
|
|
|
path: (!!props.defaultPath ? props.defaultPath + '/' : '') + values.path + '/' + (values.file || '.gitkeep'),
|
|
|
secret_repository: isRepository ? undefined : true
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.url) {
|
|
|
message/* default.success */.ZP.success('添加成功');
|
|
|
props.onOK({
|
|
|
path: (!!props.defaultPath ? props.defaultPath + '/' : '') + values.path + '/' + (values.file || '.gitkeep'),
|
|
|
name: values.path.split('/')[values.path.split('/').length - 1]
|
|
|
});
|
|
|
props.onClose();
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleFinish() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleReturn = function handleReturn() {
|
|
|
var _location$pathname2, _location$pathname2$s;
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(shixunId.current, "/").concat((_location$pathname2 = location.pathname) === null || _location$pathname2 === void 0 ? void 0 : (_location$pathname2$s = _location$pathname2.split('/')) === null || _location$pathname2$s === void 0 ? void 0 : _location$pathname2$s[3]).concat(filePath ? "/master/shixun_show/".concat(filePath) : ''));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
width: "60%",
|
|
|
centered: true,
|
|
|
open: props.visible,
|
|
|
wrapClassName: AddFilemodules.modal,
|
|
|
onOk: function onOk() {
|
|
|
form.submit();
|
|
|
},
|
|
|
onCancel: props.onClose,
|
|
|
title: "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: AddFilemodules.bg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: AddFilemodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "mt10",
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
layout: "vertical",
|
|
|
onFinish: handleFinish,
|
|
|
onChange: function onChange() {
|
|
|
var _value$path, _value$file, _arr$filter, _arr2$filter;
|
|
|
var value = objectSpread2_default()({}, form.getFieldsValue());
|
|
|
var arr = value === null || value === void 0 ? void 0 : (_value$path = value.path) === null || _value$path === void 0 ? void 0 : _value$path.split('');
|
|
|
var arr2 = value === null || value === void 0 ? void 0 : (_value$file = value.file) === null || _value$file === void 0 ? void 0 : _value$file.split('');
|
|
|
if (!!(arr !== null && arr !== void 0 && (_arr$filter = arr.filter(function (item) {
|
|
|
return item == '/';
|
|
|
})) !== null && _arr$filter !== void 0 && _arr$filter.length)) {
|
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
|
}
|
|
|
if (!!(arr2 !== null && arr2 !== void 0 && (_arr2$filter = arr2.filter(function (item) {
|
|
|
return item == '/';
|
|
|
})) !== null && _arr2$filter !== void 0 && _arr2$filter.length)) {
|
|
|
value.file = value.file.substring(0, value.path.length - 1);
|
|
|
}
|
|
|
form.setFieldsValue(objectSpread2_default()({}, value));
|
|
|
setFormValue(value);
|
|
|
}
|
|
|
// onValuesChange={() => setFormValue({ ...form.getFieldsValue() })}
|
|
|
,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u6587\u4EF6\u5939\u540D\u79F0\uFF1A",
|
|
|
name: "path",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: AddFilemodules.filePath,
|
|
|
children: props.defaultPath + '/'
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "path",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件夹名称'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0",
|
|
|
size: "large"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u6587\u4EF6\u540D\u79F0\uFF1A",
|
|
|
name: "file"
|
|
|
// rules={[
|
|
|
// { required: true, message: '请输入文件名称' },
|
|
|
// { whitespace: true, message: '请勿输入空格' }
|
|
|
// ]}
|
|
|
,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0\uFF0C\u5982\u679C\u4E0D\u586B\u5199\u7CFB\u7EDF\u5C06\u5728\u6587\u4EF6\u5939\u4E0B\u521B\u5EFA.gitkeep\u7684\u9ED8\u8BA4\u6587\u4EF6",
|
|
|
size: "large"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
|
name: "commitMessage",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入提交信息'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u672C\u6B21\u63D0\u4EA4\u7684\u4E3B\u8981\u4FE1\u606F\uFF0C\u5408\u7406\u7684\u63CF\u8FF0\u4FE1\u606F\u6709\u5229\u4E8E\u4EE3\u7801\u5386\u53F2\u8BB0\u5F55\u7684\u7BA1\u7406",
|
|
|
size: "large"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var AddFolder = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var shixunsDetail = _ref3.shixunsDetail,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting,
|
|
|
user = _ref3.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(AddFile));
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
|
|
|
var code_block = __webpack_require__(97501);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/AddFile.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddFile_excluded = ["shixunsDetail", "globalSetting", "loading", "user", "dispatch", "isRepository"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddFile_AddFile = function AddFile(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isRepository = _ref.isRepository,
|
|
|
props = objectWithoutProperties_default()(_ref, AddFile_excluded);
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var shixunId = (0,react.useRef)();
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState3 = (0,react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
filePath = _useState4[0],
|
|
|
setFilePath = _useState4[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (props.visible) {
|
|
|
form.resetFields();
|
|
|
}
|
|
|
}, [props.visible]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var pathArray = sessionStorage.getItem('pathArray');
|
|
|
if (pathArray) {
|
|
|
// 拼接成绝对路径
|
|
|
var joinPath = pathArray.split(',').join('/');
|
|
|
var path = joinPath.indexOf('/') === 0 ? joinPath.substr(1) : joinPath;
|
|
|
setFilePath(path);
|
|
|
}
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _location$pathname, _location$pathname$sp;
|
|
|
shixunId.current = (_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : (_location$pathname$sp = _location$pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[2];
|
|
|
}, []);
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var values,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
values = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
|
_context.next = 3;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/addRepositoryFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
message: values.commitMessage,
|
|
|
content: values.codeMirror,
|
|
|
path: (!!props.defaultPath ? props.defaultPath + '/' : '') + values.path,
|
|
|
secret_repository: isRepository ? undefined : true
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.url) {
|
|
|
message/* default.success */.ZP.success('添加成功');
|
|
|
props.onOK({
|
|
|
path: (!!props.defaultPath ? props.defaultPath + '/' : '') + values.path,
|
|
|
name: values.path.split('/')[values.path.split('/').length - 1]
|
|
|
});
|
|
|
props.onClose();
|
|
|
// const returnUrl = isRepository.current ?
|
|
|
// `/shixuns/${shixunId.current}/repository${filePath ? `/master/shixun_show/${filePath}` : ""}` :
|
|
|
// `/shixuns/${shixunId.current}/secret_repository`;
|
|
|
// history.replace(returnUrl);
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleFinish() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleReturn = function handleReturn() {
|
|
|
var _location$pathname2, _location$pathname2$s;
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(shixunId.current, "/").concat((_location$pathname2 = location.pathname) === null || _location$pathname2 === void 0 ? void 0 : (_location$pathname2$s = _location$pathname2.split('/')) === null || _location$pathname2$s === void 0 ? void 0 : _location$pathname2$s[3]).concat(filePath ? "/master/shixun_show/".concat(filePath) : ''));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
width: "60%",
|
|
|
open: props.visible,
|
|
|
wrapClassName: AddFilemodules.modal,
|
|
|
centered: true,
|
|
|
onOk: function onOk() {
|
|
|
form.submit();
|
|
|
},
|
|
|
onCancel: props.onClose,
|
|
|
title: "\u65B0\u5EFA\u6587\u4EF6",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: AddFilemodules.bg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: AddFilemodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "mt10",
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
layout: "vertical",
|
|
|
onFinish: handleFinish,
|
|
|
onChange: function onChange() {
|
|
|
var _value$path, _arr$filter;
|
|
|
var value = objectSpread2_default()({}, form.getFieldsValue());
|
|
|
var arr = value === null || value === void 0 ? void 0 : (_value$path = value.path) === null || _value$path === void 0 ? void 0 : _value$path.split('');
|
|
|
if ((arr === null || arr === void 0 ? void 0 : (_arr$filter = arr.filter(function (item) {
|
|
|
return item == '/';
|
|
|
})) === null || _arr$filter === void 0 ? void 0 : _arr$filter.length) > 1) {
|
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
|
}
|
|
|
form.setFieldsValue(objectSpread2_default()({}, value));
|
|
|
setFormValue(value);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u6587\u4EF6\u540D\u79F0\u6216\u6587\u4EF6\u8DEF\u5F84\uFF1A",
|
|
|
name: "path",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: AddFilemodules.filePath,
|
|
|
children: props.defaultPath + '/'
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "path",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件名称'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0",
|
|
|
size: "large"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
|
name: "commitMessage",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入提交信息'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u672C\u6B21\u63D0\u4EA4\u7684\u4E3B\u8981\u4FE1\u606F\uFF0C\u5408\u7406\u7684\u63CF\u8FF0\u4FE1\u606F\u6709\u5229\u4E8E\u4EE3\u7801\u5386\u53F2\u8BB0\u5F55\u7684\u7BA1\u7406",
|
|
|
size: "large"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt10 mb20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "codeMirror",
|
|
|
label: "\u6587\u4EF6\u5185\u5BB9\uFF1A",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* MyCodeMirror */.h, {
|
|
|
options: {
|
|
|
modal: 'javascript',
|
|
|
lineNumbers: true,
|
|
|
theme: 'railscasts',
|
|
|
indentUnit: 4,
|
|
|
matchBrackets: true,
|
|
|
autoRefresh: true,
|
|
|
smartIndent: true,
|
|
|
extraKeys: {
|
|
|
'Alt-/': 'autocomplete'
|
|
|
},
|
|
|
autofocus: true,
|
|
|
styleActiveLine: true,
|
|
|
lint: true,
|
|
|
linkurl: '',
|
|
|
gutters: ['CodeMirror-linenumbers', 'breakpoints', 'CodeMirror-lint-markers']
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var DirTree_AddFile = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var shixunsDetail = _ref3.shixunsDetail,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting,
|
|
|
user = _ref3.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(AddFile_AddFile));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/RenameFile.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RenameFile_excluded = ["shixunsDetail", "globalSetting", "loading", "user", "dispatch", "isRepository"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RenameFile_AddFile = function AddFile(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isRepository = _ref.isRepository,
|
|
|
props = objectWithoutProperties_default()(_ref, RenameFile_excluded);
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var shixunId = (0,react.useRef)();
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState3 = (0,react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
filePath = _useState4[0],
|
|
|
setFilePath = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
fileName = _useState6[0],
|
|
|
setFileName = _useState6[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (props.visible) {
|
|
|
form.resetFields();
|
|
|
}
|
|
|
}, [props.visible]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var pathArray = props.defaultPath.split('/');
|
|
|
// if (pathArray) {
|
|
|
// // 拼接成绝对路径
|
|
|
// const joinPath = pathArray.split(',').join('/');
|
|
|
// const path = joinPath.indexOf('/') === 0 ? joinPath.substr(1) : joinPath;
|
|
|
// setFilePath(path);
|
|
|
// }
|
|
|
if (pathArray.length === 1) {
|
|
|
setFilePath('');
|
|
|
setFileName(props.defaultPath);
|
|
|
} else {
|
|
|
setFileName(pathArray.pop());
|
|
|
setFilePath(pathArray.join('/') + '/');
|
|
|
}
|
|
|
}, [props.defaultPath]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _location$pathname, _location$pathname$sp;
|
|
|
shixunId.current = (_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : (_location$pathname$sp = _location$pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[2];
|
|
|
}, []);
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var values,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
values = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
|
_context.next = 3;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/moveGitFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
from: props.defaultPath,
|
|
|
to: filePath + values.path,
|
|
|
message: values.commitMessage || "".concat(props.defaultPath, " rename to ").concat(filePath).concat(values.path, " "),
|
|
|
secret_repository: isRepository
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
message/* default.success */.ZP.success('添加成功');
|
|
|
props.onOK({
|
|
|
path: values.path,
|
|
|
name: values.path
|
|
|
});
|
|
|
props.onClose();
|
|
|
// const returnUrl = isRepository.current ?
|
|
|
// `/shixuns/${shixunId.current}/repository${filePath ? `/master/shixun_show/${filePath}` : ""}` :
|
|
|
// `/shixuns/${shixunId.current}/secret_repository`;
|
|
|
// history.replace(returnUrl);
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleFinish() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleReturn = function handleReturn() {
|
|
|
var _location$pathname2, _location$pathname2$s;
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(shixunId.current, "/").concat((_location$pathname2 = location.pathname) === null || _location$pathname2 === void 0 ? void 0 : (_location$pathname2$s = _location$pathname2.split('/')) === null || _location$pathname2$s === void 0 ? void 0 : _location$pathname2$s[3]).concat(filePath ? "/master/shixun_show/".concat(filePath) : ''));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
width: "40%",
|
|
|
open: props.visible,
|
|
|
wrapClassName: AddFilemodules.modal,
|
|
|
centered: true,
|
|
|
onOk: function onOk() {
|
|
|
form.submit();
|
|
|
},
|
|
|
onCancel: props.onClose,
|
|
|
title: "\u63D0\u4EA4\u8BF4\u660E",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: AddFilemodules.bg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: AddFilemodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "mt10",
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
layout: "vertical",
|
|
|
onFinish: handleFinish,
|
|
|
onChange: function onChange() {
|
|
|
var _value$path, _arr$filter;
|
|
|
var value = objectSpread2_default()({}, form.getFieldsValue());
|
|
|
var arr = value === null || value === void 0 ? void 0 : (_value$path = value.path) === null || _value$path === void 0 ? void 0 : _value$path.split('');
|
|
|
if ((arr === null || arr === void 0 ? void 0 : (_arr$filter = arr.filter(function (item) {
|
|
|
return item == '/';
|
|
|
})) === null || _arr$filter === void 0 ? void 0 : _arr$filter.length) > 1) {
|
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
|
}
|
|
|
form.setFieldsValue(objectSpread2_default()({}, value));
|
|
|
setFormValue(value);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u91CD\u547D\u540D\uFF1A",
|
|
|
name: "path",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "path",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件名称'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0",
|
|
|
size: "large",
|
|
|
defaultValue: fileName
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
|
name: "commitMessage",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u5982\u4E0D\u586B\u5199\uFF0C\u9ED8\u8BA4\u63D0\u4EA4\u4FE1\u606F\u662F\uFF08".concat(props.defaultPath, " rename to \u65B0\u7684\u540D\u79F0 \uFF09"),
|
|
|
size: "large"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var RenameFile = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var shixunsDetail = _ref3.shixunsDetail,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting,
|
|
|
user = _ref3.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(RenameFile_AddFile));
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/style/index.js + 1 modules
|
|
|
var upload_style = __webpack_require__(13759);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/index.js + 20 modules
|
|
|
var upload = __webpack_require__(7426);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/UploadFile.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var UploadFilemodules = ({"wrap":"wrap___MBjkg","title":"title___kwzQt","path":"path___Dxzfe","colorBlue":"colorBlue___motxO"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/UploadFile.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UploadFile_excluded = ["shixunsDetail", "globalSetting", "loading", "user", "dispatch", "isRepository"];
|
|
|
|
|
|
|
|
|
|
|
|
// import SelectFilePathModal from '../../../../Detail/Repository/components/SelectFilePathModal'
|
|
|
// import SelectFilePathModal from '../../../../De/components/SelectFilePathModal';
|
|
|
|
|
|
|
|
|
|
|
|
var Dragger = upload/* default.Dragger */.Z.Dragger;
|
|
|
var UploadFile = function UploadFile(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isRepository = _ref.isRepository,
|
|
|
props = objectWithoutProperties_default()(_ref, UploadFile_excluded);
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var shixunId = (0,react.useRef)();
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState3 = (0,react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
fileList = _useState4[0],
|
|
|
setFileList = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
filePath = _useState6[0],
|
|
|
setFilePath = _useState6[1];
|
|
|
var filename;
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (props.visible) {
|
|
|
form.resetFields();
|
|
|
setFileList([]);
|
|
|
}
|
|
|
}, [props.visible]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
shixunId.current = params.taskId;
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var pathArray = sessionStorage.getItem('pathArray');
|
|
|
if (pathArray) {
|
|
|
// 拼接成绝对路径
|
|
|
var joinPath = pathArray.split(',').join('/');
|
|
|
var path = joinPath.indexOf('/') === 0 ? joinPath.substr(1) : joinPath;
|
|
|
setFilePath(path);
|
|
|
}
|
|
|
}, []);
|
|
|
var handleChangeFile = function handleChangeFile(info) {
|
|
|
filename = info.file.name;
|
|
|
if (info.file.status === 'done' || info.file.status === 'uploading') {
|
|
|
var _info$file$response, _info$file$response2, _info$file$response3;
|
|
|
setFileList(info.fileList);
|
|
|
if (!info.file.response) {
|
|
|
return;
|
|
|
}
|
|
|
if (((_info$file$response = info.file.response) === null || _info$file$response === void 0 ? void 0 : _info$file$response.status) === 0) {
|
|
|
message/* default.success */.ZP.success('上传成功!');
|
|
|
return;
|
|
|
}
|
|
|
setFileList(fileList.filter(function (item) {
|
|
|
return item.uid !== info.file.uid;
|
|
|
}));
|
|
|
((_info$file$response2 = info.file.response) === null || _info$file$response2 === void 0 ? void 0 : _info$file$response2.message) && message/* default.info */.ZP.info((_info$file$response3 = info.file.response) === null || _info$file$response3 === void 0 ? void 0 : _info$file$response3.message);
|
|
|
}
|
|
|
};
|
|
|
var handleRemoveFile = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(info) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (info.response) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.info */.ZP.info('还未上传完成,无法进行删除操作!');
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
_context.next = 5;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/deleteGitFile',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: filePath ? "".concat(filePath, "/").concat(info.name) : info.name,
|
|
|
message: form.getFieldValue('commitMessage') || "\u5220\u9664\u4E86".concat(filePath ? "".concat(filePath, "/").concat(info.name) : info.name),
|
|
|
secret_repository: isRepository ? null : true
|
|
|
}
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
setFileList(fileList.filter(function (item) {
|
|
|
return item.uid !== info.uid;
|
|
|
}));
|
|
|
message/* default.info */.ZP.info('删除成功');
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleRemoveFile(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var draggerProps = {
|
|
|
height: 300,
|
|
|
multiple: true,
|
|
|
withCredentials: true,
|
|
|
data: function () {
|
|
|
var _data = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(resolve, reject) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var v, data;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return form.getFieldsValue();
|
|
|
case 2:
|
|
|
v = _context2.sent;
|
|
|
data = objectSpread2_default()(objectSpread2_default()({}, {
|
|
|
path: !!props.defaultPath ? props.defaultPath : '',
|
|
|
message: formValue.commitMessage || "\u4E0A\u4F20\u4E86".concat(filename)
|
|
|
}), isRepository ? {} : {
|
|
|
secret_repository: true
|
|
|
});
|
|
|
resolve(data);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
})), 200);
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function (_x2, _x3) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}()));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
function data() {
|
|
|
return _data.apply(this, arguments);
|
|
|
}
|
|
|
return data;
|
|
|
}(),
|
|
|
fileList: fileList,
|
|
|
method: 'post',
|
|
|
action: "".concat(env/* default.API_SERVER */.Z.API_SERVER, "/api/sci/projects/").concat(shixunId.current, "/upload_git_file.json"),
|
|
|
onChange: handleChangeFile,
|
|
|
onRemove: handleRemoveFile,
|
|
|
beforeUpload: function beforeUpload(file) {
|
|
|
filename = file.name;
|
|
|
// if (!form.getFieldValue('commitMessage')) {
|
|
|
// message.info("上传文件请先填写提交信息");
|
|
|
// return false;
|
|
|
// }
|
|
|
}
|
|
|
};
|
|
|
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(values) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return form.validateFields();
|
|
|
case 2:
|
|
|
props.onClose();
|
|
|
props.onOK({
|
|
|
path: props.defaultPath
|
|
|
});
|
|
|
// handleReturn();
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function handleFinish(_x4) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleReturn = function handleReturn() {
|
|
|
var _location$pathname, _location$pathname$sp;
|
|
|
_umi_production_exports.history.push("/shixuns/".concat(shixunId.current, "/").concat((_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : (_location$pathname$sp = _location$pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[3]).concat(filePath ? "/master/shixun_show/".concat(filePath) : ''));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
open: props.visible,
|
|
|
onOk: handleFinish,
|
|
|
centered: true,
|
|
|
onCancel: props.onClose,
|
|
|
width: "70%",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: UploadFilemodules.bg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: UploadFilemodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: UploadFilemodules.title,
|
|
|
children: "\u4E0A\u4F20\u6587\u4EF6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "mt10",
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
layout: "vertical",
|
|
|
onFinish: handleFinish,
|
|
|
onValuesChange: function onValuesChange() {
|
|
|
return setFormValue(objectSpread2_default()({}, form.getFieldsValue()));
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
|
name: "commitMessage",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入提交信息'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u5FC5\u586B\uFF0C\u63CF\u8FF0\u4E3B\u8981\u4FEE\u6539\u5185\u5BB9\uFF08\u76F8\u5F53\u4E8EGit Commit message\u7684Header\uFF09"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u9009\u62E9\u6587\u4EF6",
|
|
|
name: "file",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择文件'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(Dragger, objectSpread2_default()(objectSpread2_default()({}, draggerProps), {}, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shangchuan font50 ".concat(UploadFilemodules.colorBlue)
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "font14 mt30",
|
|
|
children: ["\u62D6\u62FD\u6587\u4EF6\u6216", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(UploadFilemodules.colorBlue, " ml5"),
|
|
|
children: "\u70B9\u51FB\u6B64\u5904\u4E0A\u4F20"
|
|
|
})]
|
|
|
})]
|
|
|
}))
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var DirTree_UploadFile = ((0,_umi_production_exports.connect)(function (_ref6) {
|
|
|
var shixunsDetail = _ref6.shixunsDetail,
|
|
|
loading = _ref6.loading,
|
|
|
globalSetting = _ref6.globalSetting,
|
|
|
user = _ref6.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(UploadFile));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var DirTreemodules = ({"flex_box_center":"flex_box_center___ceC0y","flex_space_between":"flex_space_between___K6rVh","flex_box_vertical_center":"flex_box_vertical_center___agfJS","flex_box_center_end":"flex_box_center_end___YIze7","flex_box_column":"flex_box_column___E4huF","headLeft":"headLeft___Xwji1","colorBlue":"colorBlue_____BeE","wrap":"wrap___KU5Kb","nodata":"nodata___HezS3","nodataText":"nodataText___bdADB","content":"content___O0OuF","gitCode":"gitCode___oC8AX","ellipsis":"ellipsis___gxBif","menu":"menu___UMSQf","overlayClass":"overlayClass___pY72Q","tips":"tips___Q04Oz"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/SelectFilePathModal/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var SelectFilePathModalmodules = ({"wrap":"wrap___FeZrl","content":"content___nhYt_","mainPathWrap":"mainPathWrap___pggnV","colorBlue":"colorBlue___TPUPy"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/SelectFilePathModal/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SelectFilePathModal = function SelectFilePathModal(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
title = _ref.title,
|
|
|
_ref$pathList = _ref.pathList,
|
|
|
propsPathList = _ref$pathList === void 0 ? [] : _ref$pathList,
|
|
|
_ref$showInputPath = _ref.showInputPath,
|
|
|
showInputPath = _ref$showInputPath === void 0 ? false : _ref$showInputPath,
|
|
|
_ref$isMergeSelectFil = _ref.isMergeSelectFile,
|
|
|
isMergeSelectFile = _ref$isMergeSelectFil === void 0 ? false : _ref$isMergeSelectFil,
|
|
|
_ref$onFinish = _ref.onFinish,
|
|
|
onFinish = _ref$onFinish === void 0 ? function () {} : _ref$onFinish;
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var isRepository = (0,react.useRef)();
|
|
|
var _useState = (0,react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
selectPath = _useState2[0],
|
|
|
setSelectPath = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
originPath = _useState4[0],
|
|
|
setOriginPath = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
mainPathList = _useState6[0],
|
|
|
setMainPathList = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)([]),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
treeList = _useState8[0],
|
|
|
setTreeList = _useState8[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _location$pathname, _location$pathname$sp;
|
|
|
isRepository.current = ((_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : (_location$pathname$sp = _location$pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[3]) === 'repository';
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (shixunsDetail.actionTabs.key !== 'Repository-SelectFilePath') {
|
|
|
return;
|
|
|
}
|
|
|
var path = propsPathList.join('/');
|
|
|
var arr = [];
|
|
|
propsPathList.map(function (item, index) {
|
|
|
if (index === 0) {
|
|
|
arr.push({
|
|
|
val: '根目录',
|
|
|
path: ''
|
|
|
}, {
|
|
|
val: "/".concat(item),
|
|
|
path: path
|
|
|
});
|
|
|
} else {
|
|
|
arr.push({
|
|
|
val: "/".concat(item),
|
|
|
path: path
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
setMainPathList(arr);
|
|
|
setSelectPath(path);
|
|
|
setOriginPath(path);
|
|
|
handleGetPathData(path);
|
|
|
}, [shixunsDetail.actionTabs.key]);
|
|
|
var handleGetPathData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(path) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return dispatch({
|
|
|
type: isRepository.current ? 'shixunsDetail/getRepository' : 'shixunsDetail/getSecretRepository',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: path
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res) {
|
|
|
setTreeList(res.trees || []);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleGetPathData(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleClickTree = function handleClickTree(item) {
|
|
|
var newPath = selectPath;
|
|
|
if (item.type === 'tree') {
|
|
|
mainPathList.length ? mainPathList.push({
|
|
|
val: "/".concat(item.name),
|
|
|
path: item.name
|
|
|
}) : mainPathList.push({
|
|
|
val: '根目录',
|
|
|
path: ''
|
|
|
}, {
|
|
|
val: "/".concat(item.name),
|
|
|
path: item.name
|
|
|
});
|
|
|
setMainPathList(mainPathList);
|
|
|
newPath = selectPath ? "".concat(selectPath, "/").concat(item.name) : item.name;
|
|
|
setSelectPath(newPath);
|
|
|
}
|
|
|
handleGetPathData(newPath);
|
|
|
};
|
|
|
var handleClickMainPath = function handleClickMainPath(item, index) {
|
|
|
var currentPathList = mainPathList.filter(function (_, key) {
|
|
|
return key <= index;
|
|
|
});
|
|
|
setMainPathList(currentPathList);
|
|
|
// 排除 ”根目录“,将选中的路径连接,去掉第一个字符串 “/”,获取绝对路径
|
|
|
var currentPath = currentPathList.filter(function (_, key) {
|
|
|
return key !== 0;
|
|
|
}).map(function (item) {
|
|
|
return item.val;
|
|
|
}).join('').substr(1);
|
|
|
setSelectPath(currentPath);
|
|
|
handleGetPathData(currentPath);
|
|
|
};
|
|
|
var handleOk = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var values, path, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
values = form === null || form === void 0 ? void 0 : form.getFieldsValue();
|
|
|
path = selectPath ? "".concat(selectPath).concat(values !== null && values !== void 0 && values.name ? "/".concat(values === null || values === void 0 ? void 0 : values.name) : '') : values === null || values === void 0 ? void 0 : values.name;
|
|
|
if (!isMergeSelectFile) {
|
|
|
_context2.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
onFinish(path);
|
|
|
handleCancel();
|
|
|
return _context2.abrupt("return");
|
|
|
case 6:
|
|
|
if (!showInputPath) {
|
|
|
_context2.next = 16;
|
|
|
break;
|
|
|
}
|
|
|
_context2.next = 9;
|
|
|
return form.validateFields();
|
|
|
case 9:
|
|
|
_context2.next = 11;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/uploadGitFolder',
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, {
|
|
|
id: params.taskId,
|
|
|
path: path
|
|
|
}), isRepository.current ? {} : {
|
|
|
secret_repository: true
|
|
|
})
|
|
|
});
|
|
|
case 11:
|
|
|
res = _context2.sent;
|
|
|
onFinish(originPath);
|
|
|
if (res.status === 0) {
|
|
|
message/* default.info */.ZP.info('新建成功');
|
|
|
}
|
|
|
_context2.next = 18;
|
|
|
break;
|
|
|
case 16:
|
|
|
onFinish(path);
|
|
|
message/* default.success */.ZP.success('选择文件目录成功');
|
|
|
case 18:
|
|
|
handleCancel();
|
|
|
case 19:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleOk() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleCancel = function handleCancel() {
|
|
|
dispatch({
|
|
|
type: 'shixunsDetail/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
form.resetFields();
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
title: title || '新建文件夹',
|
|
|
closable: false,
|
|
|
keyboard: false,
|
|
|
open: shixunsDetail.actionTabs.key === 'Repository-SelectFilePath',
|
|
|
onOk: handleOk,
|
|
|
onCancel: handleCancel,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: SelectFilePathModalmodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: SelectFilePathModalmodules.content,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: SelectFilePathModalmodules.mainPathWrap,
|
|
|
children: !!(mainPathList !== null && mainPathList !== void 0 && mainPathList.length) && mainPathList.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: function onClick() {
|
|
|
return handleClickMainPath(item, index);
|
|
|
},
|
|
|
children: item.val
|
|
|
}, index);
|
|
|
})
|
|
|
}), !!(treeList !== null && treeList !== void 0 && treeList.length) && treeList.map(function (item, index) {
|
|
|
return item.type === 'tree' && /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
onClick: function onClick() {
|
|
|
return handleClickTree(item);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-wenjianjia ".concat(SelectFilePathModalmodules.colorBlue)
|
|
|
}), item.name]
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
className: "mt5",
|
|
|
children: "\u9009\u4E2D\u7684\u65B0\u5EFA\u6587\u4EF6\u5939\u76EE\u5F55\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5 mb5",
|
|
|
children: selectPath
|
|
|
}), showInputPath && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
className: "mt20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "name",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入名称'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u65B0\u6587\u4EF6\u5939\u540D/\u5B50\u6587\u4EF6\u5939\u540D\u3002\uFF08\u5982\uFF1Asrc/step1\uFF09"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var DirTree_SelectFilePathModal = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var shixunsDetail = _ref4.shixunsDetail,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(SelectFilePathModal));
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/EllipsisOutlined.js
|
|
|
var EllipsisOutlined = __webpack_require__(3471);
|
|
|
// EXTERNAL MODULE: ./src/service/shixuns.ts
|
|
|
var shixuns = __webpack_require__(56088);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./src/utils/verifyLogin.tsx + 3 modules
|
|
|
var verifyLogin = __webpack_require__(72551);
|
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 31 modules
|
|
|
var ImagesIcon = __webpack_require__(44190);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/DirTree/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DirTree_excluded = ["shixunsDetail", "globalSetting", "loading", "user", "activeKey", "dispatch", "practiceSetting", "isRepository", "treeData", "setTreeData", "haveAuth"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DirectoryTree = tree/* default.DirectoryTree */.Z.DirectoryTree;
|
|
|
var Repository = function Repository(_ref) {
|
|
|
var _shixunsDetail$detail4, _shixunsDetail$detail5;
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
activeKey = _ref.activeKey,
|
|
|
dispatch = _ref.dispatch,
|
|
|
practiceSetting = _ref.practiceSetting,
|
|
|
isRepository = _ref.isRepository,
|
|
|
treeData = _ref.treeData,
|
|
|
setTreeData = _ref.setTreeData,
|
|
|
haveAuth = _ref.haveAuth,
|
|
|
props = objectWithoutProperties_default()(_ref, DirTree_excluded);
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
// const isRepository = useRef<boolean>()
|
|
|
var _useState = (0,react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
checkedValue = _useState2[0],
|
|
|
setCheckedValue = _useState2[1];
|
|
|
// const [treeData, setTreeData] = useState([]);
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
showAddFile = _useState4[0],
|
|
|
setShowAddFile = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
showRenameFile = _useState6[0],
|
|
|
setShowRenameFile = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
showAddFolder = _useState8[0],
|
|
|
setShowAddFolder = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(false),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
showUploadFile = _useState10[0],
|
|
|
setShowUploadFile = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)(''),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
defaultPath = _useState12[0],
|
|
|
setDefaultPath = _useState12[1];
|
|
|
var _useState13 = (0,react.useState)([]),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
expandedKeys = _useState14[0],
|
|
|
setExpandedKeys = _useState14[1];
|
|
|
var _useState15 = (0,react.useState)([]),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
selectedKeys = _useState16[0],
|
|
|
setSelectedKeys = _useState16[1];
|
|
|
var _useState17 = (0,react.useState)([]),
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
treeList = _useState18[0],
|
|
|
setTreeList = _useState18[1];
|
|
|
var _useState19 = (0,react.useState)(false),
|
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
|
visibleTip = _useState20[0],
|
|
|
setVisibleTip = _useState20[1];
|
|
|
var _useState21 = (0,react.useState)(),
|
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
|
commitInfo = _useState22[0],
|
|
|
setCommitInfo = _useState22[1];
|
|
|
var _useState23 = (0,react.useState)(),
|
|
|
_useState24 = slicedToArray_default()(_useState23, 2),
|
|
|
secretDirPath = _useState24[0],
|
|
|
setSecretDirPath = _useState24[1];
|
|
|
var _useState25 = (0,react.useState)(''),
|
|
|
_useState26 = slicedToArray_default()(_useState25, 2),
|
|
|
pathList = _useState26[0],
|
|
|
setPathList = _useState26[1];
|
|
|
var _useState27 = (0,react.useState)(),
|
|
|
_useState28 = slicedToArray_default()(_useState27, 2),
|
|
|
newMergeValue = _useState28[0],
|
|
|
setNewMergeValue = _useState28[1];
|
|
|
var _useState29 = (0,react.useState)(false),
|
|
|
_useState30 = slicedToArray_default()(_useState29, 2),
|
|
|
isMergeSelectFile = _useState30[0],
|
|
|
setIsMergeSelectFile = _useState30[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
setTreeData([]);
|
|
|
handleGetRepository('');
|
|
|
if (!localStorage.warehouseHideTip) {
|
|
|
setVisibleTip(true);
|
|
|
}
|
|
|
}, [location.pathname, isRepository]);
|
|
|
var handleMergeSelectFile = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var path,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
path = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
|
_context.next = 3;
|
|
|
return (0,shixuns/* setSecretDir */.Zt)({
|
|
|
id: params.taskId,
|
|
|
secret_dir_path: path
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
res && setNewMergeValue(path);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleMergeSelectFile() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var menu = function menu(item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_menu/* default */.Z, {
|
|
|
className: DirTreemodules.menu,
|
|
|
onClick: function onClick(value) {
|
|
|
setDefaultPath(item.path || '');
|
|
|
switch (value.key) {
|
|
|
case '1':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '新建文件']);
|
|
|
setShowAddFile(true);
|
|
|
break;
|
|
|
case '2':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '新建文件夹']);
|
|
|
setShowAddFolder(true);
|
|
|
break;
|
|
|
case '3':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '上传']);
|
|
|
setShowUploadFile(true);
|
|
|
break;
|
|
|
case '4':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '重命名']);
|
|
|
setShowRenameFile(true);
|
|
|
break;
|
|
|
case '5':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '删除']);
|
|
|
handleDeleteFile(item.path, item.name, item);
|
|
|
break;
|
|
|
case '6':
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', '复制路径']);
|
|
|
copyFilePath(item);
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
children: [(item.type === 'topTree' || item.type === 'tree') && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: "\u65B0\u5EFA\u6587\u4EF6"
|
|
|
}, "1"), (item.type === 'topTree' || item.type === 'tree') && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: "\u65B0\u5EFA\u6587\u4EF6\u5939"
|
|
|
}, "2"), (item.type === 'topTree' || item.type === 'tree') && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: "\u4E0A\u4F20"
|
|
|
}, "3"), item.type !== 'topTree' && item.type !== 'tree' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: "\u91CD\u547D\u540D"
|
|
|
}, "4"), item.type !== 'topTree' && /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
|
text: "/data/workspace/myshixun/".concat(!isRepository ? 'secret/' : '').concat(item === null || item === void 0 ? void 0 : item.path),
|
|
|
onCopy: function onCopy() {
|
|
|
return message/* default.success */.ZP.success('复制成功');
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: "\u590D\u5236\u8DEF\u5F84"
|
|
|
})
|
|
|
}, "6")
|
|
|
}), item.type !== 'topTree' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
children: "\u5220\u9664"
|
|
|
}, "5")]
|
|
|
});
|
|
|
};
|
|
|
var createDom = function createDom(data, path) {
|
|
|
return data.map(function (item) {
|
|
|
if (path == '') {
|
|
|
item.path = path + item.name;
|
|
|
} else {
|
|
|
item.path = path + '/' + item.name;
|
|
|
}
|
|
|
item.title = /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "font14",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "20px",
|
|
|
children: item.type === 'blob' && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "iconfont icon-wenjian11 font12"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: " multi_ellipsis1",
|
|
|
children: item.name
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), haveAuth && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: (item.type === 'blob' || item.type === 'tree') && /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
|
|
|
dropdownRender: function dropdownRender() {
|
|
|
return menu(item);
|
|
|
},
|
|
|
className: DirTreemodules.ellipsis,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-gengduo2 c-555a88"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
item.disableCheckbox = checkedValue && checkedValue !== item.name;
|
|
|
item.className = item.type === 'tree' ? DirTreemodules.pl23 : '';
|
|
|
item.checkable = item.type !== 'tree';
|
|
|
item.isLeaf = item.type !== 'tree';
|
|
|
item.children = item.type === 'tree' && [];
|
|
|
item.key = item.path;
|
|
|
return item;
|
|
|
});
|
|
|
};
|
|
|
var selectPath = function selectPath(path) {
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
selectPath: path
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var insertFile = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(path, name) {
|
|
|
var pathArr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
pathArr = path.split('/');
|
|
|
_context2.next = 3;
|
|
|
return handleGetRepository(defaultPath);
|
|
|
case 3:
|
|
|
setTimeout(function () {
|
|
|
selectPath(path);
|
|
|
expandedKeys = [pathArr[0] || ''];
|
|
|
selectedKeys = [path];
|
|
|
setSelectedKeys(toConsumableArray_default()(selectedKeys));
|
|
|
setExpandedKeys(toConsumableArray_default()(expandedKeys));
|
|
|
}, 150);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function insertFile(_x, _x2) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var insertData = function insertData(data, path) {
|
|
|
if (path == '') {
|
|
|
treeData = toConsumableArray_default()(data);
|
|
|
setTreeData(toConsumableArray_default()(data));
|
|
|
} else {
|
|
|
var d = updateTreeData(treeData, path, data);
|
|
|
treeData = d;
|
|
|
setTreeData([].concat(d));
|
|
|
}
|
|
|
};
|
|
|
function updateTreeData(list, key, children) {
|
|
|
return list.map(function (node) {
|
|
|
if (node.key === key) {
|
|
|
node.children = toConsumableArray_default()(children);
|
|
|
return objectSpread2_default()({}, node);
|
|
|
} else if (node.children) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, node), {}, {
|
|
|
children: updateTreeData(node.children, key, children)
|
|
|
});
|
|
|
}
|
|
|
return node;
|
|
|
});
|
|
|
}
|
|
|
var handleGetRepository = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var path,
|
|
|
res,
|
|
|
_res$trees,
|
|
|
_res$commits,
|
|
|
d,
|
|
|
_args3 = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
path = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : '';
|
|
|
_context3.next = 3;
|
|
|
return dispatch({
|
|
|
type: isRepository ? 'shixunsDetail/getRepositorys' : 'shixunsDetail/getSecretRepository',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: path
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context3.sent;
|
|
|
if (res) {
|
|
|
if (!!((_res$trees = res.trees) !== null && _res$trees !== void 0 && _res$trees.length)) {
|
|
|
d = createDom(toConsumableArray_default()(res.trees), path);
|
|
|
insertData(d, path);
|
|
|
setTreeList(res.trees || []);
|
|
|
setSecretDirPath(path || '');
|
|
|
console.log('handleGetRepository:', d, path);
|
|
|
setTimeout(function () {
|
|
|
return console.log(treeData, res.trees, path, 999999);
|
|
|
}, 2000);
|
|
|
} else if (path == '') {
|
|
|
setTreeData([]);
|
|
|
}
|
|
|
setCommitInfo(((_res$commits = res.commits) === null || _res$commits === void 0 ? void 0 : _res$commits[0]) || {});
|
|
|
}
|
|
|
return _context3.abrupt("return", res);
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleGetRepository() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var loadData = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(selectedKeys) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(resolve, reject) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
if (!!selectedKeys.children.length) {
|
|
|
resolve();
|
|
|
}
|
|
|
setPathList(selectedKeys.path);
|
|
|
_context4.next = 4;
|
|
|
return handleGetRepository(selectedKeys.path);
|
|
|
case 4:
|
|
|
resolve();
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function (_x4, _x5) {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}()));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function loadData(_x3) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleSelectTree = /*#__PURE__*/function () {
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(selectedKeys, data) {
|
|
|
var toNext, _practiceSetting$side;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
console.log('handleSelectTree', selectedKeys, data.nativeEvent.target.nodeName, data);
|
|
|
toNext = function toNext() {
|
|
|
selectPath(data.node.path);
|
|
|
selectedKeys = [data.node.path];
|
|
|
setSelectedKeys(toConsumableArray_default()(selectedKeys));
|
|
|
};
|
|
|
if (!(data.nativeEvent.target.nodeName === 'svg' || data.nativeEvent.target.nodeName === 'LI' || data.nativeEvent.target.nodeName === 'I')) {
|
|
|
_context6.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
return _context6.abrupt("return");
|
|
|
case 4:
|
|
|
if (data.node.type === 'blob') {
|
|
|
if (practiceSetting !== null && practiceSetting !== void 0 && (_practiceSetting$side = practiceSetting.sideBar) !== null && _practiceSetting$side !== void 0 && _practiceSetting$side.confirmLeave) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '离开此页提示',
|
|
|
content: '系统可能不会保存您所做的更改。',
|
|
|
okText: '离开',
|
|
|
cancelText: '取消',
|
|
|
onOk: function onOk() {
|
|
|
toNext();
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
confirmLeave: false
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
toNext();
|
|
|
}
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return function handleSelectTree(_x6, _x7) {
|
|
|
return _ref7.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleDeleteFile = function handleDeleteFile(path, name, item) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
centered: true,
|
|
|
title: "\u786E\u8BA4\u9700\u8981\u5220\u9664\u8BE5\u6587\u4EF6".concat(item.children ? '夹' : '', "?"),
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
|
var res, pathArr, res2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
_context7.next = 2;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/deleteGitFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: path,
|
|
|
message: "\u5220\u9664".concat(path),
|
|
|
secret_repository: isRepository ? null : true
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context7.sent;
|
|
|
pathArr = path.split('/');
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) === 0)) {
|
|
|
_context7.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.info */.ZP.info('删除成功');
|
|
|
pathArr.splice(pathArr.length - 1, 1);
|
|
|
_context7.next = 9;
|
|
|
return handleGetRepository(pathArr.length > 1 ? pathArr.join('/') : '');
|
|
|
case 9:
|
|
|
res2 = _context7.sent;
|
|
|
if (!(res2 !== null && res2 !== void 0 && res2.trees)) {
|
|
|
_context7.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
_context7.next = 16;
|
|
|
break;
|
|
|
case 13:
|
|
|
pathArr.splice(pathArr.length - 1, 1);
|
|
|
_context7.next = 16;
|
|
|
return handleGetRepository(pathArr.length > 1 ? pathArr.join('/') : '');
|
|
|
case 16:
|
|
|
selectPath('');
|
|
|
return _context7.abrupt("return", true);
|
|
|
case 20:
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '删除失败',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u8BE5\u6587\u4EF6\u201C", path, "\u201D\u5DF2\u7ECF\u88AB\u4EFB\u52A1\u5173\u5361\u7684\u5B66\u5458\u4EFB\u52A1\u6587\u4EF6\u6216\u8BC4\u6D4B\u6267\u884C\u6587\u4EF6\u4F7F\u7528\uFF0C\u8BF7\u5148\u4FEE\u6539\u4EFB\u52A1\u5173\u5361\u4E2D\u8BC4\u6D4B\u8BBE\u7F6E\u7684\u6587\u4EF6\u8DEF\u5F84\u540E\u518D\u5220\u9664\u3002"]
|
|
|
}),
|
|
|
okText: '前往修改',
|
|
|
cancelText: '取消',
|
|
|
onOk: function onOk() {
|
|
|
window.location.href = "/shixuns/".concat(params.taskId, "/edit/").concat(res === null || res === void 0 ? void 0 : res.message, "/tab=2");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 21:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var copyFilePath = function copyFilePath(item) {
|
|
|
//事件待定
|
|
|
console.log(item, 'item');
|
|
|
};
|
|
|
var handleExpand = /*#__PURE__*/function () {
|
|
|
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(key, node) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
console.log('handleExpand', node);
|
|
|
if (!(node.nativeEvent.target.nodeName === 'svg' || node.nativeEvent.target.nodeName === 'path' || node.nativeEvent.target.nodeName === 'LI')) {
|
|
|
_context8.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
return _context8.abrupt("return", true);
|
|
|
case 5:
|
|
|
_context8.next = 7;
|
|
|
return loadData(node.node);
|
|
|
case 7:
|
|
|
if (expandedKeys.includes(node.node.path)) {
|
|
|
expandedKeys.splice(expandedKeys.indexOf(node.node.path), 1);
|
|
|
} else {
|
|
|
expandedKeys.push(node.node.path);
|
|
|
}
|
|
|
case 8:
|
|
|
setExpandedKeys(toConsumableArray_default()(expandedKeys));
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8);
|
|
|
}));
|
|
|
return function handleExpand(_x8, _x9) {
|
|
|
return _ref8.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var closeTip = function closeTip() {
|
|
|
setVisibleTip(false);
|
|
|
localStorage.warehouseHideTip = true;
|
|
|
};
|
|
|
var handleChange = /*#__PURE__*/function () {
|
|
|
var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9(checked) {
|
|
|
var _shixunsDetail$detail;
|
|
|
var content, title, okText, cancelText;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
title = '';
|
|
|
_context9.t0 = isRepository;
|
|
|
_context9.next = _context9.t0 === true ? 4 : _context9.t0 === false ? 9 : 11;
|
|
|
break;
|
|
|
case 4:
|
|
|
title = '开启版本库';
|
|
|
okText = '开启';
|
|
|
cancelText = '不开启';
|
|
|
content = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u65B0\u5EFA\u5B9E\u8DF5\u9898\u5173\u5361\u65F6\uFF0C\u9700\u8981\u4F7F\u7528\u4EE3\u7801\u4ED3\u5E93\uFF1B\u5982\u679C\u53EA\u6709\u9009\u62E9\u9898\u5173\u5361\uFF0C\u5219\u4E0D\u9700\u8981\u4EE3\u7801\u4ED3\u5E93\u3002\u4EE3\u7801\u4ED3\u5E93\u542F\u7528\u540E\uFF0C\u5C06\u65E0\u6CD5\u5173\u95ED\u3002"
|
|
|
});
|
|
|
return _context9.abrupt("break", 11);
|
|
|
case 9:
|
|
|
if (shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail = shixunsDetail.detail) !== null && _shixunsDetail$detail !== void 0 && _shixunsDetail$detail.secret_repository) {
|
|
|
title = '关闭私密代码仓库';
|
|
|
okText = '确定';
|
|
|
cancelText = '取消';
|
|
|
content = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5173\u95ED\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93\u540E\uFF0C\u5DF2\u521B\u5EFA\u7684\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93\u53CA\u5176\u5185\u5BB9\uFF0C\u5C06\u88AB\u5220\u9664\u3002\u786E\u8BA4\u8981\u5173\u95ED\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93\uFF1F"
|
|
|
});
|
|
|
} else {
|
|
|
title = '开启私密代码仓库';
|
|
|
okText = '不使用';
|
|
|
cancelText = '使用';
|
|
|
content = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u79C1\u5BC6\u7248\u672C\u5E93\u7684\u6587\u4EF6\u5BF9\u5B66\u5458\u59CB\u7EC8\u9690\u85CF\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u67E5\u770B\u3002\u9002\u7528\u4E8E\u547D\u4EE4\u884C\u3001\u56FE\u5F62\u5316\u684C\u9762\u4E24\u7C7B\u5B9E\u8BAD\uFF0C\u5176\u4ED6\u7C7B\u578B\u5B9E\u8BAD\u4E0D\u5EFA\u8BAE\u4F7F\u7528\u79C1\u5BC6\u7248\u672C\u5E93\u3002"
|
|
|
});
|
|
|
}
|
|
|
return _context9.abrupt("break", 11);
|
|
|
case 11:
|
|
|
if (!(!isRepository && (0,verifyLogin/* ShixunStatusModel */.gy)(dispatch, '不能开启/关闭私密代码仓库'))) {
|
|
|
_context9.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
return _context9.abrupt("return");
|
|
|
case 13:
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: title,
|
|
|
okText: okText,
|
|
|
cancelText: cancelText,
|
|
|
content: content,
|
|
|
onOk: function onOk() {
|
|
|
var _shixunsDetail$detail2;
|
|
|
(0,util/* trackEvent */.L9)(['实践项目', '设置', '代码仓库', title]);
|
|
|
if (!isRepository && !(shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail2 = shixunsDetail.detail) !== null && _shixunsDetail$detail2 !== void 0 && _shixunsDetail$detail2.secret_repository)) {} else {
|
|
|
handleChangeNext(checked);
|
|
|
}
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
var _shixunsDetail$detail3;
|
|
|
if (!isRepository && !(shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail3 = shixunsDetail.detail) !== null && _shixunsDetail$detail3 !== void 0 && _shixunsDetail$detail3.secret_repository)) {
|
|
|
handleChangeNext(checked);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
return function handleChange(_x10) {
|
|
|
return _ref9.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChangeNext = /*#__PURE__*/function () {
|
|
|
var _ref10 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10(checked) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
if (!isRepository) {
|
|
|
_context10.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
_context10.next = 3;
|
|
|
return (0,shixuns/* createRepositorys */.Vx)({
|
|
|
id: params.taskId
|
|
|
});
|
|
|
case 3:
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/getCommonData',
|
|
|
payload: {
|
|
|
id: params.taskId
|
|
|
}
|
|
|
});
|
|
|
_context10.next = 8;
|
|
|
break;
|
|
|
case 6:
|
|
|
_context10.next = 8;
|
|
|
return (0,shixuns/* createSecretRepository */.K0)({
|
|
|
id: params.taskId,
|
|
|
is_secret_repository: checked
|
|
|
});
|
|
|
case 8:
|
|
|
handleGetRepository();
|
|
|
dispatch({
|
|
|
type: 'shixunsDetail/getShixunsDetail',
|
|
|
payload: {
|
|
|
id: params.taskId
|
|
|
}
|
|
|
});
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10);
|
|
|
}));
|
|
|
return function handleChangeNext(_x11) {
|
|
|
return _ref10.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var onDragEnter = function onDragEnter(info) {
|
|
|
console.log(info);
|
|
|
// expandedKeys 需要受控时设置
|
|
|
// this.setState({
|
|
|
// expandedKeys: info.expandedKeys,
|
|
|
// });
|
|
|
};
|
|
|
|
|
|
var onDrop = /*#__PURE__*/function () {
|
|
|
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11(info) {
|
|
|
var dropKey, dragKey, dropPos, dropPosition, res, i, loop, data, dragObj, ar, _i2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
case 0:
|
|
|
console.log(info);
|
|
|
dropKey = info.node.key;
|
|
|
dragKey = info.dragNode.key;
|
|
|
dropPos = info.node.pos.split('-');
|
|
|
dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
|
|
if (!(info.dragNode.type === 'tree')) {
|
|
|
_context11.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('不支持文件夹移动目录');
|
|
|
return _context11.abrupt("return");
|
|
|
case 8:
|
|
|
if (!(info.node.type !== 'tree')) {
|
|
|
_context11.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
//
|
|
|
message/* default.warn */.ZP.warn('未移动文件目录位置');
|
|
|
return _context11.abrupt("return");
|
|
|
case 11:
|
|
|
_context11.next = 13;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/moveGitFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
from: info.dragNode.path,
|
|
|
to: info.node.path + '/' + info.dragNode.name,
|
|
|
message: "".concat(info.dragNode.path, " move to ").concat(info.node.path + '/' + info.dragNode.name, " ")
|
|
|
}
|
|
|
});
|
|
|
case 13:
|
|
|
res = _context11.sent;
|
|
|
if (!(res.status === 0)) {
|
|
|
_context11.next = 26;
|
|
|
break;
|
|
|
}
|
|
|
selectPath('');
|
|
|
_context11.next = 18;
|
|
|
return handleGetRepository('');
|
|
|
case 18:
|
|
|
i = 0;
|
|
|
case 19:
|
|
|
if (!(i < expandedKeys.length)) {
|
|
|
_context11.next = 26;
|
|
|
break;
|
|
|
}
|
|
|
if (!(expandedKeys[i] != '')) {
|
|
|
_context11.next = 23;
|
|
|
break;
|
|
|
}
|
|
|
_context11.next = 23;
|
|
|
return handleGetRepository(expandedKeys[i]);
|
|
|
case 23:
|
|
|
i++;
|
|
|
_context11.next = 19;
|
|
|
break;
|
|
|
case 26:
|
|
|
return _context11.abrupt("return");
|
|
|
case 32:
|
|
|
case "end":
|
|
|
return _context11.stop();
|
|
|
}
|
|
|
}, _callee11);
|
|
|
}));
|
|
|
return function onDrop(_x12) {
|
|
|
return _ref11.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: DirTreemodules.bg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: DirTreemodules.contentbg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DirTreemodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: DirTreemodules.gitCode,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: '1',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "iconfont icon-daimacangku2 mr8"
|
|
|
}), isRepository ? '代码仓库' : '私密代码仓库']
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: haveAuth && /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
|
|
|
dropdownRender: function dropdownRender() {
|
|
|
return menu({
|
|
|
type: 'topTree'
|
|
|
});
|
|
|
},
|
|
|
className: "current",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(tooltip/* default */.Z, {
|
|
|
open: visibleTip,
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "font16",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(EllipsisOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
position: 'relative',
|
|
|
left: -35
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return closeTip();
|
|
|
}
|
|
|
}), "\u70B9\u51FB\u6B64\u5904\u65B0\u5EFA\u6587\u4EF6\u3001\u65B0\u5EFA\u6587\u4EF6\u5939\u3001\u4E0A\u4F20\u6587\u4EF6\u3002", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return closeTip();
|
|
|
},
|
|
|
className: "iconfont icon-guanbi1 ml8 current font14"
|
|
|
})]
|
|
|
}),
|
|
|
overlayClassName: DirTreemodules.overlayClass,
|
|
|
overlayStyle: {
|
|
|
maxWidth: 500
|
|
|
},
|
|
|
arrowPointAtCenter: true,
|
|
|
placement: "right",
|
|
|
color: "#F7B500",
|
|
|
children: [isRepository && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-gengduo2 c-555a88"
|
|
|
}), !isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$detail4 = shixunsDetail.detail) === null || _shixunsDetail$detail4 === void 0 ? void 0 : _shixunsDetail$detail4.secret_repository) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-gengduo2 c-555a88"
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), !!treeData.length && !isRepository && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20 pl20 pr20 font14 c-white",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5B9E\u8BAD\u8BC4\u6D4B\u7684\u65F6\u5019\uFF0C\u7CFB\u7EDF\u4F1A\u4E34\u65F6\u5C06\u79C1\u5BC6\u4EE3\u7801\u5E93\u79FB\u52A8\u666E\u901A\u4EE3\u7801\u5E93\u7684secret\u76EE\u5F55\u4E0B\u9762\uFF0C\u8BC4\u6D4B\u7ED3\u675F\u4F1A\u6E05\u7A7Asecret\u76EE\u5F55\u5185\u5BB9\u3002\u5982\u679C\u79C1\u5BC6\u4EE3\u7801\u5E93\u4E2D\u5B58\u5728\u6587\u4EF6src/test.sh\uFF0C\u5728\u666E\u901A\u4EE3\u7801\u5E93\u8C03\u7528\u8BE5\u6587\u4EF6\u5219\u4F7F\u7528\u8DEF\u5F84\uFF1Asecret/src/test.sh"
|
|
|
})
|
|
|
}), treeData.length ? /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DirTreemodules.content,
|
|
|
children: [activeKey === '1' && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DirTreemodules.tips,
|
|
|
children: ["\u63D0\u793A\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u4EE3\u7801\u8FD0\u884C\u5728\u670D\u52A1\u5668/data/workspace/myshixun/\u4E0B\uFF0C\u5982\u679C\u4EE3\u7801 \u9700\u8981\u7528\u5230\u6587\u4EF6\u8DEF\u5F84\u65F6\uFF0C\u60A8\u5C06\u9F20\u6807\u79FB\u5165\u4ED3\u5E93\u6587\u4EF6\u6216\u76EE\u5F55\u53F3\u4FA7\u7684\"...\" \u56FE\u6807\uFF0C\u9009\u62E9\u590D\u5236\u8DEF\u5F84\u5F97\u5230\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DirectoryTree
|
|
|
// checkable={editable}
|
|
|
, {
|
|
|
disabled: !!loading.effects['shixunsDetail/getFileContents'],
|
|
|
multiple: true,
|
|
|
showIcon: false,
|
|
|
treeData: treeData,
|
|
|
switcherIcon: /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
fontWeight: 'bold',
|
|
|
fontSize: 14,
|
|
|
position: 'relative',
|
|
|
top: 3,
|
|
|
marginLeft: 22
|
|
|
}
|
|
|
}),
|
|
|
onExpand: handleExpand,
|
|
|
expandedKeys: expandedKeys,
|
|
|
selectedKeys: selectedKeys
|
|
|
// loadData={loadData}
|
|
|
// loadedKeys={[]}
|
|
|
,
|
|
|
onSelect: handleSelectTree,
|
|
|
draggable: true,
|
|
|
onDragEnter: onDragEnter,
|
|
|
onDrop: onDrop,
|
|
|
allowDrop: function allowDrop(_ref12) {
|
|
|
var dropNode = _ref12.dropNode,
|
|
|
dropPosition = _ref12.dropPosition;
|
|
|
return false;
|
|
|
}
|
|
|
// onCheck={handleCheckTree}
|
|
|
})]
|
|
|
})
|
|
|
}) : '', !treeData.length && isRepository && /*#__PURE__*/(0,jsx_runtime.jsx)(NoData, {}), !treeData.length && !isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$detail5 = shixunsDetail.detail) === null || _shixunsDetail$detail5 === void 0 ? void 0 : _shixunsDetail$detail5.secret_repository) && /*#__PURE__*/(0,jsx_runtime.jsx)(NoData, {})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenameFile, {
|
|
|
visible: showRenameFile,
|
|
|
defaultPath: defaultPath,
|
|
|
onClose: function onClose() {
|
|
|
return setShowRenameFile(false);
|
|
|
},
|
|
|
isRepository: !isRepository,
|
|
|
onOK: /*#__PURE__*/function () {
|
|
|
var _ref13 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12(data) {
|
|
|
var pathArr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
|
|
|
while (1) switch (_context12.prev = _context12.next) {
|
|
|
case 0:
|
|
|
// insertFile(data.path, data.name)
|
|
|
pathArr = defaultPath.split('/');
|
|
|
pathArr.pop();
|
|
|
_context12.next = 4;
|
|
|
return handleGetRepository(pathArr.join('/'));
|
|
|
case 4:
|
|
|
selectPath('');
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context12.stop();
|
|
|
}
|
|
|
}, _callee12);
|
|
|
}));
|
|
|
return function (_x13) {
|
|
|
return _ref13.apply(this, arguments);
|
|
|
};
|
|
|
}()
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DirTree_AddFile, {
|
|
|
visible: showAddFile,
|
|
|
defaultPath: defaultPath,
|
|
|
onClose: function onClose() {
|
|
|
return setShowAddFile(false);
|
|
|
},
|
|
|
isRepository: isRepository,
|
|
|
onOK: function onOK(data) {
|
|
|
insertFile(data.path, data.name);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AddFolder, {
|
|
|
visible: showAddFolder,
|
|
|
defaultPath: defaultPath,
|
|
|
onClose: function onClose() {
|
|
|
return setShowAddFolder(false);
|
|
|
},
|
|
|
isRepository: isRepository,
|
|
|
onOK: function onOK(data) {
|
|
|
insertFile(data.path, data.name);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DirTree_UploadFile, {
|
|
|
defaultPath: defaultPath,
|
|
|
visible: showUploadFile,
|
|
|
isRepository: isRepository,
|
|
|
onClose: function onClose() {
|
|
|
return setShowUploadFile(false);
|
|
|
},
|
|
|
onOK: /*#__PURE__*/function () {
|
|
|
var _ref14 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13(data) {
|
|
|
var pathArr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
|
|
|
while (1) switch (_context13.prev = _context13.next) {
|
|
|
case 0:
|
|
|
pathArr = defaultPath.split('/');
|
|
|
_context13.next = 3;
|
|
|
return handleGetRepository(defaultPath);
|
|
|
case 3:
|
|
|
expandedKeys = [pathArr[0] || ''];
|
|
|
selectedKeys = [defaultPath];
|
|
|
setSelectedKeys(toConsumableArray_default()(selectedKeys));
|
|
|
setExpandedKeys(toConsumableArray_default()(expandedKeys));
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context13.stop();
|
|
|
}
|
|
|
}, _callee13);
|
|
|
}));
|
|
|
return function (_x14) {
|
|
|
return _ref14.apply(this, arguments);
|
|
|
};
|
|
|
}()
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DirTree_SelectFilePathModal, {
|
|
|
pathList: defaultPath === null || defaultPath === void 0 ? void 0 : defaultPath.split('/'),
|
|
|
showInputPath: true,
|
|
|
isMergeSelectFile: isMergeSelectFile,
|
|
|
onFinish: function onFinish(path) {
|
|
|
isMergeSelectFile ? handleMergeSelectFile(path) : handleGetRepository(path);
|
|
|
setIsMergeSelectFile(false);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var NoData = function NoData() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt20 pb50 ".concat(DirTreemodules.nodata),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DirTreemodules.headLeft,
|
|
|
children: ["\u63D0\u793A\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u6B64\u5904\u5B58\u653E\u672C\u5B9E\u8BAD\u6240\u9700\u7684\u6240\u6709\u4EE3\u7801\u7B49\u76F8\u5173\u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u4E24\u79CD\u65B9\u5F0F\u6765\u4F7F\u7528\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "1\u3001", /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
href: "/forums/2784",
|
|
|
target: "_blank",
|
|
|
children: "Git\u5BA2\u6237\u7AEF"
|
|
|
}), ' ', "\u4E0A\u4F20\u5DF2\u6709\u6587\u4EF6\u6765\u5F00\u59CB\u4F7F\u7528\u3002", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "2\u3001\u76F4\u63A5\u5728\u5E73\u53F0\u4E0A\u521B\u5EFA\u6587\u4EF6\u76EE\u5F55\u4EE5\u53CA\u76F8\u5173\u4EE3\u7801\u6587\u4EF6\u3002"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
width: "100%",
|
|
|
src: ImagesIcon/* repositoryNoneDataIcon */.Oe
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var DirTree = ((0,_umi_production_exports.connect)(function (_ref15) {
|
|
|
var shixunsDetail = _ref15.shixunsDetail,
|
|
|
loading = _ref15.loading,
|
|
|
globalSetting = _ref15.globalSetting,
|
|
|
practiceSetting = _ref15.practiceSetting,
|
|
|
user = _ref15.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
practiceSetting: practiceSetting,
|
|
|
loading: loading
|
|
|
};
|
|
|
})(Repository));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/components/Commit/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Commitmodules = ({"flex_box_center":"flex_box_center___mJSI5","flex_space_between":"flex_space_between___m2vnD","flex_box_vertical_center":"flex_box_vertical_center___b1pIq","flex_box_center_end":"flex_box_center_end___YagwH","flex_box_column":"flex_box_column___mZenc","commitWrap":"commitWrap___M9LmK","wrap":"wrap___jv461","colorGray":"colorGray___sAqo4","content":"content___aLkz4","itemTime":"itemTime___UnJXc","imageUrl":"imageUrl___u5BIL","blueLight":"blueLight___T56XC","divider":"divider___KTMx3","empty":"empty___ltuTU"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/components/Commit/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Commit_excluded = ["shixunsDetail", "globalSetting", "loading", "user", "dispatch", "isRepository"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import Right from '../../components/Right';
|
|
|
|
|
|
|
|
|
|
|
|
var Commit = function Commit(_ref) {
|
|
|
var shixunsDetail = _ref.shixunsDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isRepository = _ref.isRepository,
|
|
|
props = objectWithoutProperties_default()(_ref, Commit_excluded);
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
commitList = _useState2[0],
|
|
|
setCommitList = _useState2[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
getRepositoryCommit();
|
|
|
}, [isRepository]);
|
|
|
var getRepositoryCommit = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/getRepositoryCommit',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
secret_repository: isRepository ? undefined : true
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res) {
|
|
|
setCommitList(res.commits || []);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getRepositoryCommit() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [commitList == '' && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Commitmodules.empty,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: ImagesIcon/* emptyIcon2 */.em,
|
|
|
width: "258"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-c font14",
|
|
|
children: "\u6682\u65E0\u63D0\u4EA4\u8BB0\u5F55"
|
|
|
})]
|
|
|
}), commitList != '' && /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: Commitmodules.bg,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Commitmodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Commitmodules.content,
|
|
|
children: commitList === null || commitList === void 0 ? void 0 : commitList.map(function (item) {
|
|
|
var _item$author, _item$author2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "c-white font16",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: item.title
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "mt20 ",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: Commitmodules.imageUrl,
|
|
|
src: env/* default.IMG_SERVER */.Z.IMG_SERVER + '/' + ((_item$author = item.author) === null || _item$author === void 0 ? void 0 : _item$author.image_url)
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: Commitmodules.blueLight,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml20",
|
|
|
children: (_item$author2 = item.author) === null || _item$author2 === void 0 ? void 0 : _item$author2.username
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml20 ".concat(Commitmodules.blueLight),
|
|
|
children: "\u63D0\u4EA4\u4E8E"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml20 ".concat(Commitmodules.blueLight),
|
|
|
children: item.time
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {
|
|
|
className: Commitmodules.divider
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Commit = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var shixunsDetail = _ref3.shixunsDetail,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting,
|
|
|
user = _ref3.user;
|
|
|
return {
|
|
|
shixunsDetail: shixunsDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(Commit));
|
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
|
|
|
var PreviewAll = __webpack_require__(36579);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/CodePane/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CodePane_excluded = ["globalSetting", "loading", "dispatch", "practiceSetting", "shixunsDetail", "haveAuth"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TabPane = tabs/* default.TabPane */.Z.TabPane;
|
|
|
var CodePane = function CodePane(_ref) {
|
|
|
var _shixunsDetail$fileCo19, _practiceSetting$side2, _practiceSetting$side6, _shixunsDetail$detail4, _shixunsDetail$detail5, _shixunsDetail$reposi, _shixunsDetail$secret, _shixunsDetail$reposi2, _shixunsDetail$secret2, _shixunsDetail$reposi3, _shixunsDetail$secret3, _practiceSetting$side8, _shixunsDetail$fileCo22, _shixunsDetail$fileCo23, _shixunsDetail$fileCo24, _shixunsDetail$fileCo25, _shixunsDetail$fileCo26, _practiceSetting$side9, _shixunsDetail$detail6;
|
|
|
var globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
practiceSetting = _ref.practiceSetting,
|
|
|
shixunsDetail = _ref.shixunsDetail,
|
|
|
haveAuth = _ref.haveAuth,
|
|
|
props = objectWithoutProperties_default()(_ref, CodePane_excluded);
|
|
|
var _useState = (0,react.useState)('1'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
activeKey = _useState2[0],
|
|
|
setActiveKey = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)('1'),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
tabKey = _useState4[0],
|
|
|
setTabKey = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
codeMirrorValue = _useState6[0],
|
|
|
setCodeMirrorValue = _useState6[1];
|
|
|
var codeMirrorSourceValue = (0,react.useRef)();
|
|
|
// let [codeMirrorSourceValue, setCodeMirrorSourceValue] = useState<string>()
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var _useState7 = (0,react.useState)(true),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isRepository = _useState8[0],
|
|
|
setIsRepository = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(['2', '1']),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
filePath = _useState10[0],
|
|
|
setFilePath = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)([]),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
treeData = _useState12[0],
|
|
|
setTreeData = _useState12[1];
|
|
|
var ref = (0,react.useRef)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var menuData = [{
|
|
|
id: '1',
|
|
|
name: '代码仓库'
|
|
|
}, {
|
|
|
id: '2',
|
|
|
name: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u79C1\u5BC6\u7248\u672C\u5E93\u7684\u6587\u4EF6\u5BF9\u5B66\u5458\u59CB\u7EC8\u9690\u85CF\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u67E5\u770B\u3002",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-xiaowenhao",
|
|
|
style: {
|
|
|
marginLeft: 2,
|
|
|
fontSize: 14
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}];
|
|
|
(0,react.useEffect)(function () {
|
|
|
try {
|
|
|
var _shixunsDetail$fileCo, _shixunsDetail$fileCo2, _shixunsDetail$fileCo3, _shixunsDetail$fileCo4, _shixunsDetail$fileCo5;
|
|
|
if (!!(shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$fileCo = shixunsDetail.fileContent) !== null && _shixunsDetail$fileCo !== void 0 && (_shixunsDetail$fileCo2 = _shixunsDetail$fileCo.content) !== null && _shixunsDetail$fileCo2 !== void 0 && (_shixunsDetail$fileCo3 = _shixunsDetail$fileCo2.content) !== null && _shixunsDetail$fileCo3 !== void 0 && _shixunsDetail$fileCo3.length) || (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo4 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo4 === void 0 ? void 0 : (_shixunsDetail$fileCo5 = _shixunsDetail$fileCo4.content) === null || _shixunsDetail$fileCo5 === void 0 ? void 0 : _shixunsDetail$fileCo5.content) == '') {
|
|
|
var _shixunsDetail$fileCo6;
|
|
|
if ((shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo6 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo6 === void 0 ? void 0 : _shixunsDetail$fileCo6.file_type) === 'txt') {
|
|
|
var _shixunsDetail$fileCo7, _shixunsDetail$fileCo8, _shixunsDetail$fileCo9, _shixunsDetail$fileCo10;
|
|
|
codeMirrorSourceValue.current = window.decodeURIComponent(escape(window.atob(shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo7 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo7 === void 0 ? void 0 : (_shixunsDetail$fileCo8 = _shixunsDetail$fileCo7.content) === null || _shixunsDetail$fileCo8 === void 0 ? void 0 : _shixunsDetail$fileCo8.content)));
|
|
|
codeMirrorValue = window.decodeURIComponent(escape(window.atob(shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo9 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo9 === void 0 ? void 0 : (_shixunsDetail$fileCo10 = _shixunsDetail$fileCo9.content) === null || _shixunsDetail$fileCo10 === void 0 ? void 0 : _shixunsDetail$fileCo10.content)));
|
|
|
// setCodeMirrorSourceValue(codeMirrorSourceValue)
|
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
|
} else {
|
|
|
var _shixunsDetail$fileCo11, _shixunsDetail$fileCo12, _shixunsDetail$fileCo13, _shixunsDetail$fileCo14;
|
|
|
codeMirrorSourceValue.current = shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo11 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo11 === void 0 ? void 0 : (_shixunsDetail$fileCo12 = _shixunsDetail$fileCo11.content) === null || _shixunsDetail$fileCo12 === void 0 ? void 0 : _shixunsDetail$fileCo12.content;
|
|
|
codeMirrorValue = shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo13 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo13 === void 0 ? void 0 : (_shixunsDetail$fileCo14 = _shixunsDetail$fileCo13.content) === null || _shixunsDetail$fileCo14 === void 0 ? void 0 : _shixunsDetail$fileCo14.content;
|
|
|
// setCodeMirrorSourceValue(codeMirrorSourceValue)
|
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
|
}
|
|
|
}
|
|
|
} catch (e) {
|
|
|
var _shixunsDetail$fileCo15, _shixunsDetail$fileCo16, _shixunsDetail$fileCo17, _shixunsDetail$fileCo18;
|
|
|
codeMirrorSourceValue.current = window.atob(shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo15 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo15 === void 0 ? void 0 : (_shixunsDetail$fileCo16 = _shixunsDetail$fileCo15.content) === null || _shixunsDetail$fileCo16 === void 0 ? void 0 : _shixunsDetail$fileCo16.content);
|
|
|
codeMirrorValue = window.atob(shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo17 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo17 === void 0 ? void 0 : (_shixunsDetail$fileCo18 = _shixunsDetail$fileCo17.content) === null || _shixunsDetail$fileCo18 === void 0 ? void 0 : _shixunsDetail$fileCo18.content);
|
|
|
// setCodeMirrorSourceValue(codeMirrorSourceValue)
|
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
|
message/* default.warn */.ZP.warn('请确认文件字符集编码是否为UTF-8');
|
|
|
}
|
|
|
console.log('codeMirrorSourceValue1212:12', shixunsDetail.fileContent.content);
|
|
|
}, [shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo19 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo19 === void 0 ? void 0 : _shixunsDetail$fileCo19.content]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _practiceSetting$side;
|
|
|
var path = practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side = practiceSetting.sideBar) === null || _practiceSetting$side === void 0 ? void 0 : _practiceSetting$side.selectPath.split('/');
|
|
|
setFilePath(path);
|
|
|
}, [practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side2 = practiceSetting.sideBar) === null || _practiceSetting$side2 === void 0 ? void 0 : _practiceSetting$side2.selectPath]);
|
|
|
var updateCodeMirrorValue = function updateCodeMirrorValue(value) {
|
|
|
// console.log(value, codeMirrorSourceValue, value === codeMirrorSourceValue.current, ":codeMirrorSourceValue")
|
|
|
setCodeMirrorValue(value);
|
|
|
var update = -1;
|
|
|
if (value === codeMirrorSourceValue.current) {
|
|
|
update = 0;
|
|
|
} else {
|
|
|
update = 1;
|
|
|
}
|
|
|
if (update !== -1) {}
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
confirmLeave: !!update
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
(0,react.useEffect)(function () {
|
|
|
new Promise( /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(resolve, reject) {
|
|
|
var _practiceSetting$side3, _practiceSetting$side4;
|
|
|
var _practiceSetting$side5, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (!((practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side3 = practiceSetting.sideBar) === null || _practiceSetting$side3 === void 0 ? void 0 : _practiceSetting$side3.selectPath) !== '' && practiceSetting !== null && practiceSetting !== void 0 && (_practiceSetting$side4 = practiceSetting.sideBar) !== null && _practiceSetting$side4 !== void 0 && _practiceSetting$side4.selectPath)) {
|
|
|
_context.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 3;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/getFileContents',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side5 = practiceSetting.sideBar) === null || _practiceSetting$side5 === void 0 ? void 0 : _practiceSetting$side5.selectPath,
|
|
|
secret_repository: isRepository ? null : true
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.content || (res === null || res === void 0 ? void 0 : res.content) == '') {
|
|
|
// setCodeMirrorValue(shixunsDetail?.fileContent?.content)
|
|
|
} else {
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
selectPath: ''
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function (_x, _x2) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}());
|
|
|
}, [practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side6 = practiceSetting.sideBar) === null || _practiceSetting$side6 === void 0 ? void 0 : _practiceSetting$side6.selectPath]);
|
|
|
var menu = /*#__PURE__*/(0,jsx_runtime.jsxs)(es_menu/* default */.Z, {
|
|
|
className: CodePanemodules.menu,
|
|
|
onClick: function onClick(value) {
|
|
|
var _shixunsDetail$detail;
|
|
|
if (!(shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail = shixunsDetail.detail) !== null && _shixunsDetail$detail !== void 0 && _shixunsDetail$detail.secret_repository) && value.key === '2') {
|
|
|
setTabKey('1');
|
|
|
}
|
|
|
setActiveKey(value.key);
|
|
|
if (value.key === '1') {
|
|
|
setIsRepository(true);
|
|
|
} else {
|
|
|
setIsRepository(false);
|
|
|
}
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
disabled: true,
|
|
|
children: "\u5207\u6362\u4ED3\u5E93"
|
|
|
}, "0"), menuData.filter(function (item) {
|
|
|
var _shixunsDetail$detail2, _shixunsDetail$detail3;
|
|
|
if (!(shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail2 = shixunsDetail.detail) !== null && _shixunsDetail$detail2 !== void 0 && _shixunsDetail$detail2.init_repository) || shixunsDetail !== null && shixunsDetail !== void 0 && (_shixunsDetail$detail3 = shixunsDetail.detail) !== null && _shixunsDetail$detail3 !== void 0 && _shixunsDetail$detail3.is_jupyter_lab) {
|
|
|
return item.id !== '2';
|
|
|
}
|
|
|
return item;
|
|
|
}).map(function (item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default.Item */.Z.Item, {
|
|
|
className: "leaveClick",
|
|
|
children: item.name
|
|
|
}, item.id);
|
|
|
})]
|
|
|
});
|
|
|
var handleSave = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _shixunsDetail$fileCo20, _shixunsDetail$fileCo21;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return dispatch({
|
|
|
type: 'shixunsDetail/updateRepositoryFiles',
|
|
|
payload: {
|
|
|
id: params.taskId,
|
|
|
path: shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo20 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo20 === void 0 ? void 0 : (_shixunsDetail$fileCo21 = _shixunsDetail$fileCo20.params) === null || _shixunsDetail$fileCo21 === void 0 ? void 0 : _shixunsDetail$fileCo21.path,
|
|
|
content: codeMirrorValue,
|
|
|
secret_repository: isRepository ? null : true
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
if (res !== null && res !== void 0 && res.content) {
|
|
|
message/* default.info */.ZP.info('保存成功');
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, practiceSetting.sideBar), {}, {
|
|
|
confirmLeave: false
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleSave() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: CodePanemodules.warehouse,
|
|
|
style: {
|
|
|
minHeight: 600
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: CodePanemodules.header,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "w100 c-white",
|
|
|
style: {
|
|
|
height: 60
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: '1',
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
|
|
|
dropdownRender: function dropdownRender() {
|
|
|
return menu;
|
|
|
},
|
|
|
className: CodePanemodules.menu,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-white current ml20",
|
|
|
children: [menuData.find(function (item) {
|
|
|
return item.id === activeKey;
|
|
|
})['name'], ' ', /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#B0B5D6'
|
|
|
},
|
|
|
className: "iconfont icon-sanjiaoxing font12"
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "81px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: CodePanemodules.line
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(tabs/* default */.Z, {
|
|
|
className: CodePanemodules.tabs,
|
|
|
activeKey: tabKey,
|
|
|
onChange: function onChange(key) {
|
|
|
var _practiceSetting$side7;
|
|
|
if (practiceSetting !== null && practiceSetting !== void 0 && (_practiceSetting$side7 = practiceSetting.sideBar) !== null && _practiceSetting$side7 !== void 0 && _practiceSetting$side7.confirmLeave) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '离开此页提示',
|
|
|
content: '系统可能不会保存您所做的更改。',
|
|
|
okText: '离开',
|
|
|
cancelText: '取消',
|
|
|
onOk: function onOk() {
|
|
|
setTabKey(key);
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
confirmLeave: false,
|
|
|
selectPath: ''
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
setTabKey(key);
|
|
|
dispatch({
|
|
|
type: 'practiceSetting/setSideBarTabs',
|
|
|
payload: {
|
|
|
confirmLeave: false,
|
|
|
selectPath: ''
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TabPane, {
|
|
|
tab: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "leaveClick",
|
|
|
children: "\u4EE3\u7801\u6587\u4EF6"
|
|
|
})
|
|
|
}, "1"), isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$detail4 = shixunsDetail.detail) === null || _shixunsDetail$detail4 === void 0 ? void 0 : _shixunsDetail$detail4.init_repository) && /*#__PURE__*/(0,jsx_runtime.jsx)(TabPane, {
|
|
|
tab: "\u63D0\u4EA4\u8BB0\u5F55",
|
|
|
className: "leaveClick"
|
|
|
}, "2"), !isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$detail5 = shixunsDetail.detail) === null || _shixunsDetail$detail5 === void 0 ? void 0 : _shixunsDetail$detail5.secret_repository) && /*#__PURE__*/(0,jsx_runtime.jsx)(TabPane, {
|
|
|
tab: "\u63D0\u4EA4\u8BB0\u5F55",
|
|
|
className: "leaveClick"
|
|
|
}, "2")]
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), (isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$reposi = shixunsDetail.repository) === null || _shixunsDetail$reposi === void 0 ? void 0 : _shixunsDetail$reposi.git_url) || !isRepository && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$secret = shixunsDetail.secretRepository) === null || _shixunsDetail$secret === void 0 ? void 0 : _shixunsDetail$secret.git_url)) && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: CodePanemodules.title,
|
|
|
children: "\u4ED3\u5E93\u5730\u5740:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
readOnly: true,
|
|
|
value: isRepository ? shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$reposi2 = shixunsDetail.repository) === null || _shixunsDetail$reposi2 === void 0 ? void 0 : _shixunsDetail$reposi2.git_url : shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$secret2 = shixunsDetail.secretRepository) === null || _shixunsDetail$secret2 === void 0 ? void 0 : _shixunsDetail$secret2.git_url
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
|
text: isRepository ? shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$reposi3 = shixunsDetail.repository) === null || _shixunsDetail$reposi3 === void 0 ? void 0 : _shixunsDetail$reposi3.git_url : shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$secret3 = shixunsDetail.secretRepository) === null || _shixunsDetail$secret3 === void 0 ? void 0 : _shixunsDetail$secret3.git_url,
|
|
|
onCopy: function onCopy() {
|
|
|
return message/* default.success */.ZP.success('复制成功');
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "topLeft",
|
|
|
title: "\u70B9\u51FB\u590D\u5236\u7248\u672C\u5E93",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-fuzhi2 current ml5 mr40"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: CodePanemodules.content,
|
|
|
style: {
|
|
|
overflow: 'auto'
|
|
|
},
|
|
|
children: [tabKey === '1' && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: CodePanemodules.left,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: !!loading.effects['shixunsDetail/getRepositorys'],
|
|
|
wrapperClassName: "".concat(CodePanemodules.loading, " ").concat(CodePanemodules.bottom0),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(DirTree, {
|
|
|
setTreeData: setTreeData,
|
|
|
treeData: treeData,
|
|
|
activeKey: activeKey,
|
|
|
isRepository: isRepository,
|
|
|
haveAuth: haveAuth
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: CodePanemodules.right,
|
|
|
ref: ref,
|
|
|
children: [(practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side8 = practiceSetting.sideBar) === null || _practiceSetting$side8 === void 0 ? void 0 : _practiceSetting$side8.selectPath) !== '' && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
spinning: !!loading.effects['shixunsDetail/getFileContents'],
|
|
|
wrapperClassName: CodePanemodules.loading,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: CodePanemodules.filePathWrp,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "w100",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "iconfont icon-daimacangku2 c-white"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "40px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: CodePanemodules.line,
|
|
|
style: {
|
|
|
marginLeft: 20
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: CodePanemodules.filePath,
|
|
|
children: filePath.map(function (item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-blue",
|
|
|
children: item
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: !!loading.effects['shixunsDetail/getFileContents'] ? 'hide' : 'show',
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
|
className: "darkBlue",
|
|
|
style: {
|
|
|
top: 66,
|
|
|
height: 'calc(100% - 60px)',
|
|
|
position: 'absolute',
|
|
|
zIndex: 1
|
|
|
},
|
|
|
filename: shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo22 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo22 === void 0 ? void 0 : _shixunsDetail$fileCo22.filename,
|
|
|
type: (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo23 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo23 === void 0 ? void 0 : _shixunsDetail$fileCo23.file_type) === 'office' ? 'download' : shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo24 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo24 === void 0 ? void 0 : _shixunsDetail$fileCo24.file_type,
|
|
|
data: codeMirrorValue,
|
|
|
monacoEditor: {
|
|
|
value: codeMirrorValue,
|
|
|
language: shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo25 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo25 === void 0 ? void 0 : _shixunsDetail$fileCo25.language,
|
|
|
onChange: function onChange(value) {
|
|
|
return updateCodeMirrorValue(value);
|
|
|
},
|
|
|
options: {
|
|
|
fontSize: 14,
|
|
|
readOnly: !haveAuth
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}), (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$fileCo26 = shixunsDetail.fileContent) === null || _shixunsDetail$fileCo26 === void 0 ? void 0 : _shixunsDetail$fileCo26.file_type) === 'txt' && haveAuth && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
justify: "center",
|
|
|
className: CodePanemodules.footer,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large"
|
|
|
// className="ml40"
|
|
|
,
|
|
|
onClick: handleSave,
|
|
|
children: "\u63D0\u4EA4"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), (practiceSetting === null || practiceSetting === void 0 ? void 0 : (_practiceSetting$side9 = practiceSetting.sideBar) === null || _practiceSetting$side9 === void 0 ? void 0 : _practiceSetting$side9.selectPath) == '' && (shixunsDetail === null || shixunsDetail === void 0 ? void 0 : (_shixunsDetail$detail6 = shixunsDetail.detail) === null || _shixunsDetail$detail6 === void 0 ? void 0 : _shixunsDetail$detail6.init_repository) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: CodePanemodules.empty,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: ImagesIcon/* emptyIcon */.x7,
|
|
|
width: "258"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-grey-c",
|
|
|
children: [!!(treeData !== null && treeData !== void 0 && treeData.length) && '在左侧代码仓库区域点击目录打开文件', !(treeData !== null && treeData !== void 0 && treeData.length) && '请先在左侧上传文件或新建文件!']
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}), tabKey === '2' && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: CodePanemodules.commit,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_Commit, {
|
|
|
isRepository: isRepository
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_CodePane = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting,
|
|
|
practiceSetting = _ref4.practiceSetting,
|
|
|
shixunsDetail = _ref4.shixunsDetail;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading,
|
|
|
practiceSetting: practiceSetting,
|
|
|
shixunsDetail: shixunsDetail
|
|
|
};
|
|
|
})(CodePane));
|
|
|
// EXTERNAL MODULE: ./src/pages/Innovation/Detail/components/DataSetPane/index.tsx
|
|
|
var DataSetPane = __webpack_require__(1310);
|
|
|
// EXTERNAL MODULE: ./src/pages/Innovation/Tasks/Collaborate/index.tsx + 4 modules
|
|
|
var Collaborate = __webpack_require__(94214);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(84519);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js + 1 modules
|
|
|
var checkbox_style = __webpack_require__(82000);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules
|
|
|
var es_checkbox = __webpack_require__(32808);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/components/RemindForkModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RemindForkModal = function RemindForkModal(_ref) {
|
|
|
var dispatch = _ref.dispatch,
|
|
|
innovation = _ref.innovation,
|
|
|
openForkModal = _ref.openForkModal;
|
|
|
var handleOk = function handleOk() {
|
|
|
openForkModal('remindModal');
|
|
|
};
|
|
|
var handleCancel = function handleCancel() {
|
|
|
dispatch({
|
|
|
type: 'innovation/closeModal'
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: "\u542F\u52A8\u73AF\u5883",
|
|
|
width: 600,
|
|
|
okText: "Fork\u9879\u76EE",
|
|
|
okButtonProps: {
|
|
|
type: 'primary'
|
|
|
},
|
|
|
centered: true,
|
|
|
open: innovation.visibleModalName === 'remindfork-project',
|
|
|
destroyOnClose: true,
|
|
|
onCancel: handleCancel,
|
|
|
onOk: handleOk,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 14
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u4F60\u4E0D\u662F\u8BE5\u9879\u76EE\u7684\u521B\u5EFA\u8005/\u5408\u4F5C\u8005\uFF0C\u65E0\u6CD5\u76F4\u63A5\u542F\u52A8\u73AF\u5883\u3002"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BF7\u5148Fork\u4E3A\u4F60\u4E2A\u4EBA\u7684\u9879\u76EE\u540E\uFF0C\u518D\u542F\u52A8\u73AF\u5883\u3002"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: innovation.hideRemindModal,
|
|
|
onChange: function onChange(e) {
|
|
|
return dispatch({
|
|
|
type: 'innovation/save',
|
|
|
payload: {
|
|
|
hideRemindModal: e.target.checked
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: "\u4E0D\u518D\u63D0\u793A"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_RemindForkModal = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var innovation = _ref2.innovation;
|
|
|
return {
|
|
|
innovation: innovation
|
|
|
};
|
|
|
})(RemindForkModal));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Innovation/Detail/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Paragraph = typography/* default.Paragraph */.Z.Paragraph;
|
|
|
var Detail_TabPane = tabs/* default.TabPane */.Z.TabPane;
|
|
|
var colors = ['#FF7E0F', '#165DFF', '#44D7B6', 'red'];
|
|
|
var ProjectDetailPage = function ProjectDetailPage(_ref) {
|
|
|
var _detail$sci_project_c, _detail$sci_project_c2, _detail$sci_project_c3, _detail$sci_project_c4, _detail$sci_project_c5, _detail$sci_project_c6, _detail$sci_project_c7, _detail$verify_info, _detail$verify_info2, _detail$verify_info3, _detail$verify_info4;
|
|
|
var user = _ref.user,
|
|
|
dispatch = _ref.dispatch;
|
|
|
var _useState = (0,react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
detail = _useState2[0],
|
|
|
setDetail = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(true),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var _useParams = (0,_umi_production_exports.useParams)(),
|
|
|
taskId = _useParams.taskId;
|
|
|
var _useState5 = (0,react.useState)('1'),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
atcivitykey = _useState6[0],
|
|
|
setkeys = _useState6[1];
|
|
|
var haveAuth = (0,react.useMemo)(function () {
|
|
|
var userInfo = user.userInfo;
|
|
|
return (0,authority/* isSuperAdmins */.Ny)() || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.user_id) === (detail === null || detail === void 0 ? void 0 : detail.sci_project.user_id) || (detail === null || detail === void 0 ? void 0 : detail.is_partner);
|
|
|
}, [user, detail]);
|
|
|
//删除权限
|
|
|
var haveDeleteAuth = (0,react.useMemo)(function () {
|
|
|
var userInfo = user.userInfo;
|
|
|
return (0,authority/* isSuperAdmins */.Ny)() || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.user_id) === (detail === null || detail === void 0 ? void 0 : detail.sci_project.user_id);
|
|
|
}, [user, detail]);
|
|
|
var _useState7 = (0,react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isshowmodal = _useState8[0],
|
|
|
setisshowmodal = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(false),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
isloading = _useState10[0],
|
|
|
setisloading = _useState10[1];
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
(0,react.useEffect)(function () {
|
|
|
(0,service_innovation/* getProjectDetail */.T)(taskId).then(function (res) {
|
|
|
setLoading(false);
|
|
|
if (res.status) {
|
|
|
return;
|
|
|
}
|
|
|
setDetail(res);
|
|
|
});
|
|
|
}, []);
|
|
|
var openForkModal = function openForkModal(position) {
|
|
|
if (detail.my_sci_projects_num >= 10 && !(0,authority/* isSuperAdmins */.Ny)()) {
|
|
|
dispatch({
|
|
|
type: 'innovation/openSimpleModal',
|
|
|
payload: {
|
|
|
title: '项目数量达到上限',
|
|
|
children: '每位用户最多只能创建10个项目,你的项目数量已经达到上限。',
|
|
|
footer: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return dispatch({
|
|
|
type: 'innovation/closeSimpleModal'
|
|
|
});
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u6211\u77E5\u9053\u4E86"
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: 'innovation/save',
|
|
|
payload: {
|
|
|
visibleModalName: 'fork-project',
|
|
|
openForkModalPosition: position
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
//跳转到编辑页面
|
|
|
var jumpToEditPage = function jumpToEditPage() {
|
|
|
_umi_production_exports.history.push("/innovation/project/edit/".concat(taskId));
|
|
|
};
|
|
|
var openDeleteModal = function openDeleteModal() {
|
|
|
dispatch({
|
|
|
type: 'innovation/openModal',
|
|
|
payload: 'delete-project'
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
children: [detail && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Detailmodules.project_detail_wrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
style: {
|
|
|
marginBottom: 10
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Detailmodules.title,
|
|
|
span: 20,
|
|
|
children: [detail.sci_project.username, " / ", detail.sci_project.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 4,
|
|
|
style: {
|
|
|
textAlign: 'right'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ForkOutlined/* default */.Z, {}),
|
|
|
className: Detailmodules.fork_btn,
|
|
|
onClick: function onClick() {
|
|
|
return openForkModal('forkButton');
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: detail.sci_project.forked_count
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Paragraph, {
|
|
|
ellipsis: {
|
|
|
rows: 3,
|
|
|
expandable: true,
|
|
|
symbol: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#165dff'
|
|
|
},
|
|
|
children: ["\u5C55\u5F00", /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {})]
|
|
|
})
|
|
|
},
|
|
|
className: Detailmodules.desc,
|
|
|
children: detail.sci_project.description
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Detailmodules.info,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u9879\u76EE\u73AF\u5883\uFF1A", detail.mirror_repository_info.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: Detailmodules.create_time,
|
|
|
children: ["\u521B\u5EFA\u65F6\u95F4\uFF1A", moment_default()(detail.sci_project.created_at).format('YYYY-MM-DD HH:mm')]
|
|
|
})]
|
|
|
}), haveAuth && /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Detailmodules.operation,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: jumpToEditPage,
|
|
|
children: "\u7F16\u8F91"
|
|
|
}), haveDeleteAuth && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Detailmodules.delete_btn,
|
|
|
onClick: openDeleteModal,
|
|
|
children: "\u5220\u9664"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsxs)(tabs/* default */.Z, {
|
|
|
// defaultActiveKey="1"
|
|
|
activeKey: atcivitykey,
|
|
|
onChange: function onChange(e) {
|
|
|
setkeys(e);
|
|
|
},
|
|
|
tabBarExtraContent: {
|
|
|
right: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: function onClick() {
|
|
|
if (!haveAuth) {
|
|
|
if (window.localStorage.getItem('hideRemindModal') === 'true') {
|
|
|
openForkModal('forkButton');
|
|
|
} else {
|
|
|
dispatch({
|
|
|
type: 'innovation/save',
|
|
|
payload: {
|
|
|
visibleModalName: 'remindfork-project',
|
|
|
hideRemindModal: true
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
(0,service_innovation/* getProjectDetail */.T)(taskId).then(function (res) {
|
|
|
setDetail(res);
|
|
|
if (res.verify_info.status === -1) {
|
|
|
setisshowmodal(true);
|
|
|
form.setFieldsValue({
|
|
|
max_cpu: 2,
|
|
|
min_cpu: 0.2,
|
|
|
max_memory: 1024,
|
|
|
min_memory: 1024,
|
|
|
max_disk: 1,
|
|
|
survival_time: 0.5
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (res.verify_info.status === 0) {
|
|
|
modal/* default.warning */.Z.warning({
|
|
|
title: '启动环境提示',
|
|
|
content: '环境资源正在【审核中】,审核通过后才能启动环境',
|
|
|
okText: '查看审核结果',
|
|
|
onOk: function onOk() {
|
|
|
setkeys('3');
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (res.verify_info.status === 1) {
|
|
|
_umi_production_exports.history.push("/innovation/tasks/".concat(taskId));
|
|
|
}
|
|
|
if (res.verify_info.status === 2) {
|
|
|
modal/* default.warning */.Z.warning({
|
|
|
title: '启动环境提示',
|
|
|
content: '您申请的环境资源【未通过】,无法启动环境。',
|
|
|
okText: '查看审核结果',
|
|
|
onOk: function onOk() {
|
|
|
setkeys('3');
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
target: "_blank",
|
|
|
children: "\u542F\u52A8\u73AF\u5883"
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Detail_TabPane, {
|
|
|
tab: "\u4EE3\u7801",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_CodePane, {
|
|
|
haveAuth: haveAuth
|
|
|
})
|
|
|
}, "1"), /*#__PURE__*/(0,jsx_runtime.jsx)(Detail_TabPane, {
|
|
|
tab: "\u6570\u636E\u96C6",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(DataSetPane/* default */.Z, {
|
|
|
detail: detail
|
|
|
})
|
|
|
}, "2"), /*#__PURE__*/(0,jsx_runtime.jsx)(Detail_TabPane, {
|
|
|
tab: "\u5408\u4F5C\u8005",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Collaborate/* default */.Z, {
|
|
|
position: "detail"
|
|
|
})
|
|
|
}, "4"), /*#__PURE__*/(0,jsx_runtime.jsxs)(Detail_TabPane, {
|
|
|
tab: "\u73AF\u5883\u4FE1\u606F",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Detailmodules.huanj,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Detailmodules.divtitle,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u786C\u4EF6\u4FE1\u606F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 28
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "CPU\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c = detail.sci_project_config) === null || _detail$sci_project_c === void 0 ? void 0 : _detail$sci_project_c.max_cpu) + '核' || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u6700\u4F4ECPU\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c2 = detail.sci_project_config) === null || _detail$sci_project_c2 === void 0 ? void 0 : _detail$sci_project_c2.min_cpu) + '核' || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u5185\u5B58\u9650\u5236\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c3 = detail.sci_project_config) === null || _detail$sci_project_c3 === void 0 ? void 0 : _detail$sci_project_c3.max_memory) + 'M' || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u5185\u5B58\u8981\u6C42\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c4 = detail.sci_project_config) === null || _detail$sci_project_c4 === void 0 ? void 0 : _detail$sci_project_c4.min_memory) + 'M' || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u78C1\u76D8\u9650\u5236\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c5 = detail.sci_project_config) === null || _detail$sci_project_c5 === void 0 ? void 0 : _detail$sci_project_c5.max_disk) + 'G' || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "GPU\u6570\u91CF\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c6 = detail.sci_project_config) === null || _detail$sci_project_c6 === void 0 ? void 0 : _detail$sci_project_c6.gpu) || '- -'
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Detailmodules.divtitle,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u73AF\u5883\u65F6\u95F4"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 28
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u73AF\u5883\u65F6\u957F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$sci_project_c7 = detail.sci_project_config) === null || _detail$sci_project_c7 === void 0 ? void 0 : _detail$sci_project_c7.survival_time) + '小时' || 0
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Detailmodules.divtitle,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u5BA1\u6838\u72B6\u6001"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 28
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u5BA1\u6838\u72B6\u6001\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: colors[parseInt("".concat(detail === null || detail === void 0 ? void 0 : (_detail$verify_info = detail.verify_info) === null || _detail$verify_info === void 0 ? void 0 : _detail$verify_info.status)) + 1]
|
|
|
},
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$verify_info2 = detail.verify_info) === null || _detail$verify_info2 === void 0 ? void 0 : _detail$verify_info2.status_cn) || '- -'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 28,
|
|
|
wordBreak: 'break-all'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
children: "\u672A\u901A\u8FC7\u539F\u56E0\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (detail === null || detail === void 0 ? void 0 : (_detail$verify_info3 = detail.verify_info) === null || _detail$verify_info3 === void 0 ? void 0 : _detail$verify_info3.refuse_reason) || '- -'
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
textAlign: 'center'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
disabled: (detail === null || detail === void 0 ? void 0 : (_detail$verify_info4 = detail.verify_info) === null || _detail$verify_info4 === void 0 ? void 0 : _detail$verify_info4.status) <= 0,
|
|
|
onClick: function onClick() {
|
|
|
form.setFieldsValue(objectSpread2_default()({}, detail === null || detail === void 0 ? void 0 : detail.sci_project_config));
|
|
|
setisshowmodal(true);
|
|
|
},
|
|
|
style: {
|
|
|
marginTop: 30,
|
|
|
textAlign: 'center'
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u91CD\u65B0\u7533\u8BF7"
|
|
|
})
|
|
|
})]
|
|
|
}, "3")]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_ForkFormModal, {
|
|
|
detail: detail
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DeleteFormModal, {
|
|
|
projectId: taskId
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_RemindForkModal, {
|
|
|
openForkModal: openForkModal
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: '启动环境',
|
|
|
open: isshowmodal,
|
|
|
okButtonProps: {
|
|
|
loading: isloading
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
setisshowmodal(false);
|
|
|
},
|
|
|
onOk: function onOk() {
|
|
|
form.submit();
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
labelCol: {
|
|
|
span: 6
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 18
|
|
|
},
|
|
|
form: form,
|
|
|
preserve: false,
|
|
|
onFinish: /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(value) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
setisloading(true);
|
|
|
_context.next = 3;
|
|
|
return (0,fetch/* default */.ZP)("/api/sci/projects/".concat(taskId, "/commit_verify.json"), {
|
|
|
method: 'POST',
|
|
|
body: objectSpread2_default()({}, value)
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
setisshowmodal(false);
|
|
|
(0,service_innovation/* getProjectDetail */.T)(taskId).then(function (res) {
|
|
|
setLoading(false);
|
|
|
if (res.status) {
|
|
|
return;
|
|
|
}
|
|
|
setDetail(res);
|
|
|
});
|
|
|
message/* default.info */.ZP.info('提交审核成功');
|
|
|
setisloading(false);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function (_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}(),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "CPU(\u6838)",
|
|
|
name: 'max_cpu',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u6700\u4F4ECPU(\u6838)",
|
|
|
name: 'min_cpu',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u5185\u5B58\u9650\u5236(M)",
|
|
|
name: 'max_memory',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u5185\u5B58\u8981\u6C42(M)",
|
|
|
name: 'min_memory',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u78C1\u76D8\u9650\u5236(G)",
|
|
|
name: 'max_disk',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
initialValue: 1,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "GPU\u6570\u91CF",
|
|
|
name: "gpu",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
precision: 0
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u73AF\u5883\u65F6\u957F(\u5C0F\u65F6)",
|
|
|
name: 'survival_time',
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0.1,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
precision: 1
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Detail = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var innovation = _ref3.innovation,
|
|
|
user = _ref3.user;
|
|
|
return {
|
|
|
innovation: innovation,
|
|
|
user: user
|
|
|
};
|
|
|
})(ProjectDetailPage));
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |