feat(接口测试): 忽略全部和配置同步信息展示更改&同步项默认值更改
This commit is contained in:
parent
89656beb95
commit
cb52137fdb
|
@ -401,8 +401,11 @@
|
||||||
const isPriorityLocalExec = computed(() => executeRef.value?.isPriorityLocalExec ?? false);
|
const isPriorityLocalExec = computed(() => executeRef.value?.isPriorityLocalExec ?? false);
|
||||||
const caseId = ref<string>(route.query.id as string);
|
const caseId = ref<string>(route.query.id as string);
|
||||||
// 忽略本次变更
|
// 忽略本次变更
|
||||||
async function clearThisChangeHandler() {
|
async function clearThisChangeHandler(isEvery: boolean) {
|
||||||
getCaseDetailInfo(caseId.value);
|
getCaseDetailInfo(caseId.value);
|
||||||
|
if (isEvery) {
|
||||||
|
showDifferentDrawer.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步参数
|
// 同步参数
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
:active-api-case-id="activeApiCaseId"
|
:active-api-case-id="activeApiCaseId"
|
||||||
:active-defined-id="activeDefinedId"
|
:active-defined-id="activeDefinedId"
|
||||||
@close="closeDifferent"
|
@close="closeDifferent"
|
||||||
@clear-this-change="brashChangeHandler"
|
@clear-this-change="(isEvery:boolean)=>brashChangeHandler(isEvery)"
|
||||||
@sync="syncParamsHandler"
|
@sync="syncParamsHandler"
|
||||||
/>
|
/>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</div>
|
</div>
|
||||||
<createAndEditCaseDrawer ref="createAndEditCaseDrawerRef" v-bind="$attrs" @load-case="brashChangeHandler" />
|
<createAndEditCaseDrawer ref="createAndEditCaseDrawerRef" v-bind="$attrs" @load-case="() => brashChangeHandler" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -347,8 +347,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 忽略本次变更
|
// 忽略本次变更
|
||||||
async function brashChangeHandler() {
|
async function brashChangeHandler(isClose = false) {
|
||||||
emit('loadCase', props.detail.id as string);
|
emit('loadCase', props.detail.id as string);
|
||||||
|
if (isClose) {
|
||||||
|
showDifferentDrawer.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步参数
|
// 同步参数
|
||||||
|
|
|
@ -1025,12 +1025,15 @@
|
||||||
}
|
}
|
||||||
const showCaseVisible = ref(false);
|
const showCaseVisible = ref(false);
|
||||||
// 清除本次变更
|
// 清除本次变更
|
||||||
async function handleClearThisChange() {
|
async function handleClearThisChange(isEvery: boolean) {
|
||||||
await loadCaseList();
|
await loadCaseList();
|
||||||
await getCaseDetailInfo(activeApiCaseId.value);
|
await getCaseDetailInfo(activeApiCaseId.value);
|
||||||
if (showCaseVisible.value) {
|
if (showCaseVisible.value) {
|
||||||
createAndEditCaseDrawerRef.value?.open(caseDetail.value.apiDefinitionId, caseDetail.value as RequestParam, false);
|
createAndEditCaseDrawerRef.value?.open(caseDetail.value.apiDefinitionId, caseDetail.value as RequestParam, false);
|
||||||
}
|
}
|
||||||
|
if (isEvery) {
|
||||||
|
showDifferentDrawer.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对比抽屉同步成功打开编辑
|
// 对比抽屉同步成功打开编辑
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<div class="flex w-full items-center justify-between">
|
<div class="flex w-full items-center justify-between">
|
||||||
<div>{{ t('case.apiAndCaseDiff') }}</div>
|
<div>{{ t('case.apiAndCaseDiff') }}</div>
|
||||||
<div class="flex items-center text-[14px]">
|
<div class="flex items-center text-[14px]">
|
||||||
<div v-if="caseDetail.inconsistentWithApi" class="-mt-[2px] mr-[8px]"> {{ t('case.syncItem') }}</div>
|
<div v-if="showSyncConfig" class="-mt-[2px] mr-[8px]"> {{ t('case.syncItem') }}</div>
|
||||||
<a-checkbox-group v-if="caseDetail.inconsistentWithApi" v-model="checkType">
|
<a-checkbox-group v-if="showSyncConfig" v-model="checkType">
|
||||||
<a-checkbox v-for="item of checkList" :key="item.value" :value="item.value">
|
<a-checkbox v-for="item of checkList" :key="item.value" :value="item.value">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</a-checkbox>
|
</a-checkbox>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
<a-divider v-if="caseDetail.inconsistentWithApi" direction="vertical" :margin="0" class="!mr-[8px]" />
|
<a-divider v-if="showSyncConfig" direction="vertical" :margin="0" class="!mr-[8px]" />
|
||||||
<a-switch
|
<a-switch
|
||||||
v-model:model-value="form.ignoreApiChange"
|
v-model:model-value="form.ignoreApiChange"
|
||||||
:before-change="(val) => changeIgnore(val)"
|
:before-change="(val) => changeIgnore(val)"
|
||||||
|
@ -37,26 +37,17 @@
|
||||||
/>
|
/>
|
||||||
<div class="ml-[8px]">{{ t('case.ignoreAllChange') }}</div>
|
<div class="ml-[8px]">{{ t('case.ignoreAllChange') }}</div>
|
||||||
<a-divider direction="vertical" :margin="8"></a-divider>
|
<a-divider direction="vertical" :margin="8"></a-divider>
|
||||||
<a-switch
|
<a-switch v-if="showSyncConfig" v-model:model-value="form.deleteRedundantParam" size="small" />
|
||||||
v-if="caseDetail.inconsistentWithApi"
|
<div v-if="showSyncConfig" class="ml-[8px] font-normal text-[var(--color-text-1)]">{{
|
||||||
v-model:model-value="form.deleteRedundantParam"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<div v-if="caseDetail.inconsistentWithApi" class="ml-[8px] font-normal text-[var(--color-text-1)]">{{
|
|
||||||
t('case.deleteNotCorrespondValue')
|
t('case.deleteNotCorrespondValue')
|
||||||
}}</div>
|
}}</div>
|
||||||
<a-divider direction="vertical" :margin="0" class="!ml-[8px]"></a-divider>
|
<a-divider v-if="showSyncConfig" direction="vertical" :margin="0" class="!ml-[8px]" />
|
||||||
<a-button class="mx-[12px]" type="secondary" @click="cancel">{{ t('common.cancel') }}</a-button>
|
<a-button class="mx-[12px]" type="secondary" @click="cancel">{{ t('common.cancel') }}</a-button>
|
||||||
<a-button
|
<a-button v-if="showSyncConfig" class="mr-[12px]" type="outline" @click="clearThisChangeHandler">
|
||||||
v-if="caseDetail.inconsistentWithApi"
|
|
||||||
class="mr-[12px]"
|
|
||||||
type="outline"
|
|
||||||
@click="clearThisChangeHandler"
|
|
||||||
>
|
|
||||||
{{ t('case.ignoreThisChange') }}
|
{{ t('case.ignoreThisChange') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" :loading="syncLoading" :disabled="!checkType.length" @click="confirmSync">
|
<a-button type="primary" :loading="syncLoading" :disabled="!checkType.length" @click="confirmSync">
|
||||||
{{ caseDetail.inconsistentWithApi ? t('case.apiSyncChange') : t('common.confirm') }}
|
{{ showSyncConfig ? t('case.apiSyncChange') : t('common.confirm') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,7 +133,7 @@
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'close'): void;
|
(e: 'close'): void;
|
||||||
(e: 'clearThisChange'): void;
|
(e: 'clearThisChange', isEvery: boolean): void;
|
||||||
(e: 'sync', mergeRequest: RequestParam): void;
|
(e: 'sync', mergeRequest: RequestParam): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -181,13 +172,20 @@
|
||||||
ignoreApiChange: false,
|
ignoreApiChange: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkType = ref([]);
|
const initCheckList = [
|
||||||
|
RequestComposition.HEADER,
|
||||||
|
RequestComposition.BODY,
|
||||||
|
RequestComposition.QUERY,
|
||||||
|
RequestComposition.REST,
|
||||||
|
];
|
||||||
|
|
||||||
|
const checkType = ref([...initCheckList]);
|
||||||
|
|
||||||
const form = ref({ ...initForm });
|
const form = ref({ ...initForm });
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
form.value = { ...initForm };
|
form.value = { ...initForm };
|
||||||
checkType.value = [];
|
checkType.value = [...initCheckList];
|
||||||
showDiffVisible.value = false;
|
showDiffVisible.value = false;
|
||||||
emit('close');
|
emit('close');
|
||||||
}
|
}
|
||||||
|
@ -321,11 +319,14 @@
|
||||||
getBodyData(RequestBodyFormat.FORM_DATA);
|
getBodyData(RequestBodyFormat.FORM_DATA);
|
||||||
getBodyData(RequestBodyFormat.WWW_FORM);
|
getBodyData(RequestBodyFormat.WWW_FORM);
|
||||||
}
|
}
|
||||||
|
// 是否显示配置项
|
||||||
|
const showSyncConfig = computed(() => caseDetail.value.inconsistentWithApi && !form.value.ignoreApiChange);
|
||||||
|
|
||||||
const syncCaseDetail = ref<Record<string, any>>({});
|
const syncCaseDetail = ref<Record<string, any>>({});
|
||||||
|
|
||||||
// 同步
|
// 同步
|
||||||
async function confirmSync() {
|
async function confirmSync() {
|
||||||
if (!caseDetail.value.inconsistentWithApi) {
|
if (!caseDetail.value.inconsistentWithApi || form.value.ignoreApiChange) {
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -410,16 +411,20 @@
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const ignoreThisChangeLoading = ref(false);
|
||||||
// 忽略并清除本次变更
|
// 忽略并清除本次变更
|
||||||
async function clearThisChangeHandler() {
|
async function clearThisChangeHandler() {
|
||||||
if (props.activeApiCaseId) {
|
if (props.activeApiCaseId) {
|
||||||
|
ignoreThisChangeLoading.value = true;
|
||||||
try {
|
try {
|
||||||
await clearThisChange(props.activeApiCaseId);
|
await clearThisChange(props.activeApiCaseId);
|
||||||
getRequestDetail(props.activeDefinedId, props.activeApiCaseId);
|
getRequestDetail(props.activeDefinedId, props.activeApiCaseId);
|
||||||
emit('clearThisChange');
|
emit('clearThisChange', true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
ignoreThisChangeLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +434,7 @@
|
||||||
await ignoreEveryTimeChange(props.activeApiCaseId, newValue as boolean);
|
await ignoreEveryTimeChange(props.activeApiCaseId, newValue as boolean);
|
||||||
Message.success(newValue ? t('case.eachHasBeenIgnored') : t('case.eachHasBeenIgnoredClosed'));
|
Message.success(newValue ? t('case.eachHasBeenIgnored') : t('case.eachHasBeenIgnoredClosed'));
|
||||||
getRequestDetail(props.activeDefinedId, props.activeApiCaseId);
|
getRequestDetail(props.activeDefinedId, props.activeApiCaseId);
|
||||||
emit('clearThisChange');
|
emit('clearThisChange', false);
|
||||||
return false;
|
return false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
|
@ -112,7 +112,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const form = ref<batchSyncForm>(cloneDeep(initForm));
|
const form = ref<batchSyncForm>(cloneDeep(initForm));
|
||||||
const checkType = ref([]);
|
const initCheckList = [
|
||||||
|
RequestComposition.HEADER,
|
||||||
|
RequestComposition.BODY,
|
||||||
|
RequestComposition.QUERY,
|
||||||
|
RequestComposition.REST,
|
||||||
|
];
|
||||||
|
const checkType = ref([...initCheckList]);
|
||||||
|
|
||||||
const checkList = ref([
|
const checkList = ref([
|
||||||
{
|
{
|
||||||
|
@ -136,7 +142,7 @@
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
form.value = cloneDeep(initForm);
|
form.value = cloneDeep(initForm);
|
||||||
checkType.value = [];
|
checkType.value = [...initCheckList];
|
||||||
showBatchSyncModal.value = false;
|
showBatchSyncModal.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue