You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2307 lines
110 KiB
2307 lines
110 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8179],{
|
|
|
|
/***/ 92336:
|
|
/*!**************************************************************************************************!*\
|
|
!*** ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx + 1 modules ***!
|
|
\**************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ components_SelectFilePathModal; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
|
|
var _umi_production_exports = __webpack_require__(23852);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
var es_form = __webpack_require__(78241);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(20008);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var SelectFilePathModalmodules = ({"wrap":"wrap___TwY3U","content":"content___Ks95W","mainPathWrap":"mainPathWrap___CrMaa","colorBlue":"colorBlue___dvWbP"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const SelectFilePathModal = ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
title,
|
|
pathList: propsPathList = [],
|
|
showInputPath = false,
|
|
isMergeSelectFile = false,
|
|
onFinish = () => {
|
|
}
|
|
}) => {
|
|
const [form] = es_form["default"].useForm();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
const [selectPath, setSelectPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [originPath, setOriginPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [mainPathList, setMainPathList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [treeList, setTreeList] = (0,_react_17_0_2_react.useState)([]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a, _b;
|
|
isRepository.current = ((_b = (_a = location.pathname) == null ? void 0 : _a.split("/")) == null ? void 0 : _b[3]) === "repository";
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (shixunsDetail.actionTabs.key !== "Repository-SelectFilePath") {
|
|
return;
|
|
}
|
|
const path = propsPathList.join("/");
|
|
let arr = [];
|
|
propsPathList.map((item, index) => {
|
|
if (index === 0) {
|
|
arr.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item}`, path });
|
|
} else {
|
|
arr.push({ val: `/${item}`, path });
|
|
}
|
|
});
|
|
setMainPathList(arr);
|
|
setSelectPath(path);
|
|
setOriginPath(path);
|
|
handleGetPathData(path);
|
|
}, [shixunsDetail.actionTabs.key]);
|
|
const handleGetPathData = (path) => __async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: isRepository.current ? "shixunsDetail/getRepository" : "shixunsDetail/getSecretRepository",
|
|
payload: {
|
|
id: params.id,
|
|
path
|
|
}
|
|
});
|
|
if (res) {
|
|
setTreeList(res.trees || []);
|
|
}
|
|
});
|
|
const handleClickTree = (item) => {
|
|
let newPath = selectPath;
|
|
if (item.type === "tree") {
|
|
mainPathList.length ? mainPathList.push({ val: `/${item.name}`, path: item.name }) : mainPathList.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item.name}`, path: item.name });
|
|
setMainPathList(mainPathList);
|
|
newPath = selectPath ? `${selectPath}/${item.name}` : item.name;
|
|
setSelectPath(newPath);
|
|
}
|
|
handleGetPathData(newPath);
|
|
};
|
|
const handleClickMainPath = (item, index) => {
|
|
const currentPathList = mainPathList.filter((_, key) => key <= index);
|
|
setMainPathList(currentPathList);
|
|
const currentPath = currentPathList.filter((_, key) => key !== 0).map((item2) => item2.val).join("").substr(1);
|
|
setSelectPath(currentPath);
|
|
handleGetPathData(currentPath);
|
|
};
|
|
const handleOk = () => __async(void 0, null, function* () {
|
|
const values = form == null ? void 0 : form.getFieldsValue();
|
|
const path = selectPath ? `${selectPath}${(values == null ? void 0 : values.name) ? `/${values == null ? void 0 : values.name}` : ""}` : values == null ? void 0 : values.name;
|
|
if (isMergeSelectFile) {
|
|
onFinish(path);
|
|
handleCancel();
|
|
return;
|
|
}
|
|
if (showInputPath) {
|
|
yield form.validateFields();
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/uploadGitFolder",
|
|
payload: __spreadValues(__spreadValues({}, {
|
|
id: params.id,
|
|
path
|
|
}), isRepository.current ? {} : { secret_repository: true })
|
|
});
|
|
onFinish(originPath);
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.info("\u65B0\u5EFA\u6210\u529F");
|
|
}
|
|
} else {
|
|
onFinish(path);
|
|
message/* default */.ZP.success("\u9009\u62E9\u6587\u4EF6\u76EE\u5F55\u6210\u529F");
|
|
}
|
|
handleCancel();
|
|
});
|
|
const handleCancel = () => {
|
|
dispatch({
|
|
type: "shixunsDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
form.resetFields();
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
title: title || "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
closable: false,
|
|
keyboard: false,
|
|
open: shixunsDetail.actionTabs.key === "Repository-SelectFilePath",
|
|
onOk: handleOk,
|
|
onCancel: handleCancel
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.mainPathWrap }, !!(mainPathList == null ? void 0 : mainPathList.length) && mainPathList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickMainPath(item, index) }, item.val);
|
|
})), !!(treeList == null ? void 0 : treeList.length) && treeList.map((item, index) => {
|
|
return item.type === "tree" && /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickTree(item) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-wenjianjia ${SelectFilePathModalmodules.colorBlue}` }), item.name);
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: "mt5" }, "\u9009\u4E2D\u7684\u65B0\u5EFA\u6587\u4EF6\u5939\u76EE\u5F55\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5 mb5" }, selectPath), showInputPath && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
scrollToFirstError: true,
|
|
className: "mt20"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: "name", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u540D\u79F0" }, { whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u8BF7\u8F93\u5165\u65B0\u6587\u4EF6\u5939\u540D/\u5B50\u6587\u4EF6\u5939\u540D\u3002\uFF08\u5982\uFF1Asrc/step1\uFF09" }))
|
|
))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_SelectFilePathModal = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading: loading.models.index
|
|
})
|
|
)(SelectFilePathModal));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 78179:
|
|
/*!**********************************************************************!*\
|
|
!*** ./src/pages/Shixuns/Edit/body/Warehouse/index.tsx + 13 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 */ body_Warehouse; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Warehousemodules = ({"flex_box_center":"flex_box_center___bPWMH","flex_space_between":"flex_space_between___fjQJK","flex_box_vertical_center":"flex_box_vertical_center___WWAEa","flex_box_center_end":"flex_box_center_end___mQNLW","flex_box_column":"flex_box_column___lOsG0","menu":"menu___szqfh","warehouse":"warehouse___SVzfZ","header":"header___DfoMH","title":"title___y2IOb","content":"content___pGWUf","left":"left___eYHD7","right":"right___RbSHM","loading":"loading___g8ST2","empty":"empty___JqJWS","tabs":"tabs___fuMob","line":"line___Wav7D","footer":"footer___xymfv","commit":"commit___ZwkDv","blueLight":"blueLight___f52KB","filePathWrp":"filePathWrp____p6mm","filePath":"filePath___qkzoJ","bottom0":"bottom0___MrVME"});
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
|
|
var _umi_production_exports = __webpack_require__(23852);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tabs/index.js + 24 modules
|
|
var tabs = __webpack_require__(99313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
|
|
var es_menu = __webpack_require__(20834);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
var col = __webpack_require__(43604);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
|
|
var dropdown = __webpack_require__(38854);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
|
|
var spin = __webpack_require__(71418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tree/index.js + 8 modules
|
|
var tree = __webpack_require__(22631);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
|
|
var es_switch = __webpack_require__(78673);
|
|
// EXTERNAL MODULE: ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/index.js
|
|
var lib = __webpack_require__(56102);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
var es_form = __webpack_require__(78241);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(20008);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/AddFile.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var AddFilemodules = ({"wrap":"wrap___yTLAj","modal":"modal___B3dwx","title":"title___FHscn","path":"path___o7aJh","colorBlue":"colorBlue___p4I9Y","width240":"width240___UNGpD","filePath":"filePath___uTJLX"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/AddFolder.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const AddFile = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
isRepository
|
|
} = _b, props = __objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch",
|
|
"isRepository"
|
|
]);
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const shixunId = (0,_react_17_0_2_react.useRef)();
|
|
const [form] = es_form["default"].useForm();
|
|
const [filePath, setFilePath] = (0,_react_17_0_2_react.useState)("");
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (props.visible) {
|
|
form.resetFields();
|
|
}
|
|
}, [props.visible]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
const pathArray = sessionStorage.getItem("pathArray");
|
|
if (pathArray) {
|
|
const joinPath = pathArray.split(",").join("/");
|
|
const path = joinPath.indexOf("/") === 0 ? joinPath.substr(1) : joinPath;
|
|
setFilePath(path);
|
|
}
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2;
|
|
shixunId.current = (_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[2];
|
|
}, []);
|
|
const handleFinish = (..._0) => __async(void 0, [..._0], function* (values = {}) {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/addRepositoryFile",
|
|
payload: {
|
|
id: params.id,
|
|
message: values.commitMessage,
|
|
content: "",
|
|
path: (!!props.defaultPath ? props.defaultPath + "/" : "") + values.path + "/" + (values.file || ".gitkeep"),
|
|
secret_repository: isRepository ? void 0 : true
|
|
}
|
|
});
|
|
if (res == null ? void 0 : res.url) {
|
|
message/* default */.ZP.success("\u6DFB\u52A0\u6210\u529F");
|
|
props.onOK({
|
|
path: (!!props.defaultPath ? props.defaultPath + "/" : "") + values.path + "/" + (values.file || ".gitkeep"),
|
|
name: values.path.split("/")[values.path.split("/").length - 1]
|
|
});
|
|
props.onClose();
|
|
}
|
|
});
|
|
const handleReturn = () => {
|
|
var _a2, _b2;
|
|
_umi_production_exports.history.push(`/shixuns/${shixunId.current}/${(_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[3]}${filePath ? `/master/shixun_show/${filePath}` : ""}`);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
width: "60%",
|
|
centered: true,
|
|
open: props.visible,
|
|
wrapClassName: AddFilemodules.modal,
|
|
onOk: () => {
|
|
form.submit();
|
|
},
|
|
onCancel: props.onClose,
|
|
title: "\u65B0\u5EFA\u6587\u4EF6\u5939"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: AddFilemodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: AddFilemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
className: "mt10",
|
|
form,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
onFinish: handleFinish,
|
|
onChange: () => {
|
|
var _a2, _b2, _c, _d;
|
|
const value = __spreadValues({}, form.getFieldsValue());
|
|
const arr = (_a2 = value == null ? void 0 : value.path) == null ? void 0 : _a2.split("");
|
|
const arr2 = (_b2 = value == null ? void 0 : value.file) == null ? void 0 : _b2.split("");
|
|
if (!!((_c = arr == null ? void 0 : arr.filter((item) => item == "/")) == null ? void 0 : _c.length)) {
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
}
|
|
if (!!((_d = arr2 == null ? void 0 : arr2.filter((item) => item == "/")) == null ? void 0 : _d.length)) {
|
|
value.file = value.file.substring(0, value.path.length - 1);
|
|
}
|
|
form.setFieldsValue(__spreadValues({}, value));
|
|
setFormValue(value);
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u6587\u4EF6\u5939\u540D\u79F0\uFF1A", name: "path" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: AddFilemodules.filePath }, props.defaultPath + "/")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "path",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["default"],
|
|
{
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0",
|
|
size: "middle"
|
|
}
|
|
)
|
|
)))),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
label: "\u6587\u4EF6\u540D\u79F0\uFF1A",
|
|
name: "file"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { 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: "middle" })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
name: "commitMessage",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u4FE1\u606F" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { 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: "middle" })
|
|
)
|
|
)))
|
|
);
|
|
};
|
|
/* harmony default export */ var AddFolder = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(AddFile));
|
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
|
|
var code_block = __webpack_require__(60759);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/AddFile.tsx
|
|
var AddFile_defProp = Object.defineProperty;
|
|
var AddFile_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var AddFile_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var AddFile_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var AddFile_defNormalProp = (obj, key, value) => key in obj ? AddFile_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var AddFile_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (AddFile_hasOwnProp.call(b, prop))
|
|
AddFile_defNormalProp(a, prop, b[prop]);
|
|
if (AddFile_getOwnPropSymbols)
|
|
for (var prop of AddFile_getOwnPropSymbols(b)) {
|
|
if (AddFile_propIsEnum.call(b, prop))
|
|
AddFile_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var AddFile_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (AddFile_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && AddFile_getOwnPropSymbols)
|
|
for (var prop of AddFile_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && AddFile_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var AddFile_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const AddFile_AddFile = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
isRepository
|
|
} = _b, props = AddFile_objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch",
|
|
"isRepository"
|
|
]);
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const shixunId = (0,_react_17_0_2_react.useRef)();
|
|
const [form] = es_form["default"].useForm();
|
|
const [filePath, setFilePath] = (0,_react_17_0_2_react.useState)("");
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (props.visible) {
|
|
form.resetFields();
|
|
}
|
|
}, [props.visible]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
const pathArray = sessionStorage.getItem("pathArray");
|
|
if (pathArray) {
|
|
const joinPath = pathArray.split(",").join("/");
|
|
const path = joinPath.indexOf("/") === 0 ? joinPath.substr(1) : joinPath;
|
|
setFilePath(path);
|
|
}
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2;
|
|
shixunId.current = (_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[2];
|
|
}, []);
|
|
const handleFinish = (..._0) => AddFile_async(void 0, [..._0], function* (values = {}) {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/addRepositoryFile",
|
|
payload: {
|
|
id: params.id,
|
|
message: values.commitMessage,
|
|
content: values.codeMirror,
|
|
path: (!!props.defaultPath ? props.defaultPath + "/" : "") + values.path,
|
|
secret_repository: isRepository ? void 0 : true
|
|
}
|
|
});
|
|
if (res == null ? void 0 : res.url) {
|
|
message/* default */.ZP.success("\u6DFB\u52A0\u6210\u529F");
|
|
props.onOK({
|
|
path: (!!props.defaultPath ? props.defaultPath + "/" : "") + values.path,
|
|
name: values.path.split("/")[values.path.split("/").length - 1]
|
|
});
|
|
props.onClose();
|
|
}
|
|
});
|
|
const handleReturn = () => {
|
|
var _a2, _b2;
|
|
_umi_production_exports.history.push(`/shixuns/${shixunId.current}/${(_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[3]}${filePath ? `/master/shixun_show/${filePath}` : ""}`);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
width: "60%",
|
|
open: props.visible,
|
|
wrapClassName: AddFilemodules.modal,
|
|
destroyOnClose: true,
|
|
centered: true,
|
|
onOk: () => {
|
|
form.submit();
|
|
},
|
|
onCancel: props.onClose,
|
|
title: "\u65B0\u5EFA\u6587\u4EF6"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: AddFilemodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: AddFilemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
className: "mt10",
|
|
form,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
onFinish: handleFinish,
|
|
onChange: () => {
|
|
var _a2, _b2;
|
|
const value = AddFile_spreadValues({}, form.getFieldsValue());
|
|
const arr = (_a2 = value == null ? void 0 : value.path) == null ? void 0 : _a2.split("");
|
|
if (((_b2 = arr == null ? void 0 : arr.filter((item) => item == "/")) == null ? void 0 : _b2.length) > 1) {
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
}
|
|
form.setFieldsValue(AddFile_spreadValues({}, value));
|
|
setFormValue(value);
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u6587\u4EF6\u540D\u79F0\u6216\u6587\u4EF6\u8DEF\u5F84\uFF1A", name: "path" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: AddFilemodules.filePath }, props.defaultPath + "/")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "path",
|
|
style: { marginBottom: 0 },
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["default"],
|
|
{
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0",
|
|
size: "middle"
|
|
}
|
|
)
|
|
)))),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
name: "commitMessage",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u4FE1\u606F" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { 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: "middle" })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt10 mb20" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "codeMirror",
|
|
label: "\u6587\u4EF6\u5185\u5BB9\uFF1A",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u6587\u4EF6\u5185\u5BB9" }
|
|
],
|
|
style: { marginBottom: 0 }
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
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 components_AddFile = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(AddFile_AddFile));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/RenameFile.tsx
|
|
var RenameFile_defProp = Object.defineProperty;
|
|
var RenameFile_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var RenameFile_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var RenameFile_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var RenameFile_defNormalProp = (obj, key, value) => key in obj ? RenameFile_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var RenameFile_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (RenameFile_hasOwnProp.call(b, prop))
|
|
RenameFile_defNormalProp(a, prop, b[prop]);
|
|
if (RenameFile_getOwnPropSymbols)
|
|
for (var prop of RenameFile_getOwnPropSymbols(b)) {
|
|
if (RenameFile_propIsEnum.call(b, prop))
|
|
RenameFile_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var RenameFile_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (RenameFile_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && RenameFile_getOwnPropSymbols)
|
|
for (var prop of RenameFile_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && RenameFile_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var RenameFile_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const RenameFile_AddFile = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
isRepository
|
|
} = _b, props = RenameFile_objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch",
|
|
"isRepository"
|
|
]);
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const shixunId = (0,_react_17_0_2_react.useRef)();
|
|
const [form] = es_form["default"].useForm();
|
|
const [filePath, setFilePath] = (0,_react_17_0_2_react.useState)("");
|
|
const [fileName, setFileName] = (0,_react_17_0_2_react.useState)("");
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (props.visible) {
|
|
form.resetFields();
|
|
}
|
|
}, [props.visible]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
const pathArray = props.defaultPath.split("/");
|
|
if (pathArray.length === 1) {
|
|
setFilePath("");
|
|
setFileName(props.defaultPath);
|
|
} else {
|
|
setFileName(pathArray.pop());
|
|
setFilePath(pathArray.join("/") + "/");
|
|
}
|
|
}, [props.defaultPath]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2;
|
|
shixunId.current = (_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[2];
|
|
}, []);
|
|
const handleFinish = (..._0) => RenameFile_async(void 0, [..._0], function* (values = {}) {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/moveGitFile",
|
|
payload: { id: params.id, from: props.defaultPath, to: filePath + values.path, message: values.commitMessage || `${props.defaultPath} rename to ${filePath}${values.path} `, secret_repository: isRepository }
|
|
});
|
|
if ((res == null ? void 0 : res.status) === 0) {
|
|
message/* default */.ZP.success("\u6DFB\u52A0\u6210\u529F");
|
|
props.onOK({
|
|
path: values.path,
|
|
name: values.path
|
|
});
|
|
props.onClose();
|
|
}
|
|
});
|
|
const handleReturn = () => {
|
|
var _a2, _b2;
|
|
_umi_production_exports.history.push(`/shixuns/${shixunId.current}/${(_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[3]}${filePath ? `/master/shixun_show/${filePath}` : ""}`);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
width: "40%",
|
|
open: props.visible,
|
|
wrapClassName: AddFilemodules.modal,
|
|
centered: true,
|
|
onOk: () => {
|
|
form.submit();
|
|
},
|
|
onCancel: props.onClose,
|
|
title: "\u63D0\u4EA4\u8BF4\u660E"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: AddFilemodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: AddFilemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
className: "mt10",
|
|
form,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
onFinish: handleFinish,
|
|
onChange: () => {
|
|
var _a2, _b2;
|
|
const value = RenameFile_spreadValues({}, form.getFieldsValue());
|
|
const arr = (_a2 = value == null ? void 0 : value.path) == null ? void 0 : _a2.split("");
|
|
if (((_b2 = arr == null ? void 0 : arr.filter((item) => item == "/")) == null ? void 0 : _b2.length) > 1) {
|
|
value.path = value.path.substring(0, value.path.length - 1);
|
|
}
|
|
form.setFieldsValue(RenameFile_spreadValues({}, value));
|
|
setFormValue(value);
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u91CD\u547D\u540D\uFF1A", name: "path" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "path",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["default"],
|
|
{
|
|
placeholder: "\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0",
|
|
size: "middle",
|
|
defaultValue: fileName
|
|
}
|
|
)
|
|
)))),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A", name: "commitMessage" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: `\u5982\u4E0D\u586B\u5199\uFF0C\u9ED8\u8BA4\u63D0\u4EA4\u4FE1\u606F\u662F\uFF08${props.defaultPath} rename to \u65B0\u7684\u540D\u79F0 \uFF09`, size: "middle" }))
|
|
)))
|
|
);
|
|
};
|
|
/* harmony default export */ var RenameFile = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(RenameFile_AddFile));
|
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(19351);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
|
|
var upload = __webpack_require__(73598);
|
|
// EXTERNAL MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx + 1 modules
|
|
var SelectFilePathModal = __webpack_require__(92336);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/UploadFile.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var UploadFilemodules = ({"wrap":"wrap___T4tjB","title":"title____QnQT","path":"path___PLUeD","colorBlue":"colorBlue___eL7QF"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/UploadFile.tsx
|
|
var UploadFile_defProp = Object.defineProperty;
|
|
var UploadFile_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var UploadFile_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var UploadFile_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var UploadFile_defNormalProp = (obj, key, value) => key in obj ? UploadFile_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var UploadFile_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (UploadFile_hasOwnProp.call(b, prop))
|
|
UploadFile_defNormalProp(a, prop, b[prop]);
|
|
if (UploadFile_getOwnPropSymbols)
|
|
for (var prop of UploadFile_getOwnPropSymbols(b)) {
|
|
if (UploadFile_propIsEnum.call(b, prop))
|
|
UploadFile_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var UploadFile_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (UploadFile_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && UploadFile_getOwnPropSymbols)
|
|
for (var prop of UploadFile_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && UploadFile_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var UploadFile_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { Dragger } = upload["default"];
|
|
const UploadFile = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
isRepository
|
|
} = _b, props = UploadFile_objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch",
|
|
"isRepository"
|
|
]);
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const shixunId = (0,_react_17_0_2_react.useRef)();
|
|
const [form] = es_form["default"].useForm();
|
|
const [fileList, setFileList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [filePath, setFilePath] = (0,_react_17_0_2_react.useState)();
|
|
let filename;
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (props.visible) {
|
|
form.resetFields();
|
|
setFileList([]);
|
|
}
|
|
}, [props.visible]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
shixunId.current = params.id;
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
const pathArray = sessionStorage.getItem("pathArray");
|
|
if (pathArray) {
|
|
const joinPath = pathArray.split(",").join("/");
|
|
const path = joinPath.indexOf("/") === 0 ? joinPath.substr(1) : joinPath;
|
|
setFilePath(path);
|
|
}
|
|
}, []);
|
|
const handleChangeFile = (info) => {
|
|
var _a2, _b2, _c;
|
|
filename = info.file.name;
|
|
if (info.file.status === "done" || info.file.status === "uploading") {
|
|
setFileList(info.fileList);
|
|
if (!info.file.response) {
|
|
return;
|
|
}
|
|
if (((_a2 = info.file.response) == null ? void 0 : _a2.status) === 0) {
|
|
message/* default */.ZP.success("\u4E0A\u4F20\u6210\u529F\uFF01");
|
|
return;
|
|
}
|
|
setFileList(fileList.filter((item) => item.uid !== info.file.uid));
|
|
((_b2 = info.file.response) == null ? void 0 : _b2.message) && message/* default */.ZP.info((_c = info.file.response) == null ? void 0 : _c.message);
|
|
}
|
|
};
|
|
const handleRemoveFile = (info) => UploadFile_async(void 0, null, function* () {
|
|
if (!info.response) {
|
|
message/* default */.ZP.info("\u8FD8\u672A\u4E0A\u4F20\u5B8C\u6210\uFF0C\u65E0\u6CD5\u8FDB\u884C\u5220\u9664\u64CD\u4F5C\uFF01");
|
|
return;
|
|
}
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/deleteGitFile",
|
|
payload: {
|
|
id: params.id,
|
|
path: filePath ? `${filePath}/${info.name}` : info.name,
|
|
message: form.getFieldValue("commitMessage") || `\u5220\u9664\u4E86${filePath ? `${filePath}/${info.name}` : info.name}`,
|
|
secret_repository: isRepository ? null : true
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
setFileList(fileList.filter((item) => item.uid !== info.uid));
|
|
message/* default */.ZP.info("\u5220\u9664\u6210\u529F");
|
|
}
|
|
});
|
|
const draggerProps = {
|
|
height: 300,
|
|
multiple: true,
|
|
withCredentials: true,
|
|
data: () => UploadFile_async(void 0, null, function* () {
|
|
return new Promise((resolve, reject) => UploadFile_async(void 0, null, function* () {
|
|
setTimeout(() => UploadFile_async(void 0, null, function* () {
|
|
const v = yield form.getFieldsValue();
|
|
const data = UploadFile_spreadValues(UploadFile_spreadValues({}, {
|
|
path: !!props.defaultPath ? props.defaultPath : "",
|
|
message: formValue.commitMessage || `\u4E0A\u4F20\u4E86${filename}`
|
|
}), isRepository ? {} : { secret_repository: true });
|
|
resolve(data);
|
|
}), 200);
|
|
}));
|
|
}),
|
|
fileList,
|
|
method: "post",
|
|
action: `${env/* default */.Z.API_SERVER}/api/shixuns/${shixunId.current}/upload_git_file.json`,
|
|
onChange: handleChangeFile,
|
|
onRemove: handleRemoveFile,
|
|
beforeUpload: (file) => {
|
|
filename = file.name;
|
|
const is150M = file.size / 1024 / 1024 > 50;
|
|
if (is150M) {
|
|
message/* default */.ZP.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E50MB");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
const handleFinish = (values) => UploadFile_async(void 0, null, function* () {
|
|
yield form.validateFields();
|
|
props.onClose();
|
|
props.onOK({ path: props.defaultPath });
|
|
handleReturn();
|
|
});
|
|
const handleReturn = () => {
|
|
var _a2, _b2;
|
|
_umi_production_exports.history.push(`/shixuns/${shixunId.current}/${(_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[3]}${filePath ? `/master/shixun_show/${filePath}` : ""}`);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: props.visible,
|
|
onOk: handleFinish,
|
|
centered: true,
|
|
onCancel: props.onClose,
|
|
width: "70%"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: UploadFilemodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UploadFilemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UploadFilemodules.title }, "\u4E0A\u4F20\u6587\u4EF6"), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
className: "mt10",
|
|
form,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
onFinish: handleFinish,
|
|
onValuesChange: () => setFormValue(UploadFile_spreadValues({}, form.getFieldsValue()))
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
label: "\u63D0\u4EA4\u4FE1\u606F\uFF1A",
|
|
name: "commitMessage",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u4FE1\u606F" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u5FC5\u586B\uFF0C\u63CF\u8FF0\u4E3B\u8981\u4FEE\u6539\u5185\u5BB9\uFF08\u76F8\u5F53\u4E8EGit Commit message\u7684Header\uFF09" })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u9009\u62E9\u6587\u4EF6", name: "file", rules: [
|
|
{ required: true, message: "\u8BF7\u9009\u62E9\u6587\u4EF6" }
|
|
] }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
Dragger,
|
|
UploadFile_spreadValues({}, draggerProps),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-shangchuan font50 ${UploadFilemodules.colorBlue}` })),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `font14 mt30` }, "\u62D6\u62FD\u6587\u4EF6\u6216", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${UploadFilemodules.colorBlue} ml5` }, "\u70B9\u51FB\u6B64\u5904\u4E0A\u4F20\uFF08\u5982\u679C\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC750MB,\u8BF7\u4E0A\u4F20\u81F3\u6570\u636E\u96C6\uFF09"))
|
|
))
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
SelectFilePathModal/* default */.Z,
|
|
{
|
|
onFinish: (path) => setFilePath(path)
|
|
}
|
|
))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_UploadFile = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(UploadFile));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/Tree.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Treemodules = ({"flex_box_center":"flex_box_center___UqJuy","flex_space_between":"flex_space_between___kWKf7","flex_box_vertical_center":"flex_box_vertical_center___nu70j","flex_box_center_end":"flex_box_center_end___NpRXJ","flex_box_column":"flex_box_column___mXaJ7","headLeft":"headLeft___CFA1O","colorBlue":"colorBlue___tdx2e","wrap":"wrap___Q6mHI","nodata":"nodata___f2U7q","nodataText":"nodataText___UUFGT","content":"content___nlH4h","gitCode":"gitCode___jaHbo","ellipsis":"ellipsis___wqs5z","menu":"menu___E01hA","overlayClass":"overlayClass___LrvQr","tips":"tips___XoHVF","gitTree":"gitTree___VsBuj"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/SelectFilePathModal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var SelectFilePathModalmodules = ({"wrap":"wrap___qIbzI","content":"content___cWjqb","mainPathWrap":"mainPathWrap___QP5mq","colorBlue":"colorBlue___zUy77"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/SelectFilePathModal/index.tsx
|
|
var SelectFilePathModal_defProp = Object.defineProperty;
|
|
var SelectFilePathModal_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var SelectFilePathModal_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var SelectFilePathModal_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var SelectFilePathModal_defNormalProp = (obj, key, value) => key in obj ? SelectFilePathModal_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var SelectFilePathModal_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (SelectFilePathModal_hasOwnProp.call(b, prop))
|
|
SelectFilePathModal_defNormalProp(a, prop, b[prop]);
|
|
if (SelectFilePathModal_getOwnPropSymbols)
|
|
for (var prop of SelectFilePathModal_getOwnPropSymbols(b)) {
|
|
if (SelectFilePathModal_propIsEnum.call(b, prop))
|
|
SelectFilePathModal_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var SelectFilePathModal_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const SelectFilePathModal_SelectFilePathModal = ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
title,
|
|
pathList: propsPathList = [],
|
|
showInputPath = false,
|
|
isMergeSelectFile = false,
|
|
onFinish = () => {
|
|
}
|
|
}) => {
|
|
const [form] = es_form["default"].useForm();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
const [selectPath, setSelectPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [originPath, setOriginPath] = (0,_react_17_0_2_react.useState)("");
|
|
const [mainPathList, setMainPathList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [treeList, setTreeList] = (0,_react_17_0_2_react.useState)([]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a, _b;
|
|
isRepository.current = ((_b = (_a = location.pathname) == null ? void 0 : _a.split("/")) == null ? void 0 : _b[3]) === "repository";
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (shixunsDetail.actionTabs.key !== "Repository-SelectFilePath") {
|
|
return;
|
|
}
|
|
const path = propsPathList.join("/");
|
|
let arr = [];
|
|
propsPathList.map((item, index) => {
|
|
if (index === 0) {
|
|
arr.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item}`, path });
|
|
} else {
|
|
arr.push({ val: `/${item}`, path });
|
|
}
|
|
});
|
|
setMainPathList(arr);
|
|
setSelectPath(path);
|
|
setOriginPath(path);
|
|
handleGetPathData(path);
|
|
}, [shixunsDetail.actionTabs.key]);
|
|
const handleGetPathData = (path) => SelectFilePathModal_async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: isRepository.current ? "shixunsDetail/getRepository" : "shixunsDetail/getSecretRepository",
|
|
payload: {
|
|
id: params.id,
|
|
path
|
|
}
|
|
});
|
|
if (res) {
|
|
setTreeList(res.trees || []);
|
|
}
|
|
});
|
|
const handleClickTree = (item) => {
|
|
let newPath = selectPath;
|
|
if (item.type === "tree") {
|
|
mainPathList.length ? mainPathList.push({ val: `/${item.name}`, path: item.name }) : mainPathList.push({ val: "\u6839\u76EE\u5F55", path: "" }, { val: `/${item.name}`, path: item.name });
|
|
setMainPathList(mainPathList);
|
|
newPath = selectPath ? `${selectPath}/${item.name}` : item.name;
|
|
setSelectPath(newPath);
|
|
}
|
|
handleGetPathData(newPath);
|
|
};
|
|
const handleClickMainPath = (item, index) => {
|
|
const currentPathList = mainPathList.filter((_, key) => key <= index);
|
|
setMainPathList(currentPathList);
|
|
const currentPath = currentPathList.filter((_, key) => key !== 0).map((item2) => item2.val).join("").substr(1);
|
|
setSelectPath(currentPath);
|
|
handleGetPathData(currentPath);
|
|
};
|
|
const handleOk = () => SelectFilePathModal_async(void 0, null, function* () {
|
|
const values = form == null ? void 0 : form.getFieldsValue();
|
|
const path = selectPath ? `${selectPath}${(values == null ? void 0 : values.name) ? `/${values == null ? void 0 : values.name}` : ""}` : values == null ? void 0 : values.name;
|
|
if (isMergeSelectFile) {
|
|
onFinish(path);
|
|
handleCancel();
|
|
return;
|
|
}
|
|
if (showInputPath) {
|
|
yield form.validateFields();
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/uploadGitFolder",
|
|
payload: SelectFilePathModal_spreadValues(SelectFilePathModal_spreadValues({}, {
|
|
id: params.id,
|
|
path
|
|
}), isRepository.current ? {} : { secret_repository: true })
|
|
});
|
|
onFinish(originPath);
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.info("\u65B0\u5EFA\u6210\u529F");
|
|
}
|
|
} else {
|
|
onFinish(path);
|
|
message/* default */.ZP.success("\u9009\u62E9\u6587\u4EF6\u76EE\u5F55\u6210\u529F");
|
|
}
|
|
handleCancel();
|
|
});
|
|
const handleCancel = () => {
|
|
dispatch({
|
|
type: "shixunsDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
form.resetFields();
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
title: title || "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
closable: false,
|
|
keyboard: false,
|
|
open: shixunsDetail.actionTabs.key === "Repository-SelectFilePath",
|
|
onOk: handleOk,
|
|
onCancel: handleCancel
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectFilePathModalmodules.mainPathWrap }, !!(mainPathList == null ? void 0 : mainPathList.length) && mainPathList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickMainPath(item, index) }, item.val);
|
|
})), !!(treeList == null ? void 0 : treeList.length) && treeList.map((item, index) => {
|
|
return item.type === "tree" && /* @__PURE__ */ _react_17_0_2_react.createElement("a", { key: index, onClick: () => handleClickTree(item) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-wenjianjia ${SelectFilePathModalmodules.colorBlue}` }), item.name);
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: "mt5" }, "\u9009\u4E2D\u7684\u65B0\u5EFA\u6587\u4EF6\u5939\u76EE\u5F55\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5 mb5" }, selectPath), showInputPath && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
scrollToFirstError: true,
|
|
className: "mt20"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: "name", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u540D\u79F0" }, { whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u8BF7\u8F93\u5165\u65B0\u6587\u4EF6\u5939\u540D/\u5B50\u6587\u4EF6\u5939\u540D\u3002\uFF08\u5982\uFF1Asrc/step1\uFF09" }))
|
|
))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_SelectFilePathModal = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading: loading.models.index
|
|
})
|
|
)(SelectFilePathModal_SelectFilePathModal));
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.1@@ant-design/icons/es/icons/EllipsisOutlined.js + 1 modules
|
|
var EllipsisOutlined = __webpack_require__(37586);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.1@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
|
|
var DownOutlined = __webpack_require__(77800);
|
|
// EXTERNAL MODULE: ./src/service/shixuns.ts
|
|
var shixuns = __webpack_require__(58215);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(75798);
|
|
// EXTERNAL MODULE: ./src/utils/verifyLogin.tsx + 2 modules
|
|
var verifyLogin = __webpack_require__(53140);
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 33 modules
|
|
var ImagesIcon = __webpack_require__(81200);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/Tree.tsx
|
|
var Tree_defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var Tree_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Tree_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Tree_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Tree_defNormalProp = (obj, key, value) => key in obj ? Tree_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var Tree_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (Tree_hasOwnProp.call(b, prop))
|
|
Tree_defNormalProp(a, prop, b[prop]);
|
|
if (Tree_getOwnPropSymbols)
|
|
for (var prop of Tree_getOwnPropSymbols(b)) {
|
|
if (Tree_propIsEnum.call(b, prop))
|
|
Tree_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var Tree_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (Tree_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && Tree_getOwnPropSymbols)
|
|
for (var prop of Tree_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && Tree_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Tree_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { DirectoryTree } = tree["default"];
|
|
const Repository = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
activeKey,
|
|
dispatch,
|
|
practiceSetting,
|
|
isRepository,
|
|
treeData,
|
|
setTreeData
|
|
} = _b, props = Tree_objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"activeKey",
|
|
"dispatch",
|
|
"practiceSetting",
|
|
"isRepository",
|
|
"treeData",
|
|
"setTreeData"
|
|
]);
|
|
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const [checkedValue, setCheckedValue] = (0,_react_17_0_2_react.useState)();
|
|
const [showAddFile, setShowAddFile] = (0,_react_17_0_2_react.useState)(false);
|
|
const [showRenameFile, setShowRenameFile] = (0,_react_17_0_2_react.useState)(false);
|
|
const [showAddFolder, setShowAddFolder] = (0,_react_17_0_2_react.useState)(false);
|
|
const [showUploadFile, setShowUploadFile] = (0,_react_17_0_2_react.useState)(false);
|
|
const [defaultPath, setDefaultPath] = (0,_react_17_0_2_react.useState)("");
|
|
let [expandedKeys, setExpandedKeys] = (0,_react_17_0_2_react.useState)([]);
|
|
let [selectedKeys, setSelectedKeys] = (0,_react_17_0_2_react.useState)([]);
|
|
const [treeList, setTreeList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [visibleTip, setVisibleTip] = (0,_react_17_0_2_react.useState)(false);
|
|
const [commitInfo, setCommitInfo] = (0,_react_17_0_2_react.useState)();
|
|
const [secretDirPath, setSecretDirPath] = (0,_react_17_0_2_react.useState)();
|
|
const [pathList, setPathList] = (0,_react_17_0_2_react.useState)("");
|
|
const [newMergeValue, setNewMergeValue] = (0,_react_17_0_2_react.useState)();
|
|
const [isMergeSelectFile, setIsMergeSelectFile] = (0,_react_17_0_2_react.useState)(false);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setTreeData([]);
|
|
handleGetRepository("");
|
|
if (!localStorage.warehouseHideTip) {
|
|
setVisibleTip(true);
|
|
}
|
|
}, [location.pathname, isRepository]);
|
|
const handleMergeSelectFile = (path = "") => Tree_async(void 0, null, function* () {
|
|
const res = yield (0,shixuns/* setSecretDir */.Zt)({ id: params.id, secret_dir_path: path });
|
|
res && setNewMergeValue(path);
|
|
});
|
|
const menu = (item) => {
|
|
var _a3;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"], { className: Treemodules.menu, onClick: (value) => {
|
|
setDefaultPath(item.path || "");
|
|
switch (value.key) {
|
|
case "1":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u65B0\u5EFA\u6587\u4EF6"]);
|
|
setShowAddFile(true);
|
|
break;
|
|
case "2":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u65B0\u5EFA\u6587\u4EF6\u5939"]);
|
|
setShowAddFolder(true);
|
|
break;
|
|
case "3":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u4E0A\u4F20"]);
|
|
setShowUploadFile(true);
|
|
break;
|
|
case "4":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u91CD\u547D\u540D"]);
|
|
setShowRenameFile(true);
|
|
break;
|
|
case "5":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u5220\u9664"]);
|
|
handleDeleteFile(item.path, item.name, item);
|
|
break;
|
|
case "6":
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", "\u590D\u5236\u8DEF\u5F84"]);
|
|
copyFilePath(item);
|
|
break;
|
|
}
|
|
} }, (item.type === "topTree" || item.type === "tree") && /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "1" }, "\u65B0\u5EFA\u6587\u4EF6"), (item.type === "topTree" || item.type === "tree") && /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "2" }, "\u65B0\u5EFA\u6587\u4EF6\u5939"), (item.type === "topTree" || item.type === "tree") && /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "3" }, "\u4E0A\u4F20"), item.type !== "topTree" && item.type !== "tree" && ((_a3 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a3.public) < 2 && /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "4" }, "\u91CD\u547D\u540D"), item.type !== "topTree" && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
lib.CopyToClipboard,
|
|
{
|
|
text: `/data/workspace/myshixun/${!isRepository ? "secret/" : ""}${item == null ? void 0 : item.path}`,
|
|
onCopy: () => message/* default */.ZP.success("\u590D\u5236\u6210\u529F")
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "6" }, /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, "\u590D\u5236\u8DEF\u5F84"))
|
|
), item.type !== "topTree" && /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { key: "5" }, "\u5220\u9664"));
|
|
};
|
|
const createDom = (data, path) => {
|
|
return data.map((item) => {
|
|
if (path == "") {
|
|
item.path = path + item.name;
|
|
} else {
|
|
item.path = path + "/" + item.name;
|
|
}
|
|
item.title = /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { className: "font14" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, item.type === "blob" && /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "20px", style: { marginLeft: -20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "iconfont icon-wenjian11 font12" })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: ` multi_ellipsis1` }, item.name)))), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, (item.type === "blob" || item.type === "tree") && /* @__PURE__ */ _react_17_0_2_react.createElement(dropdown/* default */.Z, { dropdownRender: () => menu(item), className: Treemodules.ellipsis }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-gengduo2 c-555a88" }))));
|
|
item.disableCheckbox = checkedValue && checkedValue !== item.name;
|
|
item.className = item.type === "tree" ? Treemodules.pl23 : "";
|
|
item.checkable = item.type !== "tree";
|
|
item.isLeaf = item.type !== "tree";
|
|
item.children = item.type === "tree" && [];
|
|
item.key = item.path;
|
|
return item;
|
|
});
|
|
};
|
|
const selectPath = (path) => {
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { selectPath: path }
|
|
});
|
|
};
|
|
const insertFile = (path, name) => Tree_async(void 0, null, function* () {
|
|
const pathArr = path.split("/");
|
|
yield handleGetRepository(defaultPath);
|
|
setTimeout(() => {
|
|
selectPath(path);
|
|
expandedKeys = [pathArr[0] || ""];
|
|
selectedKeys = [path];
|
|
setSelectedKeys([...selectedKeys]);
|
|
setExpandedKeys([...expandedKeys]);
|
|
}, 150);
|
|
});
|
|
const insertData = (data, path) => {
|
|
if (path == "") {
|
|
treeData = [...data];
|
|
setTreeData([...data]);
|
|
} else {
|
|
let d = updateTreeData(treeData, path, data);
|
|
treeData = d;
|
|
setTreeData([...d]);
|
|
}
|
|
};
|
|
function updateTreeData(list, key, children) {
|
|
return list.map((node) => {
|
|
if (node.key === key) {
|
|
node.children = [...children];
|
|
return Tree_spreadValues({}, node);
|
|
} else if (node.children) {
|
|
return __spreadProps(Tree_spreadValues({}, node), {
|
|
children: updateTreeData(node.children, key, children)
|
|
});
|
|
}
|
|
return node;
|
|
});
|
|
}
|
|
const handleGetRepository = (path = "") => Tree_async(void 0, null, function* () {
|
|
var _a3, _b3;
|
|
const res = yield dispatch({
|
|
type: isRepository ? "shixunsDetail/getRepository" : "shixunsDetail/getSecretRepository",
|
|
payload: {
|
|
id: params.id,
|
|
path
|
|
}
|
|
});
|
|
if (res) {
|
|
if (!!((_a3 = res.trees) == null ? void 0 : _a3.length)) {
|
|
let d = createDom([...res.trees], path);
|
|
insertData(d, path);
|
|
setTreeList(res.trees || []);
|
|
setSecretDirPath(path || "");
|
|
console.log("handleGetRepository:", d, path);
|
|
setTimeout(() => console.log(treeData, res.trees, path, 999999), 2e3);
|
|
} else if (path == "") {
|
|
setTreeData([]);
|
|
}
|
|
setCommitInfo(((_b3 = res.commits) == null ? void 0 : _b3[0]) || {});
|
|
}
|
|
return res;
|
|
});
|
|
const loadData = (selectedKeys2) => Tree_async(void 0, null, function* () {
|
|
return new Promise((resolve, reject) => Tree_async(void 0, null, function* () {
|
|
if (!!selectedKeys2.children.length) {
|
|
resolve();
|
|
}
|
|
setPathList(selectedKeys2.path);
|
|
yield handleGetRepository(selectedKeys2.path);
|
|
resolve();
|
|
}));
|
|
});
|
|
const handleSelectTree = (selectedKeys2, data) => Tree_async(void 0, null, function* () {
|
|
var _a3;
|
|
console.log("handleSelectTree", selectedKeys2, data.nativeEvent.target.nodeName, data);
|
|
const toNext = () => {
|
|
selectPath(data.node.path);
|
|
selectedKeys2 = [data.node.path];
|
|
setSelectedKeys([...selectedKeys2]);
|
|
};
|
|
if (data.nativeEvent.target.nodeName === "svg" || data.nativeEvent.target.nodeName === "LI" || data.nativeEvent.target.nodeName === "I") {
|
|
return;
|
|
}
|
|
if (data.node.type === "blob") {
|
|
if ((_a3 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _a3.confirmLeave) {
|
|
modal["default"].confirm({
|
|
title: "\u79BB\u5F00\u6B64\u9875\u63D0\u793A",
|
|
content: "\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",
|
|
okText: "\u79BB\u5F00",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => {
|
|
toNext();
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { confirmLeave: false }
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
toNext();
|
|
}
|
|
}
|
|
});
|
|
const handleDeleteFile = (path, name, item) => {
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
title: `\u786E\u8BA4\u9700\u8981\u5220\u9664\u8BE5\u6587\u4EF6${item.children ? "\u5939" : ""}?`,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => Tree_async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/deleteGitFile",
|
|
payload: {
|
|
id: params.id,
|
|
path,
|
|
message: `\u5220\u9664${path}`,
|
|
secret_repository: isRepository ? null : true
|
|
}
|
|
});
|
|
let pathArr = path.split("/");
|
|
if ((res == null ? void 0 : res.status) === 0) {
|
|
message/* default */.ZP.info("\u5220\u9664\u6210\u529F");
|
|
pathArr.splice(pathArr.length - 1, 1);
|
|
const res2 = yield handleGetRepository(pathArr.length > 1 ? pathArr.join("/") : "");
|
|
if (res2 == null ? void 0 : res2.trees) {
|
|
} else {
|
|
pathArr.splice(pathArr.length - 1, 1);
|
|
yield handleGetRepository(pathArr.length > 1 ? pathArr.join("/") : "");
|
|
}
|
|
selectPath("");
|
|
return true;
|
|
} else if ((res == null ? void 0 : res.status) === -3) {
|
|
modal["default"].confirm({
|
|
title: "\u5220\u9664\u5931\u8D25",
|
|
centered: true,
|
|
content: /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\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: "\u524D\u5F80\u4FEE\u6539",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => {
|
|
window.location.href = `/shixuns/${params.id}/edit/${res == null ? void 0 : res.message}/tab=2`;
|
|
}
|
|
});
|
|
} else if ((res == null ? void 0 : res.status) === -4) {
|
|
modal["default"].confirm({
|
|
title: "\u5220\u9664\u5931\u8D25",
|
|
centered: true,
|
|
content: /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, res == null ? void 0 : res.message),
|
|
okText: "\u524D\u5F80\u4FEE\u6539",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => {
|
|
window.location.href = `/shixuns/${params.id}/edit?tabId=service`;
|
|
}
|
|
});
|
|
}
|
|
})
|
|
});
|
|
};
|
|
const copyFilePath = (item) => {
|
|
console.log(item, "item");
|
|
};
|
|
const handleExpand = (key, node) => Tree_async(void 0, null, function* () {
|
|
console.log("handleExpand", node);
|
|
if (node.nativeEvent.target.nodeName === "svg" || node.nativeEvent.target.nodeName === "path" || node.nativeEvent.target.nodeName === "LI") {
|
|
return true;
|
|
} else {
|
|
yield loadData(node.node);
|
|
if (expandedKeys.includes(node.node.path)) {
|
|
expandedKeys.splice(expandedKeys.indexOf(node.node.path), 1);
|
|
} else {
|
|
expandedKeys.push(node.node.path);
|
|
}
|
|
}
|
|
setExpandedKeys([...expandedKeys]);
|
|
});
|
|
const closeTip = () => {
|
|
setVisibleTip(false);
|
|
localStorage.warehouseHideTip = true;
|
|
};
|
|
const handleChange = (checked) => Tree_async(void 0, null, function* () {
|
|
var _a3;
|
|
let content;
|
|
let title = "";
|
|
let okText;
|
|
let cancelText;
|
|
switch (isRepository) {
|
|
case true:
|
|
title = "\u5F00\u542F\u7248\u672C\u5E93";
|
|
okText = "\u5F00\u542F";
|
|
cancelText = "\u4E0D\u5F00\u542F";
|
|
content = /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\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");
|
|
break;
|
|
case false:
|
|
if ((_a3 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a3.secret_repository) {
|
|
title = "\u5173\u95ED\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93";
|
|
okText = "\u786E\u5B9A";
|
|
cancelText = "\u53D6\u6D88";
|
|
content = /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\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 = "\u5F00\u542F\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93";
|
|
okText = "\u4E0D\u4F7F\u7528";
|
|
cancelText = "\u4F7F\u7528";
|
|
content = /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\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");
|
|
}
|
|
break;
|
|
}
|
|
if (!isRepository && (0,verifyLogin/* ShixunStatusModel */.gy)(dispatch, "\u4E0D\u80FD\u5F00\u542F/\u5173\u95ED\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93")) {
|
|
return;
|
|
}
|
|
modal["default"].confirm({
|
|
title,
|
|
okText,
|
|
cancelText,
|
|
content,
|
|
onOk: () => {
|
|
var _a4;
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u8BBE\u7F6E", "\u4EE3\u7801\u4ED3\u5E93", title]);
|
|
if (!isRepository && !((_a4 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a4.secret_repository)) {
|
|
} else {
|
|
handleChangeNext(checked);
|
|
}
|
|
},
|
|
onCancel: () => {
|
|
var _a4;
|
|
if (!isRepository && !((_a4 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a4.secret_repository)) {
|
|
handleChangeNext(checked);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
const handleChangeNext = (checked) => Tree_async(void 0, null, function* () {
|
|
if (isRepository) {
|
|
yield (0,shixuns/* createRepository */.h4)(Tree_spreadValues({}, params));
|
|
dispatch({
|
|
type: "practiceSetting/getCommonData",
|
|
payload: Tree_spreadValues({}, params)
|
|
});
|
|
} else {
|
|
yield (0,shixuns/* createSecretRepository */.K0)(__spreadProps(Tree_spreadValues({}, params), { is_secret_repository: checked }));
|
|
}
|
|
handleGetRepository();
|
|
dispatch({
|
|
type: "shixunsDetail/getShixunsDetail",
|
|
payload: { id: params.id }
|
|
});
|
|
});
|
|
const onDragEnter = (info) => {
|
|
console.log(info);
|
|
};
|
|
const onDrop = (info) => Tree_async(void 0, null, function* () {
|
|
console.log(info);
|
|
const dropKey = info.node.key;
|
|
const dragKey = info.dragNode.key;
|
|
const dropPos = info.node.pos.split("-");
|
|
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
|
if (info.dragNode.type === "tree") {
|
|
message/* default */.ZP.warning("\u4E0D\u652F\u6301\u6587\u4EF6\u5939\u79FB\u52A8\u76EE\u5F55");
|
|
return;
|
|
}
|
|
if (info.node.type !== "tree") {
|
|
message/* default */.ZP.warning("\u672A\u79FB\u52A8\u6587\u4EF6\u76EE\u5F55\u4F4D\u7F6E");
|
|
return;
|
|
}
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/moveGitFile",
|
|
payload: { id: params.id, from: info.dragNode.path, to: info.node.path + "/" + info.dragNode.name, message: `${info.dragNode.path} move to ${info.node.path + "/" + info.dragNode.name} ` }
|
|
});
|
|
if (res.status === 0) {
|
|
selectPath("");
|
|
yield handleGetRepository("");
|
|
for (let i = 0; i < expandedKeys.length; i++) {
|
|
if (expandedKeys[i] != "")
|
|
yield handleGetRepository(expandedKeys[i]);
|
|
}
|
|
}
|
|
return;
|
|
const loop = (data2, key, callback) => {
|
|
for (let i = 0; i < data2.length; i++) {
|
|
if (data2[i].key === key) {
|
|
return callback(data2[i], i, data2);
|
|
}
|
|
if (data2[i].children) {
|
|
loop(data2[i].children, key, callback);
|
|
}
|
|
}
|
|
};
|
|
const data = [...treeData];
|
|
let dragObj;
|
|
loop(data, dragKey, (item, index, arr) => {
|
|
arr.splice(index, 1);
|
|
dragObj = item;
|
|
});
|
|
if (!info.dropToGap) {
|
|
loop(data, dropKey, (item) => {
|
|
item.children = item.children || [];
|
|
item.children.unshift(dragObj);
|
|
});
|
|
} else if ((info.node.props.children || []).length > 0 && // Has children
|
|
info.node.props.expanded && // Is expanded
|
|
dropPosition === 1) {
|
|
loop(data, dropKey, (item) => {
|
|
item.children = item.children || [];
|
|
item.children.unshift(dragObj);
|
|
});
|
|
} else {
|
|
let ar;
|
|
let i;
|
|
loop(data, dropKey, (item, index, arr) => {
|
|
ar = arr;
|
|
i = index;
|
|
});
|
|
if (dropPosition === -1) {
|
|
ar.splice(i, 0, dragObj);
|
|
} else {
|
|
ar.splice(i + 1, 0, dragObj);
|
|
}
|
|
}
|
|
setTreeData([...data]);
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Treemodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Treemodules.contentbg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Treemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { className: Treemodules.gitCode }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "iconfont icon-daimacangku2 mr8" }), isRepository ? "\u4EE3\u7801\u4ED3\u5E93" : "\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93", /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_switch/* default */.Z,
|
|
{
|
|
className: isRepository && ((_a2 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a2.init_repository) ? "hide" : "ml10",
|
|
checked: !isRepository ? (_b2 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _b2.secret_repository : (_c = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _c.init_repository,
|
|
checkedChildren: "\u5F00\u542F",
|
|
unCheckedChildren: "\u5173\u95ED",
|
|
onChange: handleChange
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(dropdown/* default */.Z, { dropdownRender: () => menu({ type: "topTree" }), className: "current" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tooltip/* default */.Z,
|
|
{
|
|
open: visibleTip,
|
|
title: /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "font16" }, /* @__PURE__ */ _react_17_0_2_react.createElement(EllipsisOutlined/* default */.Z, { style: { position: "relative", left: -35 }, onClick: () => closeTip() }), "\u70B9\u51FB\u6B64\u5904\u65B0\u5EFA\u6587\u4EF6\u3001\u65B0\u5EFA\u6587\u4EF6\u5939\u3001\u4E0A\u4F20\u6587\u4EF6\u3002", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => closeTip(), className: "iconfont icon-guanbi1 ml8 current font14" })),
|
|
overlayClassName: Treemodules.overlayClass,
|
|
overlayStyle: { maxWidth: 500 },
|
|
arrowPointAtCenter: true,
|
|
placement: "right",
|
|
color: "#F7B500"
|
|
},
|
|
isRepository && ((_d = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _d.init_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-gengduo2 c-555a88" }),
|
|
!isRepository && ((_e = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _e.secret_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-gengduo2 c-555a88" })
|
|
)))), !!treeData.length && !isRepository && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20 pl20 pr20 font14 c-white" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\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__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Treemodules.content }, activeKey === "1" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Treemodules.tips }, "\u63D0\u793A\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), '\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__ */ _react_17_0_2_react.createElement(
|
|
DirectoryTree,
|
|
{
|
|
disabled: !!loading.effects["shixunsDetail/getFileContent"],
|
|
multiple: true,
|
|
showIcon: false,
|
|
treeData,
|
|
switcherIcon: /* @__PURE__ */ _react_17_0_2_react.createElement(DownOutlined/* default */.Z, { style: { fontWeight: "bold", fontSize: 14, position: "relative", top: 5, left: -2 } }),
|
|
onExpand: handleExpand,
|
|
expandedKeys,
|
|
selectedKeys,
|
|
onSelect: handleSelectTree,
|
|
draggable: true,
|
|
onDragEnter,
|
|
onDrop,
|
|
className: Treemodules.gitTree
|
|
}
|
|
))) : "", !treeData.length && isRepository && ((_f = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _f.init_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement(NoData, null), !treeData.length && !isRepository && ((_g = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _g.secret_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement(NoData, null))), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
RenameFile,
|
|
{
|
|
visible: showRenameFile,
|
|
defaultPath,
|
|
onClose: () => setShowRenameFile(false),
|
|
isRepository: !isRepository,
|
|
onOK: (data) => Tree_async(void 0, null, function* () {
|
|
const pathArr = defaultPath.split("/");
|
|
pathArr.pop();
|
|
yield handleGetRepository(pathArr.join("/"));
|
|
selectPath("");
|
|
})
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_AddFile,
|
|
{
|
|
visible: showAddFile,
|
|
defaultPath,
|
|
onClose: () => setShowAddFile(false),
|
|
isRepository,
|
|
onOK: (data) => {
|
|
insertFile(data.path, data.name);
|
|
}
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
AddFolder,
|
|
{
|
|
visible: showAddFolder,
|
|
defaultPath,
|
|
onClose: () => setShowAddFolder(false),
|
|
isRepository,
|
|
onOK: (data) => {
|
|
insertFile(data.path, data.name);
|
|
}
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_UploadFile,
|
|
{
|
|
defaultPath,
|
|
visible: showUploadFile,
|
|
isRepository,
|
|
onClose: () => setShowUploadFile(false),
|
|
onOK: (data) => Tree_async(void 0, null, function* () {
|
|
const pathArr = defaultPath.split("/");
|
|
yield handleGetRepository(defaultPath);
|
|
expandedKeys = [pathArr[0] || ""];
|
|
selectedKeys = [defaultPath];
|
|
setSelectedKeys([...selectedKeys]);
|
|
setExpandedKeys([...expandedKeys]);
|
|
})
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_SelectFilePathModal,
|
|
{
|
|
pathList: defaultPath == null ? void 0 : defaultPath.split("/"),
|
|
showInputPath: true,
|
|
isMergeSelectFile,
|
|
onFinish: (path) => {
|
|
isMergeSelectFile ? handleMergeSelectFile(path) : handleGetRepository(path);
|
|
setIsMergeSelectFile(false);
|
|
}
|
|
}
|
|
));
|
|
};
|
|
const NoData = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `mt20 pb50 ${Treemodules.nodata}` }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Treemodules.headLeft }, "\u63D0\u793A\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\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__ */ _react_17_0_2_react.createElement("br", null), "\u4E24\u79CD\u65B9\u5F0F\u6765\u4F7F\u7528\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "1\u3001", /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: "/forums/2784", target: "_blank" }, "Git\u5BA2\u6237\u7AEF"), " \u4E0A\u4F20\u5DF2\u6709\u6587\u4EF6\u6765\u5F00\u59CB\u4F7F\u7528\u3002", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "2\u3001\u76F4\u63A5\u5728\u5E73\u53F0\u4E0A\u521B\u5EFA\u6587\u4EF6\u76EE\u5F55\u4EE5\u53CA\u76F8\u5173\u4EE3\u7801\u6587\u4EF6\u3002", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "3\u3001\u5982\u679C\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC750MB,\u8BF7\u4E0A\u4F20\u81F3\u6570\u636E\u96C6\u3002"), /* @__PURE__ */ _react_17_0_2_react.createElement("img", { width: "100%", src: ImagesIcon/* repositoryNoneDataIcon */.Oe }));
|
|
};
|
|
/* harmony default export */ var Tree = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
practiceSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
practiceSetting,
|
|
loading
|
|
})
|
|
)(Repository));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/Commit.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Commitmodules = ({"flex_box_center":"flex_box_center___JYIA5","flex_space_between":"flex_space_between___OOSa6","flex_box_vertical_center":"flex_box_vertical_center___s1AAj","flex_box_center_end":"flex_box_center_end___Ou9x8","flex_box_column":"flex_box_column___fXhOh","commitWrap":"commitWrap___xJGHF","wrap":"wrap___OEGuw","colorGray":"colorGray___nocDG","content":"content___Cvvjf","itemTime":"itemTime___wIggD","imageUrl":"imageUrl___C3Dsm","blueLight":"blueLight___qEiQB","divider":"divider___G5Y2d","empty":"empty___L1pRU"});
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/divider/index.js + 1 modules
|
|
var divider = __webpack_require__(28103);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/components/Commit.tsx
|
|
var Commit_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Commit_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Commit_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Commit_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (Commit_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && Commit_getOwnPropSymbols)
|
|
for (var prop of Commit_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && Commit_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Commit_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Commit = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch,
|
|
isRepository
|
|
} = _b, props = Commit_objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch",
|
|
"isRepository"
|
|
]);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [commitList, setCommitList] = (0,_react_17_0_2_react.useState)([]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
getRepositoryCommit();
|
|
}, [isRepository]);
|
|
const getRepositoryCommit = () => Commit_async(void 0, null, function* () {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/getRepositoryCommit",
|
|
payload: {
|
|
id: params.id,
|
|
secret_repository: isRepository ? void 0 : true
|
|
}
|
|
});
|
|
if (res) {
|
|
setCommitList(res.commits || []);
|
|
}
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, commitList == "" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Commitmodules.empty }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: ImagesIcon/* emptyIcon2 */.em, width: "258" }), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-grey-c font14" }, "\u6682\u65E0\u63D0\u4EA4\u8BB0\u5F55")), commitList != "" && /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Commitmodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Commitmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Commitmodules.content }, commitList == null ? void 0 : commitList.map((item) => {
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: "c-white font16" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, item.title)), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: `mt20 ` }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { className: Commitmodules.imageUrl, src: env/* default */.Z.IMG_SERVER + "/" + ((_a2 = item.author) == null ? void 0 : _a2.image_url) })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: Commitmodules.blueLight }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, (_b2 = item.author) == null ? void 0 : _b2.username)), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `ml20 ${Commitmodules.blueLight}` }, "\u63D0\u4EA4\u4E8E"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `ml20 ${Commitmodules.blueLight}` }, item.time))), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, { className: Commitmodules.divider }));
|
|
})))));
|
|
};
|
|
/* harmony default export */ var components_Commit = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(Commit));
|
|
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
|
|
var PreviewAll = __webpack_require__(95391);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Warehouse/index.tsx
|
|
var Warehouse_defProp = Object.defineProperty;
|
|
var Warehouse_defProps = Object.defineProperties;
|
|
var Warehouse_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var Warehouse_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Warehouse_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Warehouse_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Warehouse_defNormalProp = (obj, key, value) => key in obj ? Warehouse_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var Warehouse_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (Warehouse_hasOwnProp.call(b, prop))
|
|
Warehouse_defNormalProp(a, prop, b[prop]);
|
|
if (Warehouse_getOwnPropSymbols)
|
|
for (var prop of Warehouse_getOwnPropSymbols(b)) {
|
|
if (Warehouse_propIsEnum.call(b, prop))
|
|
Warehouse_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var Warehouse_spreadProps = (a, b) => Warehouse_defProps(a, Warehouse_getOwnPropDescs(b));
|
|
var Warehouse_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (Warehouse_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && Warehouse_getOwnPropSymbols)
|
|
for (var prop of Warehouse_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && Warehouse_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Warehouse_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { TabPane } = tabs["default"];
|
|
const Warehouse = (_a) => {
|
|
var _b = _a, { globalSetting, loading, dispatch, practiceSetting, shixunsDetail } = _b, props = Warehouse_objRest(_b, ["globalSetting", "loading", "dispatch", "practiceSetting", "shixunsDetail"]);
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
const [activeKey, setActiveKey] = (0,_react_17_0_2_react.useState)("1");
|
|
const [tabKey, setTabKey] = (0,_react_17_0_2_react.useState)("1");
|
|
let [codeMirrorValue, setCodeMirrorValue] = (0,_react_17_0_2_react.useState)();
|
|
const codeMirrorSourceValue = (0,_react_17_0_2_react.useRef)();
|
|
const [isRepository, setIsRepository] = (0,_react_17_0_2_react.useState)(true);
|
|
const [filePath, setFilePath] = (0,_react_17_0_2_react.useState)(["2", "1"]);
|
|
const [treeData, setTreeData] = (0,_react_17_0_2_react.useState)([]);
|
|
const ref = (0,_react_17_0_2_react.useRef)();
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const menuData = [{
|
|
id: "1",
|
|
name: "\u4EE3\u7801\u4ED3\u5E93"
|
|
}, {
|
|
id: "2",
|
|
name: /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, "\u79C1\u5BC6\u4EE3\u7801\u4ED3\u5E93"), /* @__PURE__ */ _react_17_0_2_react.createElement(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" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-xiaowenhao", style: { marginLeft: 2, fontSize: 14 } })))
|
|
}];
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2;
|
|
try {
|
|
if (!!((_c2 = (_b3 = (_a3 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _a3.content) == null ? void 0 : _b3.content) == null ? void 0 : _c2.length) || ((_e2 = (_d2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _d2.content) == null ? void 0 : _e2.content) == "") {
|
|
if (((_f2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _f2.file_type) === "txt") {
|
|
codeMirrorSourceValue.current = window.decodeURIComponent(escape(window.atob((_h2 = (_g2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _g2.content) == null ? void 0 : _h2.content)));
|
|
codeMirrorValue = window.decodeURIComponent(escape(window.atob((_j2 = (_i2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _i2.content) == null ? void 0 : _j2.content)));
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
} else {
|
|
codeMirrorSourceValue.current = (_l2 = (_k2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _k2.content) == null ? void 0 : _l2.content;
|
|
codeMirrorValue = (_n2 = (_m2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _m2.content) == null ? void 0 : _n2.content;
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
codeMirrorSourceValue.current = window.atob((_p2 = (_o2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _o2.content) == null ? void 0 : _p2.content);
|
|
codeMirrorValue = window.atob((_r2 = (_q2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _q2.content) == null ? void 0 : _r2.content);
|
|
setCodeMirrorValue(codeMirrorValue);
|
|
message/* default */.ZP.warning("\u8BF7\u786E\u8BA4\u6587\u4EF6\u5B57\u7B26\u96C6\u7F16\u7801\u662F\u5426\u4E3AUTF-8");
|
|
}
|
|
console.log("codeMirrorSourceValue1212:12", shixunsDetail.fileContent.content);
|
|
}, [(_a2 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _a2.content]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3;
|
|
const path = (_a3 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _a3.selectPath.split("/");
|
|
setFilePath(path);
|
|
}, [(_b2 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _b2.selectPath]);
|
|
const updateCodeMirrorValue = (value) => {
|
|
setCodeMirrorValue(value);
|
|
let update = -1;
|
|
if (value === codeMirrorSourceValue.current) {
|
|
update = 0;
|
|
} else {
|
|
update = 1;
|
|
}
|
|
if (update !== -1) {
|
|
}
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { confirmLeave: !!update }
|
|
});
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
new Promise((resolve, reject) => Warehouse_async(void 0, null, function* () {
|
|
var _a3, _b3, _c2;
|
|
if (((_a3 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _a3.selectPath) !== "" && ((_b3 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _b3.selectPath)) {
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/getFileContent",
|
|
payload: {
|
|
id: params.id,
|
|
path: (_c2 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _c2.selectPath,
|
|
secret_repository: isRepository ? null : true
|
|
}
|
|
});
|
|
if ((res == null ? void 0 : res.content) || (res == null ? void 0 : res.content) == "") {
|
|
} else {
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { selectPath: "" }
|
|
});
|
|
}
|
|
}
|
|
}));
|
|
}, [(_c = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _c.selectPath]);
|
|
const menu = /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"], { className: Warehousemodules.menu, style: { background: "#24294b" }, onClick: (value) => {
|
|
var _a3;
|
|
if (!((_a3 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a3.secret_repository) && value.key === "2") {
|
|
setTabKey("1");
|
|
}
|
|
setActiveKey(value.key);
|
|
if (value.key === "1") {
|
|
setIsRepository(true);
|
|
} else {
|
|
setIsRepository(false);
|
|
}
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { disabled: true, key: "0" }, "\u5207\u6362\u4ED3\u5E93"), menuData.filter((item) => {
|
|
var _a3, _b3;
|
|
if (!((_a3 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _a3.init_repository) || ((_b3 = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _b3.is_jupyter_lab)) {
|
|
return item.id !== "2";
|
|
}
|
|
return item;
|
|
}).map((item, key) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_menu["default"].Item, { className: "leaveClick", key: item.id }, item.name);
|
|
}));
|
|
const handleSave = () => Warehouse_async(void 0, null, function* () {
|
|
var _a3, _b3;
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/updateRepositoryFile",
|
|
payload: {
|
|
id: params.id,
|
|
path: (_b3 = (_a3 = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _a3.params) == null ? void 0 : _b3.path,
|
|
content: codeMirrorValue,
|
|
secret_repository: isRepository ? null : true
|
|
}
|
|
});
|
|
if (res == null ? void 0 : res.content) {
|
|
message/* default */.ZP.info("\u4FDD\u5B58\u6210\u529F");
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: Warehouse_spreadProps(Warehouse_spreadValues({}, practiceSetting.sideBar), { confirmLeave: false })
|
|
});
|
|
}
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.warehouse }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: "w100 c-white", style: { height: 60 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(dropdown/* default */.Z, { dropdownRender: () => menu, className: Warehousemodules.menu }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-white current ml20" }, menuData.find((item) => item.id === activeKey)["name"], " ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#B0B5D6" }, className: "iconfont icon-sanjiaoxing font12" })))), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "81px" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.line })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(tabs["default"], { className: Warehousemodules.tabs, activeKey: tabKey, onChange: (key) => {
|
|
var _a3;
|
|
if ((_a3 = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _a3.confirmLeave) {
|
|
modal["default"].confirm({
|
|
title: "\u79BB\u5F00\u6B64\u9875\u63D0\u793A",
|
|
content: "\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",
|
|
okText: "\u79BB\u5F00",
|
|
cancelText: "\u53D6\u6D88",
|
|
onOk: () => {
|
|
setTabKey(key);
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { confirmLeave: false, selectPath: "" }
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
setTabKey(key);
|
|
dispatch({
|
|
type: "practiceSetting/setSideBarTabs",
|
|
payload: { confirmLeave: false, selectPath: "" }
|
|
});
|
|
}
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement(TabPane, { tab: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "leaveClick" }, "\u4EE3\u7801\u6587\u4EF6"), key: "1" }), isRepository && ((_d = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _d.init_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement(TabPane, { tab: "\u63D0\u4EA4\u8BB0\u5F55", key: "2", className: "leaveClick" }), !isRepository && ((_e = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _e.secret_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement(TabPane, { tab: "\u63D0\u4EA4\u8BB0\u5F55", key: "2", className: "leaveClick" }))))), (isRepository && ((_f = shixunsDetail == null ? void 0 : shixunsDetail.repository) == null ? void 0 : _f.git_url) || !isRepository && ((_g = shixunsDetail == null ? void 0 : shixunsDetail.secretRepository) == null ? void 0 : _g.git_url)) && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: Warehousemodules.title }, "\u4ED3\u5E93\u5730\u5740:"), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"input",
|
|
{
|
|
value: isRepository ? (_h = shixunsDetail == null ? void 0 : shixunsDetail.repository) == null ? void 0 : _h.git_url : (_i = shixunsDetail == null ? void 0 : shixunsDetail.secretRepository) == null ? void 0 : _i.git_url
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
lib.CopyToClipboard,
|
|
{
|
|
text: isRepository ? (_j = shixunsDetail == null ? void 0 : shixunsDetail.repository) == null ? void 0 : _j.git_url : (_k = shixunsDetail == null ? void 0 : shixunsDetail.secretRepository) == null ? void 0 : _k.git_url,
|
|
onCopy: () => message/* default */.ZP.success("\u590D\u5236\u6210\u529F")
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { placement: "topLeft", title: "\u70B9\u51FB\u590D\u5236\u7248\u672C\u5E93" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-fuzhi2 current ml5 mr40" }))
|
|
))))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.content, style: { overflow: "auto" } }, tabKey === "1" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: Warehousemodules.left }, /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: !!loading.effects["shixunsDetail/getRepository"], wrapperClassName: `${Warehousemodules.loading} ${Warehousemodules.bottom0}` }, /* @__PURE__ */ _react_17_0_2_react.createElement(Tree, { setTreeData, treeData, activeKey, isRepository }))), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: Warehousemodules.right, ref }, ((_l = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _l.selectPath) !== "" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: !!loading.effects["shixunsDetail/getFileContent"], wrapperClassName: Warehousemodules.loading }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.filePathWrp }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: "w100" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "iconfont icon-daimacangku2 c-white" })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "40px" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.line, style: { marginLeft: 20 } })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: Warehousemodules.filePath }, filePath.map((item, key) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-blue" }, item);
|
|
})))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: !!loading.effects["shixunsDetail/getFileContent"] ? "hide" : "show" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
PreviewAll/* default */.Z,
|
|
{
|
|
className: `darkBlue`,
|
|
style: { top: 66, height: "calc(100% - 60px)", position: "absolute", zIndex: 1 },
|
|
filename: (_m = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _m.filename,
|
|
type: ((_n = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _n.file_type) === "office" ? "download" : (_o = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _o.file_type,
|
|
data: codeMirrorValue,
|
|
monacoEditor: {
|
|
value: codeMirrorValue,
|
|
language: (_p = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _p.language,
|
|
onChange: (value) => updateCodeMirrorValue(value),
|
|
options: {
|
|
fontSize: 14
|
|
}
|
|
}
|
|
}
|
|
))), ((_q = shixunsDetail == null ? void 0 : shixunsDetail.fileContent) == null ? void 0 : _q.file_type) === "txt" && /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", justify: "center", className: Warehousemodules.footer }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", size: "middle", ghost: true, onClick: () => {
|
|
_umi_production_exports.history.push(`/shixuns/${params.id}/challenges`);
|
|
} }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", size: "middle", className: "ml40", onClick: handleSave }, "\u63D0\u4EA4")))), ((_r = practiceSetting == null ? void 0 : practiceSetting.sideBar) == null ? void 0 : _r.selectPath) == "" && ((_s = shixunsDetail == null ? void 0 : shixunsDetail.detail) == null ? void 0 : _s.init_repository) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.empty }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: ImagesIcon/* emptyIcon */.x7, width: "258" }), /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-grey-c" }, !!(treeData == null ? void 0 : treeData.length) && "\u5728\u5DE6\u4FA7\u4EE3\u7801\u4ED3\u5E93\u533A\u57DF\u70B9\u51FB\u76EE\u5F55\u6253\u5F00\u6587\u4EF6", !(treeData == null ? void 0 : treeData.length) && "\u8BF7\u5148\u5728\u5DE6\u4FA7\u4E0A\u4F20\u6587\u4EF6\u6216\u65B0\u5EFA\u6587\u4EF6\uFF01")))), tabKey === "2" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Warehousemodules.commit }, /* @__PURE__ */ _react_17_0_2_react.createElement(components_Commit, { isRepository }))));
|
|
};
|
|
/* harmony default export */ var body_Warehouse = ((0,_umi_production_exports.connect)(({ loading, globalSetting, practiceSetting, shixunsDetail }) => ({
|
|
globalSetting,
|
|
loading,
|
|
practiceSetting,
|
|
shixunsDetail
|
|
}))(Warehouse));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |