wizard: skip cell-name and domain steps when installer pre-configured them
Unit Tests / test (push) Successful in 15m44s
Unit Tests / test (push) Successful in 15m44s
When the bash installer collects cell name and domain mode, the first-run wizard's /setup should only ask for a password, service selection, and timezone. Previously the wizard pre-filled those fields but still showed all 7 steps. - useEffect fetches /api/setup/status on mount; if preconfigured.cell_name and preconfigured.domain_mode are both set, sets installerConfigured=true and jumps to step 2 (password) - handleStep2Next → step 5 when installerConfigured (skips domain steps 3+4) - handleStep2Back → step 1 when installerConfigured (review cell name) - handleStep5Back returns to step 2 when installerConfigured Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -789,13 +789,16 @@ export default function Setup() {
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [submitError, setSubmitError] = useState('');
|
||||
|
||||
// Pre-fill from installer config if present
|
||||
// True when the bash installer already configured cell identity
|
||||
const [installerConfigured, setInstallerConfigured] = useState(false);
|
||||
|
||||
// Pre-fill from installer config; if cell + domain already set, jump to password step
|
||||
useEffect(() => {
|
||||
setupAPI.getStatus()
|
||||
.then(res => {
|
||||
const pre = res.data?.preconfigured;
|
||||
if (!pre) return;
|
||||
if (pre.cell_name) setCellName(pre.cell_name);
|
||||
if (pre.cell_name) setCellName(pre.cell_name);
|
||||
if (pre.domain_mode) {
|
||||
if (pre.domain_mode === 'pic_ngo') setDomainType('pic_ngo');
|
||||
else if (pre.domain_mode === 'lan') setDomainType('lan');
|
||||
@@ -804,6 +807,10 @@ export default function Setup() {
|
||||
if (pre.domain_name) setCustomDomain(pre.domain_name);
|
||||
if (pre.cloudflare_api_token) setCloudflareToken(pre.cloudflare_api_token);
|
||||
if (pre.duckdns_token) setDuckdnsToken(pre.duckdns_token);
|
||||
if (pre.cell_name && pre.domain_mode) {
|
||||
setInstallerConfigured(true);
|
||||
setStep(2); // skip cell name + domain steps — already done by installer
|
||||
}
|
||||
})
|
||||
.catch(() => {}); // fail silently — wizard works from scratch
|
||||
}, []);
|
||||
@@ -813,9 +820,13 @@ export default function Setup() {
|
||||
const goNext = () => setStep(s => Math.min(s + 1, TOTAL_STEPS));
|
||||
const goBack = () => setStep(s => Math.max(s - 1, 1));
|
||||
|
||||
// When installer pre-configured identity: step 2 → step 5 (skip domain steps)
|
||||
const handleStep2Next = () => installerConfigured ? setStep(5) : goNext();
|
||||
const handleStep2Back = () => installerConfigured ? setStep(1) : goBack();
|
||||
|
||||
const handleStep3Next = () => skipStep4 ? setStep(5) : setStep(4);
|
||||
const handleStep4Back = () => setStep(3);
|
||||
const handleStep5Back = () => skipStep4 ? setStep(3) : setStep(4);
|
||||
const handleStep5Back = () => installerConfigured ? setStep(2) : skipStep4 ? setStep(3) : setStep(4);
|
||||
|
||||
const handleSubmit = async () => {
|
||||
setSubmitError('');
|
||||
@@ -896,8 +907,8 @@ export default function Setup() {
|
||||
confirm={passwordConfirm}
|
||||
onChangePassword={setPassword}
|
||||
onChangeConfirm={setPasswordConfirm}
|
||||
onNext={goNext}
|
||||
onBack={goBack}
|
||||
onNext={handleStep2Next}
|
||||
onBack={handleStep2Back}
|
||||
/>
|
||||
)}
|
||||
{step === 3 && (
|
||||
|
||||
Reference in New Issue
Block a user