fix(接口测试): 修复批量编辑缺少追加标签的缺陷
--bug=1037501 --user=王孝刚 【接口测试】接口定义-API列表-批量编辑-属性选标签,没有“追加标签”功能 https://www.tapd.cn/55049933/s/1479560
This commit is contained in:
parent
844b076dc2
commit
ca5478bcf3
|
@ -26,7 +26,7 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String type;
|
private String type;
|
||||||
@Schema(description = "默认覆盖原标签")
|
@Schema(description = "默认覆盖原标签")
|
||||||
private boolean appendTag = false;
|
private boolean append = false;
|
||||||
@Schema(description = "环境id")
|
@Schema(description = "环境id")
|
||||||
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
|
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
|
||||||
private String environmentId;
|
private String environmentId;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class ApiScenarioBatchEditRequest extends ApiScenarioBatchRequest impleme
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String type;
|
private String type;
|
||||||
@Schema(description = "默认覆盖原标签")
|
@Schema(description = "默认覆盖原标签")
|
||||||
private boolean appendTag = false;
|
private boolean append = false;
|
||||||
@Schema(description = "环境id")
|
@Schema(description = "环境id")
|
||||||
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
|
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
|
||||||
private String envId;
|
private String envId;
|
||||||
|
|
|
@ -473,7 +473,7 @@ public class ApiTestCaseService extends MoveNodeService {
|
||||||
if (CollectionUtils.isEmpty(request.getTags())) {
|
if (CollectionUtils.isEmpty(request.getTags())) {
|
||||||
throw new MSException(Translator.get("tags_is_null"));
|
throw new MSException(Translator.get("tags_is_null"));
|
||||||
}
|
}
|
||||||
if (request.isAppendTag()) {
|
if (request.isAppend()) {
|
||||||
Map<String, ApiTestCase> caseMap = extApiTestCaseMapper.getTagsByIds(ids, false)
|
Map<String, ApiTestCase> caseMap = extApiTestCaseMapper.getTagsByIds(ids, false)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ApiTestCase::getId, Function.identity()));
|
.collect(Collectors.toMap(ApiTestCase::getId, Function.identity()));
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||||
if (CollectionUtils.isEmpty(request.getTags())) {
|
if (CollectionUtils.isEmpty(request.getTags())) {
|
||||||
throw new MSException(Translator.get("tags_is_null"));
|
throw new MSException(Translator.get("tags_is_null"));
|
||||||
}
|
}
|
||||||
if (request.isAppendTag()) {
|
if (request.isAppend()) {
|
||||||
Map<String, ApiScenario> scenarioMap = extApiScenarioMapper.getTagsByIds(ids, false)
|
Map<String, ApiScenario> scenarioMap = extApiScenarioMapper.getTagsByIds(ids, false)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ApiScenario::getId, Function.identity()));
|
.collect(Collectors.toMap(ApiScenario::getId, Function.identity()));
|
||||||
|
|
|
@ -1397,7 +1397,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||||
ApiScenarioBatchEditRequest request = new ApiScenarioBatchEditRequest();
|
ApiScenarioBatchEditRequest request = new ApiScenarioBatchEditRequest();
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppendTag(true);
|
request.setAppend(true);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostAndReturn(BATCH_EDIT, request);
|
requestPostAndReturn(BATCH_EDIT, request);
|
||||||
|
@ -1411,7 +1411,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||||
});
|
});
|
||||||
//覆盖标签
|
//覆盖标签
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
||||||
request.setAppendTag(false);
|
request.setAppend(false);
|
||||||
requestPostAndReturn(BATCH_EDIT, request);
|
requestPostAndReturn(BATCH_EDIT, request);
|
||||||
apiScenarioMapper.selectByExample(example).forEach(scenario -> {
|
apiScenarioMapper.selectByExample(example).forEach(scenario -> {
|
||||||
Assertions.assertEquals(scenario.getTags(), List.of("tag1"));
|
Assertions.assertEquals(scenario.getTags(), List.of("tag1"));
|
||||||
|
|
|
@ -895,7 +895,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
ApiCaseBatchEditRequest request = new ApiCaseBatchEditRequest();
|
ApiCaseBatchEditRequest request = new ApiCaseBatchEditRequest();
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppendTag(true);
|
request.setAppend(true);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
|
@ -909,7 +909,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
});
|
});
|
||||||
//覆盖标签
|
//覆盖标签
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
||||||
request.setAppendTag(false);
|
request.setAppend(false);
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
|
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
|
||||||
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
||||||
|
|
|
@ -338,6 +338,7 @@ export interface ApiCaseBatchEditParams extends ApiCaseBatchParams {
|
||||||
status?: string;
|
status?: string;
|
||||||
environmentId?: string;
|
environmentId?: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
append?: boolean;
|
||||||
}
|
}
|
||||||
// 添加用例参数
|
// 添加用例参数
|
||||||
export interface AddApiCaseParams extends ExecuteRequestParams {
|
export interface AddApiCaseParams extends ExecuteRequestParams {
|
||||||
|
|
|
@ -124,7 +124,7 @@ export interface ApiScenarioBatchEditParams extends ApiScenarioBatchParams {
|
||||||
type?: string;
|
type?: string;
|
||||||
|
|
||||||
// 修改标签相关
|
// 修改标签相关
|
||||||
appendTag?: boolean;
|
append?: boolean;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
|
||||||
// 修改环境相关
|
// 修改环境相关
|
||||||
|
|
|
@ -199,12 +199,31 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
<div class="flex" :class="[batchForm.attr === 'tags' ? 'justify-between' : 'justify-end']">
|
||||||
|
<div
|
||||||
|
v-if="batchForm.attr === 'tags'"
|
||||||
|
class="flex flex-row items-center justify-center"
|
||||||
|
style="padding-top: 10px"
|
||||||
|
>
|
||||||
|
<a-switch v-model="batchForm.append" class="mr-1" size="small" type="line" />
|
||||||
|
<a-tooltip :content="t('caseManagement.featureCase.enableTags')">
|
||||||
|
<span class="flex items-center">
|
||||||
|
<span class="mr-1">{{ t('caseManagement.featureCase.appendTag') }}</span>
|
||||||
|
<span class="mt-[2px]">
|
||||||
|
<IconQuestionCircle class="h-[16px] w-[16px] text-[rgb(var(--primary-5))]" />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end">
|
||||||
<a-button type="secondary" :disabled="batchUpdateLoading" @click="cancelBatch">
|
<a-button type="secondary" :disabled="batchUpdateLoading" @click="cancelBatch">
|
||||||
{{ t('common.cancel') }}
|
{{ t('common.cancel') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" :loading="batchUpdateLoading" @click="batchUpdate">
|
<a-button class="ml-3" type="primary" :loading="batchUpdateLoading" @click="batchUpdate">
|
||||||
{{ t('common.update') }}
|
{{ t('common.update') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
@ -626,6 +645,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
});
|
});
|
||||||
const fullAttrs = [
|
const fullAttrs = [
|
||||||
{
|
{
|
||||||
|
@ -680,6 +700,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,6 +718,7 @@
|
||||||
moduleIds: await getModuleIds(),
|
moduleIds: await getModuleIds(),
|
||||||
protocol: props.protocol,
|
protocol: props.protocol,
|
||||||
type: batchForm.value.attr,
|
type: batchForm.value.attr,
|
||||||
|
append: batchForm.value.append,
|
||||||
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
||||||
});
|
});
|
||||||
Message.success(t('common.updateSuccess'));
|
Message.success(t('common.updateSuccess'));
|
||||||
|
|
|
@ -248,12 +248,31 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
<div class="flex" :class="[batchForm.attr === 'tags' ? 'justify-between' : 'justify-end']">
|
||||||
|
<div
|
||||||
|
v-if="batchForm.attr === 'tags'"
|
||||||
|
class="flex flex-row items-center justify-center"
|
||||||
|
style="padding-top: 10px"
|
||||||
|
>
|
||||||
|
<a-switch v-model="batchForm.append" class="mr-1" size="small" type="line" />
|
||||||
|
<a-tooltip :content="t('caseManagement.featureCase.enableTags')">
|
||||||
|
<span class="flex items-center">
|
||||||
|
<span class="mr-1">{{ t('caseManagement.featureCase.appendTag') }}</span>
|
||||||
|
<span class="mt-[2px]">
|
||||||
|
<IconQuestionCircle class="h-[16px] w-[16px] text-[rgb(var(--primary-5))]" />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end">
|
||||||
<a-button type="secondary" :disabled="batchEditLoading" @click="cancelBatchEdit">
|
<a-button type="secondary" :disabled="batchEditLoading" @click="cancelBatchEdit">
|
||||||
{{ t('common.cancel') }}
|
{{ t('common.cancel') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" :loading="batchEditLoading" @click="handleBatchEditCase">
|
<a-button class="ml-3" type="primary" :loading="batchEditLoading" @click="handleBatchEditCase">
|
||||||
{{ t('common.update') }}
|
{{ t('common.update') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<createAndEditCaseDrawer
|
<createAndEditCaseDrawer
|
||||||
|
@ -723,6 +742,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const attrOptions = [
|
const attrOptions = [
|
||||||
|
@ -785,6 +805,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function handleBatchEditCase() {
|
function handleBatchEditCase() {
|
||||||
|
@ -799,6 +820,7 @@
|
||||||
excludeIds: batchParams.value?.excludeIds || [],
|
excludeIds: batchParams.value?.excludeIds || [],
|
||||||
...batchConditionParams,
|
...batchConditionParams,
|
||||||
type: batchForm.value.attr.charAt(0).toUpperCase() + batchForm.value.attr.slice(1), // 首字母大写
|
type: batchForm.value.attr.charAt(0).toUpperCase() + batchForm.value.attr.slice(1), // 首字母大写
|
||||||
|
append: batchForm.value.append,
|
||||||
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
||||||
});
|
});
|
||||||
Message.success(t('common.updateSuccess'));
|
Message.success(t('common.updateSuccess'));
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
v-if="batchForm.attr === 'TAGS'"
|
v-if="batchForm.attr === 'Tags'"
|
||||||
field="values"
|
field="values"
|
||||||
:label="t('api_scenario.table.batchUpdate')"
|
:label="t('api_scenario.table.batchUpdate')"
|
||||||
:validate-trigger="['blur', 'input']"
|
:validate-trigger="['blur', 'input']"
|
||||||
|
@ -221,12 +221,31 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
<div class="flex" :class="[batchForm.attr === 'Tags' ? 'justify-between' : 'justify-end']">
|
||||||
|
<div
|
||||||
|
v-if="batchForm.attr === 'Tags'"
|
||||||
|
class="flex flex-row items-center justify-center"
|
||||||
|
style="padding-top: 10px"
|
||||||
|
>
|
||||||
|
<a-switch v-model="batchForm.append" class="mr-1" size="small" type="line" />
|
||||||
|
<a-tooltip :content="t('caseManagement.featureCase.enableTags')">
|
||||||
|
<span class="flex items-center">
|
||||||
|
<span class="mr-1">{{ t('caseManagement.featureCase.appendTag') }}</span>
|
||||||
|
<span class="mt-[2px]">
|
||||||
|
<IconQuestionCircle class="h-[16px] w-[16px] text-[rgb(var(--primary-5))]" />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end">
|
||||||
<a-button type="secondary" :disabled="batchUpdateLoading" @click="cancelBatch">
|
<a-button type="secondary" :disabled="batchUpdateLoading" @click="cancelBatch">
|
||||||
{{ t('common.cancel') }}
|
{{ t('common.cancel') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" :loading="batchUpdateLoading" @click="batchUpdate">
|
<a-button class="ml-3" type="primary" :loading="batchUpdateLoading" @click="batchUpdate">
|
||||||
{{ t('common.update') }}
|
{{ t('common.update') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<!-- </MsDialog>-->
|
<!-- </MsDialog>-->
|
||||||
|
@ -711,6 +730,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
});
|
});
|
||||||
const fullAttrs = [
|
const fullAttrs = [
|
||||||
{
|
{
|
||||||
|
@ -722,7 +742,7 @@
|
||||||
value: 'Status',
|
value: 'Status',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '标签(待定)',
|
name: '标签',
|
||||||
value: 'Tags',
|
value: 'Tags',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -760,6 +780,7 @@
|
||||||
attr: '',
|
attr: '',
|
||||||
value: '',
|
value: '',
|
||||||
values: [],
|
values: [],
|
||||||
|
append: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,12 +802,16 @@
|
||||||
type: batchForm.value?.attr,
|
type: batchForm.value?.attr,
|
||||||
priority: '',
|
priority: '',
|
||||||
status: '',
|
status: '',
|
||||||
|
tags: [],
|
||||||
|
append: batchForm.value.append,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (batchForm.value.attr === 'Priority') {
|
if (batchForm.value.attr === 'Priority') {
|
||||||
batchEditParam.priority = batchForm.value.value;
|
batchEditParam.priority = batchForm.value.value;
|
||||||
} else if (batchForm.value.attr === 'Status') {
|
} else if (batchForm.value.attr === 'Status') {
|
||||||
batchEditParam.status = batchForm.value.value;
|
batchEditParam.status = batchForm.value.value;
|
||||||
|
} else if (batchForm.value.attr === 'Tags') {
|
||||||
|
batchEditParam.tags = batchForm.value.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
await batchEditScenario(batchEditParam);
|
await batchEditScenario(batchEditParam);
|
||||||
|
|
Loading…
Reference in New Issue