fix(项目设置): 修复非企业版在环境设置中会显示开启误报按钮的错误

修复非企业版在环境设置中会显示开启误报按钮的错误
This commit is contained in:
song-tianyang 2022-01-29 15:16:34 +08:00 committed by fit2-zhao
parent c30ec9a5c4
commit afd9c7c97b
4 changed files with 61 additions and 51 deletions

View File

@ -16,48 +16,48 @@
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
<global-assertion-text <global-assertion-text
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.regex" :list="assertions.regex"
:callback="after" :callback="after"
v-if="type === options.TEXT" v-if="type === options.TEXT"
/> />
<ms-api-assertion-regex <ms-api-assertion-regex
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.regex" :list="assertions.regex"
:callback="after" :callback="after"
v-if="type === options.REGEX" v-if="type === options.REGEX"
/> />
<ms-api-assertion-json-path <ms-api-assertion-json-path
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.jsonPath" :list="assertions.jsonPath"
:callback="after" :callback="after"
v-if="type === options.JSON_PATH" v-if="type === options.JSON_PATH"
/> />
<ms-api-assertion-x-path2 <ms-api-assertion-x-path2
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.xpath2" :list="assertions.xpath2"
:callback="after" :callback="after"
v-if="type === options.XPATH2" v-if="type === options.XPATH2"
/> />
<ms-api-assertion-duration <ms-api-assertion-duration
v-model="time" v-model="time"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:duration="assertions.duration" :duration="assertions.duration"
:callback="after" :callback="after"
v-if="type === options.DURATION" v-if="type === options.DURATION"
/> />
<ms-api-assertion-jsr223 <ms-api-assertion-jsr223
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.jsr223" :list="assertions.jsr223"
:callback="after" :callback="after"
v-if="type === options.JSR223" v-if="type === options.JSR223"
/> />
<ms-api-assertion-document <ms-api-assertion-document
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
v-model="time" v-model="time"
:document="assertions.document" :document="assertions.document"
:callback="after" :callback="after"
v-if="type === options.DOCUMENT" v-if="type === options.DOCUMENT"
/> />
<el-button v-if="!type" :disabled="true" type="primary" size="small"> <el-button v-if="!type" :disabled="true" type="primary" size="small">
{{ $t('api_test.request.assertions.add') }} {{ $t('api_test.request.assertions.add') }}
@ -67,22 +67,23 @@
</div> </div>
<api-json-path-suggest-button <api-json-path-suggest-button
:open-tip="$t('api_test.request.assertions.json_path_suggest')" v-if="isShowJsonPathSuggest"
:clear-tip="$t('api_test.request.assertions.json_path_clear')" :open-tip="$t('api_test.request.assertions.json_path_suggest')"
@open="suggestJsonOpen" :clear-tip="$t('api_test.request.assertions.json_path_clear')"
@clear="clearJson"/> @open="suggestJsonOpen"
@clear="clearJson"/>
<ms-api-assertions-edit <ms-api-assertions-edit
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:assertions="assertions" :assertions="assertions"
:apiId="apiId" :apiId="apiId"
:reloadData="reloadData" :reloadData="reloadData"
style="margin-bottom: 20px"/> style="margin-bottom: 20px"/>
<api-jsonpath-suggest <api-jsonpath-suggest
:tip="$t('api_test.request.extract.suggest_tip')" :tip="$t('api_test.request.extract.suggest_tip')"
@addSuggest="addJsonPathSuggest" @addSuggest="addJsonPathSuggest"
ref="jsonpathSuggest"/> ref="jsonpathSuggest"/>
</div> </div>
</template> </template>
@ -144,6 +145,10 @@ export default {
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
},
isShowJsonPathSuggest: {
type: Boolean,
default: true
} }
}, },
data() { data() {
@ -197,9 +202,9 @@ export default {
let expect = jsonItem.expect; let expect = jsonItem.expect;
if (expect) { if (expect) {
expect = expect.replaceAll('\\', "\\\\").replaceAll('(', "\\(").replaceAll(')', "\\)") expect = expect.replaceAll('\\', "\\\\").replaceAll('(', "\\(").replaceAll(')', "\\)")
.replaceAll('+', "\\+").replaceAll('.', "\\.").replaceAll('[', "\\[").replaceAll(']', "\\]") .replaceAll('+', "\\+").replaceAll('.', "\\.").replaceAll('[', "\\[").replaceAll(']', "\\]")
.replaceAll('?', "\\?").replaceAll('/', "\\/").replaceAll('*', "\\*") .replaceAll('?', "\\?").replaceAll('/', "\\/").replaceAll('*', "\\*")
.replaceAll('^', "\\^").replaceAll('{', "\\{").replaceAll('}', "\\}").replaceAll('$', "\\$"); .replaceAll('^', "\\^").replaceAll('{', "\\{").replaceAll('}', "\\}").replaceAll('$', "\\$");
} }
jsonItem.expect = expect; jsonItem.expect = expect;
this.assertions.jsonPath.push(jsonItem); this.assertions.jsonPath.push(jsonItem);

View File

@ -63,7 +63,7 @@
</el-tab-pane> </el-tab-pane>
<!-- 全局断言--> <!-- 全局断言-->
<el-tab-pane :label="$t('env_options.all_assertions')" name="assertions"> <el-tab-pane :label="$t('env_options.all_assertions')" name="assertions">
<el-row type="flex" :gutter="20"> <el-row type="flex" :gutter="20" v-if="hasLicense">
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
:label="$t('error_report_library.use_error_report')" :label="$t('error_report_library.use_error_report')"
@ -72,10 +72,8 @@
{{$t('error_report_library.use_desc')}} {{$t('error_report_library.use_desc')}}
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<global-assertions :is-read-only="isReadOnly" <global-assertions :is-read-only="isReadOnly" :assertions="environment.config.assertions" :is-show-json-path-suggest="false"/>
:assertions="environment.config.assertions"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="environment-footer"> <div class="environment-footer">
@ -100,7 +98,7 @@ import MsEnvironmentCommonConfig from "./EnvironmentCommonConfig";
import MsEnvironmentSSLConfig from "./EnvironmentSSLConfig"; import MsEnvironmentSSLConfig from "./EnvironmentSSLConfig";
import MsApiAuthConfig from "@/business/components/api/definition/components/auth/ApiAuthConfig"; import MsApiAuthConfig from "@/business/components/api/definition/components/auth/ApiAuthConfig";
import MsTcpConfig from "@/business/components/api/test/components/request/tcp/TcpConfig"; import MsTcpConfig from "@/business/components/api/test/components/request/tcp/TcpConfig";
import {getUUID} from "@/common/js/utils"; import {getUUID,hasLicense} from "@/common/js/utils";
import Jsr233ProcessorContent from "@/business/components/api/automation/scenario/common/Jsr233ProcessorContent"; import Jsr233ProcessorContent from "@/business/components/api/automation/scenario/common/Jsr233ProcessorContent";
import {createComponent} from "@/business/components/api/definition/components/jmeter/components"; import {createComponent} from "@/business/components/api/definition/components/jmeter/components";
import EnvironmentGlobalScript from "@/business/components/api/test/components/environment/EnvironmentGlobalScript"; import EnvironmentGlobalScript from "@/business/components/api/test/components/environment/EnvironmentGlobalScript";
@ -238,6 +236,12 @@ export default {
this.envEnable = o.enable; this.envEnable = o.enable;
} }
}, },
computed: {
hasLicense(){
let license= hasLicense();
return license;
},
},
methods: { methods: {
updateGlobalScript(isPreScript, filedName, value) { updateGlobalScript(isPreScript, filedName, value) {
if (isPreScript) { if (isPreScript) {

View File

@ -46,6 +46,7 @@
<status-table-item v-else-if="scope.row.execResult === 'STOP'" :value="'STOP'"/> <status-table-item v-else-if="scope.row.execResult === 'STOP'" :value="'STOP'"/>
<status-table-item v-else-if="scope.row.execResult === 'errorReportResult'" <status-table-item v-else-if="scope.row.execResult === 'errorReportResult'"
:value="'ErrorReportResult'"/> :value="'ErrorReportResult'"/>
<status-table-item v-else-if="scope.row.execResult === 'Timeout'" :value="'Timeout'"/>
<status-table-item v-else :value="'Prepare'"/> <status-table-item v-else :value="'Prepare'"/>
</template> </template>
</ms-table-column> </ms-table-column>

View File

@ -168,7 +168,7 @@ export default {
this.response = row.response; this.response = row.response;
} }
} else { } else {
if (row.reportId) { if (row.reportId && row.lastResult !=='Running' && row.lastResult !== 'Waiting') {
this.showResponse = true; this.showResponse = true;
this.reportId = row.reportId; this.reportId = row.reportId;
} }