parent
1454d14bc7
commit
9b7de47b07
|
@ -98,7 +98,7 @@ public class PerformanceTestController {
|
|||
checkPermissionService.checkProjectOwner(request.getProjectId());
|
||||
LoadTest loadTest = performanceTestService.save(request, files);
|
||||
//检查并发送审核脚本的通知
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, request.getId(), request.getName(), request.getProjectId());
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, loadTest);
|
||||
return loadTest;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class PerformanceTestController {
|
|||
checkPermissionService.checkPerformanceTestOwner(request.getId());
|
||||
LoadTest loadTest = performanceTestService.edit(request, files);
|
||||
//检查并发送审核脚本的通知
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, request.getId(), request.getName(), request.getProjectId());
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, loadTest);
|
||||
return loadTest;
|
||||
}
|
||||
|
||||
|
|
|
@ -1173,32 +1173,42 @@ public class PerformanceTestService {
|
|||
return this.list(request2);
|
||||
}
|
||||
|
||||
private boolean checkLoadTest(LoadTest loadTest) {
|
||||
return loadTest != null && StringUtils.isNoneBlank(loadTest.getId(), loadTest.getName(), loadTest.getProjectId(), loadTest.getCreateUser());
|
||||
}
|
||||
|
||||
//检查并发送脚本审核的通知
|
||||
public void checkAndSendReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files, String loadTestId, String loadTestName, String projectId) {
|
||||
public void checkAndSendReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files, LoadTest loadTest) {
|
||||
if (checkLoadTest(loadTest)) {
|
||||
String projectId = loadTest.getProjectId();
|
||||
ProjectApplication reviewLoadTestScript = projectApplicationService.getProjectApplication(
|
||||
projectId, ProjectApplicationType.PERFORMANCE_REVIEW_LOAD_TEST_SCRIPT.name());
|
||||
if (BooleanUtils.toBoolean(reviewLoadTestScript.getTypeValue())) {
|
||||
ProjectApplication loadTestScriptReviewerConfig = projectApplicationService.getProjectApplication(
|
||||
projectId, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name());
|
||||
if (StringUtils.isNotEmpty(loadTestScriptReviewerConfig.getTypeValue()) && projectService.isProjectMember(projectId, loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
boolean isSend = this.isSendScriptReviewMessage(fileMetadataList, files);
|
||||
if (isSend) {
|
||||
String sendUser = loadTest.getCreateUser();
|
||||
ProjectApplication loadTestScriptReviewerConfig = projectApplicationService.getProjectApplication(projectId, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name());
|
||||
if (StringUtils.isNotEmpty(loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
sendUser = loadTestScriptReviewerConfig.getTypeValue();
|
||||
}
|
||||
if (projectService.isProjectMember(projectId, loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
Notification notification = new Notification();
|
||||
notification.setTitle("性能测试通知");
|
||||
notification.setOperator(SessionUtils.getUserId());
|
||||
notification.setOperation(NoticeConstants.Event.REVIEW);
|
||||
notification.setResourceId(loadTestId);
|
||||
notification.setResourceName(loadTestName);
|
||||
notification.setResourceId(loadTest.getId());
|
||||
notification.setResourceName(loadTest.getName());
|
||||
notification.setResourceType(NoticeConstants.TaskType.PERFORMANCE_TEST_TASK);
|
||||
notification.setType(NotificationConstants.Type.SYSTEM_NOTICE.name());
|
||||
notification.setStatus(NotificationConstants.Status.UNREAD.name());
|
||||
notification.setCreateTime(System.currentTimeMillis());
|
||||
notification.setReceiver(loadTestScriptReviewerConfig.getTypeValue());
|
||||
notification.setReceiver(sendUser);
|
||||
notificationService.sendAnnouncement(notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSendScriptReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files) {
|
||||
List<FileContent> fileContentList = new ArrayList<>();
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.google.common.base.CaseFormat;
|
||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.api.tcp.TCPPool;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.ProjectApplication;
|
||||
import io.metersphere.base.domain.ProjectApplicationExample;
|
||||
import io.metersphere.base.mapper.ProjectApplicationMapper;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.commons.constants.ProjectApplicationType;
|
||||
|
@ -214,7 +216,10 @@ public class ProjectApplicationService {
|
|||
String projectId = conf.getProjectId();
|
||||
String type = conf.getType();
|
||||
String value = conf.getTypeValue();
|
||||
if (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value)) {
|
||||
|
||||
//性能测试审核人,允许value值为空
|
||||
if (!StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name())
|
||||
&& (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value))) {
|
||||
LogUtil.error("create or update project config error. project id or conf type or value is blank.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -33,18 +33,24 @@
|
|||
>
|
||||
<el-col :span="2">
|
||||
<div class="icon-title">
|
||||
{{ row.resourceName.substring(0, 1) }}
|
||||
{{ $t("commons.system_notification_logo") }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="22">
|
||||
<span class="operation">
|
||||
<span>{{ getResource(row) }}:</span>
|
||||
<span
|
||||
<el-popover
|
||||
placement="top-start"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
:content="row.resourceName">
|
||||
<span slot="reference"
|
||||
@click="clickResource(row)"
|
||||
style="color: #783887; cursor: pointer"
|
||||
>
|
||||
{{ row.resourceName }}
|
||||
{{ getShortResourceName(row.resourceName) }}
|
||||
</span>
|
||||
</el-popover>
|
||||
<span> {{ $t("project.config.contains_script_review") }} </span>
|
||||
</span>
|
||||
</el-col>
|
||||
|
@ -168,6 +174,9 @@ export default {
|
|||
let element = document.getElementById(id);
|
||||
element.parentNode.removeChild(element);
|
||||
},
|
||||
getShortResourceName(resourceName) {
|
||||
return resourceName.length > 7 ? resourceName.substring(0, 7) + "..." : resourceName;
|
||||
},
|
||||
isReviewNotice(row) {
|
||||
return row.operation === "REVIEW";
|
||||
},
|
||||
|
|
|
@ -196,6 +196,7 @@
|
|||
:reviewers="userInProject"
|
||||
:reviewer.sync="config.performanceScriptReviewer"
|
||||
:reviewerSwitch.sync="config.performanceReviewLoadTestScript"
|
||||
:placeholder="$t('commons.creator')"
|
||||
@reviewerChange="
|
||||
switchChange(
|
||||
'PERFORMANCE_SCRIPT_REVIEWER',
|
||||
|
@ -297,9 +298,11 @@ export default {
|
|||
created() {
|
||||
this.init();
|
||||
this.getResourcePools();
|
||||
this.selectUserInProject();
|
||||
this.isXpack = !!hasLicense();
|
||||
},
|
||||
activated() {
|
||||
this.selectUserInProject();
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
|
|
|
@ -23,12 +23,13 @@
|
|||
{{ $t("commons.reviewers") }}
|
||||
</span>
|
||||
<el-select
|
||||
clearable
|
||||
v-model="reviewerSelect"
|
||||
@change="reviewerChange"
|
||||
size="mini"
|
||||
style="margin-left: 5px"
|
||||
filterable
|
||||
:placeholder="$t('api_test.definition.api_principal')"
|
||||
:placeholder="placeholder"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reviewers"
|
||||
|
@ -41,7 +42,6 @@
|
|||
</template>
|
||||
<template #append>
|
||||
<el-switch
|
||||
:disabled="!reviewerSelect || reviewerSelect===''"
|
||||
v-model="reviewerSwitchSelect"
|
||||
@change="switchChange"
|
||||
></el-switch>
|
||||
|
@ -61,6 +61,12 @@ export default {
|
|||
reviewers: Array,
|
||||
reviewer: String,
|
||||
reviewerSwitch: Boolean,
|
||||
placeholder: {
|
||||
type: String,
|
||||
default() {
|
||||
return this.$t('api_test.definition.api_principal');
|
||||
}
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
return {};
|
||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
|||
xmindFile: "Xmind",
|
||||
default: "default",
|
||||
sort_default: "Default",
|
||||
system_notification_logo: "Sys",
|
||||
please_select_import_mode: 'Please select import mode',
|
||||
please_select_import_module: 'Please select import module',
|
||||
pass_rate: 'Pass Rate',
|
||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
|||
xmindFile: "思维导图.xmind",
|
||||
default: "默认值",
|
||||
sort_default: "默认排序",
|
||||
system_notification_logo: "系",
|
||||
please_select_import_mode: '请选择导入模式',
|
||||
please_select_import_module: '请选择导入模块',
|
||||
pass_rate: '通过率',
|
||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
|||
xmindFile: "思維導圖.xmind",
|
||||
default: "默認值",
|
||||
sort_default: "默認排序",
|
||||
system_notification_logo: "系",
|
||||
please_select_import_mode: '請選擇導入模式',
|
||||
please_select_import_module: '請選擇導入模塊',
|
||||
pass_rate: '通過率',
|
||||
|
|
Loading…
Reference in New Issue