mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-05 09:29:27 +00:00
Merge branch 'dev' into clients-pops
This commit is contained in:
@@ -29,23 +29,26 @@ import {
|
||||
FormMessage
|
||||
} from "@app/components/ui/form";
|
||||
import { Alert, AlertDescription } from "@app/components/ui/alert";
|
||||
import CreateSiteForm from "../[orgId]/settings/sites/CreateSiteForm";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
type Step = "org" | "site" | "resources";
|
||||
|
||||
const orgSchema = z.object({
|
||||
orgName: z.string().min(1, { message: "Organization name is required" }),
|
||||
orgId: z.string().min(1, { message: "Organization ID is required" }),
|
||||
subnet: z.string().min(1, { message: "Subnet is required" })
|
||||
});
|
||||
|
||||
export default function StepperForm() {
|
||||
const [currentStep, setCurrentStep] = useState<Step>("org");
|
||||
const [orgIdTaken, setOrgIdTaken] = useState(false);
|
||||
const t = useTranslations();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [isChecked, setIsChecked] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const orgSchema = z.object({
|
||||
orgName: z.string().min(1, { message: t('orgNameRequired') }),
|
||||
orgId: z.string().min(1, { message: t('orgIdRequired') }),
|
||||
subnet: z.string().min(1, { message: t('subnetRequired') })
|
||||
});
|
||||
|
||||
const orgForm = useForm<z.infer<typeof orgSchema>>({
|
||||
resolver: zodResolver(orgSchema),
|
||||
defaultValues: {
|
||||
@@ -132,7 +135,7 @@ export default function StepperForm() {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setError(
|
||||
formatAxiosError(e, "An error occurred while creating org")
|
||||
formatAxiosError(e, t('orgErrorCreate'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -143,9 +146,9 @@ export default function StepperForm() {
|
||||
<>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>New Organization</CardTitle>
|
||||
<CardTitle>{t('setupNewOrg')}</CardTitle>
|
||||
<CardDescription>
|
||||
Create your organization, site, and resources
|
||||
{t('setupCreate')}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -168,7 +171,7 @@ export default function StepperForm() {
|
||||
: "text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
Create Org
|
||||
{t('setupCreateOrg')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center">
|
||||
@@ -188,7 +191,7 @@ export default function StepperForm() {
|
||||
: "text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
Create Site
|
||||
{t('siteCreate')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center">
|
||||
@@ -208,7 +211,7 @@ export default function StepperForm() {
|
||||
: "text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
Create Resources
|
||||
{t('setupCreateResources')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -227,7 +230,7 @@ export default function StepperForm() {
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>
|
||||
Organization Name
|
||||
{t('setupOrgName')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
@@ -254,8 +257,7 @@ export default function StepperForm() {
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
<FormDescription>
|
||||
This is the display name for
|
||||
your organization.
|
||||
{t('orgDisplayName')}
|
||||
</FormDescription>
|
||||
</FormItem>
|
||||
)}
|
||||
@@ -266,7 +268,7 @@ export default function StepperForm() {
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>
|
||||
Organization ID
|
||||
{t('orgId')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
@@ -276,11 +278,7 @@ export default function StepperForm() {
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
<FormDescription>
|
||||
This is the unique
|
||||
identifier for your
|
||||
organization. This is
|
||||
separate from the display
|
||||
name.
|
||||
{t('setupIdentifierMessage')}
|
||||
</FormDescription>
|
||||
</FormItem>
|
||||
)}
|
||||
@@ -312,9 +310,7 @@ export default function StepperForm() {
|
||||
{orgIdTaken && (
|
||||
<Alert variant="destructive">
|
||||
<AlertDescription>
|
||||
Organization ID is already
|
||||
taken. Please choose a different
|
||||
one.
|
||||
{t('setupErrorIdentifier')}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
@@ -337,7 +333,7 @@ export default function StepperForm() {
|
||||
orgIdTaken
|
||||
}
|
||||
>
|
||||
Create Organization
|
||||
{t('setupCreateOrg')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user