This commit is contained in:
shiziyuan9527 2020-08-25 18:18:59 +08:00
commit 5bd35fa4f1
20 changed files with 1144 additions and 1052 deletions

View File

@ -219,7 +219,7 @@
<dependency>
<groupId>io.metersphere</groupId>
<artifactId>jmeter-plugins-dubbo</artifactId>
<version>2.7.9</version>
<version>2.7.10</version>
</dependency>
<!-- LDAP Module -->

View File

@ -135,16 +135,21 @@ public class Swagger2Parser extends ApiImportAbstractParser {
simpleRef = refModel.getSimpleRef();
}
Model model = definitions.get(simpleRef);
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions);
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions, refSet);
body.setRaw(bodyParameters.toJSONString());
} else if (schema instanceof ArrayModel) {
ArrayModel arrayModel = (ArrayModel) bodyParameter.getSchema();
Property items = arrayModel.getItems();
if (items instanceof RefProperty) {
RefProperty refProperty = (RefProperty) items;
Model model = definitions.get(refProperty.getSimpleRef());
String simpleRef = refProperty.getSimpleRef();
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
JSONArray propertyList = new JSONArray();
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions));
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet));
body.setRaw(propertyList.toString());
}
}
@ -152,20 +157,26 @@ public class Swagger2Parser extends ApiImportAbstractParser {
body.setFormat("json");
}
private JSONObject getBodyJSONObjectParameters(Map<String, Property> properties, Map<String, Model> definitions) {
private JSONObject getBodyJSONObjectParameters(Map<String, Property> properties, Map<String, Model> definitions, HashSet<String> refSet) {
JSONObject jsonObject = new JSONObject();
properties.forEach((key, value) -> {
if (value instanceof ObjectProperty) {
ObjectProperty objectProperty = (ObjectProperty) value;
jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions));
jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions, refSet));
} else if (value instanceof ArrayProperty) {
ArrayProperty arrayProperty = (ArrayProperty) value;
Property items = arrayProperty.getItems();
if (items instanceof RefProperty) {
RefProperty refProperty = (RefProperty) items;
Model model = definitions.get(refProperty.getSimpleRef());
String simpleRef = refProperty.getSimpleRef();
if (refSet.contains(simpleRef)) {
jsonObject.put(key, new JSONArray());
return;
}
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
JSONArray propertyList = new JSONArray();
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions));
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet));
jsonObject.put(key, propertyList);
} else {
jsonObject.put(key, new ArrayList<>());

View File

@ -15,35 +15,35 @@
</el-input>
<el-button type="primary" plain :disabled="isReadOnly" @click="saveTest">
{{$t('commons.save')}}
{{ $t('commons.save') }}
</el-button>
<el-button type="primary" plain :disabled="isReadOnly"
@click="saveRunTest">
{{$t('load_test.save_and_run')}}
{{ $t('load_test.save_and_run') }}
</el-button>
<!-- <el-button :disabled="isReadOnly" type="primary" plain v-if="isShowRun" @click="runTest">-->
<!-- {{$t('api_test.run')}}-->
<!-- </el-button>-->
<!-- <el-button :disabled="isReadOnly" type="primary" plain v-if="isShowRun" @click="runTest">-->
<!-- {{$t('api_test.run')}}-->
<!-- </el-button>-->
<el-button :disabled="isReadOnly" type="warning" plain @click="cancel">{{$t('commons.cancel')}}
<el-button :disabled="isReadOnly" type="warning" plain @click="cancel">{{ $t('commons.cancel') }}
</el-button>
<el-dropdown trigger="click" @command="handleCommand">
<el-button class="el-dropdown-link more" icon="el-icon-more" plain/>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="report">
{{$t('api_report.title')}}
{{ $t('api_report.title') }}
</el-dropdown-item>
<el-dropdown-item command="performance" :disabled="create || isReadOnly">
{{$t('api_test.create_performance_test')}}
{{ $t('api_test.create_performance_test') }}
</el-dropdown-item>
<el-dropdown-item command="export" :disabled="isReadOnly || create">
{{$t('api_test.export_config')}}
{{ $t('api_test.export_config') }}
</el-dropdown-item>
<el-dropdown-item command="import" :disabled="isReadOnly">
{{$t('api_test.api_import.label')}}
{{ $t('api_test.api_import.label') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -52,10 +52,12 @@
<ms-api-report-dialog :test-id="id" ref="reportDialog"/>
<ms-schedule-config :schedule="test.schedule" :is-read-only="isReadOnly" :save="saveCronExpression" @scheduleChange="saveSchedule" :check-open="checkScheduleEdit"/>
<ms-schedule-config :schedule="test.schedule" :is-read-only="isReadOnly" :save="saveCronExpression"
@scheduleChange="saveSchedule" :check-open="checkScheduleEdit"/>
</el-row>
</el-header>
<ms-api-scenario-config :debug-report-id="debugReportId" @runDebug="runDebug" :is-read-only="isReadOnly" :scenarios="test.scenarioDefinition" :project-id="test.projectId" ref="config"/>
<ms-api-scenario-config :debug-report-id="debugReportId" @runDebug="runDebug" :is-read-only="isReadOnly"
:scenarios="test.scenarioDefinition" :project-id="test.projectId" ref="config"/>
</el-container>
</el-card>
</div>
@ -63,16 +65,17 @@
</template>
<script>
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import {Test} from "./model/ScenarioModel"
import MsApiReportStatus from "../report/ApiReportStatus";
import MsApiReportDialog from "./ApiReportDialog";
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import ApiImport from "./components/import/ApiImport";
import {getUUID} from "../../../../common/js/utils";
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import {Test} from "./model/ScenarioModel"
import MsApiReportStatus from "../report/ApiReportStatus";
import MsApiReportDialog from "./ApiReportDialog";
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import ApiImport from "./components/import/ApiImport";
import {getUUID} from "../../../../common/js/utils";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
export default {
export default {
name: "MsApiTestConfig",
components: {ApiImport, MsScheduleConfig, MsApiReportDialog, MsApiReportStatus, MsApiScenarioConfig},
@ -155,7 +158,7 @@
let jmx = this.test.toJMX();
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
let file = new File([blob], jmx.name);
this.result = this.$fileUpload(url, file, bodyFiles, this.test,response => {
this.result = this.$fileUpload(url, file, bodyFiles, this.test, response => {
if (callback) callback();
this.create = false;
this.resetBodyFile();
@ -169,6 +172,8 @@
path: '/api/test/edit?id=' + this.test.id
})
}
// 广 head
ApiEvent.$emit(LIST_CHANGE);
})
},
runTest() {
@ -185,6 +190,8 @@
this.save(() => {
this.$success(this.$t('commons.save_success'));
this.runTest();
// 广 head
ApiEvent.$emit(LIST_CHANGE);
})
},
getBodyUploadFiles() {
@ -193,7 +200,7 @@
this.test.scenarioDefinition.forEach(scenario => {
scenario.requests.forEach(request => {
if (request.body) {
request.body.kvs.forEach( param => {
request.body.kvs.forEach(param => {
if (param.files) {
param.files.forEach(item => {
if (item.file) {
@ -217,7 +224,7 @@
this.test.scenarioDefinition.forEach(scenario => {
scenario.requests.forEach(request => {
if (request.body) {
request.body.kvs.forEach( param => {
request.body.kvs.forEach(param => {
if (param.files) {
param.files.forEach(item => {
if (item.file) {
@ -302,7 +309,7 @@
let jmx = runningTest.toJMX();
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
let file = new File([blob], jmx.name);
this.$fileUpload(url, file, null, this.test,response => {
this.$fileUpload(url, file, null, this.test, response => {
this.debugReportId = response.data;
});
}
@ -311,26 +318,26 @@
created() {
this.init();
}
}
}
</script>
<style scoped>
.test-container {
.test-container {
height: calc(100vh - 150px);
min-height: 600px;
}
}
.test-name {
.test-name {
width: 600px;
margin-left: -20px;
margin-right: 20px;
}
}
.test-project {
.test-project {
min-width: 150px;
}
}
.test-container .more {
.test-container .more {
margin-left: 10px;
}
}
</style>

View File

@ -26,6 +26,7 @@
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import MsApiReportStatus from "../report/ApiReportStatus";
import MsApiReportDialog from "./ApiReportDialog";
import {getUUID} from "../../../../common/js/utils";
export default {
@ -116,7 +117,6 @@
let item = response.data;
this.tests.push(item);
let test = new Test({
id: item.id,
projectId: item.projectId,
name: this.ruleForm.testName,
scenarioDefinition: JSON.parse(item.scenarioDefinition),
@ -142,10 +142,36 @@
save(callback) {
this.change = false;
let url = "/api/create";
this.result = this.$request(this.getOptions(url), () => {
let bodyFiles = this.getBodyUploadFiles();
this.result = this.$request(this.getOptions(url, bodyFiles), () => {
if (callback) callback();
});
},
getBodyUploadFiles() {
let bodyUploadFiles = [];
this.test.bodyUploadIds = [];
this.test.scenarioDefinition.forEach(scenario => {
scenario.requests.forEach(request => {
if (request.body) {
request.body.kvs.forEach(param => {
if (param.files) {
param.files.forEach(item => {
if (item.file) {
let fileId = getUUID().substring(0, 8);
item.name = item.file.name;
item.id = fileId;
this.test.bodyUploadIds.push(fileId);
bodyUploadFiles.push(item.file);
// item.file = undefined;
}
});
}
});
}
});
});
return bodyUploadFiles;
},
runTest() {
this.result = this.$post("/api/run", {id: this.test.id, triggerMode: 'MANUAL'}, (response) => {
this.$success(this.$t('api_test.running'));
@ -155,12 +181,19 @@
this.test = ""
});
},
getOptions(url) {
getOptions(url, bodyFiles) {
let formData = new FormData();
if (bodyFiles) {
bodyFiles.forEach(f => {
formData.append("files", f);
})
}
let requestJson = JSON.stringify(this.test);
formData.append('request', new Blob([requestJson], {
type: "application/json"
}));
let jmx = this.test.toJMX();
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
formData.append("file", new File([blob], jmx.name));

View File

@ -3,11 +3,11 @@
<el-form :model="request" ref="request" label-width="100px">
<el-form-item :label="$t('api_test.request.connect_timeout')" prop="connectTimeout">
<el-input-number size="small" :disabled="isReadOnly" v-model="request.connectTimeout" :placeholder="$t('commons.millisecond')" :maxlength="1000*10000000" />
<el-input-number size="small" :disabled="isReadOnly" v-model="request.connectTimeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" />
</el-form-item>
<el-form-item :label="$t('api_test.request.response_timeout')" prop="responseTimeout">
<el-input-number size="small" :disabled="isReadOnly" v-model="request.responseTimeout" :placeholder="$t('commons.millisecond')" :maxlength="1000*10000000"/>
<el-input-number size="small" :disabled="isReadOnly" v-model="request.responseTimeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000"/>
</el-form-item>
</el-form>

View File

@ -7,7 +7,7 @@
<el-col :span="4" class="script-index">
<div class="template-title">{{$t('api_test.request.processor.code_template')}}</div>
<div v-for="(template, index) in codeTemplates" :key="index" class="code-template">
<el-link @click="addTemplate(template)">{{template.title}}</el-link>
<el-link :disabled="template.disabled" @click="addTemplate(template)">{{template.title}}</el-link>
</div>
<div class="document-url">
<el-link href="https://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor" type="primary">{{$t('commons.reference_documentation')}}</el-link>
@ -29,23 +29,26 @@
codeTemplates: [
{
title: this.$t('api_test.request.processor.code_template_get_variable'),
value: 'vars.get("variable_name");'
value: 'vars.get("variable_name");',
},
{
title: this.$t('api_test.request.processor.code_template_set_variable'),
value: 'vars.put("variable_name", "variable_value");'
value: 'vars.put("variable_name", "variable_value");',
},
{
title: this.$t('api_test.request.processor.code_template_get_response_header'),
value: 'prev.getResponseHeaders();'
value: 'prev.getResponseHeaders();',
disabled: this.isPreProcessor
},
{
title: this.$t('api_test.request.processor.code_template_get_response_code'),
value: 'prev.getResponseCode();'
value: 'prev.getResponseCode();',
disabled: this.isPreProcessor
},
{
title: this.$t('api_test.request.processor.code_template_get_response_result'),
value: 'prev.getResponseDataAsString();'
value: 'prev.getResponseDataAsString();',
disabled: this.isPreProcessor
}
],
isCodeEditAlive: true
@ -61,6 +64,10 @@
},
beanShellProcessor: {
type: Object,
},
isPreProcessor: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -68,7 +68,7 @@
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.processor.pre_exec_script')" name="beanShellPreProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPreProcessor"/>
<ms-bean-shell-processor :is-pre-processor="true" :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPreProcessor"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.processor.post_exec_script')" name="beanShellPostProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPostProcessor"/>

View File

@ -749,13 +749,15 @@ class JMXHttpRequest {
getPostQueryParameters(request, path) {
if (this.method.toUpperCase() !== "GET") {
path += '?';
let parameters = [];
request.parameters.forEach(parameter => {
if (parameter.name && parameter.value) {
parameters.push(parameter);
}
});
if (parameters.length > 0) {
path += '?';
}
for (let i = 0; i < parameters.length; i++) {
let parameter = parameters[i];
path += (parameter.name + '=' + parameter.value);
@ -942,7 +944,7 @@ class JMXGenerator {
addBodyFormat(request) {
let bodyFormat = request.body.format;
if (bodyFormat) {
if (!request.body.isKV() && bodyFormat) {
switch (bodyFormat) {
case BODY_FORMAT.JSON:
this.addContentType(request, 'application/json');

View File

@ -72,7 +72,8 @@
format() {
if (this.mode === 'json') {
try {
this.formatData = JSON.stringify(JSON.parse(this.data), null, '\t');
var JSONbigString = require('json-bigint')({"storeAsString": true});
this.formatData = JSON.stringify(JSONbigString.parse(this.data), null, '\t');
} catch (e) {
if (this.data) {
this.formatData = this.data;

View File

@ -60,6 +60,7 @@ import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
export default {
name: "EditPerformanceTestPlan",
@ -172,6 +173,8 @@ export default {
this.$success(this.$t('commons.save_success'));
this.$refs.advancedConfig.cancelAllEdit();
this.$router.push({path: '/performance/test/all'})
// 广 head
PerformanceEvent.$emit(LIST_CHANGE);
});
},
saveAndRun() {
@ -187,6 +190,8 @@ export default {
this.result = this.$post(this.runPath, {id: this.testPlan.id, triggerMode: 'MANUAL'}, (response) => {
let reportId = response.data;
this.$router.push({path: '/performance/report/view/' + reportId})
// 广 head
PerformanceEvent.$emit(LIST_CHANGE);
})
});
},

View File

@ -286,4 +286,8 @@ export default {
cursor: pointer;
}
pre {
margin: 0 0;
}
</style>

View File

@ -12,8 +12,9 @@
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')">
<template v-slot:default="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}
</el-button>
<el-link type="primary" class="member-size" @click="cellClick(scope.row)">
{{ scope.row.memberSize }}
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
@ -27,7 +28,8 @@
</el-card>
<!-- dialog of organization member -->
<el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc" class="dialog-css">
<el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc"
class="dialog-css">
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
<!-- organization member table -->
@ -43,7 +45,8 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)" @deleteClick="delMember(scope.row)"/>
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
@deleteClick="delMember(scope.row)"/>
</template>
</el-table-column>
</el-table>
@ -146,7 +149,8 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-form-item :label="$t('commons.role')" prop="roleIds"
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
@ -171,23 +175,24 @@
</template>
<script>
import MsCreateBox from "../CreateBox";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
import MsTableOperator from "../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {
import MsCreateBox from "../CreateBox";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
import MsTableOperator from "../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {
getCurrentOrganizationId,
getCurrentUser, listenGoBack,
getCurrentUser,
listenGoBack,
refreshSessionAndCookies,
removeGoBackListener
} from "../../../../common/js/utils";
import {DEFAULT, ORGANIZATION} from "../../../../common/js/constants";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
} from "@/common/js/utils";
import {DEFAULT, ORGANIZATION} from "@/common/js/constants";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
export default {
export default {
name: "MsOrganization",
components: {
MsDeleteConfirm,
@ -339,8 +344,7 @@
let lastOrganizationId = getCurrentOrganizationId();
let sourceId = organization.id;
if (lastOrganizationId === sourceId) {
let sign = DEFAULT;
refreshSessionAndCookies(sign, sourceId);
refreshSessionAndCookies(DEFAULT, sourceId);
}
this.$success(this.$t('commons.delete_success'));
this.initTableData();
@ -363,8 +367,7 @@
let currentUser = getCurrentUser();
let userId = row.id;
if (currentUser.id === userId) {
let sign = ORGANIZATION;
refreshSessionAndCookies(sign, sourceId);
refreshSessionAndCookies(ORGANIZATION, sourceId);
}
this.$success(this.$t('commons.remove_success'))
this.cellClick(this.currentRow);
@ -472,32 +475,31 @@
},
}
}
}
</script>
<style scoped>
.member-size {
.member-size {
text-decoration: underline;
cursor: pointer;
}
}
.org-member-id {
.org-member-id {
float: left;
}
}
.org-member-email {
.org-member-email {
float: right;
color: #8492a6;
font-size: 13px;
}
}
.select-width {
.select-width {
width: 100%;
}
}
.dialog-css >>> .el-dialog__header {
padding: 0px;
}
.dialog-css >>> .el-dialog__header {
padding: 0;
}
</style>

View File

@ -12,9 +12,9 @@
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>
<el-table-column :label="$t('commons.member')">
<template v-slot:default="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">
<el-link type="primary" class="member-size" @click="cellClick(scope.row)">
{{scope.row.memberSize}}
</el-button>
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
@ -200,12 +200,11 @@
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {
getCurrentOrganizationId,
getCurrentUser,
getCurrentWorkspaceId, listenGoBack,
refreshSessionAndCookies, removeGoBackListener
} from "../../../../common/js/utils";
import {DEFAULT, WORKSPACE} from "../../../../common/js/constants";
} from "@/common/js/utils";
import {DEFAULT, WORKSPACE} from "@/common/js/constants";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
export default {
@ -537,7 +536,7 @@
}
.dialog-css >>> .el-dialog__header {
padding: 0px;
padding: 0;
}
</style>

View File

@ -75,13 +75,13 @@
</el-col>
<el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
<el-col :offset="2" :span="2">
@ -137,13 +137,13 @@
</el-col>
<el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
<el-col :offset="2" :span="2">

View File

@ -105,12 +105,12 @@
</el-col>
<el-col :span="9" :offset="1" v-if="form.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')" ></el-input>
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-top: 15px;">
<el-col :offset="2">{{$t('test_track.case.prerequisite')}}:</el-col>
<el-col :offset="2">{{ $t('test_track.case.prerequisite') }}:</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20">
@ -125,7 +125,7 @@
</el-row>
<el-row v-if="form.method && form.method != 'auto'" style="margin-bottom: 10px">
<el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col>
<el-col :offset="2">{{ $t('test_track.case.steps') }}:</el-col>
</el-row>
<el-row v-if="form.method && form.method != 'auto'" type="flex" justify="center">
@ -141,29 +141,29 @@
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="35%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
v-if="!readOnly"
:disabled="readOnly"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:rows="2"
v-model="scope.row.desc"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.desc}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="35%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
v-if="!readOnly"
:disabled="readOnly"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:rows="2"
v-model="scope.row.result"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.result}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.input_content')" min-width="15%">
@ -187,7 +187,7 @@
</el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2">{{$t('commons.remark')}}:</el-col>
<el-col :offset="2">{{ $t('commons.remark') }}:</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
@ -222,11 +222,12 @@
<script>
import {WORKSPACE_ID, TokenKey} from '../../../../../common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {listenGoBack, removeGoBackListener, removeListenGoBack} from "../../../../../common/js/utils";
import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
export default {
export default {
name: "TestCaseEdit",
components: {MsDialogFooter},
data() {
@ -242,7 +243,7 @@
method: '',
prerequisite: '',
testId: '',
otherTestName:'',
otherTestName: '',
steps: [{
num: 1,
desc: '',
@ -386,6 +387,8 @@
}
this.dialogFormVisible = false;
this.$emit("refresh");
// 广 head
TrackEvent.$emit(LIST_CHANGE);
});
}
} else {
@ -450,7 +453,7 @@
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
this.testOptions = response.data;
this.testOptions.unshift({id:'other',name:this.$t('test_track.case.other')})
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
});
}
},
@ -496,7 +499,7 @@
this.form.prerequisite = '';
this.form.remark = '';
this.form.testId = '';
this.form.testName='';
this.form.testName = '';
this.form.steps = [{
num: 1,
desc: '',
@ -507,29 +510,17 @@
}
}
}
}
}
</script>
<style scoped>
.tb-edit .el-textarea {
display: none;
}
.tb-edit .current-row .el-textarea {
display: block;
}
.tb-edit .current-row .el-textarea + pre {
display: none;
}
.el-switch {
.el-switch {
margin-bottom: 10px;
}
}
.case-name {
.case-name {
width: 194px;
}
}
</style>

View File

@ -108,7 +108,6 @@ export default {
methods: {
handleDragEnd(draggingNode, dropNode, dropType, ev) {
let param = this.buildParam(draggingNode, dropNode, dropType);
console.log(this.treeNodes);
this.$post("/case/node/drag", param, () => {
draggingNode.data.level = param.level;
this.refreshTable();

View File

@ -92,12 +92,12 @@
<div class="dialog-footer">
<el-button
@click="dialogFormVisible = false">
{{$t('test_track.cancel')}}
{{ $t('test_track.cancel') }}
</el-button>
<el-button
type="primary"
@click="savePlan">
{{$t('test_track.confirm')}}
{{ $t('test_track.confirm') }}
</el-button>
</div>
</template>
@ -110,11 +110,12 @@
<script>
import {WORKSPACE_ID} from '../../../../../common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
import {WORKSPACE_ID} from '../../../../../common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
export default {
export default {
name: "TestPlanEdit",
components: {TestPlanStatusButton},
data() {
@ -127,15 +128,15 @@
stage: '',
description: ''
},
rules:{
name :[
rules: {
name: [
{required: true, message: this.$t('test_track.plan.input_plan_name'), trigger: 'blur'},
{ max: 30, message: this.$t('test_track.length_less_than') + '30', trigger: 'blur' }
{max: 30, message: this.$t('test_track.length_less_than') + '30', trigger: 'blur'}
],
projectId :[{required: true, message: this.$t('test_track.plan.input_plan_project'), trigger: 'change'}],
principal :[{required: true, message: this.$t('test_track.plan.input_plan_principal'), trigger: 'change'}],
stage :[{required: true, message: this.$t('test_track.plan.input_plan_stage'), trigger: 'change'}],
description :[{ max: 200, message: this.$t('test_track.length_less_than') + '200', trigger: 'blur'}]
projectId: [{required: true, message: this.$t('test_track.plan.input_plan_project'), trigger: 'change'}],
principal: [{required: true, message: this.$t('test_track.plan.input_plan_principal'), trigger: 'change'}],
stage: [{required: true, message: this.$t('test_track.plan.input_plan_stage'), trigger: 'change'}],
description: [{max: 200, message: this.$t('test_track.length_less_than') + '200', trigger: 'blur'}]
},
formLabelWidth: "120px",
operationType: '',
@ -149,7 +150,7 @@
this.getProjects();
this.setPrincipalOptions();
this.operationType = 'add';
if(testPlan){
if (testPlan) {
//
this.operationType = 'edit';
let tmp = {};
@ -159,7 +160,7 @@
listenGoBack(this.close);
this.dialogFormVisible = true;
},
savePlan(){
savePlan() {
this.$refs['planFrom'].validate((valid) => {
if (valid) {
let param = {};
@ -174,6 +175,8 @@
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit("refresh");
// 广 head
TrackEvent.$emit(LIST_CHANGE);
});
} else {
return false;
@ -191,7 +194,7 @@
},
setPrincipalOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId:workspaceId}, response => {
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.principalOptions = response.data;
});
},
@ -219,7 +222,7 @@
}
}
}
}
}
</script>
<style scoped>

View File

@ -128,17 +128,30 @@
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="21%">
<template v-slot:default="scope">
<pre>{{scope.row.desc}}</pre>
<el-input
size="mini"
class="border-hidden"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4}"
:disabled="true"
v-model="scope.row.desc"/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="21%">
<template v-slot:default="scope">
<pre>{{scope.row.result}}</pre>
<el-input
size="mini"
class="border-hidden"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4}"
:disabled="true"
v-model="scope.row.result"/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.plan_view.actual_result')" min-width="21%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
@ -146,8 +159,7 @@
:disabled="isReadOnly"
v-model="scope.row.actualResult"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.actualResult}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.plan_view.step_result')" min-width="12%">
@ -303,7 +315,7 @@
readConfig: {toolbar: []},
test: {},
activeTab: 'detail',
isFailure: false,
isFailure: true,
};
},
props: {
@ -482,7 +494,7 @@
stepResultChange() {
if (this.testCase.method == 'manual') {
this.isFailure = this.testCase.steptResults.filter(s => {
return !s.executeResult || s.executeResult === 'Failure' || s.executeResult === 'Blocking';
return s.executeResult === 'Failure' || s.executeResult === 'Blocking';
}).length > 0;
}
@ -522,17 +534,10 @@
<style scoped>
.tb-edit .el-textarea {
display: none;
}
.tb-edit .current-row .el-textarea {
display: block;
}
.tb-edit .current-row .el-textarea + pre {
display: none;
.border-hidden >>> .el-textarea__inner {
border-style: hidden;
background-color: white;
color: #606266;
}
.cast_label {

View File

@ -358,13 +358,17 @@
this.total = data.itemCount;
this.tableData = data.listObject;
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i]) {
this.$set(this.tableData[i], "issuesSize", 0);
this.$get("/issues/get/" + this.tableData[i].caseId, response => {
let issues = response.data;
if (this.tableData[i]) {
this.$set(this.tableData[i], "issuesSize", issues.length);
this.$set(this.tableData[i], "issuesContent", issues);
}
})
}
}
// this.selectIds.clear();
this.selectRows.clear();
});

View File

@ -75,3 +75,22 @@ body {
background-color: #EBEEF5;
}
/* 表格拖拽表头调整宽度 --> */
/* <-- 表格 input 编辑效果*/
.table-edit-input .el-textarea__inner {
border-style: hidden;
}
.table-edit-input.is-disabled .el-textarea__inner {
background-color: white;
color: #606266;
}
.el-table .current-row .table-edit-input {
border: 1px solid #DCDFE6;
border-radius: 5px;
}
.table-edit-input .el-textarea__inner:focus {
border: 1px solid #409EFF;
}
/* 表格 input 编辑效果 --> */