|
@@ -13,7 +13,12 @@ import {
|
|
|
} from '@/types';
|
|
} from '@/types';
|
|
|
import { providerService } from '@/lib/services/providerService';
|
|
import { providerService } from '@/lib/services/providerService';
|
|
|
import { nodeConfigService } from '@/lib/services/nodeConfigService';
|
|
import { nodeConfigService } from '@/lib/services/nodeConfigService';
|
|
|
|
|
+import { accountService } from '@/lib/services/accountService';
|
|
|
|
|
+import { proxyService } from '@/lib/services/proxyService';
|
|
|
import AppointmentTypeEditor from './AppointmentTypeEditor';
|
|
import AppointmentTypeEditor from './AppointmentTypeEditor';
|
|
|
|
|
+import RegisteredNodeSelect from '@/components/admin/node-configurations/RegisteredNodeSelect';
|
|
|
|
|
+
|
|
|
|
|
+import { LOCAL_PROXY_POOLS, COMMON_WEBSITES } from './nodeConfigConstants';
|
|
|
|
|
|
|
|
interface NodeConfigCreateWizardModalProps {
|
|
interface NodeConfigCreateWizardModalProps {
|
|
|
isOpen: boolean;
|
|
isOpen: boolean;
|
|
@@ -34,13 +39,19 @@ export default function NodeConfigCreateWizardModal({
|
|
|
const [loadingProviders, setLoadingProviders] = useState(false);
|
|
const [loadingProviders, setLoadingProviders] = useState(false);
|
|
|
const [submitting, setSubmitting] = useState(false);
|
|
const [submitting, setSubmitting] = useState(false);
|
|
|
|
|
|
|
|
|
|
+ // 数据库获取的账号池与代理池
|
|
|
|
|
+ const [accountPools, setAccountPools] = useState<{ pool_name: string; total_count?: number }[]>([]);
|
|
|
|
|
+ const [cloudProxyPools, setCloudProxyPools] = useState<{ pool_name: string; total_count?: number }[]>([]);
|
|
|
|
|
+ const [customBookerAccountPool, setCustomBookerAccountPool] = useState(false);
|
|
|
|
|
+ const [customSentinelAccountPool, setCustomSentinelAccountPool] = useState(false);
|
|
|
|
|
+
|
|
|
// Step 1: Base & Identity
|
|
// Step 1: Base & Identity
|
|
|
const [nodeId, setNodeId] = useState('node01');
|
|
const [nodeId, setNodeId] = useState('node01');
|
|
|
const [identifier, setIdentifier] = useState('');
|
|
const [identifier, setIdentifier] = useState('');
|
|
|
const [website, setWebsite] = useState('');
|
|
const [website, setWebsite] = useState('');
|
|
|
const [needAccount, setNeedAccount] = useState(1);
|
|
const [needAccount, setNeedAccount] = useState(1);
|
|
|
const [needProxy, setNeedProxy] = useState(1);
|
|
const [needProxy, setNeedProxy] = useState(1);
|
|
|
- const [proxyPoolStr, setProxyPoolStr] = useState('proxy-cheap');
|
|
|
|
|
|
|
+ const [proxyPoolStr, setProxyPoolStr] = useState('cloud:proxy-cheap');
|
|
|
const [proxyCd, setProxyCd] = useState(300);
|
|
const [proxyCd, setProxyCd] = useState(300);
|
|
|
const [sessionMaxLife, setSessionMaxLife] = useState(1800);
|
|
const [sessionMaxLife, setSessionMaxLife] = useState(1800);
|
|
|
const [activeTimeStart, setActiveTimeStart] = useState('00:00');
|
|
const [activeTimeStart, setActiveTimeStart] = useState('00:00');
|
|
@@ -60,7 +71,7 @@ export default function NodeConfigCreateWizardModal({
|
|
|
const [bookerAccountPoolId, setBookerAccountPoolId] = useState('');
|
|
const [bookerAccountPoolId, setBookerAccountPoolId] = useState('');
|
|
|
const [bookerTargetInstances, setBookerTargetInstances] = useState(1);
|
|
const [bookerTargetInstances, setBookerTargetInstances] = useState(1);
|
|
|
const [bookerAccountCd, setBookerAccountCd] = useState(10800);
|
|
const [bookerAccountCd, setBookerAccountCd] = useState(10800);
|
|
|
- const [bookerCooldown, setBookerCooldown] = useState(300);
|
|
|
|
|
|
|
+ const [bookerCooldown, setBookerCooldown] = useState(30);
|
|
|
const [bookerMaxBookings, setBookerMaxBookings] = useState(8);
|
|
const [bookerMaxBookings, setBookerMaxBookings] = useState(8);
|
|
|
|
|
|
|
|
// Sentinel specifics
|
|
// Sentinel specifics
|
|
@@ -80,7 +91,8 @@ export default function NodeConfigCreateWizardModal({
|
|
|
lib_path: 'plugins',
|
|
lib_path: 'plugins',
|
|
|
plugin_name: '',
|
|
plugin_name: '',
|
|
|
plugin_bin: '',
|
|
plugin_bin: '',
|
|
|
- plugin_proto: 'IVSPlg',
|
|
|
|
|
|
|
+ plugin_class: '',
|
|
|
|
|
+ plugin_proto: 'IPlugin',
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// Appointment types & free config
|
|
// Appointment types & free config
|
|
@@ -91,16 +103,61 @@ export default function NodeConfigCreateWizardModal({
|
|
|
if (isOpen) {
|
|
if (isOpen) {
|
|
|
setStep(1);
|
|
setStep(1);
|
|
|
fetchEnabledProviders();
|
|
fetchEnabledProviders();
|
|
|
|
|
+ fetchDbPools();
|
|
|
resetForm();
|
|
resetForm();
|
|
|
}
|
|
}
|
|
|
}, [isOpen, entryType]);
|
|
}, [isOpen, entryType]);
|
|
|
|
|
|
|
|
|
|
+ const fetchDbPools = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const [accRes, proxyRes] = await Promise.allSettled([
|
|
|
|
|
+ accountService.getPools(),
|
|
|
|
|
+ proxyService.getPools(),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if (accRes.status === 'fulfilled' && accRes.value?.data) {
|
|
|
|
|
+ setAccountPools(Array.isArray(accRes.value.data) ? accRes.value.data : []);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (proxyRes.status === 'fulfilled' && proxyRes.value?.data) {
|
|
|
|
|
+ setCloudProxyPools(Array.isArray(proxyRes.value.data) ? proxyRes.value.data : []);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error('Failed to fetch pools from DB:', err);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const addProxyPoolTag = (tagToAdd: string) => {
|
|
|
|
|
+ if (!tagToAdd) return;
|
|
|
|
|
+ const current = proxyPoolStr.split(',').map((s) => s.trim()).filter(Boolean);
|
|
|
|
|
+ if (!current.includes(tagToAdd)) {
|
|
|
|
|
+ current.push(tagToAdd);
|
|
|
|
|
+ setProxyPoolStr(current.join(', '));
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const removeProxyPoolTag = (tagToRemove: string) => {
|
|
|
|
|
+ const current = proxyPoolStr.split(',').map((s) => s.trim()).filter(Boolean);
|
|
|
|
|
+ const updated = current.filter((t) => t !== tagToRemove);
|
|
|
|
|
+ setProxyPoolStr(updated.join(', '));
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 仅筛选出支持当前 entryType 角色的服务商模板
|
|
|
|
|
+ const eligibleProviders = providers.filter(
|
|
|
|
|
+ (p) => p.role_templates && Boolean(p.role_templates[entryType])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const fetchEnabledProviders = async () => {
|
|
const fetchEnabledProviders = async () => {
|
|
|
setLoadingProviders(true);
|
|
setLoadingProviders(true);
|
|
|
try {
|
|
try {
|
|
|
const res = await providerService.getList({ enabled_only: true });
|
|
const res = await providerService.getList({ enabled_only: true });
|
|
|
if (res.code === 0 && res.data) {
|
|
if (res.code === 0 && res.data) {
|
|
|
- setProviders(res.data);
|
|
|
|
|
|
|
+ const list = Array.isArray(res.data) ? res.data : [];
|
|
|
|
|
+ setProviders(list);
|
|
|
|
|
+ const matching = list.filter(
|
|
|
|
|
+ (p) => p.role_templates && Boolean(p.role_templates[entryType])
|
|
|
|
|
+ );
|
|
|
|
|
+ if (matching.length > 0 && !selectedProviderName) {
|
|
|
|
|
+ handleProviderSelect(matching[0].name, list, false);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('Failed to fetch providers:', e);
|
|
console.error('Failed to fetch providers:', e);
|
|
@@ -111,12 +168,12 @@ export default function NodeConfigCreateWizardModal({
|
|
|
|
|
|
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
|
setSelectedProviderName('');
|
|
setSelectedProviderName('');
|
|
|
- setNodeId('node01');
|
|
|
|
|
|
|
+ setNodeId('');
|
|
|
setIdentifier('');
|
|
setIdentifier('');
|
|
|
setWebsite('');
|
|
setWebsite('');
|
|
|
setNeedAccount(1);
|
|
setNeedAccount(1);
|
|
|
setNeedProxy(1);
|
|
setNeedProxy(1);
|
|
|
- setProxyPoolStr('proxy-cheap');
|
|
|
|
|
|
|
+ setProxyPoolStr('');
|
|
|
setProxyCd(300);
|
|
setProxyCd(300);
|
|
|
setSessionMaxLife(1800);
|
|
setSessionMaxLife(1800);
|
|
|
setActiveTimeStart('00:00');
|
|
setActiveTimeStart('00:00');
|
|
@@ -136,11 +193,13 @@ export default function NodeConfigCreateWizardModal({
|
|
|
setBookerAccountCd(10800);
|
|
setBookerAccountCd(10800);
|
|
|
setBookerCooldown(300);
|
|
setBookerCooldown(300);
|
|
|
setBookerMaxBookings(8);
|
|
setBookerMaxBookings(8);
|
|
|
|
|
+ setCustomBookerAccountPool(false);
|
|
|
|
|
|
|
|
setSentinelAccountSource('built-in');
|
|
setSentinelAccountSource('built-in');
|
|
|
setSentinelAccountPoolId('');
|
|
setSentinelAccountPoolId('');
|
|
|
setSentinelTargetInstances(1);
|
|
setSentinelTargetInstances(1);
|
|
|
setSentinelSignalTtl(30);
|
|
setSentinelSignalTtl(30);
|
|
|
|
|
+ setCustomSentinelAccountPool(false);
|
|
|
|
|
|
|
|
setQueryWaitMode('Random');
|
|
setQueryWaitMode('Random');
|
|
|
setFixedWait(10);
|
|
setFixedWait(10);
|
|
@@ -151,16 +210,16 @@ export default function NodeConfigCreateWizardModal({
|
|
|
lib_path: 'plugins',
|
|
lib_path: 'plugins',
|
|
|
plugin_name: '',
|
|
plugin_name: '',
|
|
|
plugin_bin: '',
|
|
plugin_bin: '',
|
|
|
- plugin_proto: 'IVSPlg',
|
|
|
|
|
|
|
+ plugin_proto: 'IPlugin',
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
setAppointmentTypes([]);
|
|
setAppointmentTypes([]);
|
|
|
setFreeConfigStr('{}');
|
|
setFreeConfigStr('{}');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const handleProviderSelect = (providerName: string) => {
|
|
|
|
|
|
|
+ const handleProviderSelect = (providerName: string, providerList = providers, showToast = true) => {
|
|
|
setSelectedProviderName(providerName);
|
|
setSelectedProviderName(providerName);
|
|
|
- const p = providers.find((item) => item.name === providerName);
|
|
|
|
|
|
|
+ const p = providerList.find((item) => item.name === providerName);
|
|
|
if (!p) return;
|
|
if (!p) return;
|
|
|
|
|
|
|
|
if (p.plugin_config) {
|
|
if (p.plugin_config) {
|
|
@@ -168,7 +227,8 @@ export default function NodeConfigCreateWizardModal({
|
|
|
lib_path: p.plugin_config.lib_path || 'plugins',
|
|
lib_path: p.plugin_config.lib_path || 'plugins',
|
|
|
plugin_name: p.plugin_config.plugin_name || '',
|
|
plugin_name: p.plugin_config.plugin_name || '',
|
|
|
plugin_bin: p.plugin_config.plugin_bin || '',
|
|
plugin_bin: p.plugin_config.plugin_bin || '',
|
|
|
- plugin_proto: p.plugin_config.plugin_proto || 'IVSPlg',
|
|
|
|
|
|
|
+ plugin_class: p.plugin_config.plugin_class || '',
|
|
|
|
|
+ plugin_proto: p.plugin_config.plugin_proto || 'IPlugin',
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -194,7 +254,9 @@ export default function NodeConfigCreateWizardModal({
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- toast.success(`已从服务商模板 [${providerName}] 继承参数`);
|
|
|
|
|
|
|
+ if (showToast) {
|
|
|
|
|
+ toast.success(`已从服务商模板 [${providerName}] 继承参数与插件驱动`);
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const buildPayload = (): Partial<NodeConfigurationItem> => {
|
|
const buildPayload = (): Partial<NodeConfigurationItem> => {
|
|
@@ -273,8 +335,12 @@ export default function NodeConfigCreateWizardModal({
|
|
|
|
|
|
|
|
const handleNext = () => {
|
|
const handleNext = () => {
|
|
|
if (step === 1) {
|
|
if (step === 1) {
|
|
|
|
|
+ if (!selectedProviderName) {
|
|
|
|
|
+ toast.error('新建任务必须选择一个服务商模板以继承配置与插件');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!nodeId.trim()) {
|
|
if (!nodeId.trim()) {
|
|
|
- toast.error('节点 ID (node_id) 不能为空');
|
|
|
|
|
|
|
+ toast.error('请选择已注册的目标集群节点 (node_id)');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!identifier.trim()) {
|
|
if (!identifier.trim()) {
|
|
@@ -364,34 +430,49 @@ export default function NodeConfigCreateWizardModal({
|
|
|
{/* STEP 1 */}
|
|
{/* STEP 1 */}
|
|
|
{step === 1 && (
|
|
{step === 1 && (
|
|
|
<div className="space-y-5">
|
|
<div className="space-y-5">
|
|
|
- {/* Provider Selection */}
|
|
|
|
|
|
|
+ {/* Provider Selection (Mandatory) */}
|
|
|
<div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
<div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
|
<div className="flex items-center justify-between border-b-2 border-black pb-1.5">
|
|
<div className="flex items-center justify-between border-b-2 border-black pb-1.5">
|
|
|
<div className="flex items-center gap-2">
|
|
<div className="flex items-center gap-2">
|
|
|
<span className="w-2 h-2 bg-amber-300 border border-black inline-block" />
|
|
<span className="w-2 h-2 bg-amber-300 border border-black inline-block" />
|
|
|
- <span className="font-black text-black uppercase">[ PROVIDER TEMPLATE // 选择预设服务商模板 ]</span>
|
|
|
|
|
|
|
+ <span className="font-black text-black uppercase">[ PROVIDER TEMPLATE // 选择预设服务商模板 (必须继承) ]</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <span className="text-[11px] text-neutral-500">选择后将自动继承默认配置</span>
|
|
|
|
|
|
|
+ <span className="text-[11px] text-red-600 font-bold">* 必须选择服务商模板以继承参数与插件驱动</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 items-center">
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 items-center">
|
|
|
<select
|
|
<select
|
|
|
value={selectedProviderName}
|
|
value={selectedProviderName}
|
|
|
onChange={(e) => handleProviderSelect(e.target.value)}
|
|
onChange={(e) => handleProviderSelect(e.target.value)}
|
|
|
- disabled={loadingProviders}
|
|
|
|
|
|
|
+ disabled={loadingProviders || eligibleProviders.length === 0}
|
|
|
className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
>
|
|
>
|
|
|
- <option value="">-- 手动配置 (不继承模板) --</option>
|
|
|
|
|
- {providers.map((p) => (
|
|
|
|
|
- <option key={p.id || p.name} value={p.name}>
|
|
|
|
|
- {p.name.toUpperCase()} (插件: {p.plugin_config?.plugin_name || '内置'})
|
|
|
|
|
- </option>
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ {eligibleProviders.length === 0 ? (
|
|
|
|
|
+ <option value="">-- 无支持 [{entryType.toUpperCase()}] 角色的服务商模板 --</option>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <option value="">-- 请选择要继承的服务商模板 (共 {eligibleProviders.length} 个支持 {entryType.toUpperCase()}) --</option>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {eligibleProviders.map((p) => {
|
|
|
|
|
+ const rolesStr = p.role_templates ? Object.keys(p.role_templates).join('/') : '';
|
|
|
|
|
+ return (
|
|
|
|
|
+ <option key={p.id || p.name} value={p.name}>
|
|
|
|
|
+ {p.name.toUpperCase()} (插件: {p.plugin_config?.plugin_name || '内置'}, 支持角色: {rolesStr})
|
|
|
|
|
+ </option>
|
|
|
|
|
+ );
|
|
|
|
|
+ })}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- {selectedProviderName && (
|
|
|
|
|
|
|
+ {selectedProviderName ? (
|
|
|
<div className="text-[11px] font-black text-black bg-amber-300 border border-black px-2 py-1 shadow-[1px_1px_0px_#000] inline-block">
|
|
<div className="text-[11px] font-black text-black bg-amber-300 border border-black px-2 py-1 shadow-[1px_1px_0px_#000] inline-block">
|
|
|
- ✓ 已继承 [{selectedProviderName.toUpperCase()}] 模板参数
|
|
|
|
|
|
|
+ ✓ 已继承 [{selectedProviderName.toUpperCase()}] 模板参数 & 插件驱动 [{pluginConfig.plugin_name || '内置'}]
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ) : eligibleProviders.length === 0 ? (
|
|
|
|
|
+ <div className="text-[11px] font-bold text-rose-600 bg-rose-50 border border-rose-400 px-2 py-1">
|
|
|
|
|
+ ⚠️ 暂无支持 [{entryType.toUpperCase()}] 的模板,请在「服务商模板」中开启此角色
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <div className="text-[11px] font-bold text-rose-600 bg-rose-50 border border-rose-400 px-2 py-1">
|
|
|
|
|
+ ⚠️ 新建 {entryType.toUpperCase()} 任务必须选择一个服务商模板
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
@@ -406,15 +487,13 @@ export default function NodeConfigCreateWizardModal({
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
<div>
|
|
<div>
|
|
|
- <label className="block text-[11px] font-bold text-black mb-1">
|
|
|
|
|
- 目标节点唯一标识 (node_id) <span className="text-red-500">*</span>
|
|
|
|
|
- </label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- placeholder="node01"
|
|
|
|
|
|
|
+ <RegisteredNodeSelect
|
|
|
value={nodeId}
|
|
value={nodeId}
|
|
|
- onChange={(e) => setNodeId(e.target.value)}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
|
|
|
|
|
|
|
+ onChange={setNodeId}
|
|
|
|
|
+ label="目标集群节点 (NODE_ID)"
|
|
|
|
|
+ badgeText="严格单选"
|
|
|
|
|
+ placeholder="-- 请选择已注册的集群节点 --"
|
|
|
|
|
+ required
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -431,15 +510,43 @@ export default function NodeConfigCreateWizardModal({
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div className="md:col-span-2">
|
|
|
|
|
- <label className="block text-[11px] font-bold text-black mb-1">使馆/登录网址 (website)</label>
|
|
|
|
|
|
|
+ <div className="md:col-span-2 space-y-1.5">
|
|
|
|
|
+ <div className="flex justify-between items-center">
|
|
|
|
|
+ <label className="block text-[11px] font-bold text-black">使馆/登录网址 (website)</label>
|
|
|
|
|
+ <span className="text-[10px] text-neutral-500">支持直接输入或点击推荐使馆</span>
|
|
|
|
|
+ </div>
|
|
|
<input
|
|
<input
|
|
|
type="text"
|
|
type="text"
|
|
|
|
|
+ list="wizard-common-websites-list"
|
|
|
placeholder="https://visa.vfsglobal.com/..."
|
|
placeholder="https://visa.vfsglobal.com/..."
|
|
|
value={website}
|
|
value={website}
|
|
|
onChange={(e) => setWebsite(e.target.value)}
|
|
onChange={(e) => setWebsite(e.target.value)}
|
|
|
className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
|
|
className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <datalist id="wizard-common-websites-list">
|
|
|
|
|
+ {COMMON_WEBSITES.map((item) => (
|
|
|
|
|
+ <option key={item.value} value={item.value}>
|
|
|
|
|
+ {item.label}
|
|
|
|
|
+ </option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </datalist>
|
|
|
|
|
+ <div className="flex flex-wrap items-center gap-1.5 pt-0.5">
|
|
|
|
|
+ <span className="text-[10px] text-neutral-500 font-bold">推荐使馆:</span>
|
|
|
|
|
+ {COMMON_WEBSITES.map((item) => (
|
|
|
|
|
+ <button
|
|
|
|
|
+ key={item.value}
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => setWebsite(item.value)}
|
|
|
|
|
+ className={`px-2 py-0.5 text-[10px] font-mono font-bold border transition ${
|
|
|
|
|
+ website === item.value
|
|
|
|
|
+ ? 'bg-amber-300 text-black border-black shadow-[1px_1px_0px_#000]'
|
|
|
|
|
+ : 'bg-white text-neutral-700 border-neutral-300 hover:border-black hover:bg-neutral-100'
|
|
|
|
|
+ }`}
|
|
|
|
|
+ >
|
|
|
|
|
+ {item.label}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -501,78 +608,221 @@ export default function NodeConfigCreateWizardModal({
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
|
|
|
|
+ {/* Account Pool ID - dropdown from DB */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- value={bookerAccountPoolId}
|
|
|
|
|
- onChange={(e) => setBookerAccountPoolId(e.target.value)}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ {customBookerAccountPool ? (
|
|
|
|
|
+ <div className="flex gap-1">
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ value={bookerAccountPoolId}
|
|
|
|
|
+ onChange={(e) => setBookerAccountPoolId(e.target.value)}
|
|
|
|
|
+ placeholder="输入自定义池 ID"
|
|
|
|
|
+ className="flex-1 px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ />
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => { setCustomBookerAccountPool(false); setBookerAccountPoolId(''); }}
|
|
|
|
|
+ className="px-2 py-1 bg-white hover:bg-neutral-200 border-2 border-black text-[10px] font-bold shadow-[1px_1px_0px_#000]"
|
|
|
|
|
+ title="切换回下拉选择"
|
|
|
|
|
+ >
|
|
|
|
|
+ ✕
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <select
|
|
|
|
|
+ value={bookerAccountPoolId}
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ if (e.target.value === '__CUSTOM__') {
|
|
|
|
|
+ setCustomBookerAccountPool(true);
|
|
|
|
|
+ setBookerAccountPoolId('');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setBookerAccountPoolId(e.target.value);
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <option value="">-- 请选择账号池 --</option>
|
|
|
|
|
+ {accountPools.map((p) => (
|
|
|
|
|
+ <option key={p.pool_name} value={p.pool_name}>
|
|
|
|
|
+ {p.pool_name} ({p.total_count ?? 0} 个账号)
|
|
|
|
|
+ </option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ <option value="__CUSTOM__">✎ 手动输入自定义池 ID...</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Target Instances - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">目标并发实例 (target_instances)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">目标并发实例 (target_instances)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
- min={1}
|
|
|
|
|
|
|
+ <select
|
|
|
value={bookerTargetInstances}
|
|
value={bookerTargetInstances}
|
|
|
onChange={(e) => setBookerTargetInstances(Number(e.target.value))}
|
|
onChange={(e) => setBookerTargetInstances(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v} 个实例{v === 1 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Account CD - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">账号冷却 (account_cd / 秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">账号冷却 (account_cd / 秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={bookerAccountCd}
|
|
value={bookerAccountCd}
|
|
|
onChange={(e) => setBookerAccountCd(Number(e.target.value))}
|
|
onChange={(e) => setBookerAccountCd(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[
|
|
|
|
|
+ { v: 1800, label: '30 分钟' },
|
|
|
|
|
+ { v: 3600, label: '1 小时' },
|
|
|
|
|
+ { v: 7200, label: '2 小时' },
|
|
|
|
|
+ { v: 10800, label: '3 小时 (默认)' },
|
|
|
|
|
+ { v: 14400, label: '4 小时' },
|
|
|
|
|
+ { v: 21600, label: '6 小时' },
|
|
|
|
|
+ { v: 43200, label: '12 小时' },
|
|
|
|
|
+ { v: 86400, label: '24 小时' },
|
|
|
|
|
+ ].map((opt) => (
|
|
|
|
|
+ <option key={opt.v} value={opt.v}>{opt.v}s — {opt.label}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Booking Cooldown - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">下单间隔冷却 (booking_cooldown / 秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">下单间隔冷却 (booking_cooldown / 秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={bookerCooldown}
|
|
value={bookerCooldown}
|
|
|
onChange={(e) => setBookerCooldown(Number(e.target.value))}
|
|
onChange={(e) => setBookerCooldown(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[
|
|
|
|
|
+ { v: 10, label: '10 秒' },
|
|
|
|
|
+ { v: 30, label: '30 秒' },
|
|
|
|
|
+ { v: 60, label: '1 分钟' },
|
|
|
|
|
+ { v: 120, label: '2 分钟' },
|
|
|
|
|
+ { v: 300, label: '5 分钟 (默认)' },
|
|
|
|
|
+ { v: 600, label: '10 分钟' },
|
|
|
|
|
+ { v: 900, label: '15 分钟' },
|
|
|
|
|
+ { v: 1800, label: '30 分钟' },
|
|
|
|
|
+ ].map((opt) => (
|
|
|
|
|
+ <option key={opt.v} value={opt.v}>{opt.v}s — {opt.label}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Max Bookings - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">单号最大占位次数</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">单号最大占位次数</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={bookerMaxBookings}
|
|
value={bookerMaxBookings}
|
|
|
onChange={(e) => setBookerMaxBookings(Number(e.target.value))}
|
|
onChange={(e) => setBookerMaxBookings(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 30, 50].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v} 次{v === 8 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Proxy CD - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">代理冷却时间 (proxy_cd / 秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">代理冷却时间 (proxy_cd / 秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={proxyCd}
|
|
value={proxyCd}
|
|
|
onChange={(e) => setProxyCd(Number(e.target.value))}
|
|
onChange={(e) => setProxyCd(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[
|
|
|
|
|
+ { v: 0, label: '无冷却' },
|
|
|
|
|
+ { v: 60, label: '1 分钟' },
|
|
|
|
|
+ { v: 120, label: '2 分钟' },
|
|
|
|
|
+ { v: 180, label: '3 分钟' },
|
|
|
|
|
+ { v: 300, label: '5 分钟 (默认)' },
|
|
|
|
|
+ { v: 600, label: '10 分钟' },
|
|
|
|
|
+ { v: 900, label: '15 分钟' },
|
|
|
|
|
+ { v: 1800, label: '30 分钟' },
|
|
|
|
|
+ ].map((opt) => (
|
|
|
|
|
+ <option key={opt.v} value={opt.v}>{opt.v}s — {opt.label}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Proxy Pool - tag-based multi-select from DB */}
|
|
|
<div className="md:col-span-2">
|
|
<div className="md:col-span-2">
|
|
|
- <label className="block text-[11px] font-bold text-black mb-1">网络代理池标签列表 (proxy_pool, 逗号分隔)</label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- value={proxyPoolStr}
|
|
|
|
|
- onChange={(e) => setProxyPoolStr(e.target.value)}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <label className="block text-[11px] font-bold text-black mb-1">网络代理池 (proxy_pool)</label>
|
|
|
|
|
+ {/* Selected tags */}
|
|
|
|
|
+ <div className="flex flex-wrap gap-1.5 mb-2 min-h-[28px] p-2 bg-white border-2 border-black shadow-[2px_2px_0px_#000]">
|
|
|
|
|
+ {proxyPoolStr.split(',').map(s => s.trim()).filter(Boolean).length === 0 && (
|
|
|
|
|
+ <span className="text-neutral-400 text-[10px] italic">尚未选择代理池...</span>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {proxyPoolStr.split(',').map(s => s.trim()).filter(Boolean).map((tag) => (
|
|
|
|
|
+ <span
|
|
|
|
|
+ key={tag}
|
|
|
|
|
+ className={`inline-flex items-center gap-1 px-2 py-0.5 border border-black text-[10px] font-bold shadow-[1px_1px_0px_#000] ${
|
|
|
|
|
+ tag.startsWith('cloud:') ? 'bg-sky-200 text-sky-900' : 'bg-emerald-200 text-emerald-900'
|
|
|
|
|
+ }`}
|
|
|
|
|
+ >
|
|
|
|
|
+ {tag.startsWith('cloud:') ? '☁' : '⊙'} {tag}
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => removeProxyPoolTag(tag)}
|
|
|
|
|
+ className="ml-0.5 hover:text-red-600 font-black"
|
|
|
|
|
+ >
|
|
|
|
|
+ ✕
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {/* Add tag dropdown */}
|
|
|
|
|
+ <select
|
|
|
|
|
+ value=""
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ if (e.target.value) addProxyPoolTag(e.target.value);
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <option value="">+ 添加代理池标签...</option>
|
|
|
|
|
+ <optgroup label="☁ 云端代理池 (cloud:)">
|
|
|
|
|
+ {cloudProxyPools.map((p) => (
|
|
|
|
|
+ <option key={`cloud:${p.pool_name}`} value={`cloud:${p.pool_name}`}>
|
|
|
|
|
+ cloud:{p.pool_name} ({p.total_count ?? 0} 条代理)
|
|
|
|
|
+ </option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </optgroup>
|
|
|
|
|
+ <optgroup label="⊙ 本地代理池 (local:)">
|
|
|
|
|
+ {LOCAL_PROXY_POOLS.map((p) => (
|
|
|
|
|
+ <option key={`local:${p.value}`} value={`local:${p.value}`}>
|
|
|
|
|
+ local:{p.value} — {p.label}
|
|
|
|
|
+ </option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </optgroup>
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Session Max Life - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">Session 最长存活 (秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">Session 最长存活 (秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={sessionMaxLife}
|
|
value={sessionMaxLife}
|
|
|
onChange={(e) => setSessionMaxLife(Number(e.target.value))}
|
|
onChange={(e) => setSessionMaxLife(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[
|
|
|
|
|
+ { v: 300, label: '5 分钟' },
|
|
|
|
|
+ { v: 600, label: '10 分钟' },
|
|
|
|
|
+ { v: 900, label: '15 分钟' },
|
|
|
|
|
+ { v: 1200, label: '20 分钟' },
|
|
|
|
|
+ { v: 1800, label: '30 分钟 (默认)' },
|
|
|
|
|
+ { v: 2700, label: '45 分钟' },
|
|
|
|
|
+ { v: 3600, label: '1 小时' },
|
|
|
|
|
+ { v: 7200, label: '2 小时' },
|
|
|
|
|
+ ].map((opt) => (
|
|
|
|
|
+ <option key={opt.v} value={opt.v}>{opt.v}s — {opt.label}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -587,41 +837,95 @@ export default function NodeConfigCreateWizardModal({
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
|
|
|
|
+ {/* Account Pool ID - dropdown from DB */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">使馆账号池 ID (account_pool_id)</label>
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- value={sentinelAccountPoolId}
|
|
|
|
|
- onChange={(e) => setSentinelAccountPoolId(e.target.value)}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ {customSentinelAccountPool ? (
|
|
|
|
|
+ <div className="flex gap-1">
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ value={sentinelAccountPoolId}
|
|
|
|
|
+ onChange={(e) => setSentinelAccountPoolId(e.target.value)}
|
|
|
|
|
+ placeholder="输入自定义池 ID"
|
|
|
|
|
+ className="flex-1 px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ />
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => { setCustomSentinelAccountPool(false); setSentinelAccountPoolId(''); }}
|
|
|
|
|
+ className="px-2 py-1 bg-white hover:bg-neutral-200 border-2 border-black text-[10px] font-bold shadow-[1px_1px_0px_#000]"
|
|
|
|
|
+ title="切换回下拉选择"
|
|
|
|
|
+ >
|
|
|
|
|
+ ✕
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <select
|
|
|
|
|
+ value={sentinelAccountPoolId}
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ if (e.target.value === '__CUSTOM__') {
|
|
|
|
|
+ setCustomSentinelAccountPool(true);
|
|
|
|
|
+ setSentinelAccountPoolId('');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setSentinelAccountPoolId(e.target.value);
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <option value="">-- 请选择账号池 --</option>
|
|
|
|
|
+ {accountPools.map((p) => (
|
|
|
|
|
+ <option key={p.pool_name} value={p.pool_name}>
|
|
|
|
|
+ {p.pool_name} ({p.total_count ?? 0} 个账号)
|
|
|
|
|
+ </option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ <option value="__CUSTOM__">✎ 手动输入自定义池 ID...</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Target Instances - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">监控并发实例数</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">监控并发实例数</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
- min={1}
|
|
|
|
|
|
|
+ <select
|
|
|
value={sentinelTargetInstances}
|
|
value={sentinelTargetInstances}
|
|
|
onChange={(e) => setSentinelTargetInstances(Number(e.target.value))}
|
|
onChange={(e) => setSentinelTargetInstances(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v} 个实例{v === 1 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Signal TTL - preset dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">放位信号 TTL 持续 (秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">放位信号 TTL 持续 (秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={sentinelSignalTtl}
|
|
value={sentinelSignalTtl}
|
|
|
onChange={(e) => setSentinelSignalTtl(Number(e.target.value))}
|
|
onChange={(e) => setSentinelSignalTtl(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[
|
|
|
|
|
+ { v: 10, label: '10 秒' },
|
|
|
|
|
+ { v: 15, label: '15 秒' },
|
|
|
|
|
+ { v: 20, label: '20 秒' },
|
|
|
|
|
+ { v: 30, label: '30 秒 (默认)' },
|
|
|
|
|
+ { v: 45, label: '45 秒' },
|
|
|
|
|
+ { v: 60, label: '1 分钟' },
|
|
|
|
|
+ { v: 90, label: '90 秒' },
|
|
|
|
|
+ { v: 120, label: '2 分钟' },
|
|
|
|
|
+ ].map((opt) => (
|
|
|
|
|
+ <option key={opt.v} value={opt.v}>{opt.v}s — {opt.label}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ {/* Query Wait Mode - dropdown */}
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">扫位轮询模式 (query_wait.mode)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">扫位轮询模式 (query_wait.mode)</label>
|
|
|
<select
|
|
<select
|
|
|
value={queryWaitMode}
|
|
value={queryWaitMode}
|
|
|
onChange={(e) => setQueryWaitMode(e.target.value as any)}
|
|
onChange={(e) => setQueryWaitMode(e.target.value as any)}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
>
|
|
>
|
|
|
<option value="Random">Random (随机等待)</option>
|
|
<option value="Random">Random (随机等待)</option>
|
|
|
<option value="Fixed">Fixed (固定等待)</option>
|
|
<option value="Fixed">Fixed (固定等待)</option>
|
|
@@ -631,32 +935,41 @@ export default function NodeConfigCreateWizardModal({
|
|
|
{queryWaitMode === 'Fixed' ? (
|
|
{queryWaitMode === 'Fixed' ? (
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">固定等待 (秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">固定等待 (秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={fixedWait}
|
|
value={fixedWait}
|
|
|
onChange={(e) => setFixedWait(Number(e.target.value))}
|
|
onChange={(e) => setFixedWait(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[5, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v}s{v === 10 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
) : (
|
|
) : (
|
|
|
<>
|
|
<>
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">随机最小等待 (秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">随机最小等待 (秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={randomMin}
|
|
value={randomMin}
|
|
|
onChange={(e) => setRandomMin(Number(e.target.value))}
|
|
onChange={(e) => setRandomMin(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[10, 20, 30, 45, 60, 90, 120, 180, 300].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v}s{v === 60 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">随机最大等待 (秒)</label>
|
|
<label className="block text-[11px] font-bold text-black mb-1">随机最大等待 (秒)</label>
|
|
|
- <input
|
|
|
|
|
- type="number"
|
|
|
|
|
|
|
+ <select
|
|
|
value={randomMax}
|
|
value={randomMax}
|
|
|
onChange={(e) => setRandomMax(Number(e.target.value))}
|
|
onChange={(e) => setRandomMax(Number(e.target.value))}
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ className="w-full px-3 py-2 border-2 border-black bg-white text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {[30, 60, 120, 180, 300, 450, 600, 900, 1200].map((v) => (
|
|
|
|
|
+ <option key={v} value={v}>{v}s{v === 300 ? ' (默认)' : ''}</option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
</>
|
|
</>
|
|
|
)}
|
|
)}
|
|
@@ -710,42 +1023,50 @@ export default function NodeConfigCreateWizardModal({
|
|
|
onChange={setAppointmentTypes}
|
|
onChange={setAppointmentTypes}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- {/* Plugin & Free Config */}
|
|
|
|
|
|
|
+ {/* Plugin (Inherited from Template, read-only) & Free Config */}
|
|
|
<div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
<div className="border-2 border-black bg-neutral-100 p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
|
- <div className="flex items-center gap-2 border-b-2 border-black pb-1.5">
|
|
|
|
|
- <span className="w-2 h-2 bg-black inline-block" />
|
|
|
|
|
- <span className="font-black text-black uppercase">[ EXTENSION // 插件与自由键值配置 ]</span>
|
|
|
|
|
|
|
+ <div className="flex items-center justify-between border-b-2 border-black pb-1.5">
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
|
+ <span className="w-2 h-2 bg-black inline-block" />
|
|
|
|
|
+ <span className="font-black text-black uppercase">[ PLUGIN DRIVER // 插件运行时 (已由模板绑定) ]</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span className="text-[10px] text-emerald-800 bg-emerald-100 border border-emerald-500 px-1.5 py-0.5 font-bold">
|
|
|
|
|
+ ✓ 自动从模板 [{selectedProviderName || '未选'}] 继承,无需手动配置
|
|
|
|
|
+ </span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
|
|
|
|
- <div>
|
|
|
|
|
- <label className="block text-[11px] font-bold text-black mb-1">插件名称 (plugin_name)</label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- value={pluginConfig.plugin_name || ''}
|
|
|
|
|
- onChange={(e) => setPluginConfig({ ...pluginConfig, plugin_name: e.target.value })}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ {/* Readonly info bar */}
|
|
|
|
|
+ <div className="bg-white border-2 border-black p-3 shadow-[1px_1px_0px_#000] space-y-2">
|
|
|
|
|
+ <div className="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
|
+ <span className="font-bold text-neutral-500 text-[11px]">绑定插件:</span>
|
|
|
|
|
+ <span className="font-mono font-black text-black bg-amber-200 border border-black px-2 py-0.5 text-xs shadow-[1px_1px_0px_#000]">
|
|
|
|
|
+ {pluginConfig.plugin_name || '默认内置驱动'}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="text-[11px] font-mono text-neutral-700">
|
|
|
|
|
+ 执行脚本: <code className="font-bold text-black bg-neutral-100 px-1 py-0.5 border border-neutral-300">{pluginConfig.plugin_bin || '(内置脚本)'}</code>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div>
|
|
|
|
|
- <label className="block text-[11px] font-bold text-black mb-1">二进制脚本 (plugin_bin)</label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- value={pluginConfig.plugin_bin || ''}
|
|
|
|
|
- onChange={(e) => setPluginConfig({ ...pluginConfig, plugin_bin: e.target.value })}
|
|
|
|
|
- className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div className="flex flex-wrap items-center justify-between text-[10px] text-neutral-500 border-t border-neutral-200 pt-1.5">
|
|
|
|
|
+ <span>接口协议: <span className="font-mono font-bold text-neutral-700">{pluginConfig.plugin_proto || 'IPlugin'}</span></span>
|
|
|
|
|
+ <span>加载目录: <span className="font-mono font-bold text-neutral-700">{pluginConfig.lib_path || 'plugins'}</span></span>
|
|
|
|
|
+ {pluginConfig.plugin_class && (
|
|
|
|
|
+ <span>入口类: <span className="font-mono font-bold text-neutral-700">{pluginConfig.plugin_class}</span></span>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
|
|
|
+ {/* Free Config */}
|
|
|
|
|
+ <div className="pt-1">
|
|
|
<label className="block text-[11px] font-bold text-black mb-1">
|
|
<label className="block text-[11px] font-bold text-black mb-1">
|
|
|
- 自定义扩展 JSON (free_config)
|
|
|
|
|
|
|
+ 自定义扩展 JSON (free_config, 可选)
|
|
|
</label>
|
|
</label>
|
|
|
<textarea
|
|
<textarea
|
|
|
rows={3}
|
|
rows={3}
|
|
|
value={freeConfigStr}
|
|
value={freeConfigStr}
|
|
|
onChange={(e) => setFreeConfigStr(e.target.value)}
|
|
onChange={(e) => setFreeConfigStr(e.target.value)}
|
|
|
|
|
+ placeholder="{}"
|
|
|
className="w-full p-2.5 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000]"
|
|
className="w-full p-2.5 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000]"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -784,18 +1105,22 @@ export default function NodeConfigCreateWizardModal({
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2 text-xs">
|
|
<div className="p-4 bg-neutral-100 border-2 border-black shadow-[2px_2px_0px_#000] space-y-2 text-xs">
|
|
|
- <div className="font-black text-black border-b-2 border-black pb-1 uppercase">[ 插件与继承模板 ]</div>
|
|
|
|
|
|
|
+ <div className="font-black text-black border-b-2 border-black pb-1 uppercase">[ 插件运行时 (由模板锁定) ]</div>
|
|
|
<div className="flex justify-between">
|
|
<div className="flex justify-between">
|
|
|
<span className="text-neutral-600">继承模板:</span>
|
|
<span className="text-neutral-600">继承模板:</span>
|
|
|
- <span className="font-bold text-black">{selectedProviderName || '无'}</span>
|
|
|
|
|
|
|
+ <span className="font-bold text-black bg-amber-200 border border-black px-1.5">{selectedProviderName || '无'}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="flex justify-between">
|
|
|
|
|
+ <span className="text-neutral-600">插件驱动:</span>
|
|
|
|
|
+ <span className="font-bold text-black">{pluginConfig.plugin_name || '默认内置'}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="flex justify-between">
|
|
<div className="flex justify-between">
|
|
|
- <span className="text-neutral-600">插件名:</span>
|
|
|
|
|
- <span className="font-bold text-black">{pluginConfig.plugin_name || '默认'}</span>
|
|
|
|
|
|
|
+ <span className="text-neutral-600">执行脚本:</span>
|
|
|
|
|
+ <span className="font-mono font-bold text-black">{pluginConfig.plugin_bin || '(内置脚本)'}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="flex justify-between">
|
|
<div className="flex justify-between">
|
|
|
- <span className="text-neutral-600">脚本文件:</span>
|
|
|
|
|
- <span className="font-bold text-black">{pluginConfig.plugin_bin || '-'}</span>
|
|
|
|
|
|
|
+ <span className="text-neutral-600">协议/目录:</span>
|
|
|
|
|
+ <span className="font-mono text-neutral-600">{pluginConfig.plugin_proto || 'IPlugin'} / {pluginConfig.lib_path || 'plugins'}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|