fix(系统设置): 修复导入postman 文件后 场景步骤删除错乱问题
This commit is contained in:
parent
6245d93ae5
commit
b5760ccbc3
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.log.utils;
|
package io.metersphere.log.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
@ -59,7 +60,7 @@ public class ReflexObjectUtil {
|
||||||
column.setDepthDff(true);
|
column.setDepthDff(true);
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
try {
|
try {
|
||||||
if (f.getName().equals("loadConfiguration")) {
|
if (ReflexObjectUtil.isJsonArray(val.toString())) {
|
||||||
val = "{\"" + "压力配置" + "\":" + val.toString() + "}";
|
val = "{\"" + "压力配置" + "\":" + val.toString() + "}";
|
||||||
}
|
}
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
@ -82,6 +83,18 @@ public class ReflexObjectUtil {
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isJsonArray(String content) {
|
||||||
|
try {
|
||||||
|
JSONArray array = JSON.parseArray(content);
|
||||||
|
if (array != null && array.size() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void order(List<String> orderRegulation, List<DetailColumn> targetList) {
|
public static void order(List<String> orderRegulation, List<DetailColumn> targetList) {
|
||||||
Collections.sort(targetList, ((o1, o2) -> {
|
Collections.sort(targetList, ((o1, o2) -> {
|
||||||
int io1 = orderRegulation.indexOf(o1.getColumnName());
|
int io1 = orderRegulation.indexOf(o1.getColumnName());
|
||||||
|
@ -98,6 +111,15 @@ public class ReflexObjectUtil {
|
||||||
List<DetailColumn> newColumns = newObj.getColumns();
|
List<DetailColumn> newColumns = newObj.getColumns();
|
||||||
for (int i = 0; i < originalColumns.size(); i++) {
|
for (int i = 0; i < originalColumns.size(); i++) {
|
||||||
if (!StringUtils.equals(JSON.toJSONString(originalColumns.get(i).getOriginalValue()), JSON.toJSONString(newColumns.get(i).getOriginalValue()))) {
|
if (!StringUtils.equals(JSON.toJSONString(originalColumns.get(i).getOriginalValue()), JSON.toJSONString(newColumns.get(i).getOriginalValue()))) {
|
||||||
|
if (originalColumns.get(i).getColumnName().equals("tags")) {
|
||||||
|
if ((originalColumns.get(i).getOriginalValue() == null || StringUtils.isEmpty(originalColumns.get(i).getOriginalValue().toString()))
|
||||||
|
&& StringUtils.equals("[]", newColumns.get(i).getOriginalValue().toString())) {
|
||||||
|
continue;
|
||||||
|
} else if ((newColumns.get(i).getOriginalValue() == null || StringUtils.isEmpty(newColumns.get(i).getOriginalValue().toString()))
|
||||||
|
&& StringUtils.equals("[]", originalColumns.get(i).getOriginalValue().toString())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 深度对比
|
// 深度对比
|
||||||
if (originalColumns.get(i).isDepthDff() && originalColumns.get(i).getOriginalValue() != null && newColumns.get(i).getOriginalValue() != null) {
|
if (originalColumns.get(i).isDepthDff() && originalColumns.get(i).getOriginalValue() != null && newColumns.get(i).getOriginalValue() != null) {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
@ -123,13 +145,13 @@ public class ReflexObjectUtil {
|
||||||
}
|
}
|
||||||
StringBuilder newValue = new StringBuilder();
|
StringBuilder newValue = new StringBuilder();
|
||||||
if (addBuff != null && addBuff.toString().length() > 0) {
|
if (addBuff != null && addBuff.toString().length() > 0) {
|
||||||
newValue.append("添加:").append(addBuff).append("\n");
|
newValue.append("添加:\n").append(addBuff).append("\n");
|
||||||
}
|
}
|
||||||
if (removeBuff != null && removeBuff.toString().length() > 0) {
|
if (removeBuff != null && removeBuff.toString().length() > 0) {
|
||||||
newValue.append("移除:").append(removeBuff).append("\n");
|
newValue.append("移除:\n").append(removeBuff).append("\n");
|
||||||
}
|
}
|
||||||
if (repBuff != null && repBuff.toString().length() > 0) {
|
if (repBuff != null && repBuff.toString().length() > 0) {
|
||||||
newValue.append("修改:").append(repBuff).append("\n");
|
newValue.append("修改:\n").append(repBuff).append("\n");
|
||||||
}
|
}
|
||||||
DetailColumn column = new DetailColumn();
|
DetailColumn column = new DetailColumn();
|
||||||
BeanUtils.copyBean(column, originalColumns.get(i));
|
BeanUtils.copyBean(column, originalColumns.get(i));
|
||||||
|
|
|
@ -651,6 +651,9 @@
|
||||||
recursiveSorting(arr, scenarioProjectId) {
|
recursiveSorting(arr, scenarioProjectId) {
|
||||||
for (let i in arr) {
|
for (let i in arr) {
|
||||||
arr[i].index = Number(i) + 1;
|
arr[i].index = Number(i) + 1;
|
||||||
|
if (!arr[i].resourceId) {
|
||||||
|
arr[i].resourceId = getUUID();
|
||||||
|
}
|
||||||
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
|
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
|
||||||
arr[i].countController.proceed = true;
|
arr[i].countController.proceed = true;
|
||||||
}
|
}
|
||||||
|
@ -677,6 +680,9 @@
|
||||||
for (let i in this.scenarioDefinition) {
|
for (let i in this.scenarioDefinition) {
|
||||||
// 排序
|
// 排序
|
||||||
this.scenarioDefinition[i].index = Number(i) + 1;
|
this.scenarioDefinition[i].index = Number(i) + 1;
|
||||||
|
if (!this.scenarioDefinition[i].resourceId) {
|
||||||
|
this.scenarioDefinition[i].resourceId = getUUID();
|
||||||
|
}
|
||||||
// 设置循环控制
|
// 设置循环控制
|
||||||
if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree
|
if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree
|
||||||
&& this.scenarioDefinition[i].hashTree.length > 1) {
|
&& this.scenarioDefinition[i].hashTree.length > 1) {
|
||||||
|
|
|
@ -310,6 +310,9 @@
|
||||||
for (let i in arr) {
|
for (let i in arr) {
|
||||||
arr[i].disabled = true;
|
arr[i].disabled = true;
|
||||||
arr[i].index = Number(i) + 1;
|
arr[i].index = Number(i) + 1;
|
||||||
|
if (!arr[i].resourceId) {
|
||||||
|
arr[i].resourceId = getUUID();
|
||||||
|
}
|
||||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||||
this.recursiveSorting(arr[i].hashTree);
|
this.recursiveSorting(arr[i].hashTree);
|
||||||
}
|
}
|
||||||
|
@ -317,6 +320,9 @@
|
||||||
},
|
},
|
||||||
sort() {
|
sort() {
|
||||||
for (let i in this.request.hashTree) {
|
for (let i in this.request.hashTree) {
|
||||||
|
if (!this.request.hashTree[i].resourceId) {
|
||||||
|
this.request.hashTree[i].resourceId = getUUID();
|
||||||
|
}
|
||||||
this.request.hashTree[i].disabled = true;
|
this.request.hashTree[i].disabled = true;
|
||||||
this.request.hashTree[i].index = Number(i) + 1;
|
this.request.hashTree[i].index = Number(i) + 1;
|
||||||
if (this.request.hashTree[i].hashTree != undefined && this.request.hashTree[i].hashTree.length > 0) {
|
if (this.request.hashTree[i].hashTree != undefined && this.request.hashTree[i].hashTree.length > 0) {
|
||||||
|
@ -368,7 +374,7 @@
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
this.reportId = getUUID();
|
this.reportId = getUUID();
|
||||||
},
|
},
|
||||||
errorRefresh(){
|
errorRefresh() {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
runRefresh(data) {
|
runRefresh(data) {
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
show-word-limit>
|
show-word-limit>
|
||||||
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced"></i>
|
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced"></i>
|
||||||
</el-autocomplete>
|
</el-autocomplete>
|
||||||
<ms-api-variable-advance ref="variableAdvance"/>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col class="item kv-delete">
|
<el-col class="item kv-delete">
|
||||||
|
@ -53,6 +52,7 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
<ms-api-variable-advance ref="variableAdvance"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue