From b616130a1910f4835dc121260465a25f31ab2372 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 14 Jul 2021 14:06:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/components/BatchAddMonitor.vue | 68 +++++++++++++++++++ .../components/PerformanceAdvancedConfig.vue | 42 ++++++++++-- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 7 +- frontend/src/i18n/zh-TW.js | 1 + 5 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 frontend/src/business/components/performance/test/components/BatchAddMonitor.vue diff --git a/frontend/src/business/components/performance/test/components/BatchAddMonitor.vue b/frontend/src/business/components/performance/test/components/BatchAddMonitor.vue new file mode 100644 index 0000000000..99aa45542e --- /dev/null +++ b/frontend/src/business/components/performance/test/components/BatchAddMonitor.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue index b3af6a2501..266ffd6ca2 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue @@ -181,20 +181,24 @@ -

监控集成

+

{{ $t('commons.monitor') }}

{{ $t('commons.add') }} + + {{ $t('commons.batch_add') }} +
- + + :label="$t('commons.name')"> @@ -223,7 +227,7 @@ + :label="$t('commons.description')"> @@ -247,10 +252,11 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton"; import EditMonitor from "@/business/components/performance/test/components/EditMonitor"; import {hasPermission} from "@/common/js/utils"; +import BatchAddMonitor from "@/business/components/performance/test/components/BatchAddMonitor"; export default { name: "PerformanceAdvancedConfig", - components: {EditMonitor, MsTableOperatorButton}, + components: {BatchAddMonitor, EditMonitor, MsTableOperatorButton}, data() { return { timeout: undefined, @@ -412,6 +418,32 @@ export default { addMonitor() { this.$refs.monitorDialog.open(); }, + batchAddMonitor() { + this.$refs.batchMonitorDialog.open(); + }, + batchSave(params) { + let targets = this._handleBatchVars(params); + targets.forEach(row => { + this.monitorParams.push(row); + }); + }, + _handleBatchVars(data) { + let params = data.split("\n"); + let keyValues = []; + params.forEach(item => { + let line = item.split(/,|,/); + if (line.length < 3) { + return; + } + keyValues.push({ + name: line[0], + ip: line[1], + port: line[2], + description: line[3] || '', + }); + }); + return keyValues; + }, modifyMonitor(row, index) { this.$refs.monitorDialog.open(row, index); }, diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index d12a416d0e..1c0a403053 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -537,6 +537,7 @@ export default { test_plan_report: 'Test Plan Report', recent: 'My recent Report', search_by_name: 'Search by Name', + batch_add_monitor_tips: 'Format: name, IP, Port, description
such as: item 1, 192.168.1.52, 9100, test', test_name: 'Test', test_overview: 'Test Overview', test_request_statistics: 'Test Request Statistics', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 0f23cac108..261d8d097c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -487,7 +487,7 @@ export default { select_project: '请选择项目', select_group: '请选择用户组', add_user_group_batch: '批量添加用户组', - add_project_batch : '批量添加到项目', + add_project_batch: '批量添加到项目', add_project_batch_tip: '默认为成员添加只读用户组(系统)', }, group: { @@ -536,6 +536,7 @@ export default { test_plan_report: '测试计划报告', recent: '我最近的报告', search_by_name: '根据名称搜索', + batch_add_monitor_tips: '格式:名称,IP,Port,描述
如:项目1,192.168.1.52,9100,测试', test_name: '所属测试', test_overview: '测试概览', test_request_statistics: '请求统计', @@ -798,8 +799,8 @@ export default { batch_delete: "批量删除", delete_confirm: "确认删除接口", batch_to_performance_confirm: "确认批量创建性能测试", - batch_copy_confirm:"确定要进行批量复制吗", - batch_copy_end:"批量复制完成", + batch_copy_confirm: "确定要进行批量复制吗", + batch_copy_end: "批量复制完成", delete_case_confirm: "确认删除用例", delete_confirm_step: "确认删除步骤", assertions_rule: "断言规则", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 001e83d01c..6b60fc6258 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -536,6 +536,7 @@ export default { test_plan_report: '測試計劃報告', recent: '我最近的報告', search_by_name: '根據名稱搜索', + batch_add_monitor_tips: '格式:名稱,IP,Port,描述
如:項目1,192.168.1.52,9100,測試', test_name: '所屬測試', test_overview: '測試概覽', test_request_statistics: '請求統計',