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; boolean isRepository = false;
BodyFile file = item.getFiles().get(0); BodyFile file = item.getFiles().get(0);
boolean isRef = StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name()); 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())) { if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name())) {
fileId = file.getFileId(); fileId = file.getFileId();
FileMetadata fileMetadata = fileMetadataService.getFileMetadataById(fileId); FileMetadata fileMetadata = fileMetadataService.getFileMetadataById(fileId);

View File

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

View File

@ -439,11 +439,16 @@ public class TestPlanApiCaseService {
try { try {
responseObj = JSON.parseMap(execResult.getContent()); responseObj = JSON.parseMap(execResult.getContent());
} catch (Exception e) { } catch (Exception e) {
LogUtil.error("转换content失败!", e);
} }
if (StringUtils.isNotEmpty(execResult.getEnvConfig())) { if (StringUtils.isNotEmpty(execResult.getEnvConfig())) {
responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), 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() { created() {
this.getEnvironments(); this.getEnvironments(null, 'created');
}, },
computed: { computed: {
projectId() { projectId() {
@ -235,7 +235,7 @@ export default {
this.initDataSource(undefined, undefined, targetDataSourceName); this.initDataSource(undefined, undefined, targetDataSourceName);
}); });
}, },
getEnvironments(environmentId) { getEnvironments(environmentId, isCreated) {
let envId = ''; let envId = '';
let id = this.request.projectId ? this.request.projectId : this.projectId; let id = this.request.projectId ? this.request.projectId : this.projectId;
let scenarioEnvId = this.scenarioId !== '' ? this.scenarioId + '_' + id : id; let scenarioEnvId = this.scenarioId !== '' ? this.scenarioId + '_' + id : id;
@ -262,7 +262,11 @@ export default {
envId = this.request.refEevMap.get(id); 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; this.request.dataSourceId = this.request.originalDataSourceId;
} }
let targetDataSourceName = ''; let targetDataSourceName = '';

View File

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

View File

@ -24,8 +24,8 @@ const message = {
title: '顯示設置', title: '顯示設置',
logo: '系統 LOGO', logo: '系統 LOGO',
loginLogo: '登錄頁左上角 LOGO', loginLogo: '登錄頁左上角 LOGO',
loginImage: '登頁面右側圖片', loginImage: '登頁面右側圖片',
loginTitle: '登頁面提示信息', loginTitle: '登頁面提示信息',
pageTitle: '頁面 Title', pageTitle: '頁面 Title',
sysTitle: '系統名稱', sysTitle: '系統名稱',
theme_style: '主題風格設置', 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 {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import FunctionalRelevance from "@/business/plan/view/comonents/functional/FunctionalRelevance"; import FunctionalRelevance from "@/business/plan/view/comonents/functional/FunctionalRelevance";
import {addTestCaseRelationship, getTestCaseNodesByCaseFilter, testCaseRelationshipRelateList} from "@/api/testCase"; import {addTestCaseRelationship, getTestCaseNodesByCaseFilter, testCaseRelationshipRelateList} from "@/api/testCase";
import {parseTag} from "@/business/utils/sdk-utils";
export default { export default {
name: "RelationshipFunctionalRelevance", name: "RelationshipFunctionalRelevance",
@ -86,10 +87,7 @@ export default {
.then(response => { .then(response => {
getPageDate(response, this.page); getPageDate(response, this.page);
let data = this.page.data; let data = this.page.data;
data.forEach(item => { parseTag(data);
item.checked = false;
item.tags = JSON.parse(item.tags);
});
}) })
}, },
getTreeNodes(vueObj) { getTreeNodes(vueObj) {

View File

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

View File

@ -593,9 +593,7 @@ export default {
// websock // websock
// websock // websock
this.$refs.apiCaseResult.open(reportId); this.$refs.apiCaseResult.open(reportId);
setTimeout(() => { run(row.id, reportId);
run(row.id, reportId);
}, 3000);
}, },
handleTestEnd(reportId) { handleTestEnd(reportId) {
if (this.runningReport.has(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 {testPlanRelevance} from "@/api/remote/plan/test-plan";
import {testCaseRelateList} from "@/api/testCase"; import {testCaseRelateList} from "@/api/testCase";
import {testCaseNodeListPlanRelate} from "@/api/test-case-node"; import {testCaseNodeListPlanRelate} from "@/api/test-case-node";
import {parseTag} from "@/business/utils/sdk-utils";
export default { export default {
name: "TestPlanFunctionalRelevance", name: "TestPlanFunctionalRelevance",
@ -88,9 +89,9 @@ export default {
this.page.loading = false; this.page.loading = false;
getPageDate(response, this.page); getPageDate(response, this.page);
let data = this.page.data; let data = this.page.data;
parseTag(this.page.data);
data.forEach(item => { data.forEach(item => {
item.checked = false; item.checked = false;
item.tags = JSON.parse(item.tags);
}); });
}); });
}, },

View File

@ -1,5 +1,5 @@
export {operationConfirm, removeGoBackListener, handleCtrlSEvent, byteToSize, resizeTextarea, 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 {parseCustomFilesForList, getCustomFieldFilter, buildBatchParam} from "metersphere-frontend/src/utils/tableUtils";
export {sortCustomFields, parseCustomField, buildCustomFields} from "metersphere-frontend/src/utils/custom_field"; export {sortCustomFields, parseCustomField, buildCustomFields} from "metersphere-frontend/src/utils/custom_field";
export {getCurrentProjectID, getCurrentWorkspaceId, getCurrentUser, setCurrentProjectID} from "metersphere-frontend/src/utils/token"; export {getCurrentProjectID, getCurrentWorkspaceId, getCurrentUser, setCurrentProjectID} from "metersphere-frontend/src/utils/token";

View File

@ -250,6 +250,9 @@ export default {
}, },
workspaceId() { workspaceId() {
return getCurrentWorkspaceId(); return getCurrentWorkspaceId();
},
isToDo() {
return !this.isFocus && !this.isCreation;
} }
}, },
created() { created() {
@ -262,8 +265,8 @@ export default {
getIssuePartTemplateWithProject((template) => { getIssuePartTemplateWithProject((template) => {
this.initFields(template); this.initFields(template);
this.page.result.loading = false; this.page.result.loading = false;
this.getIssues();
}); });
this.getIssues();
}); });
}, },
methods: { methods: {
@ -300,6 +303,9 @@ export default {
item.filters = this.columns[item.id].filters; item.filters = this.columns[item.id].filters;
} }
} }
if (this.isToDo && item.id === '状态') {
item.filters = item.filters.filter(i => i.value !== 'closed')
}
}); });
this.fields = fields; this.fields = fields;
@ -350,17 +356,7 @@ export default {
} }
} else { } else {
if (this.page.condition.filters) { this.addDefaultStatusFilter();
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.page.condition.workspaceId = getCurrentWorkspaceId(); this.page.condition.workspaceId = getCurrentWorkspaceId();
this.page.condition.orders = getLastTableSortField(this.tableHeaderKey); 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() { initCustomFieldValue() {
if (this.fields.length <= 0) { if (this.fields.length <= 0) {
return; return;