mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-27 22:25:58 +02:00
Fix domain picker build and copy in for domains
This commit is contained in:
parent
78661799f2
commit
83b00c1cfa
2 changed files with 16 additions and 10 deletions
|
@ -63,7 +63,7 @@ async function copyInDomains() {
|
||||||
if (existingDomainKeys.has(domainId)) {
|
if (existingDomainKeys.has(domainId)) {
|
||||||
await trx
|
await trx
|
||||||
.update(domains)
|
.update(domains)
|
||||||
.set({ baseDomain })
|
.set({ baseDomain, verified: true, type: "wildcard" })
|
||||||
.where(eq(domains.domainId, domainId))
|
.where(eq(domains.domainId, domainId))
|
||||||
.execute();
|
.execute();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { AxiosResponse } from "axios";
|
||||||
import { cn } from "@/lib/cn";
|
import { cn } from "@/lib/cn";
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { build } from "@server/build";
|
||||||
|
|
||||||
type OrganizationDomain = {
|
type OrganizationDomain = {
|
||||||
domainId: string;
|
domainId: string;
|
||||||
|
@ -95,7 +96,9 @@ export default function DomainPicker({
|
||||||
const domains = response.data.data.domains
|
const domains = response.data.data.domains
|
||||||
.filter(
|
.filter(
|
||||||
(domain) =>
|
(domain) =>
|
||||||
domain.type === "ns" || domain.type === "cname" || domain.type === "wildcard"
|
domain.type === "ns" ||
|
||||||
|
domain.type === "cname" ||
|
||||||
|
domain.type === "wildcard"
|
||||||
)
|
)
|
||||||
.map((domain) => ({
|
.map((domain) => ({
|
||||||
...domain,
|
...domain,
|
||||||
|
@ -198,7 +201,7 @@ export default function DomainPicker({
|
||||||
-(baseDomainLower.length + 1)
|
-(baseDomainLower.length + 1)
|
||||||
);
|
);
|
||||||
// Only allow one level up (no dots in subdomain)
|
// Only allow one level up (no dots in subdomain)
|
||||||
if (!subdomain.includes('.')) {
|
if (!subdomain.includes(".")) {
|
||||||
options.push({
|
options.push({
|
||||||
id: `org-${orgDomain.domainId}`,
|
id: `org-${orgDomain.domainId}`,
|
||||||
domain: userInput,
|
domain: userInput,
|
||||||
|
@ -220,7 +223,7 @@ export default function DomainPicker({
|
||||||
domain: option.fullDomain,
|
domain: option.fullDomain,
|
||||||
type: "provided",
|
type: "provided",
|
||||||
domainNamespaceId: option.domainNamespaceId,
|
domainNamespaceId: option.domainNamespaceId,
|
||||||
domainId: option.domainId,
|
domainId: option.domainId
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -278,7 +281,7 @@ export default function DomainPicker({
|
||||||
subdomain: option.subdomain || undefined,
|
subdomain: option.subdomain || undefined,
|
||||||
fullDomain: option.domain,
|
fullDomain: option.domain,
|
||||||
baseDomain: option.subdomain
|
baseDomain: option.subdomain
|
||||||
? option.domain.split('.').slice(1).join('.')
|
? option.domain.split(".").slice(1).join(".")
|
||||||
: option.domain
|
: option.domain
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -339,9 +342,11 @@ export default function DomainPicker({
|
||||||
<TabsTrigger value="organization">
|
<TabsTrigger value="organization">
|
||||||
{t("domainPickerTabOrganization")}
|
{t("domainPickerTabOrganization")}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
|
{build == "saas" && (
|
||||||
<TabsTrigger value="provided">
|
<TabsTrigger value="provided">
|
||||||
{t("domainPickerTabProvided")}
|
{t("domainPickerTabProvided")}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
|
)}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<Button
|
<Button
|
||||||
|
@ -406,7 +411,8 @@ export default function DomainPicker({
|
||||||
: "cursor-not-allowed opacity-60"
|
: "cursor-not-allowed opacity-60"
|
||||||
)}
|
)}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
option.verified && handleOptionSelect(option)
|
option.verified &&
|
||||||
|
handleOptionSelect(option)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue