fix(接口测试): 修复刷新页面,列表显示问题

--bug=1026638 --user=王孝刚 【接口测试】接口列表-切换http/tcp/sql/dubbo-刷新页面-列表显示问题
https://www.tapd.cn/55049933/s/1387865
This commit is contained in:
wxg0103 2023-06-28 19:19:06 +08:00 committed by fit2-zhao
parent 77171bd45e
commit f845c967c3
5 changed files with 16 additions and 14 deletions

View File

@ -738,7 +738,7 @@ public class ElementUtil {
variables.stream() variables.stream()
.filter(ScenarioVariable::isConstantValid).forEach(keyValue -> .filter(ScenarioVariable::isConstantValid).forEach(keyValue ->
arguments.addArgument(keyValue.getName(), arguments.addArgument(keyValue.getName(),
keyValue.getValue(), "=")); keyValue.getValue().replaceAll("[\r\n]",""), "="));
List<ScenarioVariable> variableList = variables.stream() List<ScenarioVariable> variableList = variables.stream()
.filter(ScenarioVariable::isListValid).collect(Collectors.toList()); .filter(ScenarioVariable::isListValid).collect(Collectors.toList());
variableList.forEach(item -> { variableList.forEach(item -> {
@ -761,7 +761,7 @@ public class ElementUtil {
arguments.addArgument(keyValue.getName(), arguments.addArgument(keyValue.getName(),
keyValue.getValue() != null && keyValue.getValue().startsWith("@") keyValue.getValue() != null && keyValue.getValue().startsWith("@")
? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) ? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue())
: keyValue.getValue(), "=")); : keyValue.getValue().replaceAll("[\r\n]",""), "="));
// List类型的变量 // List类型的变量
List<ScenarioVariable> variableList = config.getConfig().get(projectId).getCommonConfig().getVariables().stream() List<ScenarioVariable> variableList = config.getConfig().get(projectId).getCommonConfig().getVariables().stream()
.filter(ScenarioVariable::isListValid) .filter(ScenarioVariable::isListValid)

View File

@ -375,7 +375,7 @@ export default {
selectDataRange: 'all', selectDataRange: 'all',
showCasePage: true, showCasePage: true,
apiDefaultTab: 'default', apiDefaultTab: 'default',
currentProtocol: 'HTTP', currentProtocol: '',
currentModule: null, currentModule: null,
selectNodeIds: [], selectNodeIds: [],
currentApi: {}, currentApi: {},
@ -481,6 +481,11 @@ export default {
this.isAsideHidden = this.apiDefaultTab === 'default' || this.apiDefaultTab === 'trash'; this.isAsideHidden = this.apiDefaultTab === 'default' || this.apiDefaultTab === 'trash';
}, },
}, },
beforeCreate() {
getUserDefaultApiType().then(response => {
this.currentProtocol = response.data;
})
},
created() { created() {
let routeParamObj = this.$route.params; let routeParamObj = this.$route.params;
if (routeParamObj) { if (routeParamObj) {
@ -507,9 +512,6 @@ export default {
this.activeDom = 'middle'; this.activeDom = 'middle';
} }
} }
getUserDefaultApiType().then(response => {
this.currentProtocol = response.data;
})
this.getEnv(); this.getEnv();
}, },
mounted() { mounted() {

View File

@ -867,7 +867,7 @@ export default {
}, },
refreshTable() { refreshTable() {
this.initTableCondition(); this.initTableCondition();
if (this.condition.projectId) { if (this.condition.projectId && this.condition.protocol) {
this.result = getDefinitionPage(this.currentPage, this.pageSize, this.condition).then((response) => { this.result = getDefinitionPage(this.currentPage, this.pageSize, this.condition).then((response) => {
getProtocolFilter(this.condition.protocol); getProtocolFilter(this.condition.protocol);
this.total = response.data.itemCount; this.total = response.data.itemCount;
@ -881,7 +881,7 @@ export default {
}, },
initTable(currentProtocol) { initTable(currentProtocol) {
this.initTableCondition(currentProtocol); this.initTableCondition(currentProtocol);
if (this.condition.projectId) { if (this.condition.projectId && this.condition.protocol) {
this.result = getDefinitionPage(this.currentPage, this.pageSize, this.condition).then((response) => { this.result = getDefinitionPage(this.currentPage, this.pageSize, this.condition).then((response) => {
getProtocolFilter(this.condition.protocol); getProtocolFilter(this.condition.protocol);
this.total = response.data.itemCount; this.total = response.data.itemCount;

View File

@ -78,7 +78,7 @@ export default {
result: false, result: false,
refreshDataOver: true, refreshDataOver: true,
condition: { condition: {
protocol: OPTIONS[0].value, protocol: '',
filterText: '', filterText: '',
trashEnable: false, trashEnable: false,
}, },
@ -245,9 +245,11 @@ export default {
this.setData(response); this.setData(response);
}); });
} else { } else {
this.result = postApiModules(projectId, this.condition.protocol, this.currentVersion, this.param).then((response) => { if (this.condition.protocol) {
this.setData(response); this.result = postApiModules(projectId, this.condition.protocol, this.currentVersion, this.param).then((response) => {
}); this.setData(response);
});
}
} }
}, },
setNohupData(response, selectNodeId) { setNohupData(response, selectNodeId) {

View File

@ -283,8 +283,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
try { try {
Number number1 = NumberUtils.createBigDecimal(v1); Number number1 = NumberUtils.createBigDecimal(v1);
Number number2 = NumberUtils.createBigDecimal(v2); Number number2 = NumberUtils.createBigDecimal(v2);
log.info("number1: " + number1 + " number2: " + number2);
log.info("number1.equals(number2): " + number1.equals(number2));
return number1.equals(number2); return number1.equals(number2);
} catch (Exception e) { } catch (Exception e) {
return StringUtils.equals(v1, v2); return StringUtils.equals(v1, v2);