fix(项目管理): 环境添加http补充认证方式
This commit is contained in:
parent
e2f5192b16
commit
b1eabb9490
|
@ -1,4 +1,5 @@
|
||||||
import { EnableKeyValueParam, ExecuteConditionProcessor } from '@/models/apiTest/common';
|
import { EnableKeyValueParam, ExecuteConditionProcessor } from '@/models/apiTest/common';
|
||||||
|
import { RequestAuthType } from '@/enums/apiEnum';
|
||||||
|
|
||||||
export interface EnvListItem {
|
export interface EnvListItem {
|
||||||
mock?: boolean;
|
mock?: boolean;
|
||||||
|
@ -134,6 +135,12 @@ export interface DragParam {
|
||||||
moveId: string;
|
moveId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AuthForm {
|
||||||
|
userName: string;
|
||||||
|
password: string;
|
||||||
|
valid: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface HttpForm {
|
export interface HttpForm {
|
||||||
id?: string;
|
id?: string;
|
||||||
protocol: string;
|
protocol: string;
|
||||||
|
@ -156,6 +163,11 @@ export interface HttpForm {
|
||||||
path: '';
|
path: '';
|
||||||
condition: '';
|
condition: '';
|
||||||
};
|
};
|
||||||
|
authConfig: {
|
||||||
|
authType: keyof typeof RequestAuthType;
|
||||||
|
basicAuth: AuthForm;
|
||||||
|
digestAuth: AuthForm;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
// 环境列表项
|
// 环境列表项
|
||||||
export interface EnvironmentItem {
|
export interface EnvironmentItem {
|
||||||
|
|
|
@ -222,7 +222,6 @@
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
store.currentEnvDetailInfo.mock = true;
|
store.currentEnvDetailInfo.mock = true;
|
||||||
getParameters();
|
|
||||||
await updateOrAddEnv({ fileList: [], request: getParameters() });
|
await updateOrAddEnv({ fileList: [], request: getParameters() });
|
||||||
setState(true);
|
setState(true);
|
||||||
|
|
||||||
|
|
|
@ -170,15 +170,58 @@
|
||||||
/>
|
/>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<httpHeader
|
||||||
|
v-model:params="form.headers"
|
||||||
|
:layout="activeLayout"
|
||||||
|
:disabled-param-value="false"
|
||||||
|
:disabled-except-param="false"
|
||||||
|
:second-box-height="secondBoxHeight"
|
||||||
|
:type-title="t('project.environmental.requestHeader')"
|
||||||
|
/>
|
||||||
|
<a-form-item class="mt-4" asterisk-position="end" field="path" :label="t('project.environmental.http.authType')">
|
||||||
|
<a-radio-group v-model:model-value="form.authConfig.authType" class="mb-[16px]">
|
||||||
|
<a-radio :value="RequestAuthType.NONE">No Auth</a-radio>
|
||||||
|
<a-radio :value="RequestAuthType.BASIC">Basic Auth</a-radio>
|
||||||
|
<a-radio :value="RequestAuthType.DIGEST">Digest Auth</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
<a-form v-if="form.authConfig.authType === 'BASIC'" ref="authFormRef" :model="form" layout="vertical">
|
||||||
|
<a-form-item :label="t('apiTestDebug.username')">
|
||||||
|
<a-input
|
||||||
|
v-model:model-value="form.authConfig.basicAuth.userName"
|
||||||
|
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||||
|
class="w-[450px]"
|
||||||
|
:max-length="255"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="t('apiTestDebug.password')">
|
||||||
|
<a-input-password
|
||||||
|
v-model:model-value="form.authConfig.basicAuth.password"
|
||||||
|
autocomplete="new-password"
|
||||||
|
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||||
|
class="w-[450px]"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<a-form v-else-if="form.authConfig.authType == 'DIGEST'" ref="authFormRef" :model="form" layout="vertical">
|
||||||
|
<a-form-item :label="t('apiTestDebug.username')">
|
||||||
|
<a-input
|
||||||
|
v-model:model-value="form.authConfig.digestAuth.userName"
|
||||||
|
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||||
|
class="w-[450px]"
|
||||||
|
:max-length="255"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="t('apiTestDebug.password')">
|
||||||
|
<a-input-password
|
||||||
|
v-model:model-value="form.authConfig.digestAuth.password"
|
||||||
|
autocomplete="new-password"
|
||||||
|
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||||
|
class="w-[450px]"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<httpHeader
|
|
||||||
v-model:params="form.headers"
|
|
||||||
:layout="activeLayout"
|
|
||||||
:disabled-param-value="false"
|
|
||||||
:disabled-except-param="false"
|
|
||||||
:second-box-height="secondBoxHeight"
|
|
||||||
:type-title="t('project.environmental.requestHeader')"
|
|
||||||
/>
|
|
||||||
</MsDrawer>
|
</MsDrawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -198,6 +241,7 @@
|
||||||
|
|
||||||
import type { ModuleTreeNode } from '@/models/common';
|
import type { ModuleTreeNode } from '@/models/common';
|
||||||
import { HttpForm } from '@/models/projectManagement/environmental';
|
import { HttpForm } from '@/models/projectManagement/environmental';
|
||||||
|
import { RequestAuthType } from '@/enums/apiEnum';
|
||||||
|
|
||||||
const httpHeader = defineAsyncComponent(() => import('@/views/api-test/components/requestComposition/header.vue'));
|
const httpHeader = defineAsyncComponent(() => import('@/views/api-test/components/requestComposition/header.vue'));
|
||||||
|
|
||||||
|
@ -242,6 +286,19 @@
|
||||||
path: '',
|
path: '',
|
||||||
condition: '',
|
condition: '',
|
||||||
},
|
},
|
||||||
|
authConfig: {
|
||||||
|
authType: 'NONE',
|
||||||
|
basicAuth: {
|
||||||
|
userName: '',
|
||||||
|
password: '',
|
||||||
|
valid: true,
|
||||||
|
},
|
||||||
|
digestAuth: {
|
||||||
|
userName: '',
|
||||||
|
password: '',
|
||||||
|
valid: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const form = ref<HttpForm>({ ...initForm });
|
const form = ref<HttpForm>({ ...initForm });
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<MsSplitBox>
|
<MsSplitBox>
|
||||||
<template #first>
|
<template #first>
|
||||||
<div class="p-[24px]">
|
<div class="p-[24px]">
|
||||||
<div
|
<!-- TODO:这个版本环境不展示默认项目环境 -->
|
||||||
|
<!-- <div
|
||||||
><a-radio-group
|
><a-radio-group
|
||||||
v-model:model-value="showType"
|
v-model:model-value="showType"
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -13,11 +14,11 @@
|
||||||
<a-radio v-permission="['PROJECT_ENVIRONMENT:READ']" value="PROJECT">{{
|
<a-radio v-permission="['PROJECT_ENVIRONMENT:READ']" value="PROJECT">{{
|
||||||
t('project.environmental.env')
|
t('project.environmental.env')
|
||||||
}}</a-radio>
|
}}</a-radio>
|
||||||
<!-- <a-radio v-permission="['PROJECT_ENVIRONMENT:READ']" value="PROJECT_GROUP">{{
|
<a-radio v-permission="['PROJECT_ENVIRONMENT:READ']" value="PROJECT_GROUP">{{
|
||||||
t('project.environmental.envGroup')
|
t('project.environmental.envGroup')
|
||||||
}}</a-radio> -->
|
}}</a-radio>
|
||||||
</a-radio-group></div
|
</a-radio-group></div
|
||||||
>
|
> -->
|
||||||
<template v-if="showType === 'PROJECT'">
|
<template v-if="showType === 'PROJECT'">
|
||||||
<a-input-search
|
<a-input-search
|
||||||
v-model="keyword"
|
v-model="keyword"
|
||||||
|
|
Loading…
Reference in New Issue