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.
566 lines
23 KiB
566 lines
23 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[1148],{
|
|
|
|
/***/ 98629:
|
|
/*!**********************************************************!*\
|
|
!*** ./src/components/FixedButton/index.tsx + 1 modules ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
t: function() { return /* binding */ FixedButton; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var FixedButtonmodules = ({"buttonFixed":"buttonFixed___vyq30","button":"button___hxmYv","buttonWrap":"buttonWrap___uK8dl"});
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
|
|
var _classnames_2_5_1_classnames = __webpack_require__(92310);
|
|
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/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;
|
|
};
|
|
|
|
|
|
|
|
|
|
const FixedButton = ({
|
|
cancelText = "\u53D6\u6D88",
|
|
okText = "\u786E\u5B9A",
|
|
loading = false,
|
|
hasOkBtn = true,
|
|
hasCancelBtn = true,
|
|
okButtonProps = {},
|
|
onCancel = () => {
|
|
},
|
|
onOk = () => {
|
|
},
|
|
className = ""
|
|
}) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: _classnames_2_5_1_classnames_default()(FixedButtonmodules.buttonFixed, className) }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: FixedButtonmodules.buttonWrap }, hasCancelBtn && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_button/* default */.ZP,
|
|
{
|
|
size: "middle",
|
|
className: `${FixedButtonmodules.button} mr20`,
|
|
onClick: onCancel
|
|
},
|
|
cancelText
|
|
), hasOkBtn && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_button/* default */.ZP,
|
|
__spreadValues({
|
|
size: "middle",
|
|
type: "primary",
|
|
className: `${FixedButtonmodules.button} mr20`,
|
|
loading,
|
|
onClick: onOk
|
|
}, okButtonProps),
|
|
okText
|
|
)));
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 34955:
|
|
/*!******************************************************************************!*\
|
|
!*** ./src/pages/Shixuns/Detail/Repository/UploadFile/index.tsx + 1 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 */ Repository_UploadFile; }
|
|
});
|
|
|
|
// 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__(67866);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(21873);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
|
|
var upload = __webpack_require__(46651);
|
|
// 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/input/index.js + 5 modules
|
|
var input = __webpack_require__(98135);
|
|
// EXTERNAL MODULE: ./src/components/FixedButton/index.tsx + 1 modules
|
|
var FixedButton = __webpack_require__(98629);
|
|
// EXTERNAL MODULE: ./src/pages/Shixuns/Detail/Repository/components/SelectFilePathModal/index.tsx + 1 modules
|
|
var SelectFilePathModal = __webpack_require__(448);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/UploadFile/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var UploadFilemodules = ({"bg":"bg___B0fle","wrap":"wrap___cLSqe","title":"title___tslCB","path":"path____iGdu","colorBlue":"colorBlue___Baazr"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Repository/UploadFile/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 __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 { Dragger } = upload["default"];
|
|
const UploadFile = (_a) => {
|
|
var _b = _a, {
|
|
shixunsDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch
|
|
} = _b, props = __objRest(_b, [
|
|
"shixunsDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch"
|
|
]);
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const isRepository = (0,_react_17_0_2_react.useRef)();
|
|
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)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
dispatch({
|
|
type: "globalSetting/footerToggle",
|
|
payload: false
|
|
});
|
|
return () => {
|
|
dispatch({
|
|
type: "globalSetting/footerToggle",
|
|
payload: true
|
|
});
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c, _d;
|
|
shixunId.current = (_b2 = (_a2 = location.pathname) == null ? void 0 : _a2.split("/")) == null ? void 0 : _b2[2];
|
|
isRepository.current = ((_d = (_c = location.pathname) == null ? void 0 : _c.split("/")) == null ? void 0 : _d[3]) === "repository";
|
|
}, []);
|
|
(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;
|
|
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) => __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;
|
|
}
|
|
if (!form.getFieldValue("commitMessage")) {
|
|
message/* default */.ZP.info("\u5220\u9664\u6587\u4EF6\u8BF7\u5148\u586B\u5199\u63D0\u4EA4\u4FE1\u606F");
|
|
return;
|
|
}
|
|
const res = yield dispatch({
|
|
type: "shixunsDetail/deleteGitFile",
|
|
payload: {
|
|
id: shixunId.current,
|
|
path: filePath ? `${filePath}/${info.name}` : info.name,
|
|
message: form.getFieldValue("commitMessage"),
|
|
secret_repository: isRepository.current ? 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: __spreadValues(__spreadValues({}, {
|
|
path: filePath || "",
|
|
message: formValue.commitMessage
|
|
}), isRepository.current ? {} : { secret_repository: true }),
|
|
fileList,
|
|
method: "post",
|
|
action: `${env/* default */.Z.API_SERVER}/api/shixuns/${shixunId.current}/upload_git_file.json`,
|
|
onChange: handleChangeFile,
|
|
onRemove: handleRemoveFile,
|
|
beforeUpload: (file) => {
|
|
if (!form.getFieldValue("commitMessage")) {
|
|
message/* default */.ZP.info("\u4E0A\u4F20\u6587\u4EF6\u8BF7\u5148\u586B\u5199\u63D0\u4EA4\u4FE1\u606F");
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
const handleFinish = (values) => {
|
|
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("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("div", { className: UploadFilemodules.path }, "\u5F53\u524D\u76EE\u5F55\uFF1A/", filePath, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${UploadFilemodules.colorBlue} current ml5`, onClick: () => {
|
|
dispatch({
|
|
type: "shixunsDetail/setActionTabs",
|
|
payload: { key: "Repository-SelectFilePath" }
|
|
});
|
|
} }, "\u9009\u62E9\u6587\u4EF6\u76EE\u5F55")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
className: "mt10",
|
|
form,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
onFinish: handleFinish,
|
|
onValuesChange: () => setFormValue(__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, { noStyle: true }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
FixedButton/* FixedButton */.t,
|
|
{
|
|
okButtonProps: {
|
|
htmlType: "submit"
|
|
},
|
|
onCancel: handleReturn
|
|
}
|
|
))
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
Dragger,
|
|
__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"))
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
SelectFilePathModal/* default */.Z,
|
|
{
|
|
onFinish: (path) => setFilePath(path)
|
|
}
|
|
));
|
|
};
|
|
/* harmony default export */ var Repository_UploadFile = ((0,_umi_production_exports.connect)(
|
|
({
|
|
shixunsDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
shixunsDetail,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.models.index
|
|
})
|
|
)(UploadFile));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 448:
|
|
/*!**************************************************************************************************!*\
|
|
!*** ./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__(67866);
|
|
// 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__(98135);
|
|
;// 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));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |