diff --git a/sysom_web/src/pages/host/components/BulkImportFile.jsx b/sysom_web/src/pages/host/components/BulkImportFile.jsx
index 08e880caeae4e071fa3a5978e4798f8f38b72937..82aa8a5e23fb75f2b882e2c007944c4ffdd0fd3f 100644
--- a/sysom_web/src/pages/host/components/BulkImportFile.jsx
+++ b/sysom_web/src/pages/host/components/BulkImportFile.jsx
@@ -1,42 +1,101 @@
-import { Button, message, Alert } from "antd";
+import { Button, message, Alert, notification, Modal, Table } from "antd";
+import {
+ CheckCircleOutlined,
+ CloseCircleOutlined
+} from '@ant-design/icons';
import { ModalForm, ProFormUploadButton, ProFormText } from "@ant-design/pro-form";
import { FormattedMessage } from 'umi';
+import { useRef } from 'react'
import { scpFileToHost } from '../service'
const Tip = () => {
return <>
-
-
- >
+
+
+ >
}
-const BulkImportFile = (props) => {
+const BulkResult = (props) => {
+ const columns = [
+ {
+ title: '主机IP',
+ dataIndex: 'instance',
+ key: 'instance',
+ align: 'center',
+ width: 110,
+ }, {
+ title: '是否成功',
+ dataIndex: 'success',
+ align: 'center',
+ width: 90,
+ render: (bool) => {
+ return (
+ bool ? :
+ )
+ },
+ }, {
+ title: '提示信息',
+ dataIndex: 'err_msg',
+ ellipsis: true,
+ align: 'center',
+ width: 200,
+ render: (text) => {
+ return text? text: 'Success!'
+ }
+ }
+ ]
+ return
+}
+const BulkImportFile = (props) => {
+ const BulkPushForm = useRef()
const BulkImportFileEvent = async (values) => {
let status = true;
const formData = new FormData();
formData.append('opt', 'send-file')
if (props.bulk) {
formData.append('remote_nodes', props.selectedRowKeys)
- }else {
+ } else {
formData.append('remote_nodes', [props.record.id])
}
formData.append('file', values.file[0].originFileObj)
formData.append('remomte_path', values.dir)
const token = localStorage.getItem('token')
await scpFileToHost(formData, token).then((res) => {
- if (props.bulk) { props.onCleanSelected(); }
- message.success(res.message)
+ if (props.bulk) {
+ props.onCleanSelected();
+ Modal.info({
+ title: '推送结果',
+ content: (),
+ okText: '知道了',
+ width: 520
+ })
+ } else {
+ res.data?.map((item) => {
+ if (item.success) {
+ notification.success({
+ message: `${item.instance} push success!`
+ })
+ } else {
+ notification.error({
+ message: `${item.instance} push error! ${item.err_msg}}`
+ })
+ }
+ })
+ }
}).catch((err) => {
- message.error(result.message);
let status = false
})
+
+
+ BulkPushForm?.current?.setFieldValue();
return status;
}
return (