Merge branch 'canary' into feat/add-admin-roles

This commit is contained in:
Mauricio Siu
2025-07-12 16:05:28 -06:00
9 changed files with 92 additions and 50 deletions

View File

@@ -43,7 +43,7 @@ import { api } from "@/utils/api";
import { zodResolver } from "@hookform/resolvers/zod";
import { CheckIcon, ChevronsUpDown, HelpCircle, Plus, X } from "lucide-react";
import Link from "next/link";
import { useEffect } from "react";
import { useEffect, useMemo } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
@@ -96,6 +96,16 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
const repository = form.watch("repository");
const gitlabId = form.watch("gitlabId");
const gitlabUrl = useMemo(() => {
const url = gitlabProviders?.find(
(provider) => provider.gitlabId === gitlabId,
)?.gitlabUrl;
const gitlabUrl = url?.replace(/\/$/, "");
return gitlabUrl || "https://gitlab.com";
}, [gitlabId, gitlabProviders]);
const {
data: repositories,
isLoading: isLoadingRepositories,
@@ -224,7 +234,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
<FormLabel>Repository</FormLabel>
{field.value.owner && field.value.repo && (
<Link
href={`https://gitlab.com/${field.value.owner}/${field.value.repo}`}
href={`${gitlabUrl}/${field.value.owner}/${field.value.repo}`}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-1 text-sm text-muted-foreground hover:text-primary"

View File

@@ -153,8 +153,8 @@ export const ShowProviderForm = ({ applicationId }: Props) => {
setSab(e as TabState);
}}
>
<div className="flex flex-row items-center justify-between w-full gap-4">
<TabsList className="md:grid md:w-fit md:grid-cols-7 max-md:overflow-x-scroll justify-start bg-transparent overflow-y-hidden">
<div className="flex flex-row items-center justify-between w-full overflow-auto">
<TabsList className="flex gap-4 justify-start bg-transparent">
<TabsTrigger
value="github"
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"

View File

@@ -142,8 +142,8 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => {
setSab(e as TabState);
}}
>
<div className="flex flex-row items-center justify-between w-full gap-4">
<TabsList className="md:grid md:w-fit md:grid-cols-6 max-md:overflow-x-scroll justify-start bg-transparent overflow-y-hidden">
<div className="flex flex-row items-center justify-between w-full overflow-auto">
<TabsList className="flex gap-4 justify-start bg-transparent">
<TabsTrigger
value="github"
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"

View File

@@ -147,7 +147,7 @@ export const CodeEditor = ({
}: Props) => {
const { resolvedTheme } = useTheme();
return (
<div className={cn("relative overflow-auto", wrapperClassName)}>
<div className={cn("overflow-auto", wrapperClassName)}>
<CodeMirror
basicSetup={{
lineNumbers,
@@ -175,14 +175,15 @@ export const CodeEditor = ({
{...props}
editable={!props.disabled}
className={cn(
"w-full h-full text-sm leading-relaxed",
"w-full h-full text-sm leading-relaxed relative",
`cm-theme-${resolvedTheme}`,
className,
)}
/>
{props.disabled && (
<div className="absolute top-0 rounded-md left-0 w-full h-full flex items-center justify-center z-[10] [background:var(--overlay)] h-full" />
)}
>
{props.disabled && (
<div className="absolute top-0 rounded-md left-0 w-full h-full flex items-center justify-center z-[10] [background:var(--overlay)] h-full" />
)}
</CodeMirror>
</div>
);
};

View File

@@ -111,13 +111,13 @@ const Service = (
</title>
</Head>
<div className="w-full">
<Card className="h-full bg-sidebar p-2.5 rounded-xl w-full">
<Card className="h-full bg-sidebar p-2.5 rounded-xl w-full">
<div className="rounded-xl bg-background shadow-md ">
<CardHeader className="flex flex-row justify-between items-center">
<div className="flex flex-col">
<CardTitle className="text-xl flex flex-row gap-2">
<div className="relative flex flex-row gap-4">
<div className="absolute -right-1 -top-2">
<div className="absolute -right-1 -top-2">
<StatusTooltip status={data?.applicationStatus} />
</div>
@@ -218,17 +218,8 @@ const Service = (
router.push(newPath);
}}
>
<div className="flex flex-row items-center justify-between w-full gap-4 overflow-x-scroll">
<TabsList
className={cn(
"flex gap-8 justify-start max-xl:overflow-x-scroll overflow-y-hidden",
isCloud && data?.serverId
? "md:grid-cols-7"
: data?.serverId
? "md:grid-cols-6"
: "md:grid-cols-7",
)}
>
<div className="flex flex-row items-center justify-between w-full overflow-auto">
<TabsList className="flex gap-8 max-md:gap-4 justify-start">
<TabsTrigger value="general">General</TabsTrigger>
<TabsTrigger value="environment">Environment</TabsTrigger>
<TabsTrigger value="domains">Domains</TabsTrigger>
@@ -308,7 +299,7 @@ const Service = (
</TabsContent>
<TabsContent value="logs">
<div className="flex flex-col gap-4 pt-2.5">
<div className="flex flex-col gap-4 pt-2.5">
<ShowDockerLogs
appName={data?.appName || ""}
serverId={data?.serverId || ""}
@@ -316,7 +307,7 @@ const Service = (
</div>
</TabsContent>
<TabsContent value="schedules">
<div className="flex flex-col gap-4 pt-2.5">
<div className="flex flex-col gap-4 pt-2.5">
<ShowSchedules
id={applicationId}
scheduleType="application"
@@ -324,7 +315,7 @@ const Service = (
</div>
</TabsContent>
<TabsContent value="deployments" className="w-full pt-2.5">
<div className="flex flex-col gap-4 border rounded-lg">
<div className="flex flex-col gap-4 border rounded-lg">
<ShowDeployments
id={applicationId}
type="application"
@@ -334,7 +325,7 @@ const Service = (
</div>
</TabsContent>
<TabsContent value="volume-backups" className="w-full pt-2.5">
<div className="flex flex-col gap-4 border rounded-lg">
<div className="flex flex-col gap-4 border rounded-lg">
<ShowVolumeBackups
id={applicationId}
type="application"

View File

@@ -102,14 +102,14 @@ const Service = (
</title>
</Head>
<div className="w-full">
<Card className="h-full bg-sidebar p-2.5 rounded-xl w-full">
<Card className="h-full bg-sidebar p-2.5 rounded-xl w-full">
<div className="rounded-xl bg-background shadow-md ">
<div className="flex flex-col gap-4">
<CardHeader className="flex flex-row justify-between items-center">
<div className="flex flex-col">
<CardTitle className="text-xl flex flex-row gap-2">
<div className="relative flex flex-row gap-4">
<div className="absolute -right-1 -top-2">
<div className="absolute -right-1 -top-2">
<StatusTooltip status={data?.composeStatus} />
</div>
@@ -211,17 +211,8 @@ const Service = (
router.push(newPath);
}}
>
<div className="flex flex-row items-center justify-between w-full gap-4 overflow-x-scroll">
<TabsList
className={cn(
"flex gap-8 justify-start max-xl:overflow-x-scroll overflow-y-hidden",
isCloud && data?.serverId
? "md:grid-cols-7"
: data?.serverId
? "md:grid-cols-6"
: "md:grid-cols-7",
)}
>
<div className="flex flex-row items-center w-full overflow-auto">
<TabsList className="flex gap-8 max-md:gap-4 justify-start">
<TabsTrigger value="general">General</TabsTrigger>
<TabsTrigger value="environment">Environment</TabsTrigger>
<TabsTrigger value="domains">Domains</TabsTrigger>
@@ -340,7 +331,7 @@ const Service = (
</TabsContent>
<TabsContent value="deployments" className="w-full pt-2.5">
<div className="flex flex-col gap-4 border rounded-lg">
<div className="flex flex-col gap-4 border rounded-lg">
<ShowDeployments
id={composeId}
type="compose"

View File

@@ -76,6 +76,7 @@ export const gitlabRouter = createTRPCRouter({
gitProvider: {
...provider.gitProvider,
},
gitlabUrl: provider.gitlabUrl,
};
});

View File

@@ -360,11 +360,17 @@ export const projectRouter = createTRPCRouter({
redirects,
previewDeployments,
mounts,
appName,
...application
} = await findApplicationById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newApplication = await createApplication({
...application,
appName: newAppName,
name: input.duplicateInSameProject
? `${application.name} (copy)`
: application.name,
@@ -424,11 +430,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "postgres": {
const { postgresId, mounts, backups, ...postgres } =
const { postgresId, mounts, backups, appName, ...postgres } =
await findPostgresById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newPostgres = await createPostgres({
...postgres,
appName: newAppName,
name: input.duplicateInSameProject
? `${postgres.name} (copy)`
: postgres.name,
@@ -454,10 +466,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "mariadb": {
const { mariadbId, mounts, backups, ...mariadb } =
const { mariadbId, mounts, backups, appName, ...mariadb } =
await findMariadbById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newMariadb = await createMariadb({
...mariadb,
appName: newAppName,
name: input.duplicateInSameProject
? `${mariadb.name} (copy)`
: mariadb.name,
@@ -483,10 +502,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "mongo": {
const { mongoId, mounts, backups, ...mongo } =
const { mongoId, mounts, backups, appName, ...mongo } =
await findMongoById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newMongo = await createMongo({
...mongo,
appName: newAppName,
name: input.duplicateInSameProject
? `${mongo.name} (copy)`
: mongo.name,
@@ -512,10 +538,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "mysql": {
const { mysqlId, mounts, backups, ...mysql } =
const { mysqlId, mounts, backups, appName, ...mysql } =
await findMySqlById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newMysql = await createMysql({
...mysql,
appName: newAppName,
name: input.duplicateInSameProject
? `${mysql.name} (copy)`
: mysql.name,
@@ -541,9 +574,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "redis": {
const { redisId, mounts, ...redis } = await findRedisById(id);
const { redisId, mounts, appName, ...redis } =
await findRedisById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newRedis = await createRedis({
...redis,
appName: newAppName,
name: input.duplicateInSameProject
? `${redis.name} (copy)`
: redis.name,
@@ -562,10 +603,17 @@ export const projectRouter = createTRPCRouter({
break;
}
case "compose": {
const { composeId, mounts, domains, ...compose } =
const { composeId, mounts, domains, appName, ...compose } =
await findComposeById(id);
const newAppName = appName.substring(
0,
appName.lastIndexOf("-"),
);
const newCompose = await createCompose({
...compose,
appName: newAppName,
name: input.duplicateInSameProject
? `${compose.name} (copy)`
: compose.name,

View File

@@ -23,7 +23,7 @@ const config = {
sans: ["var(--font-inter)", ...defaultTheme.fontFamily.sans],
},
screens: {
"3xl": "120rem",
"3xl": "1920px",
},
maxWidth: {
"2xl": "40rem",