Added watchlist paths for Gitea and some minor typescript fixes.

This commit is contained in:
Jason Parks
2025-03-19 16:48:51 -06:00
parent 997e755b6f
commit 56d8defebe
11 changed files with 814 additions and 690 deletions

View File

@@ -1,3 +1,4 @@
import { AlertBlock } from "@/components/shared/alert-block";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -12,7 +13,6 @@ import { ExternalLink, PlusIcon } from "lucide-react";
import Link from "next/link";
import { AddManager } from "./manager/add-manager";
import { AddWorker } from "./workers/add-worker";
import { AlertBlock } from "@/components/shared/alert-block";
interface Props {
serverId?: string;

View File

@@ -45,7 +45,7 @@ const Schema = z.object({
redirectUri: z.string().min(1, {
message: "Redirect URI is required",
}),
organizationName: z.string().optional(), // Added organizationName to the schema
organizationName: z.string().optional(),
});
type Schema = z.infer<typeof Schema>;
@@ -54,8 +54,8 @@ export const AddGiteaProvider = () => {
const utils = api.useUtils();
const [isOpen, setIsOpen] = useState(false);
const url = useUrl();
const { mutateAsync, error, isError } = api.gitea.create.useMutation(); // Updated API call for Gitea
const webhookUrl = `${url}/api/providers/gitea/callback`; // Updated webhook URL for Gitea
const { mutateAsync, error, isError } = api.gitea.create.useMutation();
const webhookUrl = `${url}/api/providers/gitea/callback`;
const form = useForm<Schema>({
defaultValues: {
@@ -86,7 +86,7 @@ export const AddGiteaProvider = () => {
clientSecret: data.clientSecret || "",
name: data.name || "",
redirectUri: data.redirectUri || "",
giteaUrl: data.giteaUrl || "https://gitea.com", // Use Gitea URL
giteaUrl: data.giteaUrl || "https://gitea.com",
})
.then(async () => {
await utils.gitProvider.getAll.invalidate();
@@ -177,7 +177,7 @@ export const AddGiteaProvider = () => {
<FormField
control={form.control}
name="giteaUrl" // Ensure consistent name for Gitea URL
name="giteaUrl"
render={({ field }) => (
<FormItem>
<FormLabel>Gitea URL</FormLabel>
@@ -240,7 +240,7 @@ export const AddGiteaProvider = () => {
/>
<Button isLoading={form.formState.isSubmitting}>
Configure Gitea App {/* Ensured consistency with Gitea */}
Configure Gitea App
</Button>
</div>
</CardContent>

View File

@@ -161,7 +161,11 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
{...field}
onChange={(e) => {
const value = e.target.value;
field.onChange(value === "" ? undefined : Number(value));
field.onChange(
value === ""
? undefined
: Number(value),
);
}}
value={field.value || ""}
className="w-full dark:bg-black"
@@ -189,7 +193,11 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
{...field}
onChange={(e) => {
const value = e.target.value;
field.onChange(value === "" ? undefined : Number(value));
field.onChange(
value === ""
? undefined
: Number(value),
);
}}
value={field.value || ""}
className="w-full dark:bg-black"