feat: ✨ Aggiunta selezione dello step tramite parametro
This commit is contained in:
parent
3405e82c4c
commit
8ef0fa73f6
|
@ -23,7 +23,7 @@ class CheckConfigurationMiddleware
|
||||||
'admin_user' => static fn (): bool => !empty(User::exists()),
|
'admin_user' => static fn (): bool => !empty(User::exists()),
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($checks as $check) {
|
foreach ($checks as $name => $check) {
|
||||||
try {
|
try {
|
||||||
$check = $check();
|
$check = $check();
|
||||||
} catch (QueryException|InvalidArgumentException|PDOException $exception) {
|
} catch (QueryException|InvalidArgumentException|PDOException $exception) {
|
||||||
|
@ -44,7 +44,7 @@ class CheckConfigurationMiddleware
|
||||||
return \response()->json(['message' => __('Configurazione del database richiesta')], Response::HTTP_SERVICE_UNAVAILABLE);
|
return \response()->json(['message' => __('Configurazione del database richiesta')], Response::HTTP_SERVICE_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('setup.index');
|
return redirect()->route('setup.index', ['step' => $name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
Request,
|
Request,
|
||||||
RequestError
|
RequestError
|
||||||
} from 'mithril-utilities';
|
} from 'mithril-utilities';
|
||||||
|
import {match} from 'ts-pattern';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SetupStep,
|
SetupStep,
|
||||||
|
@ -34,6 +35,20 @@ export default class SetupPage extends Page<SetupPageAttributes> {
|
||||||
[SetupSteps.AdminUser]: new AdminUserStep()
|
[SetupSteps.AdminUser]: new AdminUserStep()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
oninit(vnode: Vnode<SetupPageAttributes, this>) {
|
||||||
|
super.oninit(vnode);
|
||||||
|
// @ts-expect-error
|
||||||
|
const {step} = route().params;
|
||||||
|
if (step) {
|
||||||
|
const setupStep = match(step)
|
||||||
|
.with('regional_settings', () => SetupSteps.RegionalSettings)
|
||||||
|
.with('database', () => SetupSteps.Database)
|
||||||
|
.with('admin_user', () => SetupSteps.AdminUser)
|
||||||
|
.otherwise(() => SetupSteps.Welcome);
|
||||||
|
this.currentStep(setupStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contents(vnode: Vnode<SetupPageAttributes>) {
|
contents(vnode: Vnode<SetupPageAttributes>) {
|
||||||
return <>
|
return <>
|
||||||
<h1>{__('Configurazione iniziale')}</h1>
|
<h1>{__('Configurazione iniziale')}</h1>
|
||||||
|
|
Loading…
Reference in New Issue