|
|
|
|
@ -273,7 +273,7 @@ var jsx_runtime = __webpack_require__(37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["InputRight", "value", "onChange"];
|
|
|
|
|
var _excluded = ["InputRight", "value", "tagsList", "onChange"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -284,6 +284,8 @@ var AddTags = function AddTags(_ref) {
|
|
|
|
|
var InputRight = _ref.InputRight,
|
|
|
|
|
_ref$value = _ref.value,
|
|
|
|
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
|
|
|
_ref$tagsList = _ref.tagsList,
|
|
|
|
|
tagsList = _ref$tagsList === void 0 ? [] : _ref$tagsList,
|
|
|
|
|
onChange = _ref.onChange,
|
|
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
|
|
@ -307,6 +309,12 @@ var AddTags = function AddTags(_ref) {
|
|
|
|
|
message/* default */.ZP.warning('不允许添加相同标签');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (tagsList.findIndex(function (e) {
|
|
|
|
|
return e === inputValue;
|
|
|
|
|
}) > -1) {
|
|
|
|
|
message/* default */.ZP.warning('标签名已存在');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
onChange([].concat(toConsumableArray_default()(value), [inputValue]));
|
|
|
|
|
setInputValue(null);
|
|
|
|
|
};
|
|
|
|
|
@ -402,99 +410,103 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
setSelectedRows = _useState8[1];
|
|
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)([]),
|
|
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
|
|
tags = _useState10[0],
|
|
|
|
|
setTags = _useState10[1];
|
|
|
|
|
tagsList = _useState10[0],
|
|
|
|
|
setTagsList = _useState10[1];
|
|
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)([]),
|
|
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
|
|
dataSource = _useState12[0],
|
|
|
|
|
setDataSource = _useState12[1];
|
|
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
tags = _useState12[0],
|
|
|
|
|
setTags = _useState12[1];
|
|
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)([]),
|
|
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
|
|
isLoading = _useState14[0],
|
|
|
|
|
setIsLoading = _useState14[1];
|
|
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)([]),
|
|
|
|
|
dataSource = _useState14[0],
|
|
|
|
|
setDataSource = _useState14[1];
|
|
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
|
|
fileList = _useState16[0],
|
|
|
|
|
setFileList = _useState16[1];
|
|
|
|
|
var _useState17 = (0,_react_17_0_2_react.useState)('windows'),
|
|
|
|
|
isLoading = _useState16[0],
|
|
|
|
|
setIsLoading = _useState16[1];
|
|
|
|
|
var _useState17 = (0,_react_17_0_2_react.useState)([]),
|
|
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
|
|
firstSelectValue = _useState18[0],
|
|
|
|
|
setFirstSelectValue = _useState18[1];
|
|
|
|
|
var _useState19 = (0,_react_17_0_2_react.useState)('2008'),
|
|
|
|
|
fileList = _useState18[0],
|
|
|
|
|
setFileList = _useState18[1];
|
|
|
|
|
var _useState19 = (0,_react_17_0_2_react.useState)('windows'),
|
|
|
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
|
|
|
secondSelectValue = _useState20[0],
|
|
|
|
|
setSecondSelectValue = _useState20[1];
|
|
|
|
|
var _useState21 = (0,_react_17_0_2_react.useState)('x86_64'),
|
|
|
|
|
firstSelectValue = _useState20[0],
|
|
|
|
|
setFirstSelectValue = _useState20[1];
|
|
|
|
|
var _useState21 = (0,_react_17_0_2_react.useState)('2008'),
|
|
|
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
|
|
|
architecture = _useState22[0],
|
|
|
|
|
setArchitecture = _useState22[1];
|
|
|
|
|
var _useState23 = (0,_react_17_0_2_react.useState)(40),
|
|
|
|
|
secondSelectValue = _useState22[0],
|
|
|
|
|
setSecondSelectValue = _useState22[1];
|
|
|
|
|
var _useState23 = (0,_react_17_0_2_react.useState)('x86_64'),
|
|
|
|
|
_useState24 = slicedToArray_default()(_useState23, 2),
|
|
|
|
|
systemDiskSize = _useState24[0],
|
|
|
|
|
setSystemDiskSize = _useState24[1];
|
|
|
|
|
var _useState25 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
architecture = _useState24[0],
|
|
|
|
|
setArchitecture = _useState24[1];
|
|
|
|
|
var _useState25 = (0,_react_17_0_2_react.useState)(40),
|
|
|
|
|
_useState26 = slicedToArray_default()(_useState25, 2),
|
|
|
|
|
showTip = _useState26[0],
|
|
|
|
|
setShowTip = _useState26[1];
|
|
|
|
|
var _useState27 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
systemDiskSize = _useState26[0],
|
|
|
|
|
setSystemDiskSize = _useState26[1];
|
|
|
|
|
var _useState27 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState28 = slicedToArray_default()(_useState27, 2),
|
|
|
|
|
description = _useState28[0],
|
|
|
|
|
setDescription = _useState28[1];
|
|
|
|
|
var _useState29 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
showTip = _useState28[0],
|
|
|
|
|
setShowTip = _useState28[1];
|
|
|
|
|
var _useState29 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState30 = slicedToArray_default()(_useState29, 2),
|
|
|
|
|
configModal = _useState30[0],
|
|
|
|
|
setConfigModal = _useState30[1];
|
|
|
|
|
var _useState31 = (0,_react_17_0_2_react.useState)(),
|
|
|
|
|
description = _useState30[0],
|
|
|
|
|
setDescription = _useState30[1];
|
|
|
|
|
var _useState31 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState32 = slicedToArray_default()(_useState31, 2),
|
|
|
|
|
basicTypeName = _useState32[0],
|
|
|
|
|
setBasicTypeName = _useState32[1]; //基于基础镜像创建的镜像名称
|
|
|
|
|
configModal = _useState32[0],
|
|
|
|
|
setConfigModal = _useState32[1];
|
|
|
|
|
var _useState33 = (0,_react_17_0_2_react.useState)(),
|
|
|
|
|
_useState34 = slicedToArray_default()(_useState33, 2),
|
|
|
|
|
localTypeName = _useState34[0],
|
|
|
|
|
setLocalTypeName = _useState34[1]; //导入本地镜像创建的镜像名称
|
|
|
|
|
var _useState35 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
basicTypeName = _useState34[0],
|
|
|
|
|
setBasicTypeName = _useState34[1]; //基于基础镜像创建的镜像名称
|
|
|
|
|
var _useState35 = (0,_react_17_0_2_react.useState)(),
|
|
|
|
|
_useState36 = slicedToArray_default()(_useState35, 2),
|
|
|
|
|
basicNameError = _useState36[0],
|
|
|
|
|
setBasicNameError = _useState36[1];
|
|
|
|
|
localTypeName = _useState36[0],
|
|
|
|
|
setLocalTypeName = _useState36[1]; //导入本地镜像创建的镜像名称
|
|
|
|
|
var _useState37 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState38 = slicedToArray_default()(_useState37, 2),
|
|
|
|
|
basicNameErrorText = _useState38[0],
|
|
|
|
|
setBasicNameErrorText = _useState38[1];
|
|
|
|
|
var _useState39 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
basicNameError = _useState38[0],
|
|
|
|
|
setBasicNameError = _useState38[1];
|
|
|
|
|
var _useState39 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState40 = slicedToArray_default()(_useState39, 2),
|
|
|
|
|
modalBtnLoading = _useState40[0],
|
|
|
|
|
setModalBtnLoading = _useState40[1];
|
|
|
|
|
var _useState41 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
basicNameErrorText = _useState40[0],
|
|
|
|
|
setBasicNameErrorText = _useState40[1];
|
|
|
|
|
var _useState41 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState42 = slicedToArray_default()(_useState41, 2),
|
|
|
|
|
mirrorFileUrl = _useState42[0],
|
|
|
|
|
setMirrorFileUrl = _useState42[1];
|
|
|
|
|
modalBtnLoading = _useState42[0],
|
|
|
|
|
setModalBtnLoading = _useState42[1];
|
|
|
|
|
var _useState43 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState44 = slicedToArray_default()(_useState43, 2),
|
|
|
|
|
mirrorFileUrlError = _useState44[0],
|
|
|
|
|
setMirrorFileUrlError = _useState44[1];
|
|
|
|
|
mirrorFileUrl = _useState44[0],
|
|
|
|
|
setMirrorFileUrl = _useState44[1];
|
|
|
|
|
var _useState45 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState46 = slicedToArray_default()(_useState45, 2),
|
|
|
|
|
systemDiskSizeError = _useState46[0],
|
|
|
|
|
setSystemDiskSizeError = _useState46[1];
|
|
|
|
|
var _useState47 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
mirrorFileUrlError = _useState46[0],
|
|
|
|
|
setMirrorFileUrlError = _useState46[1];
|
|
|
|
|
var _useState47 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState48 = slicedToArray_default()(_useState47, 2),
|
|
|
|
|
openUploadFile = _useState48[0],
|
|
|
|
|
setOpenUploadFile = _useState48[1];
|
|
|
|
|
systemDiskSizeError = _useState48[0],
|
|
|
|
|
setSystemDiskSizeError = _useState48[1];
|
|
|
|
|
var _useState49 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState50 = slicedToArray_default()(_useState49, 2),
|
|
|
|
|
uploadFileLoading = _useState50[0],
|
|
|
|
|
setUploadFileLoading = _useState50[1];
|
|
|
|
|
var _useState51 = (0,_react_17_0_2_react.useState)({
|
|
|
|
|
openUploadFile = _useState50[0],
|
|
|
|
|
setOpenUploadFile = _useState50[1];
|
|
|
|
|
var _useState51 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState52 = slicedToArray_default()(_useState51, 2),
|
|
|
|
|
uploadFileLoading = _useState52[0],
|
|
|
|
|
setUploadFileLoading = _useState52[1];
|
|
|
|
|
var _useState53 = (0,_react_17_0_2_react.useState)({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
}),
|
|
|
|
|
_useState52 = slicedToArray_default()(_useState51, 2),
|
|
|
|
|
params = _useState52[0],
|
|
|
|
|
setParams = _useState52[1];
|
|
|
|
|
var _useState53 = (0,_react_17_0_2_react.useState)(true),
|
|
|
|
|
_useState54 = slicedToArray_default()(_useState53, 2),
|
|
|
|
|
hasMore = _useState54[0],
|
|
|
|
|
setHasmore = _useState54[1];
|
|
|
|
|
params = _useState54[0],
|
|
|
|
|
setParams = _useState54[1];
|
|
|
|
|
var _useState55 = (0,_react_17_0_2_react.useState)(true),
|
|
|
|
|
_useState56 = slicedToArray_default()(_useState55, 2),
|
|
|
|
|
hasMore = _useState56[0],
|
|
|
|
|
setHasmore = _useState56[1];
|
|
|
|
|
var isclear = (0,_react_17_0_2_react.useRef)(false);
|
|
|
|
|
var originItmes = [{
|
|
|
|
|
id: 1,
|
|
|
|
|
@ -620,6 +632,7 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}]
|
|
|
|
|
};
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
gettags();
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
|
|
payload: false
|
|
|
|
|
@ -963,6 +976,32 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
return _ref4.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var gettags = /*#__PURE__*/function () {
|
|
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context6) {
|
|
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
_context6.next = 2;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/tyimages/tags_list.json", {
|
|
|
|
|
method: 'post'
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
res = _context6.sent;
|
|
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
|
|
setTagsList(res === null || res === void 0 ? void 0 : res.tags);
|
|
|
|
|
}
|
|
|
|
|
// setDataSource(res?.data?.results)
|
|
|
|
|
case 4:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context6.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee5);
|
|
|
|
|
}));
|
|
|
|
|
return function gettags() {
|
|
|
|
|
return _ref5.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var getNameError = function getNameError(typeName) {
|
|
|
|
|
console.log(basicNameError);
|
|
|
|
|
if (basicNameError != '') {
|
|
|
|
|
@ -971,24 +1010,24 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
var handleInfiniteOnLoad = /*#__PURE__*/function () {
|
|
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
|
|
|
|
|
var reload,
|
|
|
|
|
_res$data3,
|
|
|
|
|
_res$data4,
|
|
|
|
|
_res$data$results,
|
|
|
|
|
res,
|
|
|
|
|
_args6 = arguments;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context6) {
|
|
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
|
|
_args7 = arguments;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context7) {
|
|
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
reload = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
|
|
|
|
|
reload = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
|
|
|
if (!((reload || hasMore) && !isLoading)) {
|
|
|
|
|
_context6.next = 11;
|
|
|
|
|
_context7.next = 11;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setIsLoading(true);
|
|
|
|
|
// setPage(reload ? 1 : page + 1)
|
|
|
|
|
_context6.next = 5;
|
|
|
|
|
_context7.next = 5;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/tyimages/instance_list.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: {
|
|
|
|
|
@ -997,7 +1036,7 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 5:
|
|
|
|
|
res = _context6.sent;
|
|
|
|
|
res = _context7.sent;
|
|
|
|
|
reload ? setDataSource(res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.results) : setDataSource([].concat(toConsumableArray_default()(dataSource), toConsumableArray_default()(res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.results)));
|
|
|
|
|
params.pageNo = reload ? 1 : params.pageNo + 1;
|
|
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
|
|
@ -1005,12 +1044,12 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
if (((_res$data$results = res.data.results) === null || _res$data$results === void 0 ? void 0 : _res$data$results.length) < 20) setHasmore(false);
|
|
|
|
|
case 11:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context6.stop();
|
|
|
|
|
return _context7.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee5);
|
|
|
|
|
}, _callee6);
|
|
|
|
|
}));
|
|
|
|
|
return function handleInfiniteOnLoad() {
|
|
|
|
|
return _ref5.apply(this, arguments);
|
|
|
|
|
return _ref6.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var toExit = function toExit() {
|
|
|
|
|
@ -1034,45 +1073,45 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var handleConfirm = /*#__PURE__*/function () {
|
|
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
|
|
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
|
|
|
var anchorElement;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context7) {
|
|
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context8) {
|
|
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
console.log(mirrorOrigin);
|
|
|
|
|
console.log(basicTypeName);
|
|
|
|
|
if (!(mirrorOrigin === 1)) {
|
|
|
|
|
_context7.next = 6;
|
|
|
|
|
_context8.next = 6;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!(selectedRowKeys.length === 0)) {
|
|
|
|
|
_context7.next = 6;
|
|
|
|
|
_context8.next = 6;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// setMirrorOriginError('mirror_origin')
|
|
|
|
|
message/* default */.ZP.warning('请选择一个实例!');
|
|
|
|
|
return _context7.abrupt("return");
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
case 6:
|
|
|
|
|
if (!(mirrorOrigin === 2)) {
|
|
|
|
|
_context7.next = 13;
|
|
|
|
|
_context8.next = 13;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (systemDiskSize) {
|
|
|
|
|
_context7.next = 10;
|
|
|
|
|
_context8.next = 10;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setSystemDiskSizeError('system_disk_size');
|
|
|
|
|
return _context7.abrupt("return");
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
case 10:
|
|
|
|
|
if (mirrorFileUrl) {
|
|
|
|
|
_context7.next = 13;
|
|
|
|
|
_context8.next = 13;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setMirrorFileUrlError('mirror_file_url');
|
|
|
|
|
return _context7.abrupt("return");
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
case 13:
|
|
|
|
|
if (basicTypeName) {
|
|
|
|
|
_context7.next = 21;
|
|
|
|
|
_context8.next = 21;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setBasicNameError('type_name');
|
|
|
|
|
@ -1082,24 +1121,24 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
behavior: 'smooth',
|
|
|
|
|
block: 'center'
|
|
|
|
|
});
|
|
|
|
|
return _context7.abrupt("return");
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
case 21:
|
|
|
|
|
console.log(getNameError(basicTypeName));
|
|
|
|
|
if (!getNameError(basicTypeName)) {
|
|
|
|
|
_context7.next = 24;
|
|
|
|
|
_context8.next = 24;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return _context7.abrupt("return");
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
case 24:
|
|
|
|
|
setConfigModal(true);
|
|
|
|
|
case 25:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context7.stop();
|
|
|
|
|
return _context8.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee6);
|
|
|
|
|
}, _callee7);
|
|
|
|
|
}));
|
|
|
|
|
return function handleConfirm() {
|
|
|
|
|
return _ref6.apply(this, arguments);
|
|
|
|
|
return _ref7.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var columns = [{
|
|
|
|
|
@ -1175,33 +1214,33 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
setSystemDiskSize(e);
|
|
|
|
|
};
|
|
|
|
|
var pollCheckOssUpload = /*#__PURE__*/function () {
|
|
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(body) {
|
|
|
|
|
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(body) {
|
|
|
|
|
var data;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context8) {
|
|
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context9) {
|
|
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
_context8.next = 2;
|
|
|
|
|
_context9.next = 2;
|
|
|
|
|
return (0,fetch/* default */.ZP)('/api/tyimages/check_oss_upload.json', {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: body
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
data = _context8.sent;
|
|
|
|
|
data = _context9.sent;
|
|
|
|
|
if (!isclear.current) {
|
|
|
|
|
_context8.next = 5;
|
|
|
|
|
_context9.next = 5;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
return _context9.abrupt("return");
|
|
|
|
|
case 5:
|
|
|
|
|
if (!(data.status === -1)) {
|
|
|
|
|
_context8.next = 8;
|
|
|
|
|
_context9.next = 8;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setUploadFileLoading(false);
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
return _context9.abrupt("return");
|
|
|
|
|
case 8:
|
|
|
|
|
if (!(data.status === 0 && data.ty_url)) {
|
|
|
|
|
_context8.next = 17;
|
|
|
|
|
_context9.next = 17;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// 如果返回状态为 0 且 url 有值,表示上传成功
|
|
|
|
|
@ -1217,7 +1256,7 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
});
|
|
|
|
|
setUploadFileLoading(false);
|
|
|
|
|
setOpenUploadFile(false);
|
|
|
|
|
return _context8.abrupt("return");
|
|
|
|
|
return _context9.abrupt("return");
|
|
|
|
|
case 17:
|
|
|
|
|
// 否则,等待一段时间后继续轮询
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
@ -1225,12 +1264,12 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}, 1000); // 每 1 秒轮询一次
|
|
|
|
|
case 18:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context8.stop();
|
|
|
|
|
return _context9.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee7);
|
|
|
|
|
}, _callee8);
|
|
|
|
|
}));
|
|
|
|
|
return function pollCheckOssUpload(_x4) {
|
|
|
|
|
return _ref7.apply(this, arguments);
|
|
|
|
|
return _ref8.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
|
|
@ -1665,14 +1704,15 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
marginRight: 12,
|
|
|
|
|
justifyContent: 'end'
|
|
|
|
|
},
|
|
|
|
|
name: "\u9009\u62E9\u6807\u7B7E",
|
|
|
|
|
name: "\u955C\u50CF\u6807\u7B7E",
|
|
|
|
|
align: "baseline",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Add_AddTags, {
|
|
|
|
|
value: tags,
|
|
|
|
|
placeholder: "\u6DFB\u52A0\u6807\u7B7E",
|
|
|
|
|
onChange: function onChange(e) {
|
|
|
|
|
return setTags(e);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tagsList: tagsList
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(Label/* default */.Z, {
|
|
|
|
|
@ -1743,18 +1783,18 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
onCancel: function onCancel() {
|
|
|
|
|
setConfigModal(false);
|
|
|
|
|
},
|
|
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
|
|
|
|
|
var _res;
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context9) {
|
|
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context10) {
|
|
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
setModalBtnLoading(true);
|
|
|
|
|
if (!(mirrorOrigin === 1)) {
|
|
|
|
|
_context9.next = 7;
|
|
|
|
|
_context10.next = 7;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
_context9.next = 4;
|
|
|
|
|
_context10.next = 4;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/tyimages/image_create.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: {
|
|
|
|
|
@ -1765,11 +1805,11 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 4:
|
|
|
|
|
res = _context9.sent;
|
|
|
|
|
_context9.next = 10;
|
|
|
|
|
res = _context10.sent;
|
|
|
|
|
_context10.next = 10;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
_context9.next = 9;
|
|
|
|
|
_context10.next = 9;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/tyimages/image_import.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: {
|
|
|
|
|
@ -1783,7 +1823,7 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 9:
|
|
|
|
|
res = _context9.sent;
|
|
|
|
|
res = _context10.sent;
|
|
|
|
|
case 10:
|
|
|
|
|
if (((_res = res) === null || _res === void 0 ? void 0 : _res.status) === 0) {
|
|
|
|
|
message/* default */.ZP.success('创建成功');
|
|
|
|
|
@ -1792,9 +1832,9 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
setModalBtnLoading(false);
|
|
|
|
|
case 12:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context9.stop();
|
|
|
|
|
return _context10.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee8);
|
|
|
|
|
}, _callee9);
|
|
|
|
|
})),
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
className: Addmodules.btns,
|
|
|
|
|
@ -1921,18 +1961,18 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
onCancel: function onCancel() {
|
|
|
|
|
setOpenUploadFile(false);
|
|
|
|
|
},
|
|
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
|
|
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
|
|
|
|
|
var _attachments$;
|
|
|
|
|
var attachments, body, res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context10) {
|
|
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context11) {
|
|
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (fileList !== null && fileList !== void 0 && fileList.length) {
|
|
|
|
|
_context10.next = 3;
|
|
|
|
|
_context11.next = 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
setShowTip(true);
|
|
|
|
|
return _context10.abrupt("return");
|
|
|
|
|
return _context11.abrupt("return");
|
|
|
|
|
case 3:
|
|
|
|
|
setUploadFileLoading(true);
|
|
|
|
|
attachments = fileList.map(function (e) {
|
|
|
|
|
@ -1945,13 +1985,13 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
body = {
|
|
|
|
|
attachment_id: (_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.attachment_id
|
|
|
|
|
};
|
|
|
|
|
_context10.next = 8;
|
|
|
|
|
_context11.next = 8;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/tyimages/oss_upload.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: body
|
|
|
|
|
});
|
|
|
|
|
case 8:
|
|
|
|
|
res = _context10.sent;
|
|
|
|
|
res = _context11.sent;
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
// 在上传成功后开始轮询
|
|
|
|
|
pollCheckOssUpload(body);
|
|
|
|
|
@ -1960,9 +2000,9 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
}
|
|
|
|
|
case 10:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context10.stop();
|
|
|
|
|
return _context11.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee9);
|
|
|
|
|
}, _callee10);
|
|
|
|
|
})),
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
|
|
spinning: uploadFileLoading,
|
|
|
|
|
@ -2070,11 +2110,11 @@ var EditPage = function EditPage(_ref) {
|
|
|
|
|
})]
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/* harmony default export */ var Add = ((0,_umi_production_exports.connect)(function (_ref10) {
|
|
|
|
|
var classroomList = _ref10.classroomList,
|
|
|
|
|
loading = _ref10.loading,
|
|
|
|
|
globalSetting = _ref10.globalSetting,
|
|
|
|
|
user = _ref10.user;
|
|
|
|
|
/* harmony default export */ var Add = ((0,_umi_production_exports.connect)(function (_ref11) {
|
|
|
|
|
var classroomList = _ref11.classroomList,
|
|
|
|
|
loading = _ref11.loading,
|
|
|
|
|
globalSetting = _ref11.globalSetting,
|
|
|
|
|
user = _ref11.user;
|
|
|
|
|
return {
|
|
|
|
|
classroomList: classroomList,
|
|
|
|
|
globalSetting: globalSetting,
|