Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2020-07-24 16:10:37 +08:00
commit 4ba5a57bde
33 changed files with 102 additions and 63 deletions

View File

@ -11,7 +11,6 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.http.HttpMethod;
import java.io.InputStream;
import java.util.Map;
public class MsParser extends ApiImportAbstractParser {
@ -19,9 +18,7 @@ public class MsParser extends ApiImportAbstractParser {
public ApiImport parse(InputStream source, ApiTestImportRequest request) {
String testStr = getApiTestStr(source);
ApiImport apiImport = JSON.parseObject(parsePluginFormat(testStr), ApiImport.class);
apiImport.getScenarios().forEach(scenario -> {
setScenarioByRequest(scenario, request);
});
apiImport.getScenarios().forEach(scenario -> setScenarioByRequest(scenario, request));
return apiImport;
}
@ -45,9 +42,7 @@ public class MsParser extends ApiImportAbstractParser {
requestObject.put("type", RequestType.HTTP);
}
requestTmpObject.keySet().forEach(key -> {
requestObject.put(key, requestTmpObject.get(key));
});;
requestTmpObject.keySet().forEach(key -> requestObject.put(key, requestTmpObject.get(key)));
requestObject.put("name", requestName);
JSONArray bodies = requestObject.getJSONArray("body");
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) {

View File

@ -22,7 +22,7 @@ import java.util.Map;
public class PostmanParser extends ApiImportAbstractParser {
private static Map<String, String> postmanBodyRowMap;
private static final Map<String, String> postmanBodyRowMap;
static {
postmanBodyRowMap = new HashMap<>();

View File

@ -27,7 +27,7 @@ public class Swagger2Parser extends ApiImportAbstractParser {
@Override
public ApiImport parse(InputStream source, ApiTestImportRequest request) {
Swagger swagger = null;
Swagger swagger;
if (StringUtils.isNotBlank(request.getSwaggerUrl())) {
swagger = new SwaggerParser().read(request.getSwaggerUrl());
} else {
@ -35,9 +35,7 @@ public class Swagger2Parser extends ApiImportAbstractParser {
}
ApiImport apiImport = new ApiImport();
apiImport.setScenarios(parseRequests(swagger));
apiImport.getScenarios().forEach(scenario -> {
scenario.setEnvironmentId(request.getEnvironmentId());
});
apiImport.getScenarios().forEach(scenario -> scenario.setEnvironmentId(request.getEnvironmentId()));
return apiImport;
}
@ -45,7 +43,6 @@ public class Swagger2Parser extends ApiImportAbstractParser {
Map<String, Path> paths = swagger.getPaths();
Set<String> pathNames = paths.keySet();
Map<String, Scenario> scenarioMap = new HashMap<>();
List<Scenario> scenarios = new ArrayList<>();
for (String pathName : pathNames) {
Path path = paths.get(pathName);
Map<HttpMethod, Operation> operationMap = path.getOperationMap();
@ -78,8 +75,7 @@ public class Swagger2Parser extends ApiImportAbstractParser {
}
}
scenarios.addAll(scenarioMap.values());
return scenarios;
return new ArrayList<>(scenarioMap.values());
}
private void parseParameters(Operation operation, Map<String, Model> definitions, HttpRequest request) {

View File

@ -117,7 +117,7 @@ public class ShiroDBRealm extends AuthorizingRealm {
UserDTO user = userService.getLoginUser(userId, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name()));
String msg;
if (user == null) {
user = userService.getLoginUserByEmail(email, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name()));
user = userService.getUserDTOByEmail(email, UserSource.LDAP.name(), UserSource.LOCAL.name());
if (user == null) {
msg = "The user does not exist: " + userId;
logger.warn(msg);
@ -136,7 +136,7 @@ public class ShiroDBRealm extends AuthorizingRealm {
UserDTO user = userService.getLoginUser(userId, Collections.singletonList(UserSource.LOCAL.name()));
String msg;
if (user == null) {
user = userService.getLoginUserByEmail(userId, Collections.singletonList(UserSource.LOCAL.name()));
user = userService.getUserDTOByEmail(userId, UserSource.LOCAL.name());
if (user == null) {
msg = "The user does not exist: " + userId;
logger.warn(msg);

View File

@ -199,23 +199,21 @@ public class UserService {
return getUserDTO(userId);
}
public UserDTO getUserDTOByEmail(String email) {
public UserDTO getUserDTOByEmail(String email, String... source) {
UserExample example = new UserExample();
example.createCriteria().andEmailEqualTo(email);
List<User> users = userMapper.selectByExample(example);
if (users == null || users.size() <= 0) {
return null;
}
return getUserDTO(users.get(0).getId());
}
UserExample.Criteria criteria = example.createCriteria();
criteria.andEmailEqualTo(email);
if (!CollectionUtils.isEmpty(Arrays.asList(source))) {
criteria.andSourceIn(Arrays.asList(source));
}
public UserDTO getLoginUserByEmail(String email, List<String> list) {
UserExample example = new UserExample();
example.createCriteria().andEmailEqualTo(email).andSourceIn(list);
List<User> users = userMapper.selectByExample(example);
if (users == null || users.size() <= 0) {
return null;
}
return getUserDTO(users.get(0).getId());
}

View File

@ -3,7 +3,7 @@
<template v-slot:header>
<span class="title">{{$t('api_report.title')}}</span>
</template>
<el-table :data="tableData" class="table-content" @row-click="link">
<el-table border :data="tableData" class="adjust-table table-content" @row-click="link">
<el-table-column prop="name" :label="$t('commons.name')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">
<template v-slot:default="scope">

View File

@ -3,7 +3,7 @@
<template v-slot:header>
<span class="title">{{$t('commons.test')}}</span>
</template>
<el-table :data="tableData" class="table-content" @row-click="link">
<el-table border :data="tableData" class="adjust-table table-content" @row-click="link">
<el-table-column prop="name" :label="$t('commons.name')" width="150" show-overflow-tooltip/>
<el-table-column prop="projectName" :label="$t('load_test.project_name')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">

View File

@ -7,7 +7,7 @@
:title="$t('api_report.title')"
:show-create="false"/>
</template>
<el-table :data="tableData" class="table-content" @sort-change="sort"
<el-table border :data="tableData" class="adjust-table table-content" @sort-change="sort"
@filter-change="filter" @row-click="handleView">
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
</el-table-column>
@ -83,7 +83,8 @@
{text: 'Running', value: 'Running'},
{text: 'Reporting', value: 'Reporting'},
{text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'}
{text: 'Error', value: 'Error'},
{text: 'Success', value: 'Success'},
],
triggerFilters: [
{text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'},

View File

@ -1,9 +1,12 @@
<template>
<div>
<el-tag size="mini" type="primary" v-if="row.status === 'Starting'">
<el-tag size="mini" type="info" v-if="row.status === 'Starting'">
{{ row.status }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.status === 'Running'">
<el-tag size="mini" type="primary" effect="plain" v-else-if="row.status === 'Running'">
{{ row.status }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.status === 'Success'">
{{ row.status }}
</el-tag>
<el-tag size="mini" type="warning" v-else-if="row.status === 'Reporting'">

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="$t('api_report.title')" :visible.sync="reportVisible">
<el-table :data="tableData" v-loading="result.loading">
<el-table border class="adjust-table" :data="tableData" v-loading="result.loading">
<el-table-column :label="$t('commons.name')" width="150" show-overflow-tooltip>
<template v-slot:default="scope">
<el-link type="info" @click="link(scope.row)">{{ scope.row.name }}</el-link>

View File

@ -7,7 +7,7 @@
:title="$t('commons.test')"
@create="create" :createTip="$t('load_test.create')"/>
</template>
<el-table :data="tableData" class="table-content" @sort-change="sort" @row-click="handleView"
<el-table border :data="tableData" class="adjust-table table-content" @sort-change="sort" @row-click="handleView"
@filter-change="filter">
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip>
</el-table-column>

View File

@ -283,10 +283,20 @@ export class HttpRequest extends Request {
info: 'api_test.request.input_path'
}
}
} else if (!this.url) {
return {
isValid: false,
info: 'api_test.request.input_url'
} else {
if (!this.url) {
return {
isValid: false,
info: 'api_test.request.input_url'
}
}
try {
new URL(this.url)
} catch (e) {
return {
isValid: false,
info: 'api_test.request.url_invalid'
}
}
}
return {
@ -631,6 +641,9 @@ class JMXHttpRequest {
this.useEnvironment = request.useEnvironment;
this.method = request.method;
if (!request.useEnvironment) {
if (!request.url.startsWith("http://") && !request.url.startsWith("https://")) {
request.url = 'http://' + request.url;
}
let url = new URL(request.url);
this.hostname = decodeURIComponent(url.hostname);
this.pathname = decodeURIComponent(url.pathname);

View File

@ -3,7 +3,7 @@
<template v-slot:header>
<span class="title">{{$t('api_report.title')}}</span>
</template>
<el-table :data="tableData" class="table-content" @row-click="link">
<el-table border :data="tableData" class="adjust-table table-content" @row-click="link">
<el-table-column prop="name" :label="$t('commons.name')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">
<template v-slot:default="scope">

View File

@ -3,7 +3,7 @@
<template v-slot:header>
<span class="title">{{$t('commons.test')}}</span>
</template>
<el-table :data="tableData" class="table-content" @row-click="link">
<el-table border :data="tableData" class="adjust-table table-content" @row-click="link">
<el-table-column prop="name" :label="$t('commons.name')" width="150" show-overflow-tooltip/>
<el-table-column prop="projectName" :label="$t('load_test.project_name')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">

View File

@ -8,7 +8,7 @@
:show-create="false"/>
</template>
<el-table :data="tableData" class="test-content"
<el-table border :data="tableData" class="adjust-table test-content"
@sort-change="sort"
@filter-change="filter"
>

View File

@ -8,7 +8,7 @@
@create="create" :createTip="$t('load_test.create')"/>
</template>
<el-table :data="tableData" class="test-content"
<el-table border :data="tableData" class="adjust-table test-content"
@sort-change="sort"
@filter-change="filter"
@row-click="link"

View File

@ -6,7 +6,7 @@
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="title"/>
</template>
<el-table @row-click="link" :data="items" style="width: 100%" @sort-change="sort">
<el-table border class="adjust-table" @row-click="link" :data="items" style="width: 100%" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip/>
<el-table-column prop="description" :label="$t('commons.description')" show-overflow-tooltip/>
<!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>-->
@ -106,13 +106,7 @@
rules: {
name: [
{required: true, message: this.$t('project.input_name'), trigger: 'blur'},
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'},
{
required: true,
pattern: /^(?!-)(?!.*?-$)[a-zA-Z0-9\u4e00-\u9fa5-]+$/,
message: this.$t('project.special_characters_are_not_supported'),
trigger: 'blur'
}
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}
],
description: [
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}

View File

@ -5,7 +5,7 @@
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
</template>
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" :label="$t('commons.email')"/>

View File

@ -5,7 +5,7 @@
<ms-table-header :condition.sync="condition" @search="list" @create="create"
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
</template>
<el-table :data="items" style="width: 100%">
<el-table border class="adjust-table" :data="items" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')">

View File

@ -15,7 +15,7 @@
</div>
</template>
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="accessKey" label="Access Key"/>
<el-table-column prop="secretKey" label="Secret Key">
<template v-slot:default="scope">

View File

@ -10,7 +10,7 @@
</template>
<!--Personal information menu-->
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" :label="$t('commons.email')"/>

View File

@ -7,7 +7,7 @@
:create-tip="$t('organization.create')" :title="$t('commons.organization')"/>
</template>
<!-- system menu organization table-->
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')">
@ -31,7 +31,7 @@
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
<!-- organization member table -->
<el-table :data="memberLineData" style="width: 100%;margin-top:5px;">
<el-table :border="true" :data="memberLineData" style="width: 100%;margin-top:5px;">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" :label="$t('commons.email')"/>

View File

@ -6,7 +6,7 @@
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
</template>
<!-- workspace table -->
<el-table :data="items" style="width: 100%">
<el-table border class="adjust-table" :data="items" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>

View File

@ -5,7 +5,7 @@
<ms-table-header :condition.sync="condition" @search="search" @create="create"
:create-tip="$t('test_resource_pool.create_resource_pool')" :title="$t('commons.test_resource_pool')"/>
</template>
<el-table :data="items" style="width: 100%">
<el-table border class="adjust-table" :data="items" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column prop="type" :label="$t('test_resource_pool.type')">

View File

@ -7,7 +7,7 @@
:create-tip="$t('user.create')" :title="$t('commons.user')"/>
</template>
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.name')" width="200"/>
<el-table-column :label="$t('commons.role')" width="120">

View File

@ -5,7 +5,7 @@
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
</template>
<el-table :data="tableData" style="width: 100%">
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" :label="$t('commons.email')"/>

View File

@ -28,6 +28,7 @@
ref="testCaseImport"/>
<el-table
border
:data="tableData"
@sort-change="sort"
@filter-change="filter"
@ -35,7 +36,7 @@
@select="handleSelectionChange"
@row-click="showDetail"
row-key="id"
class="test-content">
class="test-content adjust-table">
<el-table-column
type="selection"/>
<el-table-column

View File

@ -1,6 +1,8 @@
<template>
<home-base-component :title="$t('test_track.home.my_plan')" v-loading>
<el-table
class="adjust-table"
border
:data="tableData"
@row-click="intoPlan"
v-loading="result.loading">

View File

@ -4,6 +4,8 @@
<el-table
row-key="id"
border
class="adjust-table"
@row-click="editTestCase"
:data="tableData"
v-loading="result.loading">

View File

@ -8,6 +8,8 @@
</template>
<el-table
border
class="adjust-table"
:data="tableData"
@filter-change="filter"
@sort-change="sort"

View File

@ -34,6 +34,8 @@
<status-edit ref="statusEdit" :plan-id="planId" :select-ids="selectIds" @refresh="initTableData"/>
<el-table
class="adjust-table"
border
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"

View File

@ -3,6 +3,8 @@
<common-component :title="$t('test_track.plan_view.test_result')">
<template>
<el-table
border
class="adjust-table"
:data="testResults"
stripe
style="width: 100%">

View File

@ -47,3 +47,31 @@ body {
width: 100%;
table-layout: fixed !important;
}
/* <-- 表格拖拽表头调整宽度,在 t-bable 上添加 border 属性,并添加 adjust-table 类名*/
.adjust-table td {
border-right-color: white;
}
.adjust-table th {
border-right-color: white;
}
.adjust-table {
border-color: white;
}
.adjust-table:after {
background-color: white;
}
.adjust-table th:hover:after {
content: '';
position: absolute;
top: 25%;
right: 0;
height: 50%;
width: 3px;
background-color: #EBEEF5;
}
/* 表格拖拽表头调整宽度 --> */