精简及美化修改DNS服务器的弹窗界面
This commit is contained in:
parent
0f7699b21c
commit
93136d0ea5
@ -2,23 +2,16 @@
|
|||||||
<Dialog :options="{ title: '修改DNS服务器', size: 'lg' }" v-model="show">
|
<Dialog :options="{ title: '修改DNS服务器', size: 'lg' }" v-model="show">
|
||||||
<template #body-content>
|
<template #body-content>
|
||||||
<div class="p-4 sm:p-6">
|
<div class="p-4 sm:p-6">
|
||||||
<div class="mb-6">
|
|
||||||
<p class="mt-1 text-sm text-gray-600">
|
|
||||||
域名: <span class="font-medium">{{ domainDoc?.domain }}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<!-- DNS1 -->
|
<!-- DNS1 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
主DNS服务器 <span class="text-red-500">*</span>
|
DNS1(主DNS服务器)<span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns1"
|
v-model="dnsServers.dns1"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns1.example.com"
|
|
||||||
:class="{ 'border-red-300': errors.dns1 }"
|
:class="{ 'border-red-300': errors.dns1 }"
|
||||||
/>
|
/>
|
||||||
<p v-if="errors.dns1" class="mt-1 text-sm text-red-600">{{ errors.dns1 }}</p>
|
<p v-if="errors.dns1" class="mt-1 text-sm text-red-600">{{ errors.dns1 }}</p>
|
||||||
@ -27,13 +20,12 @@
|
|||||||
<!-- DNS2 -->
|
<!-- DNS2 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
辅DNS服务器 <span class="text-red-500">*</span>
|
DNS2(辅DNS服务器)<span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns2"
|
v-model="dnsServers.dns2"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns2.example.com"
|
|
||||||
:class="{ 'border-red-300': errors.dns2 }"
|
:class="{ 'border-red-300': errors.dns2 }"
|
||||||
/>
|
/>
|
||||||
<p v-if="errors.dns2" class="mt-1 text-sm text-red-600">{{ errors.dns2 }}</p>
|
<p v-if="errors.dns2" class="mt-1 text-sm text-red-600">{{ errors.dns2 }}</p>
|
||||||
@ -42,87 +34,51 @@
|
|||||||
<!-- DNS3 -->
|
<!-- DNS3 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
第三个DNS服务器
|
DNS3(可选)
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns3"
|
v-model="dnsServers.dns3"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns3.example.com(可选)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- DNS4 -->
|
<!-- DNS4 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
第四个DNS服务器
|
DNS4(可选)
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns4"
|
v-model="dnsServers.dns4"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns4.example.com(可选)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- DNS5 -->
|
<!-- DNS5 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
第五个DNS服务器
|
DNS5(可选)
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns5"
|
v-model="dnsServers.dns5"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns5.example.com(可选)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- DNS6 -->
|
<!-- DNS6 -->
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
第六个DNS服务器
|
DNS6(可选)
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-model="dnsServers.dns6"
|
v-model="dnsServers.dns6"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
||||||
placeholder="例如:ns6.example.com(可选)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 当前DNS服务器信息 -->
|
|
||||||
<div class="mt-6 p-4 bg-gray-50 rounded-md">
|
|
||||||
<h4 class="text-sm font-medium text-gray-700 mb-3">当前DNS服务器</h4>
|
|
||||||
<div class="space-y-2 text-sm">
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">主DNS:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host1 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">辅DNS:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host2 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">DNS3:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host3 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">DNS4:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host4 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">DNS5:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host5 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600">DNS6:</span>
|
|
||||||
<span class="font-mono text-gray-900">{{ domainDoc?.dns_host6 || '未设置' }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="error" class="mt-4 p-3 bg-red-50 text-red-700 rounded-md text-sm">
|
<div v-if="error" class="mt-4 p-3 bg-red-50 text-red-700 rounded-md text-sm">
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</div>
|
</div>
|
||||||
@ -140,11 +96,11 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="px-4 py-2 bg-blue-600 border border-transparent rounded-md text-sm font-medium text-white hover:bg-blue-700 focus:outline-none disabled:bg-gray-300 disabled:cursor-not-allowed"
|
class="px-4 py-2 bg-black border border-transparent rounded-md text-sm font-medium text-white hover:bg-gray-800 focus:outline-none disabled:bg-gray-300 disabled:cursor-not-allowed"
|
||||||
@click="modifyDNSServer"
|
@click="modifyDNSServer"
|
||||||
:disabled="isLoading || !isValid"
|
:disabled="isLoading || !isValid"
|
||||||
>
|
>
|
||||||
{{ isLoading ? '修改中...' : '确认修改' }}
|
{{ isLoading ? '修改中...' : '确定' }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -2395,7 +2395,6 @@ def west_domain_modify_dns_server(**data):
|
|||||||
|
|
||||||
# 异步更新本地域名记录的DNS服务器字段
|
# 异步更新本地域名记录的DNS服务器字段
|
||||||
try:
|
try:
|
||||||
# 查找对应的Jsite Domain记录
|
|
||||||
domain_records = jingrow.get_all(
|
domain_records = jingrow.get_all(
|
||||||
"Jsite Domain",
|
"Jsite Domain",
|
||||||
{"domain": domain},
|
{"domain": domain},
|
||||||
@ -2403,7 +2402,6 @@ def west_domain_modify_dns_server(**data):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if domain_records:
|
if domain_records:
|
||||||
# 如果找到记录,异步更新DNS服务器
|
|
||||||
jingrow.enqueue_pg(
|
jingrow.enqueue_pg(
|
||||||
"Jsite Domain",
|
"Jsite Domain",
|
||||||
domain_records[0].name,
|
domain_records[0].name,
|
||||||
@ -2415,11 +2413,8 @@ def west_domain_modify_dns_server(**data):
|
|||||||
dns5=dns5,
|
dns5=dns5,
|
||||||
dns6=dns6
|
dns6=dns6
|
||||||
)
|
)
|
||||||
jingrow.log_error("DNS服务器异步更新", f"已为域名 {domain} 安排异步更新DNS服务器")
|
|
||||||
else:
|
|
||||||
jingrow.log_error("DNS服务器异步更新", f"未找到域名 {domain} 对应的Jsite Domain记录")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
jingrow.log_error("DNS服务器异步更新失败", f"域名 {domain} 异步更新失败: {str(e)}")
|
jingrow.log_error(f"域名 {domain} DNS服务器更新失败", f"错误: {str(e)}")
|
||||||
|
|
||||||
# 返回成功结果
|
# 返回成功结果
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user