Merge branch 'master' of https://github.com/metersphere/metersphere
# Conflicts: # frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue
This commit is contained in:
commit
14a54cabcc
|
@ -13,11 +13,11 @@
|
|||
<slot name="headerLeft">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
|
||||
@click="active(request)"/>
|
||||
<el-input draggable v-if="isShowInput || !request.name" size="small" v-model="request.name" class="name-input"
|
||||
<el-input v-if="(isShowInput || !request.name) && !isDeletedOrRef" size="small" v-model="request.name" class="name-input"
|
||||
@blur="isShowInput = false" :placeholder="$t('commons.input_name')"/>
|
||||
<span v-else>
|
||||
{{request.name}}
|
||||
<i :class="{'edit-disable' : isDeletedOrRef}" class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester/>
|
||||
<i v-if="!isDeletedOrRef" class="el-icon-edit" style="cursor:pointer" @click="isShowInput = true" v-tester/>
|
||||
</span>
|
||||
</slot>
|
||||
|
||||
|
@ -60,84 +60,6 @@
|
|||
@runRefresh="runRefresh" ref="runTest"/>
|
||||
|
||||
</api-base-component>
|
||||
|
||||
<!--<div v-loading="loading" @click="active(request)">-->
|
||||
<!--<el-card>-->
|
||||
<!--<el-row>-->
|
||||
<!--<!–<div class="el-step__icon is-text ms-api-col" v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'">–>-->
|
||||
<!--<!–<div class="el-step__icon-inner">{{request.index}}</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="el-step__icon is-text ms-api-col-ot-import" v-else-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'">–>-->
|
||||
<!--<!–<div class="el-step__icon-inner">{{request.index}}</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="el-step__icon is-text ms-api-col-create" v-else>–>-->
|
||||
<!--<!–<div class="el-step__icon-inner">{{request.index}}</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
|
||||
<!--<!–<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'" class="ms-left-button" size="small">–>-->
|
||||
<!--<!–{{$t('api_test.automation.api_list_import')}}–>-->
|
||||
<!--<!–</el-button>–>-->
|
||||
|
||||
<!--<!–<el-button v-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'" class="ms-api-col-ot-import-button" size="small">–>-->
|
||||
<!--<!–{{$t('api_test.automation.external_import')}}–>-->
|
||||
<!--<!–</el-button>–>-->
|
||||
|
||||
<!--<!–<el-button v-if="request.referenced==undefined || request.referenced==='Created' " class="ms-create-button" size="small">–>-->
|
||||
<!--<!–{{$t('api_test.automation.customize_req')}}–>-->
|
||||
<!--<!–</el-button>–>-->
|
||||
|
||||
<!--<span v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF'">{{request.name}} </span>-->
|
||||
<!--<el-input size="small" v-model="request.name" style="width: 40%;" :placeholder="$t('commons.input_name')" v-else/>-->
|
||||
|
||||
<!--<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>-->
|
||||
<!--<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced==='Copy'">{{ $t('commons.copy') }}</el-tag>-->
|
||||
<!--<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced ==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>-->
|
||||
|
||||
<!--<div style="margin-right: 20px; float: right">-->
|
||||
<!--<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"-->
|
||||
<!--@click="active(request)"/>-->
|
||||
<!--<el-switch v-model="request.enable" style="margin-left: 10px"/>-->
|
||||
<!--<el-button @click="run" :tip="$t('api_test.run')" icon="el-icon-video-play"-->
|
||||
<!--style="background-color: #409EFF;color: white;margin-left: 10px" size="mini" circle/>-->
|
||||
<!--<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>-->
|
||||
<!--<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>-->
|
||||
<!--</div>-->
|
||||
<!--</el-row>-->
|
||||
<!--<!–<!– 请求参数–>–>-->
|
||||
<!--<!–<el-collapse-transition>–>-->
|
||||
<!--<!–<div v-if="request.active">–>-->
|
||||
<!--<!–<div v-if="request.protocol === 'HTTP'">–>-->
|
||||
<!--<!–<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-if="request.url" v-model="request.url" style="width: 85%;margin-top: 10px" size="small">–>-->
|
||||
<!--<!–<el-select v-model="request.method" slot="prepend" style="width: 100px" size="small">–>-->
|
||||
<!--<!–<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>–>-->
|
||||
<!--<!–</el-select>–>-->
|
||||
<!--<!–</el-input>–>-->
|
||||
<!--<!–<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-else v-model="request.path" style="width: 85%;margin-top: 10px" size="small">–>-->
|
||||
<!--<!–<el-select v-model="request.method" slot="prepend" style="width: 100px" size="small">–>-->
|
||||
<!--<!–<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>–>-->
|
||||
<!--<!–</el-select>–>-->
|
||||
<!--<!–</el-input>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>–>-->
|
||||
<!--<!–<ms-api-request-form :referenced="true" :headers="request.headers " :request="request" v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"/>–>-->
|
||||
<!--<!–<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'|| request.type==='TCPSampler'"/>–>-->
|
||||
<!--<!–<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'" :showScript="false"/>–>-->
|
||||
<!--<!–<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/>–>-->
|
||||
|
||||
<!--<!–<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>–>-->
|
||||
<!--<!–<ms-request-result-tail :currentProtocol="request.protocol" :response="request.requestResult" ref="runResult"/>–>-->
|
||||
|
||||
<!--<!–<!– 保存操作 –>–>-->
|
||||
<!--<!–<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">–>-->
|
||||
<!--<!–{{$t('commons.save')}}–>-->
|
||||
<!--<!–</el-button>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–</el-collapse-transition>–>-->
|
||||
<!--</el-card>-->
|
||||
<!--<!– 执行组件 –>-->
|
||||
<!--<!–<ms-run :debug="false" :reportId="reportId" :run-data="runData"–>-->
|
||||
<!--<!–@runRefresh="runRefresh" ref="runTest"/>–>-->
|
||||
<!--</div>-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -250,12 +172,6 @@
|
|||
copyRow() {
|
||||
this.$emit('copyRow', this.request, this.node);
|
||||
},
|
||||
editName() {
|
||||
if (this.isDeletedOrRef) {
|
||||
return;
|
||||
}
|
||||
this.isShowInput = true;
|
||||
},
|
||||
getApiInfo() {
|
||||
if (this.request.id && this.request.referenced === 'REF') {
|
||||
let requestResult = this.request.requestResult;
|
||||
|
@ -359,7 +275,4 @@
|
|||
.icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.edit-disable {
|
||||
color: #808080;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<div class="el-step__icon is-text ms-api-col">
|
||||
<div class="el-step__icon-inner">{{scenario.index}}</div>
|
||||
</div>
|
||||
<el-button class="ms-title-buttion" size="small">{{$t('api_test.automation.scenario_import')}}</el-button>
|
||||
{{scenario.name}}
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Copy'">{{ $t('commons.copy') }}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<el-switch v-model="scenario.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
<api-base-component
|
||||
v-loading="loading"
|
||||
@copy="copyRow"
|
||||
@remove="remove"
|
||||
:data="scenario"
|
||||
:show-collapse="false"
|
||||
color="#606266"
|
||||
background-color="#F4F4F5"
|
||||
:title="$t('api_test.automation.scenario_import')">
|
||||
|
||||
<template v-slot:headerLeft>
|
||||
<slot name="headerLeft">
|
||||
<el-input v-if="(isShowInput || !scenario.name) && !isDeletedOrRef" size="small" v-model="scenario.name" class="name-input"
|
||||
@blur="isShowInput = false" :placeholder="$t('commons.input_name')"/>
|
||||
<span v-else>
|
||||
{{scenario.name}}
|
||||
<i v-if="!isDeletedOrRef" class="el-icon-edit" style="cursor:pointer" @click="isShowInput = true" v-tester/>
|
||||
</span>
|
||||
</slot>
|
||||
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Copy'">{{ $t('commons.copy') }}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||
</template>
|
||||
|
||||
</api-base-component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -25,6 +32,7 @@
|
|||
import MsTcpBasisParameters from "../../definition/components/request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../definition/components/request/http/ApiRequestForm";
|
||||
import ApiBaseComponent from "./common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "ApiScenarioComponent",
|
||||
|
@ -45,9 +53,20 @@
|
|||
})
|
||||
}
|
||||
},
|
||||
components: {MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm},
|
||||
components: {ApiBaseComponent, MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm},
|
||||
data() {
|
||||
return {loading: false}
|
||||
return {
|
||||
loading: false,
|
||||
isShowInput: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isDeletedOrRef() {
|
||||
if (this.scenario.referenced!= undefined && this.scenario.referenced === 'Deleted' || this.scenario.referenced === 'REF') {
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove() {
|
||||
|
@ -71,23 +90,11 @@
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-api-col {
|
||||
background-color: #F4F4F5;
|
||||
border-color: #606266;
|
||||
margin-right: 10px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.ms-title-buttion {
|
||||
background-color: #F4F4F5;
|
||||
margin-right: 20px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
|
|
@ -155,18 +155,15 @@
|
|||
<!--等待控制器-->
|
||||
<ms-constant-timer :timer="data" :node="node" v-if="data.type==='ConstantTimer'" @remove="remove" @copyRow="copyRow"/>
|
||||
<!--自定义脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.automation.customize_script')"
|
||||
style-type="color: #7B4D12;background-color: #F1EEE9" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.automation.customize_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--前置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"
|
||||
style-type="color: #B8741A;background-color: #F9F1EA" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.post_script')"
|
||||
style-type="color: #783887;background-color: #F2ECF3" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.post_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions :draggable="true" @suggestClick="suggestClick(node)" :response="response" v-if="data.type==='Assertions'" @remove="remove" @copyRow="copyRow" customizeStyle="margin-top: 0px" :assertions="data" :node="node"/>
|
||||
<ms-api-assertions :draggable="true" @suggestClick="suggestClick(node)" :response="response" v-if="data.type==='Assertions'" @remove="remove" @copyRow="copyRow" :assertions="data" :node="node"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :draggable="true" @suggestClick="suggestClick(node)" :response="response" @remove="remove" @copyRow="copyRow" v-if="data.type==='Extract'" customizeStyle="margin-top: 0px" :extract="data" :node="node"/>
|
||||
<ms-api-extract :draggable="true" @suggestClick="suggestClick(node)" :response="response" @remove="remove" @copyRow="copyRow" v-if="data.type==='Extract'" :extract="data" :node="node"/>
|
||||
<!--API 导入 -->
|
||||
<ms-api-component :request="data" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" @remove="remove" @copyRow="copyRow"
|
||||
v-if="data.type==='HTTPSamplerProxy'||data.type==='DubboSampler'||data.type==='JDBCSampler'||data.type==='TCPSampler'" :node="node"/>
|
||||
|
|
|
@ -139,9 +139,6 @@
|
|||
languageChange(language) {
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
},
|
||||
changeActive() {
|
||||
this.jsr223ProcessorData.active = !this.jsr223ProcessorData.active;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-card>
|
||||
<el-card class="api-component">
|
||||
<div class="header" @click="active(data)">
|
||||
|
||||
<div v-if="data.index" class="el-step__icon is-text" style="margin-right: 10px;" :style="{'color': color, 'background-color': backgroundColor}">
|
||||
|
@ -75,7 +75,7 @@
|
|||
},
|
||||
methods: {
|
||||
active() {
|
||||
this.data.active = !this.data.active;
|
||||
this.$set(this.data, 'active', !this.data.active);
|
||||
this.$emit('active');
|
||||
},
|
||||
copyRow() {
|
||||
|
|
|
@ -403,4 +403,8 @@ export default {
|
|||
border-top: none;
|
||||
}
|
||||
|
||||
/deep/ .api-component {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -56,12 +56,12 @@
|
|||
|
||||
<script>
|
||||
import {AssertionJSR223} from "../../model/ApiTestModel";
|
||||
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiAssertionJsr223",
|
||||
components: {MsDialogFooter, MsJsr233Processor},
|
||||
components: {MsJsr233Processor, MsDialogFooter},
|
||||
props: {
|
||||
assertion: {
|
||||
default: () => {
|
||||
|
|
|
@ -112,13 +112,13 @@ import MsApiRequestForm from "../request/http/ApiRequestForm";
|
|||
import MsResponseText from "../response/ResponseText";
|
||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
||||
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import {KeyValue} from "../../model/ApiTestModel";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsAddCompleteHttpApi",
|
||||
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor, MsInputTag},
|
||||
components: {MsJsr233Processor, MsResponseText, MsApiRequestForm, MsInputTag},
|
||||
data() {
|
||||
let validateURL = (rule, value, callback) => {
|
||||
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
|
||||
|
|
|
@ -1,212 +0,0 @@
|
|||
<template>
|
||||
<div style="margin-top: 10px">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<div @click="changeActive">
|
||||
<el-button class="ms-left-buttion" size="small" :style="styleType" style="color: #B8741A;background-color: #F9F1EA">{{title}}</el-button>
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" style="margin-left:15px" @click="changeActive"/>
|
||||
<el-input size="small" v-model="jsr223ProcessorData.name" class="ms-api-header-select" style="width: 380px"/>
|
||||
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<el-switch v-model="jsr223ProcessorData.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-collapse-transition>
|
||||
<div v-if="active">
|
||||
<el-row style="margin:0px 10px 10px">
|
||||
<el-col>
|
||||
<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>
|
||||
<ms-instructions-icon :content="$t('api_test.request.processor.bean_shell_processor_tip')"/>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="20" class="script-content">
|
||||
<ms-code-edit v-if="isCodeEditAlive" :mode="jsr223ProcessorData.scriptLanguage"
|
||||
:read-only="isReadOnly"
|
||||
:data.sync="jsr223ProcessorData.script" theme="eclipse" :modes="[]"
|
||||
ref="codeEdit"/>
|
||||
</el-col>
|
||||
<el-col :span="4" class="script-index">
|
||||
<ms-dropdown :default-command="jsr223ProcessorData.scriptLanguage" :commands="languages" @command="languageChange"/>
|
||||
<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 :disabled="template.disabled" @click="addTemplate(template)">{{template.title}}</el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
|
||||
|
||||
export default {
|
||||
name: "MsJsr233Processor",
|
||||
components: {MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
data() {
|
||||
return {
|
||||
active: false,
|
||||
jsr223ProcessorData: {},
|
||||
codeTemplates: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_variable'),
|
||||
value: 'vars.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_variable'),
|
||||
value: 'vars.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_global_variable'),
|
||||
value: 'props.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_global_variable'),
|
||||
value: 'props.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_header'),
|
||||
value: 'prev.getResponseHeaders()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_code'),
|
||||
value: 'prev.getResponseCode()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_result'),
|
||||
value: 'prev.getResponseDataAsString()',
|
||||
disabled: this.isPreProcessor
|
||||
}
|
||||
],
|
||||
isCodeEditAlive: true,
|
||||
languages: [
|
||||
'beanshell', "python"
|
||||
],
|
||||
codeEditModeMap: {
|
||||
beanshell: 'beanshell',
|
||||
python: 'python'
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.jsr223ProcessorData = this.jsr223Processor;
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
}
|
||||
,
|
||||
jsr223Processor: {
|
||||
type: Object,
|
||||
}
|
||||
,
|
||||
isPreProcessor: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
}
|
||||
,
|
||||
title: String,
|
||||
styleType:
|
||||
String,
|
||||
}
|
||||
,
|
||||
watch: {
|
||||
jsr223Processor() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {
|
||||
addTemplate(template) {
|
||||
if (!this.jsr223ProcessorData.script) {
|
||||
this.jsr223ProcessorData.script = "";
|
||||
}
|
||||
this.jsr223ProcessorData.script += template.value;
|
||||
if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') {
|
||||
this.jsr223ProcessorData.script += ';';
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
remove() {
|
||||
this.$emit('remove', this.jsr223ProcessorData);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223ProcessorData);
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
},
|
||||
languageChange(language) {
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
},
|
||||
changeActive() {
|
||||
this.active = !this.active;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.ace_editor {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.script-content {
|
||||
height: calc(100vh - 570px);
|
||||
}
|
||||
|
||||
.script-index {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.template-title {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.document-url {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.instructions-icon {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.ms-dropdown {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ms-api-header-select {
|
||||
margin-left: 5px;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
|
@ -104,7 +104,6 @@
|
|||
import MsApiAssertions from "../../assertion/ApiAssertions";
|
||||
import MsApiExtract from "../../extract/ApiExtract";
|
||||
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
|
||||
import MsJsr233Processor from "../../processor/Jsr233Processor";
|
||||
import MsCodeEdit from "../../../../../common/components/MsCodeEdit";
|
||||
import MsApiScenarioVariables from "../../ApiScenarioVariables";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
|
@ -113,13 +112,15 @@
|
|||
import ApiEnvironmentConfig from "../../environment/ApiEnvironmentConfig";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsJsr233Processor from "../../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
components: {
|
||||
MsJsr233Processor,
|
||||
MsApiScenarioVariables,
|
||||
MsCodeEdit,
|
||||
MsJsr233Processor, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, ApiEnvironmentConfig
|
||||
ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, ApiEnvironmentConfig
|
||||
},
|
||||
props: {
|
||||
request: {},
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
import MsApiAssertions from "../../assertion/ApiAssertions";
|
||||
import MsApiExtract from "../../extract/ApiExtract";
|
||||
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
|
||||
import MsJsr233Processor from "../../processor/Jsr233Processor";
|
||||
import MsCodeEdit from "../../../../../common/components/MsCodeEdit";
|
||||
import MsApiScenarioVariables from "../../ApiScenarioVariables";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
|
@ -90,13 +89,15 @@
|
|||
import MsDubboConfigCenter from "../../request/dubbo/ConfigCenter";
|
||||
import MsDubboConsumerService from "../../request/dubbo/ConsumerAndService";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsJsr233Processor from "../../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
components: {
|
||||
MsJsr233Processor,
|
||||
MsApiScenarioVariables,
|
||||
MsCodeEdit,
|
||||
MsJsr233Processor, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, MsDubboConsumerService,
|
||||
ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, MsDubboConsumerService,
|
||||
MsDubboConfigCenter,
|
||||
MsDubboRegistryCenter,
|
||||
MsDubboInterface,
|
||||
|
|
|
@ -69,11 +69,11 @@
|
|||
</div>
|
||||
<div v-if="!referenced">
|
||||
<div v-for="row in request.hashTree" :key="row.id">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
<!--前置脚本-->
|
||||
<ms-jsr233-processor v-if="row.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<div style="margin-top: 10px">
|
||||
|
@ -108,7 +108,6 @@
|
|||
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
|
||||
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||
import MsApiVariable from "../../ApiVariable";
|
||||
import MsJsr233Processor from "../../processor/Jsr233Processor";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
import MsApiAssertions from "../../assertion/ApiAssertions";
|
||||
import MsApiExtract from "../../extract/ApiExtract";
|
||||
|
@ -116,6 +115,7 @@
|
|||
import {getUUID} from "@/common/js/utils";
|
||||
import BatchAddParameter from "../../basis/BatchAddParameter";
|
||||
import MsApiAdvancedConfig from "./ApiAdvancedConfig";
|
||||
import MsJsr233Processor from "../../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiHttpRequestForm",
|
||||
|
|
|
@ -127,7 +127,6 @@
|
|||
import MsApiAssertions from "../../assertion/ApiAssertions";
|
||||
import MsApiExtract from "../../extract/ApiExtract";
|
||||
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
|
||||
import MsJsr233Processor from "../../processor/Jsr233Processor";
|
||||
import MsCodeEdit from "../../../../../common/components/MsCodeEdit";
|
||||
import MsApiScenarioVariables from "../../ApiScenarioVariables";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
|
@ -148,7 +147,7 @@
|
|||
MsApiVariable,
|
||||
MsApiScenarioVariables,
|
||||
MsCodeEdit,
|
||||
MsJsr233Processor, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, ApiEnvironmentConfig
|
||||
ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, ApiEnvironmentConfig
|
||||
},
|
||||
props: {
|
||||
request: {},
|
||||
|
|
|
@ -56,12 +56,12 @@
|
|||
|
||||
<script>
|
||||
import {AssertionJSR223} from "../../model/ScenarioModel";
|
||||
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiAssertionJsr223",
|
||||
components: {MsDialogFooter, MsJsr233Processor},
|
||||
components: {MsJsr233Processor, MsDialogFooter},
|
||||
props: {
|
||||
assertion: {
|
||||
type: AssertionJSR223,
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter";
|
||||
import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter";
|
||||
import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiDubboRequestForm",
|
||||
|
|
|
@ -93,8 +93,8 @@ import MsApiExtract from "../extract/ApiExtract";
|
|||
import ApiRequestMethodSelect from "../collapse/ApiRequestMethodSelect";
|
||||
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||
import MsApiVariable from "@/business/components/api/test/components/ApiVariable";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import MsApiAdvancedConfig from "../ApiAdvancedConfig";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiHttpRequestForm",
|
||||
|
|
|
@ -76,16 +76,16 @@
|
|||
import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter";
|
||||
import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter";
|
||||
import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsApiScenarioVariables from "../ApiScenarioVariables";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiSqlRequestForm",
|
||||
components: {
|
||||
MsJsr233Processor,
|
||||
MsApiScenarioVariables,
|
||||
MsCodeEdit,
|
||||
MsJsr233Processor,
|
||||
MsDubboConsumerService,
|
||||
MsDubboConfigCenter,
|
||||
MsDubboRegistryCenter,
|
||||
|
|
|
@ -119,12 +119,12 @@
|
|||
import {Scenario, TCPConfig, TCPRequest} from "@/business/components/api/test/model/ScenarioModel";
|
||||
import MsApiAssertions from "@/business/components/api/test/components/assertion/ApiAssertions";
|
||||
import MsApiExtract from "@/business/components/api/test/components/extract/ApiExtract";
|
||||
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
import MsJsr233Processor from "../../../automation/scenario/Jsr233Processor";
|
||||
|
||||
export default {
|
||||
name: "MsApiTcpRequestForm",
|
||||
components: {MsCodeEdit, MsJsr233Processor, MsApiExtract, MsApiAssertions},
|
||||
components: {MsJsr233Processor, MsCodeEdit, MsApiExtract, MsApiAssertions},
|
||||
props: {
|
||||
request: TCPRequest,
|
||||
scenario: Scenario,
|
||||
|
|
Loading…
Reference in New Issue