mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
refactor edit connector page for smaller file size
This commit is contained in:
parent
5c81c6037d
commit
53436370d6
4 changed files with 312 additions and 342 deletions
33
surfsense_web/components/editConnector/types.ts
Normal file
33
surfsense_web/components/editConnector/types.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import * as z from "zod";
|
||||
|
||||
// Types
|
||||
export interface GithubRepo {
|
||||
id: number;
|
||||
name: string;
|
||||
full_name: string;
|
||||
private: boolean;
|
||||
url: string;
|
||||
description: string | null;
|
||||
last_updated: string | null;
|
||||
}
|
||||
|
||||
export type EditMode = 'viewing' | 'editing_repos';
|
||||
|
||||
// Schemas
|
||||
export const githubPatSchema = z.object({
|
||||
github_pat: z.string()
|
||||
.min(20, { message: "GitHub Personal Access Token seems too short." })
|
||||
.refine(pat => pat.startsWith('ghp_') || pat.startsWith('github_pat_'), {
|
||||
message: "GitHub PAT should start with 'ghp_' or 'github_pat_'",
|
||||
}),
|
||||
});
|
||||
export type GithubPatFormValues = z.infer<typeof githubPatSchema>;
|
||||
|
||||
export const editConnectorSchema = z.object({
|
||||
name: z.string().min(3, { message: "Connector name must be at least 3 characters." }),
|
||||
SLACK_BOT_TOKEN: z.string().optional(),
|
||||
NOTION_INTEGRATION_TOKEN: z.string().optional(),
|
||||
SERPER_API_KEY: z.string().optional(),
|
||||
TAVILY_API_KEY: z.string().optional(),
|
||||
});
|
||||
export type EditConnectorFormValues = z.infer<typeof editConnectorSchema>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue