perf: EAB授权支持绑定邮箱,支持公共EAB设置

This commit is contained in:
xiaojunnuo
2024-10-14 03:17:10 +08:00
parent e8b617b80c
commit 07043aff0c
32 changed files with 374 additions and 57 deletions
@@ -58,10 +58,43 @@ export async function DeleteBatch(ids: any[]) {
});
}
export async function SetDisabled(bean: { id?: number; name?: string; type?: string; disabled: boolean }) {
export async function SetDisabled(data: { id?: number; name?: string; type?: string; disabled: boolean }) {
return await request({
url: apiPrefix + "/setDisabled",
method: "post",
data: bean
data: data
});
}
export type PluginConfigBean = {
name: string;
disabled: boolean;
sysSetting: {
input?: Record<string, any>;
};
};
export type CertApplyPluginSysInput = {
googleCommonEabAccessId: number;
};
export type PluginSysSetting<T> = {
input?: T;
};
export type CommPluginConfig = {
CertApply?: PluginSysSetting<CertApplyPluginSysInput>;
};
export async function GetCommPluginConfigs(): Promise<CommPluginConfig> {
return await request({
url: apiPrefix + "/getCommPluginConfigs",
method: "post"
});
}
export async function SaveCommPluginConfigs(data: CommPluginConfig): Promise<void> {
return await request({
url: apiPrefix + "/saveCommPluginConfigs",
method: "post",
data
});
}
@@ -0,0 +1,62 @@
<template>
<fs-page class="page-plugin-config">
<template #header>
<div class="title">证书插件配置</div>
</template>
<div class="sys-plugin-config settings-form">
<a-form :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed">
<a-form-item label="公共Google EAB授权" :name="['CertApply', 'input', 'googleCommonEabAccessId']">
<access-selector v-model:model-value="formState.CertApply.input.googleCommonEabAccessId" type="eab" from="sys"></access-selector>
<div class="helper">设置公共Google EAB授权给用户使用避免用户自己去翻墙获取Google EAB授权</div>
</a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button>
</a-form-item>
</a-form>
</div>
</fs-page>
</template>
<script lang="ts" setup>
import AccessSelector from "/@/views/certd/access/access-selector/index.vue";
import { reactive, ref } from "vue";
import { CommPluginConfig, GetCommPluginConfigs, SaveCommPluginConfigs } from "/@/views/sys/plugin/api";
import { merge } from "lodash-es";
import { notification } from "ant-design-vue";
defineOptions({
name: "SysPluginConfig"
});
const formState = reactive<Partial<CommPluginConfig>>({
CertApply: {
input: {}
}
});
async function loadForm() {
const res = await GetCommPluginConfigs();
merge(formState, res);
}
loadForm();
const saveLoading = ref(false);
const onFinish = async (form: any) => {
try {
saveLoading.value = true;
await SaveCommPluginConfigs(form);
notification.success({
message: "保存成功"
});
} finally {
saveLoading.value = false;
}
};
const onFinishFailed = (errorInfo: any) => {
console.log("Failed:", errorInfo);
};
</script>
<style lang="less"></style>