Compare commits
2 Commits
Features/B
...
fd00f83585
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd00f83585 | ||
|
|
935bee357c |
@@ -45,6 +45,7 @@ const bootstrapStepDefinitions: readonly BootstrapStepDefinition[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const bootstrapCompletionStorageKey = "moku.bootstrap.completed";
|
const bootstrapCompletionStorageKey = "moku.bootstrap.completed";
|
||||||
|
const isDevelopmentEnvironment = import.meta.env.DEV;
|
||||||
|
|
||||||
const defaultInstanceForm = {
|
const defaultInstanceForm = {
|
||||||
protocol: "http",
|
protocol: "http",
|
||||||
@@ -57,7 +58,7 @@ const defaultModeForm = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const defaultAdminForm = {
|
const defaultAdminForm = {
|
||||||
displayName: "Admin",
|
displayName: "First admin",
|
||||||
email: "admin@example.com",
|
email: "admin@example.com",
|
||||||
password: "",
|
password: "",
|
||||||
} as const;
|
} as const;
|
||||||
@@ -291,6 +292,32 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
|
|||||||
void submitCurrentStep();
|
void submitCurrentStep();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDevelopmentReset = async (): Promise<void> => {
|
||||||
|
const response = await fetch(`${apiBase()}/dev/bootstrap/reset`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data = await readResponseBody(response);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(
|
||||||
|
typeof data?.message === "string"
|
||||||
|
? data.message
|
||||||
|
: typeof data?.error?.message === "string"
|
||||||
|
? data.error.message
|
||||||
|
: "Failed to reset development bootstrap state.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
writeBootstrapCompletion(false);
|
||||||
|
setIsBootstrapComplete(false);
|
||||||
|
setIsWizardOpen(true);
|
||||||
|
resetWizardState();
|
||||||
|
await appShellData.reload();
|
||||||
|
};
|
||||||
|
|
||||||
const statusLabel = (state: BootstrapSubmissionState): string => {
|
const statusLabel = (state: BootstrapSubmissionState): string => {
|
||||||
switch (state.status) {
|
switch (state.status) {
|
||||||
case "submitting":
|
case "submitting":
|
||||||
@@ -352,6 +379,20 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
<Show when={isDevelopmentEnvironment && isBootstrapStateResolved()}>
|
||||||
|
<div class={styles.heroActions}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class={styles.secondaryButton}
|
||||||
|
data-slot="development-bootstrap-reset"
|
||||||
|
onClick={() => {
|
||||||
|
void handleDevelopmentReset();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reset development bootstrap state
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@@ -455,13 +496,13 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
|
|||||||
<>
|
<>
|
||||||
<label class={styles.field}>
|
<label class={styles.field}>
|
||||||
<span class={styles.fieldLabel}>Display name</span>
|
<span class={styles.fieldLabel}>Display name</span>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={adminForm.displayName}
|
value={adminForm.displayName}
|
||||||
onInput={(event): void => setAdminForm("displayName", event.currentTarget.value)}
|
onInput={(event): void => setAdminForm("displayName", event.currentTarget.value)}
|
||||||
placeholder="Admin"
|
placeholder="First admin"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class={styles.field}>
|
<label class={styles.field}>
|
||||||
<span class={styles.fieldLabel}>Email</span>
|
<span class={styles.fieldLabel}>Email</span>
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in New Issue
Block a user