Merge branch 'main' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
be6c7f38ba
|
@ -878,13 +878,13 @@ public class JMeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
private static MsTestElement getMqttElement(Object key, String className) {
|
||||
MsTestElement elementNode;
|
||||
try {
|
||||
Class<?> clazz = null;
|
||||
clazz = Class.forName(className);
|
||||
Class<?> clazz = Class.forName(className);
|
||||
Object instance = clazz.getConstructor().newInstance();
|
||||
Method methods2 = clazz.getMethod("importJmx", Object.class);
|
||||
Object invoke = methods2.invoke(instance, key);
|
||||
Method mqttMethod = clazz.getMethod("importJmx", Object.class);
|
||||
Object invoke = mqttMethod.invoke(instance, key);
|
||||
elementNode = (MsTestElement) invoke;
|
||||
} catch (Exception e) {
|
||||
LogUtil.info("MQTT反射方法报错", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return elementNode;
|
||||
|
|
|
@ -6,10 +6,7 @@ import io.metersphere.api.jmeter.utils.ReportStatusUtil;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.plan.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.PropertyConstant;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.enums.ApiReportStatus;
|
||||
import io.metersphere.commons.enums.ExecutionExecuteTypeEnum;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
|
@ -56,6 +53,8 @@ public class TestResultService {
|
|||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
BaseShareInfoService baseShareInfoService;
|
||||
|
||||
// 场景
|
||||
private static final List<String> scenarioRunModes = new ArrayList<>() {{
|
||||
|
@ -275,7 +274,7 @@ public class TestResultService {
|
|||
String event = StringUtils.EMPTY;
|
||||
String successContext = "${operator}执行接口自动化成功: ${name}" + ", 报告: ${reportUrl}";
|
||||
String failedContext = "${operator}执行接口自动化失败: ${name}" + ", 报告: ${reportUrl}";
|
||||
|
||||
String shareUrl = getScenarioShareUrl(report.getId(), report.getUserId());
|
||||
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) {
|
||||
subject = "Jenkins任务通知";
|
||||
}
|
||||
|
@ -294,9 +293,19 @@ public class TestResultService {
|
|||
paramMap.put("url", baseSystemConfigDTO.getUrl());
|
||||
paramMap.put("reportUrl", reportUrl);
|
||||
paramMap.put("operator", report.getExecutor());
|
||||
paramMap.put("scenarioShareUrl", baseSystemConfigDTO.getUrl() + "/api/share-api-report" + shareUrl);
|
||||
paramMap.putAll(new BeanMap(report));
|
||||
paramMap.putAll(new BeanMap(scenario));
|
||||
NoticeModel noticeModel = NoticeModel.builder().operator(report.getUserId()).successContext(successContext).failedContext(failedContext).testId(testId).status(report.getStatus()).event(event).subject(subject).paramMap(paramMap).build();
|
||||
noticeSendService.send(report.getTriggerMode(), NoticeConstants.TaskType.API_DEFINITION_TASK, noticeModel);
|
||||
}
|
||||
|
||||
public String getScenarioShareUrl(String scenarioReportId, String userId) {
|
||||
ShareInfo shareRequest = new ShareInfo();
|
||||
shareRequest.setCustomData(scenarioReportId);
|
||||
shareRequest.setShareType(ShareType.API_REPORT.name());
|
||||
shareRequest.setCreateUserId(userId);
|
||||
ShareInfo shareInfo = baseShareInfoService.generateShareInfo(shareRequest);
|
||||
return baseShareInfoService.conversionShareInfoToDTO(shareInfo).getShareUrl();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import io.metersphere.log.vo.OperatingLogDetails;
|
|||
import io.metersphere.log.vo.api.ModuleReference;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.NoticeSendService;
|
||||
import io.metersphere.service.BaseShareInfoService;
|
||||
import io.metersphere.service.BaseUserService;
|
||||
import io.metersphere.service.ServiceUtils;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
|
@ -86,6 +87,8 @@ public class ApiScenarioReportService {
|
|||
private BaseUserService userService;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
BaseShareInfoService baseShareInfoService;
|
||||
|
||||
public void saveResult(ResultDTO dto) {
|
||||
// 报告详情内容
|
||||
|
@ -486,6 +489,8 @@ public class ApiScenarioReportService {
|
|||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + result.getId();
|
||||
paramMap.put("reportUrl", reportUrl);
|
||||
String shareUrl = getScenarioShareUrl(result.getId(), userId);
|
||||
paramMap.put("scenarioShareUrl", baseSystemConfigDTO.getUrl() + "/api/share-api-report" + shareUrl);
|
||||
String context = "${operator}执行接口自动化" + status + ": ${name}";
|
||||
NoticeModel noticeModel = NoticeModel.builder().operator(userId).context(context).subject("接口自动化通知").paramMap(paramMap).event(event).build();
|
||||
|
||||
|
@ -493,6 +498,15 @@ public class ApiScenarioReportService {
|
|||
noticeSendService.send(project, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel);
|
||||
}
|
||||
|
||||
public String getScenarioShareUrl(String scenarioReportId, String userId) {
|
||||
ShareInfo shareRequest = new ShareInfo();
|
||||
shareRequest.setCustomData(scenarioReportId);
|
||||
shareRequest.setShareType(ShareType.API_REPORT.name());
|
||||
shareRequest.setCreateUserId(userId);
|
||||
ShareInfo shareInfo = baseShareInfoService.generateShareInfo(shareRequest);
|
||||
return baseShareInfoService.conversionShareInfoToDTO(shareInfo).getShareUrl();
|
||||
}
|
||||
|
||||
public String update(ApiScenarioReportResult test) {
|
||||
ApiScenarioReport report = updateReport(test);
|
||||
ApiScenarioReportDetail detail = apiScenarioReportDetailMapper.selectByPrimaryKey(test.getId());
|
||||
|
|
|
@ -606,7 +606,7 @@ export default {
|
|||
ScenarioApiRelevance: () => import('./api/ApiRelevance'),
|
||||
ApiEnvironmentConfig: () => import('metersphere-frontend/src/components/environment/ApiEnvironmentConfig'),
|
||||
MsApiReportDetail: () => import('../report/SyncApiReportDetail'),
|
||||
MsInputTag: () => import('./MsInputTag'),
|
||||
MsInputTag: () => import('metersphere-frontend/src/components/MsInputTag'),
|
||||
MsRun: () => import('./DebugRun'),
|
||||
MsApiCustomize: () => import('./ApiCustomize'),
|
||||
ApiImport: () => import('../../definition/components/import/ApiImport'),
|
||||
|
|
|
@ -1,210 +0,0 @@
|
|||
<template>
|
||||
<div
|
||||
class="el-input-tag input-tag-wrapper"
|
||||
:class="[size ? 'el-input-tag--' + size : '']"
|
||||
style="height: auto"
|
||||
@click="foucusTagInput">
|
||||
<el-tag
|
||||
class="ms-top"
|
||||
v-for="(tag, idx) in innerTags"
|
||||
v-bind="$attrs"
|
||||
type="info"
|
||||
:key="tag"
|
||||
:size="size"
|
||||
:closable="!readOnly"
|
||||
:disable-transitions="false"
|
||||
@close="remove(idx)">
|
||||
<span v-if="tag && tag.length > 10">
|
||||
<el-tooltip class="item" effect="light" :content="tag" placement="top" :enterable="false">
|
||||
<span>{{ tag && tag.length > 10 ? tag.substring(0, 10) + "..." : tag }}</span>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ tag }}
|
||||
</span>
|
||||
</el-tag>
|
||||
<input
|
||||
:disabled="readOnly"
|
||||
class="tag-input el-input"
|
||||
v-model="newTag"
|
||||
:placeholder="defaultPlaceHolder"
|
||||
@keydown.delete.stop="removeLastTag"
|
||||
@keydown="addNew"
|
||||
@blur="addNew"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MsInputTag',
|
||||
props: {
|
||||
currentScenario: {},
|
||||
placeholder: {
|
||||
type: String,
|
||||
},
|
||||
errorInfo: String,
|
||||
addTagOnKeys: {
|
||||
type: Array,
|
||||
default: () => [13, 188, 9],
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
size: {type: String, default: 'small'},
|
||||
prop: {
|
||||
type: String,
|
||||
default: 'tags',
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (!this.currentScenario[this.prop]) {
|
||||
this.currentScenario[this.prop] = [];
|
||||
}
|
||||
if (this.placeholder) {
|
||||
this.defaultPlaceHolder = this.placeholder;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultPlaceHolder: this.$t('commons.tag_tip'),
|
||||
newTag: '',
|
||||
innerTags: this.currentScenario[this.prop] ? [...this.currentScenario[this.prop]] : [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
innerTags() {
|
||||
this.currentScenario[this.prop] = this.innerTags;
|
||||
},
|
||||
'currentScenario.tags'() {
|
||||
if (this.prop === 'tags') {
|
||||
if (
|
||||
!this.currentScenario[this.prop] ||
|
||||
this.currentScenario[this.prop] === '' ||
|
||||
this.currentScenario[this.prop].length === 0
|
||||
) {
|
||||
if (this.innerTags.length !== 0) {
|
||||
this.innerTags = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
foucusTagInput() {
|
||||
if (!this.readOnly && this.$el.querySelector('.tag-input')) {
|
||||
this.$el.querySelector('.tag-input').focus();
|
||||
}
|
||||
},
|
||||
addNew(e) {
|
||||
if (e && !this.addTagOnKeys.includes(e.keyCode) && e.type !== 'blur') {
|
||||
return;
|
||||
}
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
let addSuucess = false;
|
||||
if (this.newTag.includes(',')) {
|
||||
this.newTag.split(',').forEach((item) => {
|
||||
if (this.addTag(item.trim())) {
|
||||
addSuucess = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (this.addTag(this.newTag.trim())) {
|
||||
addSuucess = true;
|
||||
}
|
||||
}
|
||||
if (addSuucess) {
|
||||
this.tagChange();
|
||||
this.newTag = '';
|
||||
}
|
||||
this.$emit('onblur');
|
||||
},
|
||||
addTag(tag) {
|
||||
tag = tag.trim();
|
||||
if (tag && !this.innerTags.includes(tag)) {
|
||||
this.innerTags.push(tag);
|
||||
return true;
|
||||
} else {
|
||||
if (tag !== '' && this.errorInfo) {
|
||||
this.$error(this.errorInfo);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
remove(index) {
|
||||
this.innerTags.splice(index, 1);
|
||||
this.tagChange();
|
||||
this.$nextTick(() => {
|
||||
//删除tag元素操作是在输入框中去掉元素,也应当触发onblur操作
|
||||
this.$emit('onblur');
|
||||
});
|
||||
},
|
||||
removeLastTag() {
|
||||
if (this.newTag) {
|
||||
return;
|
||||
}
|
||||
this.innerTags.pop();
|
||||
this.tagChange();
|
||||
},
|
||||
tagChange() {
|
||||
this.$emit('input', this.innerTags);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.input-tag-wrapper {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdfe6;
|
||||
box-sizing: border-box;
|
||||
color: #606266;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
padding: 0 10px 0 5px;
|
||||
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.tag-input {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: #303133;
|
||||
font-size: 12px;
|
||||
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif;
|
||||
outline: none;
|
||||
padding-left: 0;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.el-input-tag {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.el-input-tag--mini {
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-input-tag--small {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.el-input-tag--medium {
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
</style>
|
|
@ -363,7 +363,7 @@ export default {
|
|||
ScenarioApiRelevance: () => import('../api/ApiRelevance'),
|
||||
ApiEnvironmentConfig: () => import('metersphere-frontend/src/components/environment/ApiEnvironmentConfig'),
|
||||
MsApiReportDetail: () => import('../../report/ApiReportDetail'),
|
||||
MsInputTag: () => import('../MsInputTag'),
|
||||
MsInputTag: () => import('metersphere-frontend/src/components/MsInputTag'),
|
||||
MsRun: () => import('../DebugRun'),
|
||||
MsApiCustomize: () => import('../ApiCustomize'),
|
||||
ApiImport: () => import('../../../definition/components/import/ApiImport'),
|
||||
|
|
|
@ -133,6 +133,10 @@ export default {
|
|||
label: this.$t('api_test.automation.scenario.principal'),
|
||||
value: 'principal',
|
||||
},
|
||||
{
|
||||
label: this.$t('report.plan_share_url'),
|
||||
value: 'scenarioShareUrl',
|
||||
},
|
||||
{
|
||||
label: this.$t('api_test.automation.step_total'),
|
||||
value: 'stepTotal',
|
||||
|
|
|
@ -440,7 +440,7 @@ export default {
|
|||
ScenarioChildDiff,
|
||||
MsComponentConfig,
|
||||
MsSelectTree: () => import('metersphere-frontend/src/components/select-tree/SelectTree'),
|
||||
MsInputTag: () => import('@/business/automation/scenario/MsInputTag'),
|
||||
MsInputTag: () => import('metersphere-frontend/src/components/MsInputTag'),
|
||||
EnvPopover: () => import('@/business/automation/scenario/EnvPopover'),
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -73,7 +73,7 @@ import { listenGoBack, removeGoBackListener } from 'metersphere-frontend/src/uti
|
|||
import EnvPopover from '@/business/automation/scenario/EnvPopover';
|
||||
import { ENV_TYPE } from 'metersphere-frontend/src/utils/constants';
|
||||
import CustomFiledComponent from 'metersphere-frontend/src/components/template/CustomFiledComponent';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import { getScenarioByProjectId } from '../../api/scenario';
|
||||
import { getOwnerProjects } from '../../api/project';
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<script>
|
||||
import MsDialogFooter from 'metersphere-frontend/src/components/MsDialogFooter';
|
||||
import { listenGoBack, removeGoBackListener } from 'metersphere-frontend/src/utils';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
|
||||
export default {
|
||||
name: 'BatchEdit',
|
||||
|
|
|
@ -272,7 +272,7 @@ import MsSqlBasisParameters from '../request/database/BasisParameters';
|
|||
import TcpFormatParameters from '@/business/definition/components/request/tcp/TcpFormatParameters';
|
||||
import MsDubboBasisParameters from '../request/dubbo/BasisParameters';
|
||||
import MsApiExtendBtns from '../reference/ApiExtendBtns';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import MsRequestResultTail from '../response/RequestResultTail';
|
||||
import ApiResponseComponent from '../../../automation/scenario/component/ApiResponseComponent';
|
||||
import ShowMoreBtn from '@/business/commons/ShowMoreBtn';
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
<script>
|
||||
import { definitionFollow } from '@/api/definition';
|
||||
import { API_STATUS } from '../../model/JsonData';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import MsSelectTree from 'metersphere-frontend/src/components/select-tree/SelectTree';
|
||||
import { getProjectMemberOption } from '@/api/project';
|
||||
import { useApiStore } from '@/store';
|
||||
|
|
|
@ -179,7 +179,7 @@ import MsApiRequestForm from '../request/http/ApiHttpRequestForm';
|
|||
import MsResponseText from '../response/ResponseText';
|
||||
import { API_STATUS, REQ_METHOD } from '../../model/JsonData';
|
||||
import { KeyValue } from '../../model/ApiTestModel';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import MsJsr233Processor from '../../../automation/scenario/component/Jsr233Processor';
|
||||
import MsSelectTree from 'metersphere-frontend/src/components/select-tree/SelectTree';
|
||||
import MsChangeHistory from '@/business/history/ApiHistory';
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<script>
|
||||
import { definitionFollow } from '@/api/definition';
|
||||
import { API_STATUS } from '../../model/JsonData';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import MsSelectTree from 'metersphere-frontend/src/components/select-tree/SelectTree';
|
||||
import { getProjectMemberOption } from '@/api/project';
|
||||
import { useApiStore } from '@/store';
|
||||
|
|
|
@ -322,7 +322,7 @@ import MsFormDivider from 'metersphere-frontend/src/components/MsFormDivider';
|
|||
import MsResponseText from '../../response/ResponseText';
|
||||
import MsApiRequestForm from '../../request/http/ApiHttpRequestForm';
|
||||
import MsSelectTree from 'metersphere-frontend/src/components/select-tree/SelectTree';
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import ApiInfoContainer from '@/business/definition/components/complete/ApiInfoContainer';
|
||||
import DependenciesList from '@/business/commons/DependenciesList';
|
||||
import FormRichTextItem from '@/business/commons/FormRichTextItem';
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsInputTag from '@/business/automation/scenario/MsInputTag';
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
|
||||
export default {
|
||||
name: 'MockConfigHeader',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class="el-input-tag input-tag-wrapper"
|
||||
:class="[size ? 'el-input-tag--' + size : '']"
|
||||
style="height: auto"
|
||||
@click="foucusTagInput">
|
||||
@click="focusTagInput">
|
||||
|
||||
<el-tag
|
||||
class="ms-top"
|
||||
|
@ -89,7 +89,7 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
foucusTagInput() {
|
||||
focusTagInput() {
|
||||
if (!this.readOnly && this.$el.querySelector('.tag-input')) {
|
||||
this.$el.querySelector('.tag-input').focus()
|
||||
}
|
||||
|
@ -102,19 +102,19 @@ export default {
|
|||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
let addSuucess = false
|
||||
let addSuccess = false
|
||||
if (this.newTag.includes(',')) {
|
||||
this.newTag.split(',').forEach(item => {
|
||||
if (this.addTag(item.trim())) {
|
||||
addSuucess = true
|
||||
addSuccess = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.addTag(this.newTag.trim())) {
|
||||
addSuucess = true
|
||||
addSuccess = true
|
||||
}
|
||||
}
|
||||
if (addSuucess) {
|
||||
if (addSuccess) {
|
||||
this.tagChange()
|
||||
this.newTag = ''
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
|
||||
:total="total" enableSelection @selectCountChange="selectCountChange"
|
||||
:screenHeight="screenHeight"
|
||||
row-key="id"
|
||||
:reserve-option="true"
|
||||
:page-refresh="pageRefresh"
|
||||
operator-width="170px"
|
||||
@order="initTable"
|
||||
@filter="search"
|
||||
|
@ -103,7 +106,7 @@
|
|||
:label="$t('api_test.definition.api_case_number')"/>
|
||||
|
||||
</ms-table>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
<ms-table-pagination :change="pageChange" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
||||
</span>
|
||||
|
@ -165,6 +168,7 @@ export default {
|
|||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
versionEnable: false,
|
||||
pageRefresh: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -190,12 +194,17 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
currentProtocol() {
|
||||
this.pageRefresh = false;
|
||||
this.getProtocolFilter();
|
||||
},
|
||||
projectId() {
|
||||
this.pageRefresh = false;
|
||||
this.checkVersionEnable();
|
||||
this.getUserFilter();
|
||||
}
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.pageRefresh = false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.$refs.apitable) {
|
||||
|
@ -235,7 +244,11 @@ export default {
|
|||
this.currentPage = 1;
|
||||
this.initTable();
|
||||
},
|
||||
initTable() {
|
||||
pageChange() {
|
||||
this.initTable("page");
|
||||
},
|
||||
initTable(data) {
|
||||
this.pageRefresh = data === "page";
|
||||
this.$emit('refreshTable');
|
||||
},
|
||||
clear() {
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
@row-click="handleRowClick"
|
||||
ref="table"
|
||||
>
|
||||
<el-table-column v-if="enableSelection" width="50" type="selection" />
|
||||
<el-table-column v-if="enableSelection && !reserveOption" width="50" type="selection"/>
|
||||
|
||||
<el-table-column v-if="enableSelection && reserveOption" width="50" type="selection" reserve-selection/>
|
||||
|
||||
<ms-table-header-select-popover
|
||||
v-if="enableSelection && showSelectAll && !hidePopover"
|
||||
|
@ -254,7 +256,22 @@ export default {
|
|||
default() {
|
||||
return true;
|
||||
},
|
||||
}, //开启全选
|
||||
},
|
||||
//开启保留前一页的选项的功能,注意需要与row-key搭配使用,否则不生效
|
||||
reserveOption: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
//是否是翻页的刷新,当reserveOption为true时,引用列表页需要在翻页的时候使该属性为true,用以避免clear
|
||||
pageRefresh: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
//开启全选
|
||||
showSelectAll: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
|
@ -306,7 +323,9 @@ export default {
|
|||
if (newVar !== oldVar) {
|
||||
this.$nextTick(() => {
|
||||
this.setDefaultOrders();
|
||||
if (!this.pageRefresh) {
|
||||
this.clear();
|
||||
}
|
||||
this.doLayout();
|
||||
this.checkTableRowIsSelect();
|
||||
this.listenRowDrop();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum ShareType {
|
||||
Single, Batch, PLAN_REPORT, PLAN_DB_REPORT
|
||||
Single, Batch, PLAN_REPORT, PLAN_DB_REPORT, API_REPORT
|
||||
}
|
||||
|
|
|
@ -122,6 +122,10 @@ export default {
|
|||
label: this.$t('api_test.automation.scenario.principal'),
|
||||
value: 'principal',
|
||||
},
|
||||
{
|
||||
label: this.$t('report.plan_share_url'),
|
||||
value: 'scenarioShareUrl',
|
||||
},
|
||||
{
|
||||
label: this.$t('api_test.automation.step_total'),
|
||||
value: 'stepTotal',
|
||||
|
|
|
@ -1,209 +0,0 @@
|
|||
<template>
|
||||
<div
|
||||
class="el-input-tag input-tag-wrapper"
|
||||
:class="[size ? 'el-input-tag--' + size : '']"
|
||||
style="height: auto"
|
||||
@click="foucusTagInput">
|
||||
|
||||
<el-tag
|
||||
class="ms-top"
|
||||
v-for="(tag, idx) in innerTags"
|
||||
v-bind="$attrs"
|
||||
type="info"
|
||||
:key="tag"
|
||||
:size="size"
|
||||
:closable="!readOnly"
|
||||
:disable-transitions="false"
|
||||
@close="remove(idx)">
|
||||
<span v-if="tag && tag.length > 10">
|
||||
<el-tooltip class="item" effect="light" :content="tag" placement="top" :enterable="false">
|
||||
<span>{{ tag && tag.length > 10 ? tag.substring(0, 10) + "..." : tag }}</span>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ tag }}
|
||||
</span>
|
||||
</el-tag>
|
||||
<input
|
||||
:disabled="readOnly"
|
||||
class="tag-input el-input"
|
||||
v-model="newTag"
|
||||
:placeholder=defaultPlaceHolder
|
||||
@keydown.delete.stop="removeLastTag"
|
||||
@keydown="addNew"
|
||||
@blur="addNew"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MsInputTag',
|
||||
props: {
|
||||
currentScenario: {},
|
||||
placeholder: {
|
||||
type: String,
|
||||
},
|
||||
errorInfo: String,
|
||||
addTagOnKeys: {
|
||||
type: Array,
|
||||
default: () => [13, 188, 9]
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
size: {type: String, default: "small"},
|
||||
prop: {
|
||||
type: String,
|
||||
default: "tags"
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.currentScenario[this.prop]) {
|
||||
this.currentScenario[this.prop] = [];
|
||||
}
|
||||
if (this.placeholder) {
|
||||
this.defaultPlaceHolder = this.placeholder;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultPlaceHolder: this.$t('commons.tag_tip'),
|
||||
newTag: '',
|
||||
innerTags: this.currentScenario[this.prop] ? [...this.currentScenario[this.prop]] : []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
innerTags() {
|
||||
this.currentScenario[this.prop] = this.innerTags;
|
||||
},
|
||||
'currentScenario.tags'() {
|
||||
if (this.prop === 'tags') {
|
||||
if (!this.currentScenario[this.prop] || this.currentScenario[this.prop] === '' || this.currentScenario[this.prop].length === 0) {
|
||||
if (this.innerTags.length !== 0) {
|
||||
this.innerTags = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
foucusTagInput() {
|
||||
if (!this.readOnly && this.$el.querySelector('.tag-input')) {
|
||||
this.$el.querySelector('.tag-input').focus()
|
||||
}
|
||||
},
|
||||
addNew(e) {
|
||||
if (e && (!this.addTagOnKeys.includes(e.keyCode)) && (e.type !== 'blur')) {
|
||||
return
|
||||
}
|
||||
if (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
let addSuucess = false
|
||||
if (this.newTag.includes(',')) {
|
||||
this.newTag.split(',').forEach(item => {
|
||||
if (this.addTag(item.trim())) {
|
||||
addSuucess = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.addTag(this.newTag.trim())) {
|
||||
addSuucess = true
|
||||
}
|
||||
}
|
||||
if (addSuucess) {
|
||||
this.tagChange()
|
||||
this.newTag = ''
|
||||
}
|
||||
this.$emit("onblur");
|
||||
},
|
||||
addTag(tag) {
|
||||
tag = tag.trim()
|
||||
if (tag && !this.innerTags.includes(tag)) {
|
||||
this.innerTags.push(tag)
|
||||
return true
|
||||
} else {
|
||||
if (tag !== "" && this.errorInfo) {
|
||||
this.$error(this.errorInfo);
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
remove(index) {
|
||||
this.innerTags.splice(index, 1);
|
||||
this.tagChange();
|
||||
this.$nextTick(() => {
|
||||
//删除tag元素操作是在输入框中去掉元素,也应当触发onblur操作
|
||||
this.$emit("onblur");
|
||||
});
|
||||
},
|
||||
removeLastTag() {
|
||||
if (this.newTag) {
|
||||
return
|
||||
}
|
||||
this.innerTags.pop()
|
||||
this.tagChange()
|
||||
},
|
||||
tagChange() {
|
||||
this.$emit('input', this.innerTags)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.input-tag-wrapper {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdfe6;
|
||||
box-sizing: border-box;
|
||||
color: #606266;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
padding: 0 10px 0 5px;
|
||||
transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.tag-input {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: #303133;
|
||||
font-size: 12px;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
||||
outline: none;
|
||||
padding-left: 0;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.el-input-tag {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.el-input-tag--mini {
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-input-tag--small {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.el-input-tag--medium {
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -166,7 +166,7 @@
|
|||
|
||||
import {getUUID, listenGoBack, removeGoBackListener} from "metersphere-frontend/src/utils"
|
||||
import {getCurrentProjectID, getCurrentUserId} from "metersphere-frontend/src/utils/token";
|
||||
import MsInputTag from "@/business/compnent/form/MsInputTag";
|
||||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
||||
import EmailComponent from "@/business/enterprisereport/components/container/EmailComponent";
|
||||
import ReportStatisticsDialog from "@/business/enterprisereport/components/dialog/SelectReportStatisticsDialog";
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
:total="total"
|
||||
:remember-order="true"
|
||||
row-key="id"
|
||||
:reserve-option="true"
|
||||
:page-refresh="pageRefresh"
|
||||
:row-order-group-id="projectId"
|
||||
@order="search"
|
||||
@filter="filterSearch"
|
||||
|
@ -145,7 +147,7 @@
|
|||
/>
|
||||
</ms-table>
|
||||
<ms-table-pagination
|
||||
:change="search"
|
||||
:change="pageChange"
|
||||
:current-page.sync="currentPage"
|
||||
:page-size.sync="pageSize"
|
||||
:total="total"
|
||||
|
@ -228,6 +230,7 @@ export default {
|
|||
environmentType: ENV_TYPE.JSON,
|
||||
envGroupId: "",
|
||||
versionFilters: [],
|
||||
pageRefresh: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -257,7 +260,11 @@ export default {
|
|||
this.currentPage = 1;
|
||||
this.search();
|
||||
},
|
||||
search() {
|
||||
pageChange() {
|
||||
this.search("page");
|
||||
},
|
||||
search(data) {
|
||||
this.pageRefresh = data === "page";
|
||||
this.projectEnvMap.clear();
|
||||
this.projectIds.clear();
|
||||
if (!this.projectId) {
|
||||
|
@ -358,7 +365,7 @@ export default {
|
|||
this.selectRows = this.$refs.scenarioTable.selectRows;
|
||||
this.initProjectIds();
|
||||
this.$emit("selectCountChange", data);
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
:total="page.total"
|
||||
:page-size.sync="page.pageSize"
|
||||
:screen-height="screenHeight"
|
||||
row-key="id"
|
||||
:reserve-option="true"
|
||||
:page-refresh="pageRefresh"
|
||||
@handlePageChange="getTestCases"
|
||||
@selectCountChange="setSelectCounts"
|
||||
@order="getTestCases"
|
||||
|
@ -94,7 +97,7 @@
|
|||
|
||||
</ms-table>
|
||||
|
||||
<ms-table-pagination :change="getTestCases" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize"
|
||||
<ms-table-pagination :change="pageChange" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize"
|
||||
:total="page.total"/>
|
||||
</test-case-relevance-base>
|
||||
|
||||
|
@ -172,6 +175,7 @@ export default {
|
|||
],
|
||||
versionFilters: null,
|
||||
testCaseTemplate: {},
|
||||
pageRefresh: false
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -253,7 +257,8 @@ export default {
|
|||
this.getTestCases();
|
||||
this.getProjectNode(this.projectId, this.page.condition);
|
||||
},
|
||||
getTestCases() {
|
||||
getTestCases(data) {
|
||||
this.pageRefresh = data === "page";
|
||||
let condition = this.page.condition;
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
condition.nodeIds = this.selectNodeIds;
|
||||
|
@ -265,6 +270,9 @@ export default {
|
|||
this.getTableData();
|
||||
}
|
||||
},
|
||||
pageChange() {
|
||||
this.getTestCases("page")
|
||||
},
|
||||
saveCaseRelevance(item) {
|
||||
this.isSaving = true;
|
||||
let param = {};
|
||||
|
@ -311,7 +319,7 @@ export default {
|
|||
this.testCaseTemplate = data;
|
||||
this.page.condition.components = initTestCaseConditionComponents(this.page.condition, this.testCaseTemplate.customFields);
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
:total="total"
|
||||
:remember-order="true"
|
||||
row-key="id"
|
||||
:reserve-option="true"
|
||||
:page-refresh="pageRefresh"
|
||||
:row-order-group-id="projectId"
|
||||
@order="getTestCases"
|
||||
@filter="search"
|
||||
|
@ -81,7 +83,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</ms-table>
|
||||
<ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
<ms-table-pagination :change="pageChange" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
||||
</test-case-relevance-base>
|
||||
|
@ -147,6 +149,7 @@ export default {
|
|||
{text: 'Error', value: 'Error'}
|
||||
],
|
||||
versionFilters: null,
|
||||
pageRefresh: false
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -218,7 +221,11 @@ export default {
|
|||
this.testCases = [];
|
||||
this.getTestCases(true);
|
||||
},
|
||||
getTestCases() {
|
||||
pageChange() {
|
||||
this.getTestCases("page");
|
||||
},
|
||||
getTestCases(data) {
|
||||
this.pageRefresh = data === "page";
|
||||
if (this.planId) {
|
||||
this.condition.testPlanId = this.planId;
|
||||
this.condition.projectId = this.projectId;
|
||||
|
@ -231,9 +238,6 @@ export default {
|
|||
this.testCases = data.listObject;
|
||||
|
||||
this.selectIds.clear();
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.clearSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
:total="total"
|
||||
:remember-order="true"
|
||||
row-key="id"
|
||||
:reserve-option="true"
|
||||
:page-refresh="pageRefresh"
|
||||
:row-order-group-id="projectId"
|
||||
@order="search"
|
||||
@filter="filterSearch"
|
||||
|
@ -76,7 +78,7 @@
|
|||
<ms-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
|
||||
show-overflow-tooltip/>
|
||||
</ms-table>
|
||||
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
<ms-table-pagination :change="pageChange" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -147,6 +149,7 @@ export default {
|
|||
envGroupId: "",
|
||||
versionFilters: [],
|
||||
fieldsWidth: getCustomTableWidth('TEST_PLAN_UI_SCENARIO_CASE'),
|
||||
pageRefresh: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -176,7 +179,11 @@ export default {
|
|||
this.currentPage = 1;
|
||||
this.search();
|
||||
},
|
||||
search() {
|
||||
pageChange() {
|
||||
this.search("page");
|
||||
},
|
||||
search(data) {
|
||||
this.pageRefresh = data === "page";
|
||||
this.projectEnvMap.clear();
|
||||
if (!this.projectId) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue