mirror of
https://gitee.com/mirrors/AllinSSL.git
synced 2026-03-09 16:21:10 +08:00
【新增】插件git同步模块,用于同步项目内容,加速项目开发
【调整】前端暗色问题
This commit is contained in:
@@ -129,6 +129,8 @@ export default defineComponent({
|
||||
// 错误信息
|
||||
const errorMessage = ref('')
|
||||
|
||||
console.log(props.type)
|
||||
|
||||
/**
|
||||
* @description 跳转到DNS提供商授权页面
|
||||
*/
|
||||
@@ -145,12 +147,11 @@ export default defineComponent({
|
||||
return (
|
||||
<div class="flex items-center">
|
||||
{option.label ? (
|
||||
<NFlex>
|
||||
<SvgIcon icon={`resources-${option.type}`} size="2rem" />
|
||||
<NText>{option.label}</NText>
|
||||
</NFlex>
|
||||
renderLabel(option)
|
||||
) : (
|
||||
<NText>{props.type === 'dns' ? $t('t_3_1745490735059') : $t('t_19_1745735766810')}</NText>
|
||||
<NText class="text-[#aaa]">
|
||||
{props.type === 'dns' ? $t('t_0_1747019621052', []) : $t('t_0_1746858920894')}
|
||||
</NText>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
@@ -247,18 +248,22 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.value,
|
||||
() => {
|
||||
loadDnsProviders(props.type)
|
||||
// loadDnsProviders(props.type)
|
||||
handleUpdateValue(props.value)
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
loadDnsProviders(props.type)
|
||||
})
|
||||
|
||||
return () => (
|
||||
<NSpin show={isLoading.value}>
|
||||
<NGrid cols={24} class={props.customClass}>
|
||||
<NFormItemGi
|
||||
span={props.isAddMode ? 13 : 24}
|
||||
label={props.type === 'dns' ? $t('t_3_1745735765112') : $t('t_0_1745744902975')}
|
||||
label={props.type === 'dns' ? $t('t_3_1745735765112') : $t('t_0_1746754500246')}
|
||||
path={props.path}
|
||||
>
|
||||
<NSelect
|
||||
@@ -268,7 +273,7 @@ export default defineComponent({
|
||||
renderTag={renderSingleSelectTag}
|
||||
filterable
|
||||
filter={handleFilter}
|
||||
placeholder={props.type === 'dns' ? $t('t_3_1745490735059') : $t('t_1_1745744905566')}
|
||||
placeholder={props.type === 'dns' ? $t('t_3_1745490735059') : $t('t_0_1746858920894')}
|
||||
v-model:value={param.value.value}
|
||||
onUpdateValue={handleUpdateValue}
|
||||
disabled={props.disabled}
|
||||
@@ -276,7 +281,7 @@ export default defineComponent({
|
||||
empty: () => {
|
||||
return (
|
||||
<span class="text-[1.4rem]">
|
||||
{errorMessage.value || (props.type === 'dns' ? $t('t_3_1745490735059') : $t('t_1_1745744905566'))}
|
||||
{errorMessage.value || (props.type === 'dns' ? $t('t_1_1746858922914') : $t('t_2_1746858923964'))}
|
||||
</span>
|
||||
)
|
||||
},
|
||||
@@ -286,7 +291,7 @@ export default defineComponent({
|
||||
{props.isAddMode && (
|
||||
<NFormItemGi span={11}>
|
||||
<NButton class="mx-[8px]" onClick={goToAddDnsProvider} disabled={props.disabled}>
|
||||
{props.type === 'dns' ? $t('t_1_1746004861166') : $t('t_0_1745748292337')}
|
||||
{props.type === 'dns' ? $t('t_1_1746004861166') : $t('t_3_1746858920060')}
|
||||
</NButton>
|
||||
<NButton onClick={() => loadDnsProviders(props.type)} loading={isLoading.value} disabled={props.disabled}>
|
||||
{$t('t_0_1746497662220')}
|
||||
|
||||
47
frontend/apps/allin-ssl/src/components/emptyState/index.tsx
Normal file
47
frontend/apps/allin-ssl/src/components/emptyState/index.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import { NEmpty, NButton } from 'naive-ui'
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
/**
|
||||
* 空状态提示组件,带有添加按钮和社区链接
|
||||
* @param addButtonText 添加按钮文本
|
||||
* @param onAddClick 添加按钮点击事件
|
||||
*/
|
||||
interface EmptyActionPromptProps {
|
||||
addButtonText: string
|
||||
onAddClick: () => void
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EmptyActionPrompt',
|
||||
props: {
|
||||
addButtonText: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
onAddClick: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props: EmptyActionPromptProps) {
|
||||
return () => (
|
||||
<div class="flex justify-center items-center h-full">
|
||||
<NEmpty class="px-[4rem]">
|
||||
请先
|
||||
<NButton text type="primary" size="small" onClick={props.onAddClick}>
|
||||
{props.addButtonText}
|
||||
</NButton>
|
||||
,有问题或建议可提
|
||||
<NButton text tag="a" target="_blank" type="primary" href="https://github.com/allinssl/allinssl/issues">
|
||||
Issues
|
||||
</NButton>
|
||||
,也可在Github给我们
|
||||
<NButton text tag="a" target="_blank" type="primary" href="https://github.com/allinssl/allinssl">
|
||||
Star
|
||||
</NButton>
|
||||
,您的参与对AllinSSL极其重要,感谢。
|
||||
</NEmpty>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -4,8 +4,8 @@ import { useStore } from '@components/flowChart/useStore'
|
||||
import { $t } from '@locales/index'
|
||||
import rules from './verify'
|
||||
import DnsProviderSelect from '@components/dnsProviderSelect'
|
||||
|
||||
import type { ApplyNodeConfig } from '@components/flowChart/types'
|
||||
import { deepClone } from '@baota/utils/data'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApplyNodeDrawer',
|
||||
@@ -15,7 +15,15 @@ export default defineComponent({
|
||||
type: Object as PropType<{ id: string; config: ApplyNodeConfig }>,
|
||||
default: () => ({
|
||||
id: '',
|
||||
config: {},
|
||||
config: {
|
||||
domains: '',
|
||||
email: '',
|
||||
provider_id: '',
|
||||
provider: '',
|
||||
end_day: 30,
|
||||
name_server: '',
|
||||
skip_check: 1,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
@@ -24,14 +32,9 @@ export default defineComponent({
|
||||
// 弹窗辅助
|
||||
const { confirm } = useModalHooks()
|
||||
// 获取表单助手函数
|
||||
const { useFormInput } = useFormHooks()
|
||||
|
||||
const { useFormInput, useFormHelp, useFormSwitch } = useFormHooks()
|
||||
// 表单参数
|
||||
const param = ref<ApplyNodeConfig>(
|
||||
Object.keys(props.node.config).length > 0
|
||||
? props.node.config
|
||||
: { domains: '', email: '', provider_id: '', provider: '', end_day: 30 },
|
||||
)
|
||||
const param = ref(deepClone(props.node.config))
|
||||
|
||||
// 表单渲染配置
|
||||
const config = computed(() => {
|
||||
@@ -39,9 +42,18 @@ export default defineComponent({
|
||||
return [
|
||||
useFormInput($t('t_17_1745227838561'), 'domains', {
|
||||
placeholder: $t('t_0_1745735774005'),
|
||||
onInput: (val: string) => {
|
||||
param.value.domains = val.trim() // 去除空格
|
||||
param.value.domains = param.value.domains.replace(/,/g, ',') // 中文逗号分隔
|
||||
param.value.domains = param.value.domains.replace(/;/g, ',') // 去除分号
|
||||
},
|
||||
onFocus: () => {
|
||||
param.value.domains = param.value.domains.replace(/,^/g, '') // 中文逗号分隔
|
||||
},
|
||||
}),
|
||||
useFormInput($t('t_1_1745735764953'), 'email', {
|
||||
placeholder: $t('t_2_1745735773668'),
|
||||
onInput: (val: string) => (param.value.email = val.trim()),
|
||||
}),
|
||||
{
|
||||
type: 'custom' as const,
|
||||
@@ -76,6 +88,33 @@ export default defineComponent({
|
||||
)
|
||||
},
|
||||
},
|
||||
useFormInput(
|
||||
$t('t_0_1747106957037'),
|
||||
'name_server',
|
||||
{
|
||||
placeholder: $t('t_1_1747106961747'),
|
||||
onInput: (val: string) => {
|
||||
param.value.name_server = val.trim() // 去除空格
|
||||
param.value.name_server = param.value.name_server.replace(/,/g, ',') // 中文逗号分隔
|
||||
param.value.name_server = param.value.name_server.replace(/;/g, ',') // 去除分号
|
||||
},
|
||||
onFocus: () => {
|
||||
param.value.name_server = param.value.name_server.replace(/,^/g, '') // 中文逗号分隔
|
||||
},
|
||||
},
|
||||
{ showRequireMark: false },
|
||||
),
|
||||
useFormSwitch($t('t_2_1747106957037'), 'skip_check', {}, { showRequireMark: false }),
|
||||
useFormHelp([
|
||||
{
|
||||
content: $t('t_0_1747040228657'),
|
||||
isHtml: false,
|
||||
},
|
||||
{
|
||||
content: $t('t_1_1747040226143'),
|
||||
isHtml: false,
|
||||
},
|
||||
]),
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ export default {
|
||||
validator: (rule: FormItemRule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!isDomainGroup(value)) {
|
||||
reject(new Error($t('t_0_1745553910661')))
|
||||
reject(new Error($t('t_3_1747047218669')))
|
||||
} else if (!value) {
|
||||
reject(new Error($t('t_0_1746697487119')))
|
||||
reject(new Error($t('t_0_1744958839535')))
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import DnsProviderSelect from '@/components/dnsProviderSelect'
|
||||
|
||||
import styles from './index.module.css'
|
||||
import verifyRules from './verify'
|
||||
import { isArray } from '@baota/utils/type'
|
||||
import { deepClone } from '@baota/utils/data'
|
||||
|
||||
type StepStatus = 'process' | 'wait' | 'finish' | 'error'
|
||||
|
||||
@@ -26,6 +26,10 @@ export default defineComponent({
|
||||
config: {
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
inputs: {
|
||||
fromNodeId: '',
|
||||
name: '',
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -61,20 +65,13 @@ export default defineComponent({
|
||||
const current = ref(1) // 当前步骤
|
||||
const next = ref(true) // 是否是下一步
|
||||
const currentStatus = ref<StepStatus>('process') // 当前步骤状态
|
||||
// 表单参数
|
||||
const param = ref(
|
||||
Object.keys(props.node.config).length > 0
|
||||
? props.node.config
|
||||
: {
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
inputs: {
|
||||
fromNodeId: '',
|
||||
name: '',
|
||||
},
|
||||
},
|
||||
) as Ref<DeployNodeConfig & { inputs: DeployNodeInputsConfig }>
|
||||
|
||||
const param = ref(deepClone(props.node.config)) // 表单参数
|
||||
const provider = computed(() => {
|
||||
return param.value.provider
|
||||
? $t('t_4_1746858917773') + ':' + deployTypeOptions.find((item) => item.value === param.value.provider)?.label
|
||||
: $t('t_19_1745735766810')
|
||||
})
|
||||
// 表单配置
|
||||
const formConfig = computed(() => {
|
||||
const config = []
|
||||
@@ -107,8 +104,14 @@ export default defineComponent({
|
||||
case 'ssh':
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('证书文件路径(仅支持PEM格式)', 'certPath', { placeholder: $t('t_30_1746667591892') }),
|
||||
useFormInput('私钥文件路径', 'keyPath', { placeholder: $t('t_31_1746667593074') }),
|
||||
useFormInput('证书文件路径(仅支持PEM格式)', 'certPath', {
|
||||
placeholder: $t('t_30_1746667591892'),
|
||||
onInput: (val: string) => (param.value.certPath = val.trim()),
|
||||
}),
|
||||
useFormInput('私钥文件路径', 'keyPath', {
|
||||
placeholder: $t('t_31_1746667593074'),
|
||||
onInput: (val: string) => (param.value.keyPath = val.trim()),
|
||||
}),
|
||||
useFormTextarea(
|
||||
'前置命令',
|
||||
'beforeCmd',
|
||||
@@ -125,20 +128,62 @@ export default defineComponent({
|
||||
)
|
||||
break
|
||||
case 'btpanel-site':
|
||||
config.push(...[useFormInput('站点名称', 'siteName', { placeholder: $t('t_23_1745735766455') })])
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('站点名称', 'siteName', {
|
||||
placeholder: $t('t_23_1745735766455'),
|
||||
onInput: (val: string) => (param.value.siteName = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
break
|
||||
case '1panel-site':
|
||||
config.push(...[useFormInput('站点ID', 'site_id', { placeholder: $t('t_24_1745735766826') })])
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('站点ID', 'site_id', {
|
||||
placeholder: $t('t_24_1745735766826'),
|
||||
onInput: (val: string) => (param.value.site_id = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
break
|
||||
case 'tencentcloud-cdn':
|
||||
case 'aliyun-cdn':
|
||||
config.push(...[useFormInput('域名', 'domain', { placeholder: $t('t_0_1744958839535') })])
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('域名', 'domain', {
|
||||
placeholder: $t('t_0_1744958839535'),
|
||||
onInput: (val: string) => (param.value.domain = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
break
|
||||
case 'tencentcloud-cos':
|
||||
case 'aliyun-oss':
|
||||
config.push(...[useFormInput('域名', 'domain', { placeholder: $t('t_0_1744958839535') })])
|
||||
config.push(...[useFormInput('区域', 'region', { placeholder: $t('t_25_1745735766651') })])
|
||||
config.push(...[useFormInput('存储桶', 'bucket', { placeholder: $t('t_26_1745735767144') })])
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('域名', 'domain', {
|
||||
placeholder: $t('t_0_1744958839535'),
|
||||
onInput: (val: string) => (param.value.domain = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('区域', 'region', {
|
||||
placeholder: $t('t_25_1745735766651'),
|
||||
onInput: (val: string) => (param.value.region = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
config.push(
|
||||
...[
|
||||
useFormInput('存储桶', 'bucket', {
|
||||
placeholder: $t('t_26_1745735767144'),
|
||||
onInput: (val: string) => (param.value.bucket = val.trim()),
|
||||
}),
|
||||
],
|
||||
)
|
||||
break
|
||||
}
|
||||
return config
|
||||
@@ -149,7 +194,7 @@ export default defineComponent({
|
||||
* @returns
|
||||
*/
|
||||
const nextStep = async () => {
|
||||
if (!props.node.config.provider) return message.error($t('t_19_1745735766810'))
|
||||
if (!param.value.provider) return message.error($t('t_0_1746858920894'))
|
||||
|
||||
// 加载证书来源选项
|
||||
certOptions.value = findApplyUploadNodesUp(props.node.id).map((item) => {
|
||||
@@ -158,7 +203,7 @@ export default defineComponent({
|
||||
|
||||
if (!certOptions.value.length) {
|
||||
message.warning($t('t_3_1745748298161'))
|
||||
} else if (!props.node.config.inputs?.fromNodeId) {
|
||||
} else if (!param.value.inputs?.fromNodeId) {
|
||||
param.value.inputs = {
|
||||
name: certOptions.value[0]?.label || '',
|
||||
fromNodeId: certOptions.value[0]?.value || '',
|
||||
@@ -221,7 +266,7 @@ export default defineComponent({
|
||||
return () => (
|
||||
<div class={styles.container} style={cssVar.value}>
|
||||
<NSteps size="small" current={current.value} status={currentStatus.value}>
|
||||
<NStep title={$t('t_28_1745735766626')} description={$t('t_19_1745735766810')}></NStep>
|
||||
<NStep title={$t('t_28_1745735766626')} description={provider.value}></NStep>
|
||||
<NStep title={$t('t_29_1745735768933')} description={$t('t_2_1745738969878')}></NStep>
|
||||
</NSteps>
|
||||
{current.value === 1 && (
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isDomain } from '@baota/utils/business'
|
||||
export default {
|
||||
provider: {
|
||||
required: true,
|
||||
message: $t('t_19_1745735766810'),
|
||||
message: $t('t_0_1746858920894'),
|
||||
type: 'string',
|
||||
trigger: 'change',
|
||||
},
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
type: 'string',
|
||||
validator: (rule: FormItemRule, value: number) => {
|
||||
if (!value) {
|
||||
return new Error($t('t_1_1745744905566'))
|
||||
return new Error($t('t_0_1746858920894'))
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ import NotifyProviderSelect from '@components/notifyProviderSelect'
|
||||
import verify from './verify'
|
||||
|
||||
import { NotifyNodeConfig } from '@components/flowChart/types'
|
||||
import { deepClone } from '@baota/utils/data'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NotifyNodeDrawer',
|
||||
@@ -32,25 +33,18 @@ export default defineComponent({
|
||||
const { useFormInput, useFormTextarea, useFormCustom } = useFormHooks()
|
||||
const { confirm } = useModalHooks()
|
||||
const { handleError } = useError()
|
||||
const param = ref(
|
||||
Object.keys(props.node.config).length > 0
|
||||
? props.node.config
|
||||
: {
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
subject: '',
|
||||
body: '',
|
||||
},
|
||||
)
|
||||
const param = ref(deepClone(props.node.config))
|
||||
|
||||
// 表单渲染配置
|
||||
const formConfig: FormConfig = [
|
||||
useFormInput($t('t_0_1745920566646'), 'subject', {
|
||||
placeholder: $t('t_3_1745887835089'),
|
||||
onInput: (val: string) => (param.value.subject = val.trim()),
|
||||
}),
|
||||
useFormTextarea($t('t_1_1745920567200'), 'body', {
|
||||
placeholder: $t('t_4_1745887835265'),
|
||||
rows: 4,
|
||||
onInput: (val: string) => (param.value.body = val.trim()),
|
||||
}),
|
||||
useFormCustom(() => (
|
||||
<NotifyProviderSelect
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { FormConfig } from '@baota/naive-ui/types/form'
|
||||
// 类型
|
||||
import type { VNode } from 'vue'
|
||||
import { useError } from '@baota/hooks/error'
|
||||
import { deepClone } from '@baota/utils/data'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'StartNodeDrawer',
|
||||
@@ -17,7 +18,12 @@ export default defineComponent({
|
||||
// 节点配置数据
|
||||
node: {
|
||||
type: Object as PropType<{ id: string; config: StartNodeConfig }>,
|
||||
default: () => ({}),
|
||||
default: () => ({
|
||||
id: '',
|
||||
config: {
|
||||
exec_type: 'auto',
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
@@ -29,9 +35,7 @@ export default defineComponent({
|
||||
// 获取表单助手函数
|
||||
const { useFormRadio, useFormCustom } = useFormHooks()
|
||||
// 表单参数
|
||||
const param = ref<StartNodeConfig>(
|
||||
Object.values(props.node.config).length > 0 ? props.node.config : { exec_type: 'manual' },
|
||||
)
|
||||
const param = ref(deepClone(props.node.config))
|
||||
|
||||
// 周期类型选项
|
||||
const cycleTypeOptions = [
|
||||
@@ -58,9 +62,6 @@ export default defineComponent({
|
||||
month: { exec_type: 'auto', type: 'month', hour: 1, minute: 0, month: 1 },
|
||||
}
|
||||
|
||||
// 节点配置
|
||||
const { config } = toRefs(props.node)
|
||||
|
||||
// 创建时间输入input
|
||||
const createTimeInput = (value: number, updateFn: (val: number) => void, max: number, label: string): VNode => (
|
||||
<NInputGroup>
|
||||
@@ -115,7 +116,7 @@ export default defineComponent({
|
||||
</NFormItemGi>
|
||||
)}
|
||||
|
||||
<NFormItemGi span={config.value.type === 'day' ? 7 : 5} path="hour">
|
||||
<NFormItemGi span={param.value.type === 'day' ? 7 : 5} path="hour">
|
||||
{createTimeInput(
|
||||
param.value.hour || 0,
|
||||
(val: number) => (param.value.hour = val),
|
||||
@@ -124,7 +125,7 @@ export default defineComponent({
|
||||
)}
|
||||
</NFormItemGi>
|
||||
|
||||
<NFormItemGi span={config.value.type === 'day' ? 7 : 5} path="minute">
|
||||
<NFormItemGi span={param.value.type === 'day' ? 7 : 5} path="minute">
|
||||
{createTimeInput(
|
||||
param.value.minute || 0,
|
||||
(val: number) => (param.value.minute = val),
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { useForm, useFormHooks, useModalHooks } from '@baota/naive-ui/hooks'
|
||||
import { FormConfig } from '@baota/naive-ui/types/form'
|
||||
import { $t } from '@locales/index'
|
||||
import { useStore } from '@components/flowChart/useStore'
|
||||
import { useError } from '@baota/hooks/error'
|
||||
import { deepClone } from '@baota/utils/data'
|
||||
|
||||
import { $t } from '@locales/index'
|
||||
import { getCertList, uploadCert } from '@api/cert'
|
||||
import { useStore } from '@components/flowChart/useStore'
|
||||
import verifyRules from './verify'
|
||||
import { UploadNodeConfig } from '@components/flowChart/types'
|
||||
|
||||
import type { FormConfig } from '@baota/naive-ui/types/form'
|
||||
import type { UploadNodeConfig } from '@components/flowChart/types'
|
||||
import type { CertItem } from '@/types/cert'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UploadNodeDrawer',
|
||||
@@ -15,6 +20,7 @@ export default defineComponent({
|
||||
default: () => ({
|
||||
id: '',
|
||||
config: {
|
||||
cert_id: '',
|
||||
cert: '',
|
||||
key: '',
|
||||
},
|
||||
@@ -25,25 +31,69 @@ export default defineComponent({
|
||||
// 获取store
|
||||
const { updateNodeConfig, isRefreshNode } = useStore()
|
||||
// 获取表单助手函数
|
||||
const { useFormTextarea } = useFormHooks()
|
||||
const { useFormTextarea, useFormSelect, useFormHelp } = useFormHooks()
|
||||
// 节点配置数据
|
||||
const { config } = toRefs(props.node)
|
||||
const param = ref(deepClone(props.node.config))
|
||||
// 弹窗辅助
|
||||
const { confirm } = useModalHooks()
|
||||
const { confirm, options } = useModalHooks()
|
||||
// 错误处理
|
||||
const { handleError } = useError()
|
||||
// 弹窗配置
|
||||
const modalOptions = options()
|
||||
|
||||
// 证书列表
|
||||
const certList = ref<{ cert: string; key: string; label: string; value: string }[]>([
|
||||
{
|
||||
cert: '',
|
||||
key: '',
|
||||
label: '自定义证书',
|
||||
value: '',
|
||||
},
|
||||
])
|
||||
|
||||
// 表单渲染配置
|
||||
const formConfig: FormConfig = [
|
||||
useFormTextarea($t('t_34_1745735771147'), 'cert', {
|
||||
placeholder: $t('t_35_1745735781545'),
|
||||
rows: 6,
|
||||
}),
|
||||
useFormTextarea($t('t_36_1745735769443'), 'key', {
|
||||
placeholder: $t('t_37_1745735779980'),
|
||||
rows: 6,
|
||||
}),
|
||||
]
|
||||
const formConfig = computed(
|
||||
() =>
|
||||
[
|
||||
useFormSelect(
|
||||
$t('t_0_1747110184700'),
|
||||
'cert_id',
|
||||
certList.value,
|
||||
{
|
||||
filterable: true,
|
||||
onUpdateValue: (val: string) => {
|
||||
param.value.cert_id = val
|
||||
const item = findCertItem(val)
|
||||
if (item) {
|
||||
param.value.cert = item.cert
|
||||
param.value.key = item.key
|
||||
}
|
||||
},
|
||||
},
|
||||
{ showRequireMark: false },
|
||||
),
|
||||
useFormTextarea($t('t_34_1745735771147'), 'cert', {
|
||||
placeholder: $t('t_35_1745735781545'),
|
||||
rows: 6,
|
||||
readonly: param.value.cert_id === '' ? false : true,
|
||||
onInput: (val: string) => (param.value.cert = val.trim()),
|
||||
}),
|
||||
useFormTextarea($t('t_36_1745735769443'), 'key', {
|
||||
placeholder: $t('t_37_1745735779980'),
|
||||
rows: 6,
|
||||
readonly: param.value.cert_id === '' ? false : true,
|
||||
onInput: (val: string) => (param.value.key = val.trim()),
|
||||
}),
|
||||
useFormHelp([
|
||||
{
|
||||
content: $t('t_1_1747110191587'),
|
||||
},
|
||||
{
|
||||
content: $t('t_2_1747110193465'),
|
||||
},
|
||||
]),
|
||||
] as FormConfig,
|
||||
)
|
||||
|
||||
// 创建表单实例
|
||||
const {
|
||||
@@ -51,23 +101,68 @@ export default defineComponent({
|
||||
data,
|
||||
example,
|
||||
} = useForm<UploadNodeConfig>({
|
||||
defaultValue: config,
|
||||
defaultValue: param,
|
||||
config: formConfig,
|
||||
rules: verifyRules,
|
||||
})
|
||||
|
||||
/**
|
||||
* 查找证书项
|
||||
* @param {string} val 证书值
|
||||
* @returns {object} 证书项
|
||||
*/
|
||||
const findCertItem = (val: string) => {
|
||||
return certList.value.find((item) => item.value === val)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 渲染证书列表
|
||||
*/
|
||||
const renderCertList = async () => {
|
||||
try {
|
||||
const { data } = await getCertList({ p: 1, limit: 100 }).fetch()
|
||||
certList.value =
|
||||
data?.map((item: CertItem) => ({
|
||||
cert: item.cert,
|
||||
key: item.key,
|
||||
label: item.domains + ' 【 ' + item.issuer + ' 】',
|
||||
value: item.sha256,
|
||||
})) || []
|
||||
certList.value.unshift({
|
||||
cert: '',
|
||||
key: '',
|
||||
label: '自定义证书',
|
||||
value: '',
|
||||
})
|
||||
} catch (error) {
|
||||
certList.value = []
|
||||
handleError(error)
|
||||
}
|
||||
}
|
||||
onMounted(async () => {
|
||||
await renderCertList()
|
||||
})
|
||||
|
||||
modalOptions.value.confirmText = computed(() => {
|
||||
return param.value.cert_id === '' ? $t('t_3_1747110185110') : $t('t_2_1744861190040')
|
||||
})
|
||||
|
||||
// 确认事件触发
|
||||
confirm(async (close) => {
|
||||
try {
|
||||
await example.value?.validate()
|
||||
if (param.value.cert_id === '') {
|
||||
const { data } = await uploadCert(param.value).fetch()
|
||||
param.value.cert_id = data
|
||||
}
|
||||
updateNodeConfig(props.node.id, data.value) // 更新节点配置
|
||||
console.log(data.value, props.node.id)
|
||||
isRefreshNode.value = props.node.id // 刷新节点
|
||||
close()
|
||||
} catch (error) {
|
||||
handleError(error)
|
||||
}
|
||||
})
|
||||
|
||||
return () => (
|
||||
<div class="upload-node-drawer">
|
||||
<Form labelPlacement="top" />
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { FormItemRule, FormRules } from 'naive-ui'
|
||||
export default {
|
||||
key: {
|
||||
required: true,
|
||||
trigger: 'input',
|
||||
trigger: ['input', 'blur', 'focus'],
|
||||
validator: (rule: FormItemRule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!value) {
|
||||
@@ -16,7 +16,7 @@ export default {
|
||||
},
|
||||
cert: {
|
||||
required: true,
|
||||
trigger: 'input',
|
||||
trigger: ['input', 'blur', 'focus'],
|
||||
validator: (rule: FormItemRule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!value) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
.flowContainer {
|
||||
@apply flex relative box-border w-full h-[calc(100vh-19rem)] overflow-x-auto overflow-y-auto bg-slate-50 dark:bg-gray-900 ;
|
||||
@apply flex relative box-border w-full h-[calc(100vh-19rem)] overflow-x-auto overflow-y-auto bg-slate-50 ;
|
||||
}
|
||||
|
||||
.flowProcess {
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
/* 右侧配置区样式 */
|
||||
.configPanel {
|
||||
@apply flex flex-col w-[360px] min-w-[360px] bg-white dark:bg-gray-800 dark:border-gray-700 z-10 rounded-lg;
|
||||
@apply flex flex-col w-[360px] min-w-[360px] bg-white z-10 rounded-lg;
|
||||
}
|
||||
|
||||
.configHeader {
|
||||
@apply flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700;
|
||||
@apply flex items-center justify-between px-4 py-3 border-b border-gray-200 ;
|
||||
}
|
||||
|
||||
.configContent {
|
||||
@@ -45,5 +45,5 @@
|
||||
}
|
||||
|
||||
.emptyTip {
|
||||
@apply flex items-center justify-center h-full text-gray-400 dark:text-gray-500;
|
||||
@apply flex items-center justify-center h-full text-gray-400 ;
|
||||
}
|
||||
@@ -106,9 +106,9 @@ nodeOptions[APPLY] = () =>
|
||||
config: {
|
||||
domains: '',
|
||||
email: '',
|
||||
end_day: 30,
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
end_day: 30,
|
||||
},
|
||||
childNode: null,
|
||||
},
|
||||
@@ -125,6 +125,7 @@ nodeOptions[UPLOAD] = () =>
|
||||
name: '上传',
|
||||
type: UPLOAD,
|
||||
config: {
|
||||
cert_id: '',
|
||||
cert: '',
|
||||
key: '',
|
||||
},
|
||||
@@ -146,6 +147,10 @@ nodeOptions[DEPLOY] = () =>
|
||||
config: {
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
inputs: {
|
||||
fromNodeId: '',
|
||||
name: '',
|
||||
},
|
||||
},
|
||||
childNode: null,
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
id: 'deploy-1',
|
||||
name: '部署',
|
||||
type: 'deploy',
|
||||
inputs: {},
|
||||
inputs: [],
|
||||
config: {
|
||||
provider: '',
|
||||
provider_id: '',
|
||||
|
||||
@@ -203,6 +203,8 @@ export interface ApplyNodeConfig {
|
||||
provider_id: string // DNS提供商授权ID
|
||||
provider: string // DNS提供商
|
||||
end_day: number // 续签间隔
|
||||
name_server: string // DNS递归服务器
|
||||
skip_check: number // 跳过检查
|
||||
// 高级功能
|
||||
// algorithm: 'RSA2048' | 'RSA3072' | 'RSA4096' | 'RSA8192' | 'EC256' | 'EC384' // 数字证书算法
|
||||
// dnsServer?: string // 指定DNS解析服务器
|
||||
@@ -229,11 +231,10 @@ export interface DeployConfig<
|
||||
> {
|
||||
provider: T
|
||||
provider_id: string
|
||||
[key: string]: Z
|
||||
[key: string]: Z
|
||||
}
|
||||
|
||||
export interface DeployPanelConfig {
|
||||
}
|
||||
export interface DeployPanelConfig {}
|
||||
|
||||
// 部署节点配置(ssh)
|
||||
export interface DeploySSHConfig {
|
||||
@@ -265,21 +266,17 @@ export interface DeployStorageConfig {
|
||||
bucket: string
|
||||
}
|
||||
|
||||
|
||||
// 部署节点配置
|
||||
export type DeployNodeConfig = DeployConfig<
|
||||
DeploySSHConfig | DeployBTPanelConfig | Deploy1PanelConfig | DeployCDNConfig | DeployStorageConfig
|
||||
>
|
||||
|
||||
|
||||
// 部署节点输入配置
|
||||
export interface DeployNodeInputsConfig {
|
||||
name: string
|
||||
fromNodeId: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 定义通知节点配置类型
|
||||
interface NotifyNodeConfig {
|
||||
provider: string
|
||||
@@ -288,10 +285,9 @@ interface NotifyNodeConfig {
|
||||
body: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 定义上传节点配置类型
|
||||
interface UploadNodeConfig {
|
||||
cert_id: string
|
||||
cert: string
|
||||
key: string
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ const types = {
|
||||
tencentcloud: '腾讯云',
|
||||
btpanel: '宝塔面板',
|
||||
'1panel': '1Panel',
|
||||
huaweicloud: '华为云',
|
||||
cloudflare: 'Cloudflare',
|
||||
mail: '邮件',
|
||||
dingtalk: '钉钉',
|
||||
wecom: '企业微信',
|
||||
@@ -59,6 +61,8 @@ export const AuthApiTypeIcon = defineComponent({
|
||||
tencentcloud: 'tencentcloud',
|
||||
btpanel: 'btpanel',
|
||||
'1panel': '1panel',
|
||||
huaweicloud: 'huaweicloud',
|
||||
cloudflare: 'cloudflare',
|
||||
mail: 'mail',
|
||||
dingtalk: 'dingtalk',
|
||||
wecom: 'wecom',
|
||||
@@ -92,15 +96,9 @@ export const AuthApiTypeIcon = defineComponent({
|
||||
)
|
||||
|
||||
return () => (
|
||||
<NTag
|
||||
bordered={false}
|
||||
class="cursor-pointer"
|
||||
type={props.type}
|
||||
v-slots={{
|
||||
avatar: () => <SvgIcon icon={iconPath.value} size="1.4rem" />,
|
||||
}}
|
||||
>
|
||||
<NText class="text-[12px]">{props.text && <span>{typeName.value}</span>}</NText>
|
||||
<NTag type={props.type} size="small">
|
||||
<SvgIcon icon={iconPath.value} size="1.2rem" class="mr-[0.4rem]" />
|
||||
<span class="text-[12px]">{props.text && <span>{typeName.value}</span>}</span>
|
||||
</NTag>
|
||||
)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user