fix(接口测试): 修复表头配置所属模块后刷新又不显示问题

--story=1013902 --user=王旭 【接口测试】和【UI测试】场景列表的表头字段支持展示所属模块 https://www.tapd.cn/55049933/s/1446277
This commit is contained in:
WangXu10 2023-12-20 16:54:55 +08:00 committed by 刘瑞斌
parent 4cddc43770
commit 8b04686ad1
2 changed files with 28 additions and 22 deletions

View File

@ -77,7 +77,7 @@ export let CUSTOM_TABLE_HEADER = {
API_SCENARIO: [ API_SCENARIO: [
{ id: "num", key: "1", label: "ID" }, { id: "num", key: "1", label: "ID" },
{ id: "name", key: "2", label: "api_report.scenario_name" }, { id: "name", key: "2", label: "api_report.scenario_name" },
{ id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true }, { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true },
{ id: "level", key: "3", label: "api_test.automation.case_level" }, { id: "level", key: "3", label: "api_test.automation.case_level" },
{ id: "status", key: "4", label: "test_track.plan.plan_status" }, { id: "status", key: "4", label: "test_track.plan.plan_status" },
{ id: "tags", key: "5", label: "commons.tag" }, { id: "tags", key: "5", label: "commons.tag" },
@ -100,7 +100,7 @@ export let CUSTOM_TABLE_HEADER = {
UI_SCENARIO: [ UI_SCENARIO: [
{ id: "num", key: "1", label: "ID" }, { id: "num", key: "1", label: "ID" },
{ id: "name", key: "2", label: "api_report.scenario_name" }, { id: "name", key: "2", label: "api_report.scenario_name" },
{ id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true }, { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true },
{ id: "level", key: "3", label: "api_test.automation.case_level" }, { id: "level", key: "3", label: "api_test.automation.case_level" },
{ id: "status", key: "4", label: "test_track.plan.plan_status" }, { id: "status", key: "4", label: "test_track.plan.plan_status" },
{ id: "tags", key: "5", label: "commons.tag" }, { id: "tags", key: "5", label: "commons.tag" },
@ -123,7 +123,7 @@ export let CUSTOM_TABLE_HEADER = {
UI_CUSTOM_COMMAND: [ UI_CUSTOM_COMMAND: [
{ id: "num", key: "1", label: "ID" }, { id: "num", key: "1", label: "ID" },
{ id: "name", key: "2", label: "ui.command_name_label" }, { id: "name", key: "2", label: "ui.command_name_label" },
{ id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true}, { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true},
{ id: "tags", key: "5", label: "commons.tag" }, { id: "tags", key: "5", label: "commons.tag" },
{ id: "creatorName", key: "d", label: "api_test.automation.creator" }, { id: "creatorName", key: "d", label: "api_test.automation.creator" },
{ {

View File

@ -311,26 +311,32 @@ export function getCustomTableHeaderByDefault(key, customFields) {
} }
export function getAllFieldWithCustomFieldsByDefault(key, customFields) { export function getAllFieldWithCustomFieldsByDefault(key, customFields) {
let fieldSetting = [...CUSTOM_TABLE_HEADER[key]]; let fieldStr = localStorage.getItem(key);
// 如果没有 license, 排除 xpack if (fieldStr == null) {
if (!hasLicense()) { let fieldSetting = [...CUSTOM_TABLE_HEADER[key]];
fieldSetting = fieldSetting.filter((v) => !v.xpack); // 如果没有 license, 排除 xpack
if (!hasLicense()) {
fieldSetting = fieldSetting.filter((v) => !v.xpack);
}
fieldSetting = fieldSetting.filter((v) => !v.defaultHide);
fieldSetting = JSON.parse(JSON.stringify(fieldSetting));
translateLabel(fieldSetting);
if (customFields) {
customFields.forEach((item) => {
let field = {
id: item.name,
key: item.key,
label: item.name,
isCustom: true,
};
fieldSetting.push(field);
});
}
return fieldSetting;
} else {
return getAllFieldWithCustomFields(key, customFields)
} }
fieldSetting = fieldSetting.filter((v) => !v.defaultHide);
fieldSetting = JSON.parse(JSON.stringify(fieldSetting));
translateLabel(fieldSetting);
if (customFields) {
customFields.forEach((item) => {
let field = {
id: item.name,
key: item.key,
label: item.name,
isCustom: true,
};
fieldSetting.push(field);
});
}
return fieldSetting;
} }