mirror of
https://github.com/LukeHagar/dokploy.git
synced 2025-12-06 04:19:37 +00:00
feat: add appName field to GitHub provider settings and update related API and database schema
This commit is contained in:
@@ -30,6 +30,9 @@ const Schema = z.object({
|
|||||||
name: z.string().min(1, {
|
name: z.string().min(1, {
|
||||||
message: "Name is required",
|
message: "Name is required",
|
||||||
}),
|
}),
|
||||||
|
appName: z.string().min(1, {
|
||||||
|
message: "App Name is required",
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Schema = z.infer<typeof Schema>;
|
type Schema = z.infer<typeof Schema>;
|
||||||
@@ -55,6 +58,7 @@ export const EditGithubProvider = ({ githubId }: Props) => {
|
|||||||
const form = useForm<Schema>({
|
const form = useForm<Schema>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: "",
|
name: "",
|
||||||
|
appName: "",
|
||||||
},
|
},
|
||||||
resolver: zodResolver(Schema),
|
resolver: zodResolver(Schema),
|
||||||
});
|
});
|
||||||
@@ -62,6 +66,7 @@ export const EditGithubProvider = ({ githubId }: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.reset({
|
form.reset({
|
||||||
name: github?.gitProvider.name || "",
|
name: github?.gitProvider.name || "",
|
||||||
|
appName: github?.githubAppName || "",
|
||||||
});
|
});
|
||||||
}, [form, isOpen]);
|
}, [form, isOpen]);
|
||||||
|
|
||||||
@@ -70,6 +75,7 @@ export const EditGithubProvider = ({ githubId }: Props) => {
|
|||||||
githubId,
|
githubId,
|
||||||
name: data.name || "",
|
name: data.name || "",
|
||||||
gitProviderId: github?.gitProviderId || "",
|
gitProviderId: github?.gitProviderId || "",
|
||||||
|
githubAppName: data.appName || "",
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await utils.gitProvider.getAll.invalidate();
|
await utils.gitProvider.getAll.invalidate();
|
||||||
@@ -124,6 +130,22 @@ export const EditGithubProvider = ({ githubId }: Props) => {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="appName"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>App Name</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="pp Name eg(my-personal)"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="flex w-full justify-between gap-4 mt-4">
|
<div className="flex w-full justify-between gap-4 mt-4">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
getGithubBranches,
|
getGithubBranches,
|
||||||
getGithubRepositories,
|
getGithubRepositories,
|
||||||
haveGithubRequirements,
|
haveGithubRequirements,
|
||||||
|
updateGithub,
|
||||||
updateGitProvider,
|
updateGitProvider,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
@@ -134,5 +135,9 @@ export const githubRouter = createTRPCRouter({
|
|||||||
name: input.name,
|
name: input.name,
|
||||||
organizationId: ctx.session.activeOrganizationId,
|
organizationId: ctx.session.activeOrganizationId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await updateGithub(input.githubId, {
|
||||||
|
...input,
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -58,4 +58,5 @@ export const apiUpdateGithub = createSchema.extend({
|
|||||||
githubId: z.string().min(1),
|
githubId: z.string().min(1),
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
gitProviderId: z.string().min(1),
|
gitProviderId: z.string().min(1),
|
||||||
|
githubAppName: z.string().min(1),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user