@mostajs/setup 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useState, useEffect, useCallback } from 'react';
|
|
6
6
|
// ── Constants ────────────────────────────────────────────────
|
|
7
|
-
const
|
|
7
|
+
const ALL_STEPS = ['welcome', 'modules', 'dialect', 'database', 'admin', 'summary'];
|
|
8
8
|
const DIALECT_DEFAULTS = {
|
|
9
9
|
mongodb: { host: 'localhost', port: 27017, name: 'mydb_prod', user: '', password: '' },
|
|
10
10
|
sqlite: { host: '', port: 0, name: 'mydb', user: '', password: '' },
|
|
@@ -346,14 +346,19 @@ function JarUploadInline({ dialect, jarEndpoint, dbConfig }) {
|
|
|
346
346
|
// ── Main Component ───────────────────────────────────────────
|
|
347
347
|
export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNamePrefix = 'mydb', persistState = true, }) {
|
|
348
348
|
const t = tProp || ((k) => k);
|
|
349
|
+
// Modules step is only shown if detectModules endpoint is explicitly provided
|
|
350
|
+
const hasModulesStep = !!endpoints.detectModules;
|
|
351
|
+
const STEPS = hasModulesStep
|
|
352
|
+
? ALL_STEPS
|
|
353
|
+
: ALL_STEPS.filter(s => s !== 'modules');
|
|
349
354
|
const ep = {
|
|
350
|
-
detectModules: endpoints.detectModules || '
|
|
355
|
+
detectModules: endpoints.detectModules || '',
|
|
351
356
|
testDb: endpoints.testDb || '/api/setup/test-db',
|
|
352
|
-
installModules: endpoints.installModules || '
|
|
357
|
+
installModules: endpoints.installModules || '',
|
|
353
358
|
install: endpoints.install || '/api/setup/install',
|
|
354
359
|
uploadJar: endpoints.uploadJar || '/api/setup/upload-jar',
|
|
355
|
-
wireModule: endpoints.wireModule || '
|
|
356
|
-
seed: endpoints.seed || '
|
|
360
|
+
wireModule: endpoints.wireModule || '',
|
|
361
|
+
seed: endpoints.seed || '',
|
|
357
362
|
};
|
|
358
363
|
// --- State ---
|
|
359
364
|
const [currentStep, setCurrentStep] = useState(0);
|
|
@@ -411,8 +416,12 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
|
|
|
411
416
|
}
|
|
412
417
|
catch { }
|
|
413
418
|
}, [hydrated, persistState, currentStep, dialect, dbConfig, adminConfig, seedOptions, selectedModules]);
|
|
414
|
-
// --- Detect modules ---
|
|
419
|
+
// --- Detect modules (only if endpoint is provided) ---
|
|
415
420
|
useEffect(() => {
|
|
421
|
+
if (!ep.detectModules) {
|
|
422
|
+
setModulesDetected(true);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
416
425
|
fetch(ep.detectModules)
|
|
417
426
|
.then(r => r.json())
|
|
418
427
|
.then((data) => {
|
|
@@ -460,8 +469,10 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
|
|
|
460
469
|
}
|
|
461
470
|
});
|
|
462
471
|
}, [availableModules]);
|
|
463
|
-
// --- Wire modules (load after installation success) ---
|
|
472
|
+
// --- Wire modules (load after installation success, only if endpoint provided) ---
|
|
464
473
|
const loadWireModules = useCallback(async () => {
|
|
474
|
+
if (!ep.wireModule)
|
|
475
|
+
return;
|
|
465
476
|
setWireLoading(true);
|
|
466
477
|
try {
|
|
467
478
|
const res = await fetch(ep.wireModule);
|
package/package.json
CHANGED