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

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

View File

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

View File

@ -63,7 +63,7 @@
</el-tab-pane>
<!-- 全局断言-->
<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-form-item
:label="$t('error_report_library.use_error_report')"
@ -72,10 +72,8 @@
{{$t('error_report_library.use_desc')}}
</el-form-item>
</el-col>
</el-row>
<global-assertions :is-read-only="isReadOnly"
:assertions="environment.config.assertions"/>
<global-assertions :is-read-only="isReadOnly" :assertions="environment.config.assertions" :is-show-json-path-suggest="false"/>
</el-tab-pane>
</el-tabs>
<div class="environment-footer">
@ -100,7 +98,7 @@ import MsEnvironmentCommonConfig from "./EnvironmentCommonConfig";
import MsEnvironmentSSLConfig from "./EnvironmentSSLConfig";
import MsApiAuthConfig from "@/business/components/api/definition/components/auth/ApiAuthConfig";
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 {createComponent} from "@/business/components/api/definition/components/jmeter/components";
import EnvironmentGlobalScript from "@/business/components/api/test/components/environment/EnvironmentGlobalScript";
@ -238,6 +236,12 @@ export default {
this.envEnable = o.enable;
}
},
computed: {
hasLicense(){
let license= hasLicense();
return license;
},
},
methods: {
updateGlobalScript(isPreScript, filedName, value) {
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 === 'errorReportResult'"
:value="'ErrorReportResult'"/>
<status-table-item v-else-if="scope.row.execResult === 'Timeout'" :value="'Timeout'"/>
<status-table-item v-else :value="'Prepare'"/>
</template>
</ms-table-column>

View File

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