This commit is contained in:
liqiang-fit2cloud 2023-01-12 17:34:49 +08:00
commit 4588a6914e
12 changed files with 65 additions and 45 deletions

View File

@ -125,7 +125,7 @@ public class ElementUtil {
boolean isRepository = false;
BodyFile file = item.getFiles().get(0);
boolean isRef = StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name());
String path = StringUtils.join(BODY_FILE_DIR, File.pathSeparator, item.getFiles().get(0).getId(), "_", item.getFiles().get(0).getName());
String path = StringUtils.join(BODY_FILE_DIR, File.separator, item.getFiles().get(0).getId(), "_", item.getFiles().get(0).getName());
if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name())) {
fileId = file.getFileId();
FileMetadata fileMetadata = fileMetadataService.getFileMetadataById(fileId);

View File

@ -74,14 +74,11 @@ public class ApiScenarioEnvService {
List<Boolean> hasFullUrlList = new ArrayList<>();
for (MsTestElement testElement : hashTree) {
this.formatElement(testElement, env, hasFullUrlList);
if (CollectionUtils.isNotEmpty(testElement.getHashTree()) && !hasFullUrlList.contains(false)) {
if (CollectionUtils.isNotEmpty(testElement.getHashTree())) {
getHashTree(testElement.getHashTree(), env, hasFullUrlList);
}
if (hasFullUrlList.contains(false)) {
env.setFullUrl(false);
break;
}
}
env.setFullUrl(!hasFullUrlList.contains(false));
return env;
}
@ -92,12 +89,9 @@ public class ApiScenarioEnvService {
tree = tree.stream().filter(item -> item.isEnable()).collect(Collectors.toList());
for (MsTestElement element : tree) {
this.formatElement(element, env, hasFullUrlList);
if (CollectionUtils.isNotEmpty(element.getHashTree()) && !hasFullUrlList.contains(false)) {
if (CollectionUtils.isNotEmpty(element.getHashTree())) {
getHashTree(element.getHashTree(), env, hasFullUrlList);
}
if (hasFullUrlList.contains(false)) {
break;
}
}
} catch (Exception e) {
LogUtil.error(e);

View File

@ -439,11 +439,16 @@ public class TestPlanApiCaseService {
try {
responseObj = JSON.parseMap(execResult.getContent());
} catch (Exception e) {
LogUtil.error("转换content失败!", e);
}
if (StringUtils.isNotEmpty(execResult.getEnvConfig())) {
responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig()));
}
item.setResponse(responseObj.toString());
/*
* 之前这里的写法是responseObj.toString()
* 猜测是fastjson转换之后只是单纯的把JSONObject改成了map所以这里放进去的不是json格式的数据
*/
item.setResponse(JSON.toJSONString(responseObj));
}
});
}

View File

@ -147,7 +147,7 @@ export default {
};
},
created() {
this.getEnvironments();
this.getEnvironments(null, 'created');
},
computed: {
projectId() {
@ -235,7 +235,7 @@ export default {
this.initDataSource(undefined, undefined, targetDataSourceName);
});
},
getEnvironments(environmentId) {
getEnvironments(environmentId, isCreated) {
let envId = '';
let id = this.request.projectId ? this.request.projectId : this.projectId;
let scenarioEnvId = this.scenarioId !== '' ? this.scenarioId + '_' + id : id;
@ -262,7 +262,11 @@ export default {
envId = this.request.refEevMap.get(id);
}
}
if (envId === this.request.originalEnvironmentId && this.request.originalDataSourceId) {
if (
envId === this.request.originalEnvironmentId &&
this.request.originalDataSourceId &&
isCreated !== 'created'
) {
this.request.dataSourceId = this.request.originalDataSourceId;
}
let targetDataSourceName = '';

View File

@ -24,8 +24,8 @@ const message = {
title: '显示设置',
logo: '系统 LOGO',
loginLogo: '登录页左上角 LOGO',
loginImage: '登页面右侧图片',
loginTitle: '登页面提示信息',
loginImage: '登页面右侧图片',
loginTitle: '登页面提示信息',
pageTitle: '页面 Title',
sysTitle: '系统名称',
theme_style: '主题风格设置',

View File

@ -24,8 +24,8 @@ const message = {
title: '顯示設置',
logo: '系統 LOGO',
loginLogo: '登錄頁左上角 LOGO',
loginImage: '登頁面右側圖片',
loginTitle: '登頁面提示信息',
loginImage: '登頁面右側圖片',
loginTitle: '登頁面提示信息',
pageTitle: '頁面 Title',
sysTitle: '系統名稱',
theme_style: '主題風格設置',

View File

@ -16,6 +16,7 @@ import {getPageDate, getPageInfo} from "metersphere-frontend/src/utils/tableUtil
import {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import FunctionalRelevance from "@/business/plan/view/comonents/functional/FunctionalRelevance";
import {addTestCaseRelationship, getTestCaseNodesByCaseFilter, testCaseRelationshipRelateList} from "@/api/testCase";
import {parseTag} from "@/business/utils/sdk-utils";
export default {
name: "RelationshipFunctionalRelevance",
@ -86,10 +87,7 @@ export default {
.then(response => {
getPageDate(response, this.page);
let data = this.page.data;
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
parseTag(data);
})
},
getTreeNodes(vueObj) {

View File

@ -114,7 +114,7 @@ import {
} from "metersphere-frontend/src/components/search/search-components";
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
import ApiListContainer from "@/business/plan/view/comonents/api/ApiListContainer";
import {buildBatchParam, hasLicense, isProjectVersionEnable} from "@/business/utils/sdk-utils";
import {buildBatchParam, hasLicense, isProjectVersionEnable, parseTag} from "@/business/utils/sdk-utils";
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
import {apiDefinitionGet} from "@/api/remote/api/api-definition";
import {testPlanApiCaseRelevanceList} from "@/api/remote/plan/test-plan-api-case";
@ -246,11 +246,7 @@ export default {
this.loading = false;
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
parseTag(this.tableData);
});
},
clear() {

View File

@ -593,9 +593,7 @@ export default {
// websock
// websock
this.$refs.apiCaseResult.open(reportId);
setTimeout(() => {
run(row.id, reportId);
}, 3000);
},
handleTestEnd(reportId) {
if (this.runningReport.has(reportId)) {

View File

@ -18,6 +18,7 @@ import FunctionalRelevance from "@/business/plan/view/comonents/functional/Funct
import {testPlanRelevance} from "@/api/remote/plan/test-plan";
import {testCaseRelateList} from "@/api/testCase";
import {testCaseNodeListPlanRelate} from "@/api/test-case-node";
import {parseTag} from "@/business/utils/sdk-utils";
export default {
name: "TestPlanFunctionalRelevance",
@ -88,9 +89,9 @@ export default {
this.page.loading = false;
getPageDate(response, this.page);
let data = this.page.data;
parseTag(this.page.data);
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
});
},

View File

@ -1,5 +1,5 @@
export {operationConfirm, removeGoBackListener, handleCtrlSEvent, byteToSize, resizeTextarea,
getTypeByFileName, strMapToObj, getUUID, windowPrint} from "metersphere-frontend/src/utils";
getTypeByFileName, strMapToObj, getUUID, windowPrint, parseTag} from "metersphere-frontend/src/utils";
export {parseCustomFilesForList, getCustomFieldFilter, buildBatchParam} from "metersphere-frontend/src/utils/tableUtils";
export {sortCustomFields, parseCustomField, buildCustomFields} from "metersphere-frontend/src/utils/custom_field";
export {getCurrentProjectID, getCurrentWorkspaceId, getCurrentUser, setCurrentProjectID} from "metersphere-frontend/src/utils/token";

View File

@ -250,6 +250,9 @@ export default {
},
workspaceId() {
return getCurrentWorkspaceId();
},
isToDo() {
return !this.isFocus && !this.isCreation;
}
},
created() {
@ -262,9 +265,9 @@ export default {
getIssuePartTemplateWithProject((template) => {
this.initFields(template);
this.page.result.loading = false;
});
this.getIssues();
});
});
},
methods: {
getCustomFieldValue(row, field, defaultVal) {
@ -300,6 +303,9 @@ export default {
item.filters = this.columns[item.id].filters;
}
}
if (this.isToDo && item.id === '状态') {
item.filters = item.filters.filter(i => i.value !== 'closed')
}
});
this.fields = fields;
@ -350,17 +356,7 @@ export default {
}
} else {
if (this.page.condition.filters) {
this.page.condition.filters.status = ["new"];
} else {
this.page.condition.filters = {status: ["new"]};
}
this.page.condition.combine = {
creator: {
operator: "current user",
value: "current user",
}
}
this.addDefaultStatusFilter();
}
this.page.condition.workspaceId = getCurrentWorkspaceId();
this.page.condition.orders = getLastTableSortField(this.tableHeaderKey);
@ -382,6 +378,34 @@ export default {
});
}
},
addDefaultStatusFilter() {
this.page.condition.combine = {
creator: {
operator: "current user",
value: "current user",
}
}
if (this.isToDo) {
let statusFieldId = null;
this.issueTemplate.customFields.forEach(field => {
if (field.name === '状态') {
statusFieldId = field.id;
}
});
if (statusFieldId) {
this.page.condition.combine.customs = [
{
id: statusFieldId,
operator: 'not in',
value:[
'closed'
],
type: 'select'
}
];
}
}
},
initCustomFieldValue() {
if (this.fields.length <= 0) {
return;