Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wenyann 2020-06-02 15:16:32 +08:00
commit 2bd46011ea
28 changed files with 238 additions and 119 deletions

View File

@ -15,7 +15,12 @@
and w.id = #{proRequest.workspaceId}
</if>
</where>
order by p.update_time desc
<if test="proRequest.orders != null and proRequest.orders.size() > 0">
order by
<foreach collection="proRequest.orders" separator="," item="order">
p.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getProjectIdByWorkspaceId" resultType="java.lang.String">
select id

View File

@ -3,9 +3,12 @@ package io.metersphere.controller.request;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class ProjectRequest {
private String workspaceId;
private String name;
private List<OrderRequest> orders;
}

View File

@ -10,6 +10,7 @@ import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.dto.ProjectDTO;
@ -81,6 +82,7 @@ public class ProjectService {
if (StringUtils.isNotBlank(request.getName())) {
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
}
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extProjectMapper.getProjectWithWorkspace(request);
}

View File

@ -1,17 +1,17 @@
<template>
<div>
<el-radio-group v-model="body.type" size="mini">
<el-radio-button :label="type.KV">
<el-radio-button :disabled="isReadOnly" :label="type.KV">
{{$t('api_test.request.body_kv')}}
</el-radio-button>
<el-radio-button :label="type.RAW">
<el-radio-button :disabled="isReadOnly" :label="type.RAW">
{{$t('api_test.request.body_text')}}
</el-radio-button>
</el-radio-group>
<ms-api-key-value :items="body.kvs" v-if="body.isKV()"/>
<ms-api-key-value :is-read-only="isReadOnly" :items="body.kvs" v-if="body.isKV()"/>
<el-input class="textarea" type="textarea" v-model="body.raw" :autosize="{ minRows: 10, maxRows: 25}" resize="none"
<el-input :disabled="isReadOnly" class="textarea" type="textarea" v-model="body.raw" :autosize="{ minRows: 10, maxRows: 25}" resize="none"
v-else/>
</div>
</template>
@ -24,7 +24,11 @@
name: "MsApiBody",
components: {MsApiKeyValue},
props: {
body: Body
body: Body,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -6,16 +6,16 @@
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-model="item.name" size="small" maxlength="100" @change="change"
<el-input :disabled="isReadOnly" v-model="item.name" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.key')" show-word-limit/>
</el-col>
<el-col>
<el-input v-model="item.value" size="small" maxlength="100" @change="change"
<el-input :disabled="isReadOnly" v-model="item.value" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.value')" show-word-limit/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index)"/>
:disabled="isDisable(index) || isReadOnly"/>
</el-col>
</el-row>
</div>
@ -30,7 +30,11 @@
props: {
description: String,
items: Array
items: Array,
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -14,10 +14,10 @@
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link el-icon-more"/>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type: 'copy', index: index}">
<el-dropdown-item :disabled="isReadOnly" :command="{type: 'copy', index: index}">
{{$t('api_test.request.copy')}}
</el-dropdown-item>
<el-dropdown-item :command="{type: 'delete', index: index}">
<el-dropdown-item :disabled="isReadOnly" :command="{type: 'delete', index: index}">
{{$t('api_test.request.delete')}}
</el-dropdown-item>
</el-dropdown-menu>
@ -26,7 +26,7 @@
</el-row>
</div>
</draggable>
<el-button class="request-create" type="primary" size="mini" icon="el-icon-plus" plain @click="createRequest"/>
<el-button :disabled="isReadOnly" class="request-create" type="primary" size="mini" icon="el-icon-plus" plain @click="createRequest"/>
</div>
</template>
@ -41,7 +41,11 @@
props: {
requests: Array,
open: Function
open: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -1,13 +1,13 @@
<template>
<el-form :model="request" :rules="rules" ref="request" label-width="100px">
<el-form-item :label="$t('api_test.request.name')" prop="name">
<el-input v-model="request.name" maxlength="100" show-word-limit/>
<el-input :disabled="isReadOnly" v-model="request.name" maxlength="100" show-word-limit/>
</el-form-item>
<el-form-item :label="$t('api_test.request.url')" prop="url">
<el-input v-model="request.url" maxlength="100" :placeholder="$t('api_test.request.url_description')"
<el-input :disabled="isReadOnly" v-model="request.url" maxlength="100" :placeholder="$t('api_test.request.url_description')"
@change="urlChange" clearable>
<el-select v-model="request.method" slot="prepend" class="request-method-select" @change="methodChange">
<el-select :disabled="isReadOnly" v-model="request.method" slot="prepend" class="request-method-select" @change="methodChange">
<el-option label="GET" value="GET"/>
<el-option label="POST" value="POST"/>
<el-option label="PUT" value="PUT"/>
@ -22,20 +22,20 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.request.parameters')" name="parameters">
<ms-api-key-value :items="request.parameters" :description="$t('api_test.request.parameters_desc')"
<ms-api-key-value :is-read-only="isReadOnly" :items="request.parameters" :description="$t('api_test.request.parameters_desc')"
@change="parametersChange"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.headers')" name="headers">
<ms-api-key-value :items="request.headers"/>
<ms-api-key-value :is-read-only="isReadOnly" :items="request.headers"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.body')" name="body" v-if="isNotGet">
<ms-api-body :body="request.body"/>
<ms-api-body :is-read-only="isReadOnly" :body="request.body"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.assertions.label')" name="assertions">
<ms-api-assertions :assertions="request.assertions"/>
<ms-api-assertions :is-read-only="isReadOnly" :assertions="request.assertions"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
<ms-api-extract :extract="request.extract"/>
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
</el-tab-pane>
</el-tabs>
</el-form>
@ -52,7 +52,11 @@
name: "MsApiRequestForm",
components: {MsApiExtract, MsApiAssertions, MsApiBody, MsApiKeyValue},
props: {
request: Request
request: Request,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -16,27 +16,27 @@
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link el-icon-more scenario-btn"/>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type: 'copy', index: index}">
<el-dropdown-item :disabled="isReadOnly" :command="{type: 'copy', index: index}">
{{$t('api_test.scenario.copy')}}
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete', index:index}">
<el-dropdown-item :disabled="isReadOnly" :command="{type:'delete', index:index}">
{{$t('api_test.scenario.delete')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
<ms-api-request-config :requests="scenario.requests" :open="select"/>
<ms-api-request-config :is-read-only="isReadOnly" :requests="scenario.requests" :open="select"/>
</ms-api-collapse-item>
</draggable>
</ms-api-collapse>
</div>
<el-button class="scenario-create" type="primary" size="mini" icon="el-icon-plus" plain @click="createScenario"/>
<el-button :disabled="isReadOnly" class="scenario-create" type="primary" size="mini" icon="el-icon-plus" plain @click="createScenario"/>
</el-aside>
<el-main class="scenario-main">
<div class="scenario-form">
<ms-api-scenario-form :scenario="selected" v-if="isScenario"/>
<ms-api-request-form :request="selected" v-if="isRequest"/>
<ms-api-scenario-form :is-read-only="isReadOnly" :scenario="selected" v-if="isScenario"/>
<ms-api-request-form :is-read-only="isReadOnly" :request="selected" v-if="isRequest"/>
</div>
</el-main>
</el-container>
@ -65,7 +65,11 @@
},
props: {
scenarios: Array
scenarios: Array,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -1,7 +1,7 @@
<template>
<el-form :model="scenario" :rules="rules" ref="scenario" label-width="100px">
<el-form-item :label="$t('api_test.scenario.name')" prop="name">
<el-input v-model="scenario.name" maxlength="100" show-word-limit/>
<el-input :disabled="isReadOnly" v-model="scenario.name" maxlength="100" show-word-limit/>
</el-form-item>
<!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">-->
@ -10,10 +10,10 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters">
<ms-api-scenario-variables :items="scenario.variables" :description="$t('api_test.scenario.kv_description')"/>
<ms-api-scenario-variables :is-read-only="isReadOnly" :items="scenario.variables" :description="$t('api_test.scenario.kv_description')"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
<ms-api-key-value :items="scenario.headers" :description="$t('api_test.scenario.kv_description')"/>
<ms-api-key-value :is-read-only="isReadOnly" :items="scenario.headers" :description="$t('api_test.scenario.kv_description')"/>
</el-tab-pane>
</el-tabs>
</el-form>
@ -28,7 +28,11 @@
name: "MsApiScenarioForm",
components: {MsApiScenarioVariables, MsApiKeyValue},
props: {
scenario: Scenario
scenario: Scenario,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -6,16 +6,16 @@
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<ms-api-variable-input v-model="item.name" size="small" maxlength="100" @change="change"
<ms-api-variable-input :is-read-only="isReadOnly" v-model="item.name" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.variable_name')" show-word-limit/>
</el-col>
<el-col>
<el-input v-model="item.value" size="small" maxlength="100" @change="change"
<el-input :disabled="isReadOnly" v-model="item.value" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.value')" show-word-limit/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index)"/>
:disabled="isDisable(index) || isReadOnly"/>
</el-col>
</el-row>
</div>
@ -31,7 +31,11 @@
components: {MsApiVariableInput},
props: {
description: String,
items: Array
items: Array,
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -1,6 +1,6 @@
<template>
<div class="variable-input">
<el-input :value="value" v-bind="$attrs" :size="size" @change="change" @input="input"/>
<el-input :disabled="isReadOnly" :value="value" v-bind="$attrs" :size="size" @change="change" @input="input"/>
<div class="variable-combine" v-if="value">
<div class="variable">{{variable}}</div>
<el-tooltip :content="$t('api_test.copied')" manual v-model="visible" placement="top" :visible-arrow="false">
@ -14,7 +14,14 @@
export default {
name: "MsApiVariableInput",
props: ['value', 'size'],
props: {
value: String,
size: String,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {

View File

@ -2,7 +2,7 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col class="assertion-select">
<el-select class="assertion-item" v-model="regex.subject" size="small"
<el-select :disabled="isReadOnly" class="assertion-item" v-model="regex.subject" size="small"
:placeholder="$t('api_test.request.assertions.select_subject')">
<el-option label="Response Code" :value="subjects.RESPONSE_CODE"/>
<el-option label="Response Headers" :value="subjects.RESPONSE_HEADERS"/>
@ -10,12 +10,12 @@
</el-select>
</el-col>
<el-col>
<el-input v-model="regex.expression" maxlength="255" size="small" show-word-limit
<el-input :disabled="isReadOnly" v-model="regex.expression" maxlength="255" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.expression')"/>
</el-col>
<el-col class="assertion-btn">
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
</el-col>
</el-row>
</div>
@ -40,7 +40,11 @@
},
index: Number,
list: Array,
callback: Function
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -2,12 +2,12 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col>
<el-input :value="value" v-bind="$attrs" step="100" size="small" type="number" @change="change" @input="input"
<el-input :disabled="isReadOnly" :value="value" v-bind="$attrs" step="100" size="small" type="number" @change="change" @input="input"
:placeholder="$t('api_test.request.assertions.response_in_time')"/>
</el-col>
<el-col class="assertion-btn">
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
</el-col>
</el-row>
</div>
@ -24,7 +24,11 @@
duration: ResponseTime,
value: [Number, String],
edit: Boolean,
callback: Function
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -2,7 +2,7 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col class="assertion-select">
<el-select class="assertion-item" v-model="subject" size="small"
<el-select :disabled="isReadOnly" class="assertion-item" v-model="subject" size="small"
:placeholder="$t('api_test.request.assertions.select_subject')">
<el-option label="Response Code" :value="subjects.RESPONSE_CODE"/>
<el-option label="Response Headers" :value="subjects.RESPONSE_HEADERS"/>
@ -10,7 +10,7 @@
</el-select>
</el-col>
<el-col class="assertion-select">
<el-select class="assertion-item" v-model="condition" size="small"
<el-select :disabled="isReadOnly" class="assertion-item" v-model="condition" size="small"
:placeholder="$t('api_test.request.assertions.select_condition')">
<el-option :label="$t('api_test.request.assertions.contains')" value="CONTAINS"/>
<el-option :label="$t('api_test.request.assertions.not_contains')" value="NOT_CONTAINS"/>
@ -20,11 +20,11 @@
</el-select>
</el-col>
<el-col>
<el-input v-model="value" maxlength="200" size="small" show-word-limit
<el-input :disabled="isReadOnly" v-model="value" maxlength="200" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.value')"/>
</el-col>
<el-col class="assertion-btn">
<el-button type="primary" size="small" icon="el-icon-plus" plain @click="add"/>
<el-button :disabled="isReadOnly" type="primary" size="small" icon="el-icon-plus" plain @click="add"/>
</el-col>
</el-row>
</div>
@ -38,7 +38,11 @@
props: {
list: Array,
callback: Function
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -2,7 +2,7 @@
<div>
<el-row :gutter="10">
<el-col :span="4">
<el-select class="assertion-item" v-model="type" :placeholder="$t('api_test.request.assertions.select_type')"
<el-select :disabled="isReadOnly" class="assertion-item" v-model="type" :placeholder="$t('api_test.request.assertions.select_type')"
size="small">
<el-option :label="$t('api_test.request.assertions.text')" :value="options.TEXT"/>
<el-option :label="$t('api_test.request.assertions.regex')" :value="options.REGEX"/>
@ -10,14 +10,14 @@
</el-select>
</el-col>
<el-col :span="20">
<ms-api-assertion-text :list="assertions.regex" v-if="type === options.TEXT" :callback="after"/>
<ms-api-assertion-regex :list="assertions.regex" v-if="type === options.REGEX" :callback="after"/>
<ms-api-assertion-response-time v-model="time" :duration="assertions.duration"
<ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT" :callback="after"/>
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX" :callback="after"/>
<ms-api-assertion-response-time :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration"
v-if="type === options.RESPONSE_TIME" :callback="after"/>
</el-col>
</el-row>
<ms-api-assertions-edit :assertions="assertions"/>
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions"/>
</div>
</template>
@ -34,7 +34,11 @@
components: {MsApiAssertionsEdit, MsApiAssertionResponseTime, MsApiAssertionRegex, MsApiAssertionText},
props: {
assertions: Assertions
assertions: Assertions,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -5,7 +5,7 @@
{{$t("api_test.request.assertions.regex")}}
</div>
<div class="regex-item" v-for="(regex, index) in assertions.regex" :key="index">
<ms-api-assertion-regex :list="assertions.regex" :regex="regex" :edit="true" :index="index"/>
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" :regex="regex" :edit="true" :index="index"/>
</div>
</div>
@ -13,7 +13,7 @@
<div>
{{$t("api_test.request.assertions.response_time")}}
</div>
<ms-api-assertion-response-time v-model="assertions.duration.value" :duration="assertions.duration" :edit="true"/>
<ms-api-assertion-response-time :is-read-only="isReadOnly" v-model="assertions.duration.value" :duration="assertions.duration" :edit="true"/>
</div>
</div>
@ -30,7 +30,11 @@
components: {MsApiAssertionResponseTime, MsApiAssertionRegex},
props: {
assertions: Assertions
assertions: Assertions,
isReadOnly: {
type: Boolean,
default: false
}
},
computed: {

View File

@ -5,7 +5,7 @@
</div>
<el-row :gutter="10">
<el-col :span="4">
<el-select class="extract-item" v-model="type" :placeholder="$t('api_test.request.extract.select_type')"
<el-select :disabled="isReadOnly" class="extract-item" v-model="type" :placeholder="$t('api_test.request.extract.select_type')"
size="small">
<el-option :label="$t('api_test.request.extract.regex')" :value="options.REGEX"/>
<el-option label="JSONPath" :value="options.JSON_PATH"/>
@ -13,11 +13,11 @@
</el-select>
</el-col>
<el-col :span="20">
<ms-api-extract-common :extract-type="type" :list="list" v-if="type" :callback="after"/>
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type" :list="list" v-if="type" :callback="after"/>
</el-col>
</el-row>
<ms-api-extract-edit :extract="extract"/>
<ms-api-extract-edit :is-read-only="isReadOnly" :extract="extract"/>
</div>
</template>
@ -35,7 +35,11 @@
},
props: {
extract: Extract
extract: Extract,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -2,15 +2,15 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col :span="10">
<ms-api-variable-input v-model="common.variable" size="small" maxlength="60" @change="change"
<ms-api-variable-input :is-read-only="isReadOnly" v-model="common.variable" size="small" maxlength="60" @change="change"
:placeholder="$t('api_test.variable_name')"/>
</el-col>
<el-col>
<el-input v-model="common.expression" maxlength="255" size="small" :placeholder="expression"/>
<el-input :disabled="isReadOnly" v-model="common.expression" maxlength="255" size="small" :placeholder="expression"/>
</el-col>
<el-col class="extract-btn">
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
</el-col>
</el-row>
</div>
@ -42,7 +42,11 @@
},
index: Number,
list: Array,
callback: Function
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -5,7 +5,7 @@
{{$t("api_test.request.extract.regex")}}
</div>
<div class="regex-item" v-for="(regex, index) in extract.regex" :key="index">
<ms-api-extract-common :extract-type="type.REGEX" :list="extract.regex" :common="regex"
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type.REGEX" :list="extract.regex" :common="regex"
:edit="true" :index="index"/>
</div>
</div>
@ -15,7 +15,7 @@
JSONPath
</div>
<div class="regex-item" v-for="(json, index) in extract.json" :key="index">
<ms-api-extract-common :extract-type="type.JSON_PATH" :list="extract.json" :common="json"
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type.JSON_PATH" :list="extract.json" :common="json"
:edit="true" :index="index"/>
</div>
</div>
@ -25,7 +25,7 @@
XPath
</div>
<div class="regex-item" v-for="(xpath, index) in extract.xpath" :key="index">
<ms-api-extract-common :extract-type="type.XPATH" :list="extract.xpath" :common="xpath"
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type.XPATH" :list="extract.xpath" :common="xpath"
:edit="true" :index="index"/>
</div>
</div>
@ -43,7 +43,11 @@
components: {MsApiExtractCommon},
props: {
extract: Extract
extract: Extract,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {

View File

@ -16,11 +16,6 @@
export default {
name: "MsTableOperatorButton",
components: {MsTipButton, MsTableButton},
data() {
return{
disabled: false
}
},
props: {
icon: {
type: String,
@ -33,6 +28,10 @@
tip: {
type: String
},
disabled: {
type: Boolean,
default: false
},
isTesterPermission: {
type: Boolean,
default: false

View File

@ -4,7 +4,7 @@
<el-row type="flex" justify="start">
<el-col :span="8">
<h3>{{$t('load_test.domain_bind')}}</h3>
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('domains')">{{$t('commons.add')}}
<el-button :disabled="readOnly" icon="el-icon-circle-plus-outline" plain size="mini" @click="add('domains')">{{$t('commons.add')}}
</el-button>
</el-col>
</el-row>
@ -19,7 +19,7 @@
<template v-slot:default="{row}">
<el-input
size="mini"
v-if="readOnly"
v-if="!readOnly"
type="textarea"
:rows="1"
class="edit-input"
@ -36,7 +36,7 @@
show-overflow-tooltip>
<template v-slot:default="{row}">
<el-switch
:disabled="!row.edit"
:disabled="!row.edit || readOnly"
size="mini"
v-model="row.enable"
active-color="#13ce66"
@ -54,7 +54,7 @@
<template v-slot:default="{row}">
<el-input
size="mini"
v-if="readOnly"
v-if="!readOnly"
type="textarea"
class="edit-input"
:rows="1"
@ -66,7 +66,7 @@
</el-table-column>
<el-table-column align="center" :label="$t('load_test.operating')">
<template v-slot:default="{row, $index}">
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" type="danger"
<ms-table-operator-button :disabled="readOnly" :tip="$t('commons.delete')" icon="el-icon-delete" type="danger"
@exec="del(row, 'domains', $index)"/>
</template>
</el-table-column>
@ -77,7 +77,7 @@
<el-row>
<el-col :span="8">
<h3>{{$t('load_test.params')}}</h3>
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('params')">{{$t('commons.add')}}
<el-button :disabled="readOnly" icon="el-icon-circle-plus-outline" plain size="mini" @click="add('params')">{{$t('commons.add')}}
</el-button>
</el-col>
</el-row>
@ -92,7 +92,7 @@
<template v-slot:default="{row}">
<el-input
size="mini"
v-if="readOnly"
v-if="!readOnly"
type="textarea"
:rows="1"
class="edit-input"
@ -109,7 +109,7 @@
show-overflow-tooltip>
<template v-slot:default="{row}">
<el-switch
:disabled="!row.edit"
:disabled="!row.edit || readOnly"
size="mini"
v-model="row.enable"
active-color="#13ce66"
@ -127,7 +127,7 @@
<span v-else>{{ row.value }}</span>-->
<el-input
size="mini"
v-if="readOnly"
v-if="!readOnly"
type="textarea"
class="edit-input"
:rows="1"
@ -139,7 +139,7 @@
</el-table-column>
<el-table-column align="center" :label="$t('load_test.operating')">
<template v-slot:default="{row, $index}">
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" type="danger"
<ms-table-operator-button :disabled="readOnly" :tip="$t('commons.delete')" icon="el-icon-delete" type="danger"
@exec="del(row, 'params', $index)"/>
</template>
</el-table-column>
@ -154,7 +154,7 @@
<div>{{$t('load_test.connect_timeout')}}</div>
</el-form-item>
<el-form-item>
<el-input-number size="mini" v-model="timeout" :min="10" :max="100000"></el-input-number>
<el-input-number :disabled="readOnly" size="mini" v-model="timeout" :min="10" :max="100000"></el-input-number>
</el-form-item>
<el-form-item>
ms
@ -169,7 +169,7 @@
<div>{{$t('load_test.custom_http_code')}}</div>
</el-form-item>
<el-form-item>
<el-input size="mini" v-model="statusCodeStr" :placeholder="$t('load_test.separated_by_commas')"
<el-input :disabled="readOnly" size="mini" v-model="statusCodeStr" :placeholder="$t('load_test.separated_by_commas')"
@input="checkStatusCode"></el-input>
</el-form-item>
</el-form>
@ -196,7 +196,7 @@
props: {
readOnly: {
type: Boolean,
default: true
default: false
},
testId: String,
},

View File

@ -10,6 +10,7 @@
:before-upload="beforeUpload"
:http-request="handleUpload"
:on-exceed="handleExceed"
:disabled="isReadOnly"
:file-list="fileList">
<i class="el-icon-upload"/>
<div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div>
@ -41,9 +42,9 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="handleDownload(scope.row)" :disabled="!scope.row.id" type="primary" icon="el-icon-download"
<el-button @click="handleDownload(scope.row)" :disabled="!scope.row.id || isReadOnly" type="primary" icon="el-icon-download"
size="mini" circle/>
<el-button @click="handleDelete(scope.row, scope.$index)" type="danger" icon="el-icon-delete" size="mini"
<el-button :disabled="isReadOnly" @click="handleDelete(scope.row, scope.$index)" type="danger" icon="el-icon-delete" size="mini"
circle/>
</template>
</el-table-column>
@ -56,7 +57,15 @@
export default {
name: "PerformanceBasicConfig",
props: ["testPlan"],
props: {
testPlan: {
type: Object
},
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
result: {},

View File

@ -8,6 +8,7 @@
</el-form-item>
<el-form-item>
<el-input-number
:disabled="isReadOnly"
:placeholder="$t('load_test.input_thread_num')"
v-model="threadNumber"
@change="calculateChart"
@ -21,6 +22,7 @@
</el-form-item>
<el-form-item>
<el-input-number
:disabled="isReadOnly"
:placeholder="$t('load_test.duration')"
v-model="duration"
:min="1"
@ -35,6 +37,7 @@
</el-form-item>
<el-form-item>
<el-input-number
:disabled="isReadOnly"
:placeholder="$t('load_test.input_rps_limit')"
v-model="rpsLimit"
@change="calculateChart"
@ -50,6 +53,7 @@
</el-form-item>
<el-form-item>
<el-input-number
:disabled="isReadOnly"
placeholder=""
:min="1"
:max="duration"
@ -62,6 +66,7 @@
</el-form-item>
<el-form-item>
<el-input-number
:disabled="isReadOnly"
placeholder=""
:min="1"
:max="Math.min(threadNumber, rampUpTime)"
@ -78,7 +83,7 @@
<div>{{$t('load_test.select_resource_pool')}}</div>
</el-form-item>
<el-form-item>
<el-select v-model="resourcePool" size="mini">
<el-select v-model="resourcePool" :disabled="isReadOnly" size="mini">
<el-option
v-for="item in resourcePools"
:key="item.id"
@ -108,7 +113,18 @@
export default {
name: "PerformancePressureConfig",
props: ['testPlan','testId'],
props: {
testPlan: {
type: Object
},
testId: {
type: String
},
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
result: {},

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 :data="items" style="width: 100%">
<el-table :data="items" style="width: 100%" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')">
<template v-slot:default="scope">
<el-link type="info" @click="link(scope.row)">{{ scope.row.name }}</el-link>
@ -15,6 +15,8 @@
<el-table-column prop="description" :label="$t('commons.description')"/>
<!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>-->
<el-table-column
sortable
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
@ -22,6 +24,8 @@
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
@ -67,7 +71,7 @@
import MsTableHeader from "../common/components/MsTableHeader";
import MsTableOperator from "../common/components/MsTableOperator";
import MsDialogFooter from "../common/components/MsDialogFooter";
import {getCurrentUser} from "../../../common/js/utils";
import {_sort, getCurrentUser} from "../../../common/js/utils";
import MsContainer from "../common/components/MsContainer";
import MsMainContainer from "../common/components/MsMainContainer";
@ -228,7 +232,11 @@
path: '/api/test/list/' + row.id
})
}
}
},
sort(column) {
_sort(column, this.condition);
this.list();
},
}
}
</script>

View File

@ -91,11 +91,11 @@
<el-tabs v-model="activeTab" type="border-card" @tab-click="testTabChange">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
<api-test-detail v-if="testCase.type == 'api'" @runTest="testRun" :id="testCase.testId" ref="apiTestDetail"/>
<performance-test-detail v-if="testCase.type == 'performance'" @runTest="testRun" :id="testCase.testId" ref="performanceTestDetail"/>
<performance-test-detail :is-read-only="isReadOnly" v-if="testCase.type == 'performance'" @runTest="testRun" :id="testCase.testId" ref="performanceTestDetail"/>
</el-tab-pane>
<el-tab-pane name="result" :label="$t('test_track.plan_view.test_result')">
<api-test-result :report-id="testCase.reportId" v-if=" testCase.type == 'api'" ref="apiTestResult"/>
<performance-test-result :report-id="testCase.reportId" v-if="testCase.type == 'performance'" ref="performanceTestResult"/>
<performance-test-result :is-read-only="isReadOnly" :report-id="testCase.reportId" v-if="testCase.type == 'performance'" ref="performanceTestResult"/>
</el-tab-pane>
</el-tabs>
</el-col>

View File

@ -16,7 +16,7 @@
</el-row>
</el-header>
<ms-api-scenario-config :scenarios="test.scenarioDefinition" ref="config"/>
<ms-api-scenario-config :is-read-only="true" :scenarios="test.scenarioDefinition" ref="config"/>
</el-container>
</el-card>

View File

@ -13,19 +13,19 @@
</el-input>
</el-col>
<el-col :span="12" :offset="2">
<el-button type="primary" plain @click="runTest">执行</el-button>
<el-button :disabled="isReadOnly" type="primary" plain @click="runTest">执行</el-button>
</el-col>
</el-row>
<el-tabs class="test-config" v-model="active" type="border-card" :stretch="true">
<el-tab-pane :label="$t('load_test.basic_config')">
<performance-basic-config :test-plan="test" ref="basicConfig"/>
<performance-basic-config :is-read-only="true" :test-plan="test" ref="basicConfig"/>
</el-tab-pane>
<el-tab-pane :label="$t('load_test.pressure_config')">
<performance-pressure-config :test-plan="test" :test-id="id" ref="pressureConfig"/>
<performance-pressure-config :is-read-only="true" :test-plan="test" :test-id="id" ref="pressureConfig"/>
</el-tab-pane>
<el-tab-pane :label="$t('load_test.advanced_config')" class="advanced-config">
<performance-advanced-config :test-id="id" ref="advancedConfig"/>
<performance-advanced-config :read-only="true" :test-id="id" ref="advancedConfig"/>
</el-tab-pane>
</el-tabs>
</el-card>
@ -74,7 +74,13 @@
}]
}
},
props: ['id'],
props: {
id: String,
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {
init() {
this.getTest();

View File

@ -13,12 +13,12 @@
<el-breadcrumb-item>{{reportName}}</el-breadcrumb-item>
</el-breadcrumb>
</el-row>
<el-row class="ms-report-view-btns">
<el-button type="primary" plain size="mini">{{$t('report.test_stop_now')}}</el-button>
<el-button type="success" plain size="mini">{{$t('report.test_execute_again')}}</el-button>
<el-button type="info" plain size="mini">{{$t('report.export')}}</el-button>
<el-button type="warning" plain size="mini">{{$t('report.compare')}}</el-button>
</el-row>
<!--<el-row class="ms-report-view-btns">-->
<!--<el-button :disabled="isReadOnly" type="primary" plain size="mini">{{$t('report.test_stop_now')}}</el-button>-->
<!--<el-button :disabled="isReadOnly" type="success" plain size="mini">{{$t('report.test_execute_again')}}</el-button>-->
<!--<el-button :disabled="isReadOnly" type="info" plain size="mini">{{$t('report.export')}}</el-button>-->
<!--<el-button :disabled="isReadOnly" type="warning" plain size="mini">{{$t('report.compare')}}</el-button>-->
<!--</el-row>-->
</el-col>
<el-col :span="8">
<span class="ms-report-time-desc">
@ -91,7 +91,13 @@
report: {}
}
},
props: ['reportId'],
props: {
reportId: String,
isReadOnly: {
type: Boolean,
default: false
},
},
mounted() {
this.init();
},
@ -177,7 +183,6 @@
this.$set(this.report, "id", this.reportId);
this.$set(this.report, "status", data.status);
// this.checkReportStatus(data.status);
if (this.status === "Completed") {
this.result = this.$get("/performance/report/content/report_time/" + this.reportId).then(res => {
let data = res.data.data;
@ -205,7 +210,6 @@
this.status = data.status;
this.$set(this.report, "id", this.reportId);
this.$set(this.report, "status", data.status);
// this.checkReportStatus(data.status);
if (this.status === "Completed") {
this.initReportTimeInfo();
}