mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: wizard last step disable
This commit is contained in:
@@ -79,8 +79,27 @@
|
||||
|
||||
wizard.setInterceptor(null);
|
||||
if (isLastStep) {
|
||||
trackEvent('wizard_finish');
|
||||
dispatch('finish');
|
||||
if ($wizard.finalAction) {
|
||||
$wizard.nextDisabled = true;
|
||||
try {
|
||||
await $wizard.finalAction();
|
||||
trackEvent('wizard_finish');
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
} finally {
|
||||
$wizard.nextDisabled = false;
|
||||
}
|
||||
} else {
|
||||
$wizard.nextDisabled = true;
|
||||
trackEvent('wizard_finish');
|
||||
dispatch('finish');
|
||||
setTimeout(() => {
|
||||
$wizard.nextDisabled = false;
|
||||
}, 2000);
|
||||
}
|
||||
} else {
|
||||
if (steps.get($wizard.step + 1)?.disabled) {
|
||||
$wizard.step++;
|
||||
|
||||
@@ -9,6 +9,7 @@ export type WizardStore = {
|
||||
component?: typeof SvelteComponent<unknown>;
|
||||
cover?: typeof SvelteComponent<unknown>;
|
||||
interceptor?: () => Promise<void>;
|
||||
finalAction?: () => Promise<void>;
|
||||
nextDisabled: boolean;
|
||||
step: number;
|
||||
interceptorNotificationEnabled: boolean;
|
||||
@@ -23,7 +24,8 @@ function createWizardStore() {
|
||||
interceptorNotificationEnabled: true,
|
||||
media: null,
|
||||
nextDisabled: false,
|
||||
step: 1
|
||||
step: 1,
|
||||
finalAction: null
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -34,9 +36,12 @@ function createWizardStore() {
|
||||
n.show = true;
|
||||
n.component = component;
|
||||
n.interceptor = null;
|
||||
n.interceptorNotificationEnabled = true;
|
||||
n.media = media;
|
||||
n.step = 1;
|
||||
n.cover = null;
|
||||
n.nextDisabled = false;
|
||||
n.finalAction = null;
|
||||
trackEvent('wizard_start');
|
||||
return n;
|
||||
}),
|
||||
@@ -57,9 +62,13 @@ function createWizardStore() {
|
||||
n.show = false;
|
||||
n.component = null;
|
||||
n.interceptor = null;
|
||||
n.interceptorNotificationEnabled = true;
|
||||
n.media = null;
|
||||
n.step = 1;
|
||||
n.cover = null;
|
||||
n.nextDisabled = false;
|
||||
n.finalAction = null;
|
||||
|
||||
return n;
|
||||
}),
|
||||
showCover: (component: typeof SvelteComponent<unknown>) =>
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
}
|
||||
|
||||
async function changeTier() {
|
||||
$wizard.nextDisabled = true;
|
||||
//Downgrade
|
||||
if ($changeOrganizationTier.billingPlan === 'tier-0') {
|
||||
try {
|
||||
@@ -72,8 +71,6 @@
|
||||
e,
|
||||
$isUpgrade ? Submit.OrganizationUpgrade : Submit.OrganizationDowngrade
|
||||
);
|
||||
} finally {
|
||||
$wizard.nextDisabled = false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -178,8 +175,6 @@
|
||||
e,
|
||||
$isUpgrade ? Submit.OrganizationUpgrade : Submit.OrganizationDowngrade
|
||||
);
|
||||
} finally {
|
||||
$wizard.nextDisabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,11 +225,12 @@
|
||||
label: 'Review',
|
||||
component: ConfirmDetails
|
||||
});
|
||||
|
||||
$wizard.finalAction = changeTier;
|
||||
</script>
|
||||
|
||||
<Wizard
|
||||
title="Change plan"
|
||||
steps={$changeTierSteps}
|
||||
finalAction={$changeOrganizationFinalAction}
|
||||
on:finish={changeTier}
|
||||
on:exit={onFinish} />
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
}
|
||||
|
||||
async function create() {
|
||||
$wizard.nextDisabled = true;
|
||||
try {
|
||||
const org = await sdk.forConsole.billing.createOrganization(
|
||||
$createOrganization.id ?? ID.unique(),
|
||||
@@ -105,8 +104,6 @@
|
||||
message: e.mesage
|
||||
});
|
||||
trackError(e, Submit.OrganizationCreate);
|
||||
} finally {
|
||||
$wizard.nextDisabled = false;
|
||||
}
|
||||
}
|
||||
onDestroy(() => {
|
||||
@@ -150,11 +147,12 @@
|
||||
label: 'Review',
|
||||
component: ConfirmDetails
|
||||
});
|
||||
|
||||
$wizard.finalAction = create;
|
||||
</script>
|
||||
|
||||
<Wizard
|
||||
title="Create organization"
|
||||
steps={$createOrgSteps}
|
||||
finalAction={$createOrganizationFinalAction}
|
||||
on:finish={create}
|
||||
on:exit={onFinish} />
|
||||
|
||||
@@ -72,14 +72,11 @@
|
||||
project: null
|
||||
};
|
||||
}
|
||||
|
||||
$wizard.finalAction = handleSubmit;
|
||||
</script>
|
||||
|
||||
<Wizard
|
||||
title="Contact us"
|
||||
steps={stepsComponents}
|
||||
finalAction="Submit"
|
||||
on:finish={handleSubmit}
|
||||
on:exit={resetData}>
|
||||
<Wizard title="Contact us" steps={stepsComponents} finalAction="Submit" on:exit={resetData}>
|
||||
<svelte:fragment slot="aside">
|
||||
<h4 class="body-text-1 u-bold">Contact the Appwrite Team</h4>
|
||||
<p class="text u-margin-block-start-16">
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<InputText
|
||||
label="Name"
|
||||
id="name"
|
||||
autofocus
|
||||
placeholder="Organization name"
|
||||
bind:value={$createOrganization.name}
|
||||
required />
|
||||
|
||||
Reference in New Issue
Block a user