diff --git a/orion-ops-vue/src/components/import/DataImportModal.vue b/orion-ops-vue/src/components/import/DataImportModal.vue
new file mode 100644
index 00000000..edc63fe7
--- /dev/null
+++ b/orion-ops-vue/src/components/import/DataImportModal.vue
@@ -0,0 +1,239 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 选择文件
+
+
+
+ {{ uploadFile.name }}
+
+
+
+
下载模板
+
+
+
+
+
+
+
+
+
非法数据 (不会导入)
+
+ 第 {{ row.row }} 行, {{ row.symbol }}
+ {{ row.illegalMessage }}
+
+
+
+
+
新增数据
+
+ 第 {{ row.row }} 行, {{ row.symbol }}
+
+
+
+
+
修改数据
+
+ 第 {{ row.row }} 行, {{ row.symbol }}
+
+
+
+
+
+
+
+
+
+
diff --git a/orion-ops-vue/src/components/machine/AddMachineModal.vue b/orion-ops-vue/src/components/machine/AddMachineModal.vue
index ac54986d..cbf445de 100644
--- a/orion-ops-vue/src/components/machine/AddMachineModal.vue
+++ b/orion-ops-vue/src/components/machine/AddMachineModal.vue
@@ -173,8 +173,8 @@ export default {
validateUsername(rule, value, callback) {
if (!value) {
callback(new Error('请输入用户名'))
- } else if (value.length > 32) {
- callback(new Error('用户名长度不能大于32位'))
+ } else if (value.length > 128) {
+ callback(new Error('用户名长度不能大于128位'))
} else {
callback()
}
diff --git a/orion-ops-vue/src/components/machine/AddMachineProxyModal.vue b/orion-ops-vue/src/components/machine/AddMachineProxyModal.vue
index d20ce5b9..c0a48e36 100644
--- a/orion-ops-vue/src/components/machine/AddMachineProxyModal.vue
+++ b/orion-ops-vue/src/components/machine/AddMachineProxyModal.vue
@@ -53,8 +53,8 @@ function getDecorators() {
required: true,
message: '请输入主机'
}, {
- max: 32,
- message: '主机长度不能大于32位'
+ max: 128,
+ message: '主机长度不能大于128位'
}]
}],
port: ['port', {
diff --git a/orion-ops-vue/src/lib/api.js b/orion-ops-vue/src/lib/api.js
index 08175966..20a62499 100644
--- a/orion-ops-vue/src/lib/api.js
+++ b/orion-ops-vue/src/lib/api.js
@@ -2194,14 +2194,14 @@ const $api = {
},
/**
- * 导出机器终端日志
+ * 导出终端日志
*/
exportMachineTerminalLog: param => {
return $http.$export('/data-export/machine-terminal-log', param)
},
/**
- * 导出机器日志文件
+ * 导出日志文件
*/
exportMachineTailFile: param => {
return $http.$export('/data-export/machine-tail-file', param)
@@ -2273,12 +2273,26 @@ const $api = {
},
/**
- * 导入机器数据
+ * 导入机器信息
*/
importMachineData: param => {
return $http.$post('/data-import/import-machine', param)
},
+ /**
+ * 导入机器代理
+ */
+ importMachineProxy: param => {
+ return $http.$post('/data-import/import-machine-proxy', param)
+ },
+
+ /**
+ * 导入日志文件
+ */
+ importTailFile: param => {
+ return $http.$post('/data-import/import-tail-file', param)
+ },
+
/**
* 取消导入数据
*/
diff --git a/orion-ops-vue/src/lib/enum.js b/orion-ops-vue/src/lib/enum.js
index d0c0809a..cd7b53b4 100644
--- a/orion-ops-vue/src/lib/enum.js
+++ b/orion-ops-vue/src/lib/enum.js
@@ -1586,11 +1586,11 @@ const $enum = {
value: 8510,
label: '机器代理'
},
- DATA_EXPORT_MACHINE_TERMINAL_LOG: {
+ DATA_EXPORT_TERMINAL_LOG: {
value: 8515,
label: '终端日志'
},
- DATA_EXPORT_MACHINE_TAIL_FILE: {
+ DATA_EXPORT_TAIL_FILE: {
value: 8520,
label: '日志文件'
},
@@ -2220,7 +2220,22 @@ const $enum = {
*/
IMPORT_TYPE: {
MACHINE: {
- value: 10
+ value: 100,
+ tips: '使用唯一标识来区分数据, 存在更新不存在新增, 优先使用导入密码',
+ title: '机器信息 导入',
+ api: 'importMachineData'
+ },
+ MACHINE_PROXY: {
+ value: 110,
+ tips: '导入时优先使用导入密码',
+ title: '机器代理 导入',
+ api: 'importMachineProxy'
+ },
+ TAIL_FILE: {
+ value: 130,
+ tips: '通过机器标识来区分机器, 机器名称无需填写',
+ title: '日志文件 导入',
+ api: 'importTailFile'
}
}
diff --git a/orion-ops-vue/src/lib/utils.js b/orion-ops-vue/src/lib/utils.js
index 185452df..117e0c47 100644
--- a/orion-ops-vue/src/lib/utils.js
+++ b/orion-ops-vue/src/lib/utils.js
@@ -326,6 +326,28 @@ function clearStainKeywords(message) {
.replaceAll('</sr>', '')
}
+/**
+ * 下载文件
+ */
+function downloadFile(res) {
+ const blob = new Blob([res.data])
+ const tempLink = document.createElement('a')
+ const blobURL = window.URL.createObjectURL(blob)
+ tempLink.style.display = 'none'
+ tempLink.href = blobURL
+ const fileName = res.headers['content-disposition']
+ ? res.headers['content-disposition'].split(';')[1].split('=')[1]
+ : new Date().getTime()
+ tempLink.download = decodeURIComponent(fileName)
+ if (typeof tempLink.download === 'undefined') {
+ tempLink.target = '_blank'
+ }
+ document.body.appendChild(tempLink)
+ tempLink.click()
+ document.body.removeChild(tempLink)
+ window.URL.revokeObjectURL(blobURL)
+}
+
/**
* 自适应终端大小
*/
@@ -404,5 +426,6 @@ export default {
replaceStainKeywords,
clearStainKeywords,
fitDimensions,
- getUUID
+ getUUID,
+ downloadFile
}
diff --git a/orion-ops-vue/src/views/log/LoggerList.vue b/orion-ops-vue/src/views/log/LoggerList.vue
index 1d4f3a43..deba86d0 100644
--- a/orion-ops-vue/src/views/log/LoggerList.vue
+++ b/orion-ops-vue/src/views/log/LoggerList.vue
@@ -125,6 +125,8 @@
+
+
@@ -137,6 +139,7 @@ import TextPreview from '@/components/preview/TextPreview'
import LoggerViewModal from '@/components/log/LoggerViewModal'
import _filters from '@/lib/filters'
import MachineTailFileExportModal from '@/components/export/MachineTailFileExportModal'
+import DataImportModal from '@/components/import/DataImportModal'
/**
* 列
@@ -212,6 +215,7 @@ const columns = [
export default {
name: 'LoggerList',
components: {
+ DataImportModal,
MachineTailFileExportModal,
LoggerViewModal,
MachineSelector,
diff --git a/orion-ops-vue/src/views/machine/MachineList.vue b/orion-ops-vue/src/views/machine/MachineList.vue
index bcdfbc5a..82d6011a 100644
--- a/orion-ops-vue/src/views/machine/MachineList.vue
+++ b/orion-ops-vue/src/views/machine/MachineList.vue
@@ -201,7 +201,7 @@
-
+
+
+
@@ -114,6 +116,7 @@