fix(全局): bug修复

This commit is contained in:
baiqi 2024-04-22 11:58:28 +08:00 committed by 刘瑞斌
parent de8c3ca502
commit cdbe4af91b
9 changed files with 57 additions and 27 deletions

View File

@ -124,7 +124,7 @@
}
const { height } = useWindowSize();
appStore.innerHeight = height.value;
await userStore.initLocalConfig(); //
userStore.initLocalConfig(); //
// @desc: TODO便
appStore.getProjectInfos();
});

View File

@ -343,8 +343,8 @@
// TODO: MessageResourceType
const resourceTypeRouteMap: Record<string, string> = {
[MessageResourceType.BUG_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL,
[MessageResourceType.BUG_SYNC_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL,
[MessageResourceType.BUG_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_INDEX,
[MessageResourceType.BUG_SYNC_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_INDEX,
[MessageResourceType.FUNCTIONAL_CASE_TASK]: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE_DETAIL,
[MessageResourceType.CASE_REVIEW_TASK]: CaseManagementRouteEnum.CASE_MANAGEMENT_REVIEW_DETAIL,
[MessageResourceType.API_DEFINITION_TASK]: ApiTestRouteEnum.API_TEST_MANAGEMENT,

View File

@ -171,7 +171,9 @@
>
<div class="break-all text-[var(--color-text-3)]">{{ t('ms.paramsInput.preview') }}</div>
<a-spin :loading="previewLoading" class="flex flex-1 flex-wrap items-baseline gap-[8px]">
<div class="param-preview">{{ paramPreview }}</div>
<div v-show="paramPreview" class="ms-params-input-setting-trigger-content-scroll-preview">
{{ paramPreview }}
</div>
<MsButton type="text" @click="getMockValue">{{ t('ms.paramsInput.previewClick') }}</MsButton>
</a-spin>
</div>
@ -557,15 +559,6 @@
}
const JMeterVarsOptions = genJMeterVarsOptions();
function cancel() {
paramFormRef.value?.resetFields();
paramSettingType.value = 'mock';
paramSettingVisible.value = false;
currentParamsInputGroup.value = [];
currentParamsFuncInputGroup.value = [];
paramForm.value = { ...defaultParamForm };
}
/**
* 应用 Mock类型变量和函数
*/
@ -615,6 +608,16 @@
}
}
function cancel() {
paramFormRef.value?.resetFields();
paramSettingType.value = 'mock';
paramSettingVisible.value = false;
currentParamsInputGroup.value = [];
currentParamsFuncInputGroup.value = [];
paramForm.value = { ...defaultParamForm };
paramPreview.value = '';
}
watch(
() => popoverVisible.value,
(val) => {

View File

@ -112,11 +112,15 @@
};
const handleMoreActionLength = () => {
if (moreAction.value && moreAction.value.length === 0) {
moreActionLength.value = 0;
} else {
moreAction.value?.forEach((key) => {
if (key.permission && hasAllPermission(key.permission as string[])) {
moreActionLength.value += 1;
}
});
}
};
const computedLastVisibleIndex = () => {

View File

@ -186,10 +186,14 @@ const useUserStore = defineStore('user', {
const res = await getLocalConfig();
if (res) {
const apiLocalExec = res.find((e) => e.type === 'API');
if (apiLocalExec) {
if (apiLocalExec && apiLocalExec.userUrl) {
this.hasLocalExec = true;
this.isPriorityLocalExec = apiLocalExec.enable || false;
this.localExecuteUrl = apiLocalExec.userUrl || '';
} else {
this.hasLocalExec = false;
this.isPriorityLocalExec = false;
this.localExecuteUrl = '';
}
}
} catch (error) {

View File

@ -167,6 +167,13 @@
const environmentId = ref(appStore.currentEnvConfig?.id);
watch(
() => appStore.currentEnvConfig?.id,
(val) => {
environmentId.value = val;
}
);
const formRef = ref<FormInstance>();
const requestCompositionRef = ref<InstanceType<typeof requestComposition>>();
const defaultCaseParams = inject<RequestParam>('defaultCaseParams');

View File

@ -40,7 +40,7 @@
<a-input
v-if="isShowEditStepNameInput"
ref="stepNameInputRef"
v-model:model-value="requestVModel.name"
v-model:model-value="requestVModel.stepName"
class="flex-1"
:placeholder="t('apiScenario.pleaseInputStepName')"
:max-length="255"
@ -289,6 +289,7 @@
v-model:config="requestVModel.children[0].preProcessorConfig"
is-definition
:disabled="!isEditableApi"
:tip-content="t('apiScenario.openGlobalPreConditionTip')"
@change="handleActiveDebugChange"
/>
<postcondition
@ -298,6 +299,7 @@
:layout="activeLayout"
:disabled="!isEditableApi"
:second-box-height="secondBoxHeight"
:tip-content="t('apiScenario.openGlobalPostConditionTip')"
is-definition
@change="handleActiveDebugChange"
/>
@ -439,6 +441,7 @@
label: string;
name: string;
stepId: string | number; // id
stepName: string; //
resourceId: string | number; // id
isNew: boolean;
protocol: string;
@ -500,6 +503,7 @@
name: '',
type: 'api',
stepId: '',
stepName: '',
resourceId: '',
customizeRequest: true,
customizeRequestEnvEnable: false,
@ -576,9 +580,9 @@
_stepType.value.isQuoteApi ||
props.step?.stepType === ScenarioStepType.CUSTOM_REQUEST
) {
return requestVModel.value.name || props.step?.name;
return requestVModel.value.stepName || requestVModel.value.name || props.step?.name;
}
return requestVModel.value.name || t('apiScenario.customApi');
return requestVModel.value.stepName || requestVModel.value.name || t('apiScenario.customApi');
});
//
const showEnvPrefix = computed(
@ -1066,7 +1070,7 @@
responseActiveTab: ResponseComposition.BODY,
protocol: requestVModel.value.protocol,
method: isHttpProtocol.value ? requestVModel.value.method : requestVModel.value.protocol,
name: requestVModel.value.name,
name: requestVModel.value.stepName || requestVModel.value.name,
unSaved: requestVModel.value.unSaved,
customizeRequest: requestVModel.value.customizeRequest,
customizeRequestEnvEnable: requestVModel.value.customizeRequestEnvEnable,
@ -1232,6 +1236,7 @@
unSaved: false,
isNew: false,
label: res.name,
stepName: props.step?.name || res.name,
...res.request,
...res,
response: cloneDeep(defaultResponse),
@ -1316,6 +1321,7 @@
...defaultApiParams,
...props.request,
name: props.step?.name || props.request.name,
stepName: props.step?.name || props.request.name,
url: props.request.path, // path
activeTab: contentTabList.value[0].value,
responseActiveTab: ResponseComposition.BODY,

View File

@ -17,10 +17,9 @@
</div>
<stepType v-if="activeStep?.stepType" :step="activeStep" class="mr-[4px]" />
<a-input
v-if="activeStep?.name"
v-show="isShowEditStepNameInput"
ref="stepNameInputRef"
v-model:model-value="activeStep.name"
v-model:model-value="requestVModel.stepName"
class="flex-1"
:placeholder="t('apiScenario.pleaseInputStepName')"
:max-length="255"
@ -367,6 +366,7 @@
const defaultApiParams: RequestParam = {
label: '',
name: '',
stepName: '',
type: 'api',
stepId: '',
resourceId: '',
@ -493,6 +493,9 @@
});
}
function updateStepName() {
if (requestVModel.value.stepName === '') {
requestVModel.value.stepName = requestVModel.value.name;
}
isShowEditStepNameInput.value = false;
}
@ -900,6 +903,7 @@
protocol: requestVModel.value.protocol,
method: isHttpProtocol.value ? requestVModel.value.method : requestVModel.value.protocol,
name: requestVModel.value.name,
stepName: requestVModel.value.stepName,
customizeRequestEnvEnable: requestVModel.value.customizeRequestEnvEnable,
children: [
{
@ -1056,6 +1060,7 @@
...res,
response: cloneDeep(defaultResponse),
url: res.path,
stepName: activeStep.value?.name || res.name,
name: res.name, // requestnamenull
resourceId: res.id,
stepId: activeStep.value?.uniqueId || '',
@ -1104,6 +1109,7 @@
...props.request,
isNew: false,
stepId: activeStep.value?.uniqueId || '',
stepName: activeStep.value?.name || props.request?.name || '',
});
if (isQuote.value || isCopyNeedInit.value) {
// (request.requestrequest null)

View File

@ -1538,7 +1538,7 @@
handleCreateStep(
{
stepType: ScenarioStepType.CUSTOM_REQUEST,
name: request.name || t('apiScenario.customApi'),
name: request.stepName || request.name || t('apiScenario.customApi'),
config: {
protocol: request.protocol,
method: request.method,
@ -1601,7 +1601,7 @@
...activeStep.value.config,
method: request.method,
};
activeStep.value.name = request.name;
activeStep.value.name = request.stepName || request.name;
emit('updateResource', request.uploadFileIds, request.linkFileIds);
activeStep.value = undefined;
}