feat(接口测试): 前后置脚本页面
This commit is contained in:
parent
0f92569e22
commit
5ec095673c
|
@ -1 +1 @@
|
||||||
Subproject commit 356bb744a72304067b9222cb0cb2be01d4ebff2a
|
Subproject commit 8de0d4e47675bd1a5a8ea4c99e1a2b76e53ebc08
|
|
@ -0,0 +1,45 @@
|
||||||
|
<template>
|
||||||
|
<div class="script-content">
|
||||||
|
<ms-code-edit mode="java" :read-only="isReadOnly" :data.sync="beanShellProcessor.script" theme="eclipse" :modes="['java']" ref="codeEdit"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||||
|
export default {
|
||||||
|
name: "MsBeanShellProcessor",
|
||||||
|
components: {MsCodeEdit},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
isReadOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
beanShellProcessor: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.ace_editor {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.script-content {
|
||||||
|
padding: 15px 0;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -68,6 +68,12 @@
|
||||||
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
|
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
|
||||||
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
|
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="'预执行脚本'" name="beanShellPreProcessor">
|
||||||
|
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPreProcessor"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="'后执行脚本'" name="beanShellPostProcessor">
|
||||||
|
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPostProcessor"/>
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
@ -81,10 +87,13 @@ import MsApiExtract from "../extract/ApiExtract";
|
||||||
import ApiRequestMethodSelect from "../collapse/ApiRequestMethodSelect";
|
import ApiRequestMethodSelect from "../collapse/ApiRequestMethodSelect";
|
||||||
import {REQUEST_HEADERS} from "@/common/js/constants";
|
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||||
import MsApiVariable from "@/business/components/api/test/components/ApiVariable";
|
import MsApiVariable from "@/business/components/api/test/components/ApiVariable";
|
||||||
|
import MsBeanShellProcessor from "../processor/BeanShellProcessor";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiHttpRequestForm",
|
name: "MsApiHttpRequestForm",
|
||||||
components: {MsApiVariable, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiBody, MsApiKeyValue},
|
components: {
|
||||||
|
MsBeanShellProcessor,
|
||||||
|
MsApiVariable, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiBody, MsApiKeyValue},
|
||||||
props: {
|
props: {
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
scenario: Scenario,
|
scenario: Scenario,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<editor v-model="formatData" :lang="mode" @init="editorInit" theme="chrome"/>
|
<editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -15,6 +15,12 @@
|
||||||
data: {
|
data: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
theme: {
|
||||||
|
type: String,
|
||||||
|
default() {
|
||||||
|
return 'chrome'
|
||||||
|
}
|
||||||
|
},
|
||||||
init: {
|
init: {
|
||||||
type: Function
|
type: Function
|
||||||
},
|
},
|
||||||
|
@ -54,7 +60,7 @@
|
||||||
this.modes.forEach(mode => {
|
this.modes.forEach(mode => {
|
||||||
require('brace/mode/' + mode); //language
|
require('brace/mode/' + mode); //language
|
||||||
});
|
});
|
||||||
require('brace/theme/chrome')
|
require('brace/theme/' + this.theme)
|
||||||
require('brace/snippets/javascript') //snippet
|
require('brace/snippets/javascript') //snippet
|
||||||
if (this.readOnly) {
|
if (this.readOnly) {
|
||||||
editor.setReadOnly(true);
|
editor.setReadOnly(true);
|
||||||
|
|
Loading…
Reference in New Issue