feat(UI测试): ui测试新增消息通知配置
--story=1012714 --user=王旭 【UI测试】消息通知 https://www.tapd.cn/55049933/s/1410749
This commit is contained in:
parent
60d6a5d904
commit
75bdaa6027
|
@ -35,6 +35,9 @@ export function getResource(d) {
|
||||||
case "API_DEFINITION_TASK" :
|
case "API_DEFINITION_TASK" :
|
||||||
resourceType = i18n.t('notice.api_case') + i18n.t('notice.result.' + d.operation);
|
resourceType = i18n.t('notice.api_case') + i18n.t('notice.result.' + d.operation);
|
||||||
break;
|
break;
|
||||||
|
case "UI_AUTOMATION_TASK" :
|
||||||
|
resourceType += i18n.t('notice.result.' + d.operation);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +130,12 @@ export function getUrl(d) {
|
||||||
case "TRACK_REPORT_TASK" :
|
case "TRACK_REPORT_TASK" :
|
||||||
url += "/track/testPlan/reportList";
|
url += "/track/testPlan/reportList";
|
||||||
break;
|
break;
|
||||||
|
case "UI_AUTOMATION_TASK" :
|
||||||
|
url += "/ui/automation";
|
||||||
|
break;
|
||||||
|
case "UI_REPORT_TASK" :
|
||||||
|
url += "ui/report";
|
||||||
|
break;
|
||||||
case"ENV_TASK" :
|
case"ENV_TASK" :
|
||||||
url += "/project/env?resourceId=" + d.resourceId;
|
url += "/project/env?resourceId=" + d.resourceId;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2394,6 +2394,7 @@ const message = {
|
||||||
definition: "Api Definition",
|
definition: "Api Definition",
|
||||||
automation: "Api Automation",
|
automation: "Api Automation",
|
||||||
report: "Test Report",
|
report: "Test Report",
|
||||||
|
ui_automation: "Ui Automation",
|
||||||
},
|
},
|
||||||
ldap: {
|
ldap: {
|
||||||
url: "LDAP URL",
|
url: "LDAP URL",
|
||||||
|
@ -2720,6 +2721,8 @@ const message = {
|
||||||
TRACK_TEST_CASE_TASK: " TestCase",
|
TRACK_TEST_CASE_TASK: " TestCase",
|
||||||
TRACK_HOME_TASK: " Tracking HomePage",
|
TRACK_HOME_TASK: " Tracking HomePage",
|
||||||
TRACK_REPORT_TASK: " Tracking Report",
|
TRACK_REPORT_TASK: " Tracking Report",
|
||||||
|
UI_AUTOMATION_TASK: " UI Automation",
|
||||||
|
UI_REPORT_TASK: " UI Report",
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
EXECUTE_SUCCESSFUL: " Success",
|
EXECUTE_SUCCESSFUL: " Success",
|
||||||
|
@ -3528,6 +3531,19 @@ const message = {
|
||||||
smart_variable_enable: "Use the current scene variables first",
|
smart_variable_enable: "Use the current scene variables first",
|
||||||
use_origin_variable_scene: "Use original scene variables",
|
use_origin_variable_scene: "Use original scene variables",
|
||||||
use_origin_env_run: "Use original scene environment to execute",
|
use_origin_env_run: "Use original scene environment to execute",
|
||||||
|
automation: {
|
||||||
|
scenario: {
|
||||||
|
module_id: "Scenario Module ID",
|
||||||
|
principal: "Principal",
|
||||||
|
step_total: "Step total",
|
||||||
|
schedule: "Schedule",
|
||||||
|
last_result: "Last result",
|
||||||
|
order: "Order",
|
||||||
|
environment_type: "Environment type",
|
||||||
|
environment_json: "Environment json",
|
||||||
|
environment_group_id: "Environment group ID",
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
project_application: {
|
project_application: {
|
||||||
workstation: {
|
workstation: {
|
||||||
|
|
|
@ -782,6 +782,7 @@ const message = {
|
||||||
api: "接口测试任务通知",
|
api: "接口测试任务通知",
|
||||||
performance: "性能测试任务通知",
|
performance: "性能测试任务通知",
|
||||||
notice_count: "通知数",
|
notice_count: "通知数",
|
||||||
|
ui: "UI自动化消息配置",
|
||||||
},
|
},
|
||||||
integration: {
|
integration: {
|
||||||
select_defect_platform: "请选择要集成的缺陷管理平台:",
|
select_defect_platform: "请选择要集成的缺陷管理平台:",
|
||||||
|
@ -2300,6 +2301,7 @@ const message = {
|
||||||
definition: "接口定义",
|
definition: "接口定义",
|
||||||
automation: "接口自动化",
|
automation: "接口自动化",
|
||||||
report: "测试报告",
|
report: "测试报告",
|
||||||
|
ui_automation: "UI自动化",
|
||||||
},
|
},
|
||||||
ldap: {
|
ldap: {
|
||||||
url: "LDAP地址",
|
url: "LDAP地址",
|
||||||
|
@ -2623,6 +2625,8 @@ const message = {
|
||||||
TRACK_TEST_CASE_TASK: "测试用例",
|
TRACK_TEST_CASE_TASK: "测试用例",
|
||||||
TRACK_HOME_TASK: "测试跟踪首页",
|
TRACK_HOME_TASK: "测试跟踪首页",
|
||||||
TRACK_REPORT_TASK: "测试跟踪报告",
|
TRACK_REPORT_TASK: "测试跟踪报告",
|
||||||
|
UI_AUTOMATION_TASK: "UI自动化",
|
||||||
|
UI_REPORT_TASK: "UI测试报告",
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
EXECUTE_SUCCESSFUL: "成功",
|
EXECUTE_SUCCESSFUL: "成功",
|
||||||
|
@ -3399,6 +3403,19 @@ const message = {
|
||||||
null: "空",
|
null: "空",
|
||||||
not_null: "非空",
|
not_null: "非空",
|
||||||
assertion_configuration: "断言配置",
|
assertion_configuration: "断言配置",
|
||||||
|
automation: {
|
||||||
|
scenario: {
|
||||||
|
module_id: "场景模块ID",
|
||||||
|
principal: "责任人",
|
||||||
|
step_total: "步骤总数",
|
||||||
|
schedule: "定时任务",
|
||||||
|
last_result: "执行结果",
|
||||||
|
order: "排序方式",
|
||||||
|
environment_type: "环境类型",
|
||||||
|
environment_json: "环境配置",
|
||||||
|
environment_group_id: "环境组ID",
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
project_application: {
|
project_application: {
|
||||||
workstation: {
|
workstation: {
|
||||||
|
|
|
@ -2299,6 +2299,7 @@ const message = {
|
||||||
definition: "接口定義",
|
definition: "接口定義",
|
||||||
automation: "接口自動化",
|
automation: "接口自動化",
|
||||||
report: "測試報告",
|
report: "測試報告",
|
||||||
|
ui_automation: "UI自動化",
|
||||||
},
|
},
|
||||||
ldap: {
|
ldap: {
|
||||||
url: "LDAP地址",
|
url: "LDAP地址",
|
||||||
|
@ -2618,6 +2619,8 @@ const message = {
|
||||||
TRACK_TEST_CASE_TASK: "測試用例",
|
TRACK_TEST_CASE_TASK: "測試用例",
|
||||||
TRACK_HOME_TASK: "測試跟蹤首頁",
|
TRACK_HOME_TASK: "測試跟蹤首頁",
|
||||||
TRACK_REPORT_TASK: "測試跟蹤報告",
|
TRACK_REPORT_TASK: "測試跟蹤報告",
|
||||||
|
UI_AUTOMATION_TASK: "UI自動化",
|
||||||
|
UI_REPORT_TASK: "UI測試報告",
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
EXECUTE_SUCCESSFUL: "成功",
|
EXECUTE_SUCCESSFUL: "成功",
|
||||||
|
@ -3399,6 +3402,19 @@ const message = {
|
||||||
use_origin_env_run: "使用原場景環境執行",
|
use_origin_env_run: "使用原場景環境執行",
|
||||||
open_new: "追加頁面",
|
open_new: "追加頁面",
|
||||||
open_new_tip: "追加頁面,在新的頁面打開url,不勾選覆蓋當前url",
|
open_new_tip: "追加頁面,在新的頁面打開url,不勾選覆蓋當前url",
|
||||||
|
automation: {
|
||||||
|
scenario: {
|
||||||
|
module_id: "場景模塊ID",
|
||||||
|
principal: "責任人",
|
||||||
|
step_total: "步驟總數",
|
||||||
|
schedule: "定時任務",
|
||||||
|
last_result: "執行結果",
|
||||||
|
order: "排序方式",
|
||||||
|
environment_type: "環境類型",
|
||||||
|
environment_json: "環境配置",
|
||||||
|
environment_group_id: "環境組ID",
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
project_application: {
|
project_application: {
|
||||||
workstation: {
|
workstation: {
|
||||||
|
|
|
@ -263,6 +263,10 @@
|
||||||
UNION
|
UNION
|
||||||
SELECT project_id
|
SELECT project_id
|
||||||
FROM api_test_environment
|
FROM api_test_environment
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM ui_scenario
|
||||||
WHERE id = #{resourceId})
|
WHERE id = #{resourceId})
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -48,6 +48,20 @@
|
||||||
<api-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
<api-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||||
:receive-type-options="receiveTypeOptions"/>
|
:receive-type-options="receiveTypeOptions"/>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
|
<el-collapse-item name="5" v-xpack>
|
||||||
|
<template v-slot:title>
|
||||||
|
<span style="width: 200px">
|
||||||
|
{{ $t('organization.message.ui') }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ $t('organization.message.notice_count') }}: <span class="primary-text">{{ uiNoticeSize }}</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<ui-automation-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||||
|
:receive-type-options="receiveTypeOptions"/>
|
||||||
|
<ui-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||||
|
:receive-type-options="receiveTypeOptions"/>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item name="4">
|
<el-collapse-item name="4">
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<span style="width: 200px">
|
<span style="width: 200px">
|
||||||
|
@ -94,6 +108,8 @@ import ApiReportNotification from "./api/ApiReportNotification";
|
||||||
import PerformanceTestNotification from "./performance/PerformanceTestNotification";
|
import PerformanceTestNotification from "./performance/PerformanceTestNotification";
|
||||||
import PerformanceReportNotification from "./performance/PerformanceReportNotification";
|
import PerformanceReportNotification from "./performance/PerformanceReportNotification";
|
||||||
import ApiHomeNotification from "./api/ApiHomeNotification";
|
import ApiHomeNotification from "./api/ApiHomeNotification";
|
||||||
|
import UiAutomationNotification from "./ui/UiAutomationNotification";
|
||||||
|
import UiReportNotification from "./ui/UiReportNotification";
|
||||||
import {getUserProjectMemberList} from "../../../api/user";
|
import {getUserProjectMemberList} from "../../../api/user";
|
||||||
|
|
||||||
let taskData = {
|
let taskData = {
|
||||||
|
@ -101,6 +117,7 @@ let taskData = {
|
||||||
api: [],
|
api: [],
|
||||||
performance: [],
|
performance: [],
|
||||||
track: [],
|
track: [],
|
||||||
|
ui: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -118,6 +135,8 @@ export default {
|
||||||
HomeNotification,
|
HomeNotification,
|
||||||
DefectTaskNotification, TestReviewNotification, TestPlanTaskNotification, JenkinsNotification, MsContainer,
|
DefectTaskNotification, TestReviewNotification, TestPlanTaskNotification, JenkinsNotification, MsContainer,
|
||||||
MsMainContainer,
|
MsMainContainer,
|
||||||
|
UiAutomationNotification,
|
||||||
|
UiReportNotification
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
|
@ -126,6 +145,7 @@ export default {
|
||||||
apiNoticeSize: 0,
|
apiNoticeSize: 0,
|
||||||
performanceNoticeSize: 0,
|
performanceNoticeSize: 0,
|
||||||
trackNoticeSize: 0,
|
trackNoticeSize: 0,
|
||||||
|
uiNoticeSize: 0,
|
||||||
jenkinsReceiverOptions: [],
|
jenkinsReceiverOptions: [],
|
||||||
//测试计划
|
//测试计划
|
||||||
testPlanReceiverOptions: [],
|
testPlanReceiverOptions: [],
|
||||||
|
@ -190,6 +210,11 @@ export default {
|
||||||
taskData.track = taskData.track.concat(config.data);
|
taskData.track = taskData.track.concat(config.data);
|
||||||
this.trackNoticeSize = taskData.track.length;
|
this.trackNoticeSize = taskData.track.length;
|
||||||
break;
|
break;
|
||||||
|
case 'ui':
|
||||||
|
taskData.ui = taskData.ui.filter(t => t.taskType !== config.taskType);
|
||||||
|
taskData.ui = taskData.ui.concat(config.data);
|
||||||
|
this.uiNoticeSize = taskData.ui.length;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,309 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<h5>{{ $t('i18n.ui_automation') }}</h5>
|
||||||
|
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel"
|
||||||
|
v-permission="['PROJECT_MESSAGE:READ+EDIT']">
|
||||||
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<notification-table
|
||||||
|
v-loading="loading"
|
||||||
|
:table-data="defectTask"
|
||||||
|
:event-options="eventOptions"
|
||||||
|
:receive-type-options="receiveTypeOptions"
|
||||||
|
@handleReceivers="handleReceivers"
|
||||||
|
@handleTemplate="handleTemplate"
|
||||||
|
@refresh="initForm"/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<mx-notice-template v-xpack ref="noticeTemplate" :variables="variables"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
|
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
||||||
|
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
||||||
|
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
|
||||||
|
import {searchNoticeByType} from "../../../../api/notification";
|
||||||
|
import MxNoticeTemplate from "metersphere-frontend/src/components/MxNoticeTemplate";
|
||||||
|
|
||||||
|
const TASK_TYPE = 'UI_AUTOMATION_TASK';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "UiAutomationNotification",
|
||||||
|
components: {
|
||||||
|
NotificationTable,
|
||||||
|
MsTipButton,
|
||||||
|
MsCodeEdit,
|
||||||
|
MxNoticeTemplate
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
receiverOptions: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
receiveTypeOptions: {
|
||||||
|
type: Array
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
modes: ['text', 'html'],
|
||||||
|
robotTitle: "${operator}创建了UI自动化: ${name}",
|
||||||
|
loading: false,
|
||||||
|
defectTask: [{
|
||||||
|
taskType: "defectTask",
|
||||||
|
event: "",
|
||||||
|
userIds: [],
|
||||||
|
type: [],
|
||||||
|
webhook: "",
|
||||||
|
isSet: true,
|
||||||
|
identification: "",
|
||||||
|
isReadOnly: false,
|
||||||
|
}],
|
||||||
|
eventOptions: [
|
||||||
|
{value: 'CREATE', label: this.$t('commons.create')},
|
||||||
|
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||||
|
{value: 'DELETE', label: this.$t('commons.delete')},
|
||||||
|
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('commons.run_success')},
|
||||||
|
{value: 'EXECUTE_FAILED', label: this.$t('commons.run_fail')},
|
||||||
|
],
|
||||||
|
variables: [
|
||||||
|
{
|
||||||
|
label: this.$t('group.operator'),
|
||||||
|
value: 'operator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'id',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('load_test.report.url'),
|
||||||
|
value: 'reportUrl',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('project.id'),
|
||||||
|
value: 'projectId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.tag'),
|
||||||
|
value: 'tags',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('user.id'),
|
||||||
|
value: 'userId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.module_id'),
|
||||||
|
value: 'moduleId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('module.path'),
|
||||||
|
value: 'modulePath',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.name'),
|
||||||
|
value: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.level'),
|
||||||
|
value: 'level',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.status'),
|
||||||
|
value: 'status',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.principal'),
|
||||||
|
value: 'principal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('report.plan_share_url'),
|
||||||
|
value: 'scenarioShareUrl',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.step_total'),
|
||||||
|
value: 'stepTotal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.schedule'),
|
||||||
|
value: 'schedule',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.create_time'),
|
||||||
|
value: 'createTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.update_time'),
|
||||||
|
value: 'updateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('test_track.pass_rate'),
|
||||||
|
value: 'passRate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.last_result'),
|
||||||
|
value: 'lastResult',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('report.id'),
|
||||||
|
value: 'reportId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('test_track.case.number'),
|
||||||
|
value: 'num',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.original_state'),
|
||||||
|
value: 'originalState',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.custom_num'),
|
||||||
|
value: 'customNum',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.create_user'),
|
||||||
|
value: 'createUser',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.delete_time'),
|
||||||
|
value: 'deleteTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.delete_user_id'),
|
||||||
|
value: 'deleteUserId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.execution_times'),
|
||||||
|
value: 'executeTimes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.order'),
|
||||||
|
value: 'order',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('ui.automation.scenario.environment_type'),
|
||||||
|
value: 'environmentType',
|
||||||
|
}, {
|
||||||
|
label: this.$t('ui.automation.scenario.environment_json'),
|
||||||
|
value: 'environmentJson',
|
||||||
|
}, {
|
||||||
|
label: this.$t('ui.automation.scenario.environment_group_id'),
|
||||||
|
value: 'environmentGroupId',
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.initForm();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initForm() {
|
||||||
|
this.loading = searchNoticeByType(TASK_TYPE).then(response => {
|
||||||
|
this.defectTask = response.data;
|
||||||
|
// 上报通知数
|
||||||
|
this.$emit("noticeSize", {module: 'ui', data: this.defectTask, taskType: TASK_TYPE});
|
||||||
|
this.defectTask.forEach(planTask => {
|
||||||
|
this.handleReceivers(planTask);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAddTaskModel() {
|
||||||
|
let task = {};
|
||||||
|
task.receiverOptions = this.receiverOptions;
|
||||||
|
task.event = '';
|
||||||
|
task.userIds = [];
|
||||||
|
task.type = '';
|
||||||
|
task.webhook = '';
|
||||||
|
task.isSet = true;
|
||||||
|
task.identification = '';
|
||||||
|
task.taskType = TASK_TYPE;
|
||||||
|
this.defectTask.unshift(task);
|
||||||
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
let robotTemplate = "";
|
||||||
|
switch (row.event) {
|
||||||
|
case 'CREATE':
|
||||||
|
robotTemplate = this.robotTitle;
|
||||||
|
break;
|
||||||
|
case 'UPDATE':
|
||||||
|
robotTemplate = this.robotTitle.replace('创建', '更新');
|
||||||
|
break;
|
||||||
|
case 'DELETE':
|
||||||
|
robotTemplate = this.robotTitle.replace('创建', '删除');
|
||||||
|
break;
|
||||||
|
case 'EXECUTE_SUCCESSFUL':
|
||||||
|
robotTemplate = this.robotTitle.replace('创建', '执行')
|
||||||
|
.replace('UI自动化', 'UI自动化成功');
|
||||||
|
break;
|
||||||
|
case 'EXECUTE_FAILED':
|
||||||
|
robotTemplate = this.robotTitle.replace('创建', '执行')
|
||||||
|
.replace('UI自动化', 'UI自动化失败');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.$refs.noticeTemplate.open(row, robotTemplate);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleReceivers(row) {
|
||||||
|
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
|
||||||
|
let i2 = row.userIds.indexOf('CREATOR');
|
||||||
|
|
||||||
|
switch (row.event) {
|
||||||
|
case "CREATE":
|
||||||
|
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
|
||||||
|
if (i2 < 0) {
|
||||||
|
row.userIds.unshift('CREATOR');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "UPDATE":
|
||||||
|
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
|
||||||
|
if (row.isSet) {
|
||||||
|
if (i2 < 0) {
|
||||||
|
row.userIds.unshift('CREATOR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "DELETE":
|
||||||
|
case "EXECUTE_SUCCESSFUL":
|
||||||
|
case "EXECUTE_FAILED":
|
||||||
|
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
|
||||||
|
if (row.isSet) {
|
||||||
|
if (i2 < 0) {
|
||||||
|
row.userIds.unshift('CREATOR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
row.receiverOptions = receiverOptions;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
receiverOptions(value) {
|
||||||
|
if (value && value.length > 0) {
|
||||||
|
this.initForm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-row {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-button {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,212 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<h5>{{ $t('i18n.report') }}</h5>
|
||||||
|
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel"
|
||||||
|
v-permission="['PROJECT_MESSAGE:READ+EDIT']">
|
||||||
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<notification-table
|
||||||
|
v-loading="loading"
|
||||||
|
:table-data="defectTask"
|
||||||
|
:event-options="eventOptions"
|
||||||
|
:receive-type-options="receiveTypeOptions"
|
||||||
|
@handleReceivers="handleReceivers"
|
||||||
|
@handleTemplate="handleTemplate"
|
||||||
|
@refresh="initForm"/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<mx-notice-template v-xpack ref="noticeTemplate" :variables="variables"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
|
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
||||||
|
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
||||||
|
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
|
||||||
|
import {searchNoticeByType} from "../../../../api/notification";
|
||||||
|
import MxNoticeTemplate from "metersphere-frontend/src/components/MxNoticeTemplate";
|
||||||
|
|
||||||
|
const TASK_TYPE = 'UI_REPORT_TASK';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "UiReportNotification",
|
||||||
|
components: {
|
||||||
|
NotificationTable,
|
||||||
|
MsTipButton,
|
||||||
|
MsCodeEdit,
|
||||||
|
MxNoticeTemplate
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
receiverOptions: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
receiveTypeOptions: {
|
||||||
|
type: Array
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
modes: ['text', 'html'],
|
||||||
|
robotTitle: "${operator}删除了测试报告: ${name}",
|
||||||
|
loading: false,
|
||||||
|
defectTask: [{
|
||||||
|
taskType: "defectTask",
|
||||||
|
event: "",
|
||||||
|
userIds: [],
|
||||||
|
type: [],
|
||||||
|
webhook: "",
|
||||||
|
isSet: true,
|
||||||
|
identification: "",
|
||||||
|
isReadOnly: false,
|
||||||
|
}],
|
||||||
|
eventOptions: [
|
||||||
|
{value: 'DELETE', label: this.$t('commons.delete')},
|
||||||
|
],
|
||||||
|
variables: [
|
||||||
|
{
|
||||||
|
label: this.$t('group.operator'),
|
||||||
|
value: 'operator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'id',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('project.id'),
|
||||||
|
value: 'projectId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.name'),
|
||||||
|
value: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.create_time'),
|
||||||
|
value: 'createTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.update_time'),
|
||||||
|
value: 'updateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.status'),
|
||||||
|
value: 'status',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('user.id'),
|
||||||
|
value: 'userId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.create_user'),
|
||||||
|
value: 'createUser',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.trigger_mode.name'),
|
||||||
|
value: 'triggerMode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('api_test.automation.scenario_name'),
|
||||||
|
value: 'scenarioName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('api_test.scenario.id'),
|
||||||
|
value: 'scenarioId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.actuator'),
|
||||||
|
value: 'actuator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('commons.description'),
|
||||||
|
value: 'description',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('report.test_end_time'),
|
||||||
|
value: 'endTime',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.initForm();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initForm() {
|
||||||
|
this.loading = searchNoticeByType(TASK_TYPE).then(response => {
|
||||||
|
this.defectTask = response.data;
|
||||||
|
// 上报通知数
|
||||||
|
this.$emit("noticeSize", {taskType: TASK_TYPE, module: 'api', data: this.defectTask});
|
||||||
|
this.defectTask.forEach(task => {
|
||||||
|
this.handleReceivers(task);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAddTaskModel() {
|
||||||
|
let task = {};
|
||||||
|
task.receiverOptions = this.receiverOptions;
|
||||||
|
task.event = '';
|
||||||
|
task.userIds = [];
|
||||||
|
task.type = '';
|
||||||
|
task.webhook = '';
|
||||||
|
task.isSet = true;
|
||||||
|
task.identification = '';
|
||||||
|
task.taskType = TASK_TYPE;
|
||||||
|
this.defectTask.unshift(task);
|
||||||
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
let robotTemplate = "";
|
||||||
|
switch (row.event) {
|
||||||
|
case 'DELETE':
|
||||||
|
robotTemplate = this.robotTitle.replace('创建', '删除');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.$refs.noticeTemplate.open(row, robotTemplate);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleReceivers(row) {
|
||||||
|
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
|
||||||
|
let i2 = row.userIds.indexOf('CREATOR');
|
||||||
|
|
||||||
|
switch (row.event) {
|
||||||
|
case "DELETE":
|
||||||
|
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
|
||||||
|
if (row.isSet) {
|
||||||
|
if (i2 < 0) {
|
||||||
|
row.userIds.unshift('CREATOR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
row.receiverOptions = receiverOptions;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
receiverOptions(value) {
|
||||||
|
if (value && value.length > 0) {
|
||||||
|
this.initForm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-row {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-button {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,7 @@
|
||||||
|
SET SESSION innodb_lock_wait_timeout = 7200;
|
||||||
|
-- 项目 默认勾选
|
||||||
|
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||||
|
SELECT UUID(), id, 'PROJECT_UI_SCENARIO:READ+SCHEDULE', 'PROJECT_UI_SCENARIO'
|
||||||
|
FROM `group`
|
||||||
|
WHERE type = 'PROJECT' AND id != 'read_only';
|
||||||
|
SET SESSION innodb_lock_wait_timeout = DEFAULT;
|
Loading…
Reference in New Issue