refactor(swarm-mgmt): backfill host address from agent's .tgz source IP
This commit is contained in:
@@ -14,7 +14,6 @@ interface BundleResult {
|
||||
const AgentEnrollment: React.FC = () => {
|
||||
const [masterHost, setMasterHost] = useState(window.location.hostname);
|
||||
const [agentName, setAgentName] = useState('');
|
||||
const [agentHost, setAgentHost] = useState('');
|
||||
const [withUpdater, setWithUpdater] = useState(true);
|
||||
const [servicesIni, setServicesIni] = useState<string | null>(null);
|
||||
const [servicesIniName, setServicesIniName] = useState<string | null>(null);
|
||||
@@ -49,7 +48,6 @@ const AgentEnrollment: React.FC = () => {
|
||||
setResult(null);
|
||||
setError(null);
|
||||
setAgentName('');
|
||||
setAgentHost('');
|
||||
setWithUpdater(true);
|
||||
setServicesIni(null);
|
||||
setServicesIniName(null);
|
||||
@@ -65,7 +63,6 @@ const AgentEnrollment: React.FC = () => {
|
||||
const res = await api.post('/swarm/enroll-bundle', {
|
||||
master_host: masterHost,
|
||||
agent_name: agentName,
|
||||
agent_host: agentHost,
|
||||
with_updater: withUpdater,
|
||||
services_ini: servicesIni,
|
||||
});
|
||||
@@ -112,16 +109,6 @@ const AgentEnrollment: React.FC = () => {
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Agent host (IP or DNS of the new worker VM)
|
||||
<input
|
||||
type="text"
|
||||
value={agentHost}
|
||||
onChange={(e) => setAgentHost(e.target.value)}
|
||||
placeholder="e.g. 192.168.1.23"
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Agent name (lowercase, digits, dashes)
|
||||
<input
|
||||
@@ -152,7 +139,7 @@ const AgentEnrollment: React.FC = () => {
|
||||
<button
|
||||
type="submit"
|
||||
className="control-btn primary"
|
||||
disabled={submitting || !nameOk || !masterHost || !agentHost}
|
||||
disabled={submitting || !nameOk || !masterHost}
|
||||
>
|
||||
{submitting ? 'Generating…' : 'Generate enrollment bundle'}
|
||||
</button>
|
||||
|
||||
@@ -92,7 +92,7 @@ const SwarmHosts: React.FC = () => {
|
||||
{h.status === 'active' ? <Wifi size={16} /> : <WifiOff size={16} />} {h.status}
|
||||
</td>
|
||||
<td>{h.name}</td>
|
||||
<td>{h.address}:{h.agent_port}</td>
|
||||
<td>{h.address ? `${h.address}:${h.agent_port}` : <em>pending first connect</em>}</td>
|
||||
<td>{h.last_heartbeat ? new Date(h.last_heartbeat).toLocaleString() : '—'}</td>
|
||||
<td title={h.client_cert_fingerprint}><code>{shortFp(h.client_cert_fingerprint)}</code></td>
|
||||
<td>{new Date(h.enrolled_at).toLocaleString()}</td>
|
||||
|
||||
Reference in New Issue
Block a user