mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-08 20:46:44 +03:00
feat: add ConnectionsForm and ScheduleAndCleanupForm components with configuration forms
This commit is contained in:
47
src/components/config/ConnectionsForm.tsx
Normal file
47
src/components/config/ConnectionsForm.tsx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { GitHubConfigForm } from './GitHubConfigForm';
|
||||||
|
import { GiteaConfigForm } from './GiteaConfigForm';
|
||||||
|
import { Separator } from '../ui/separator';
|
||||||
|
import type { GitHubConfig, GiteaConfig } from '@/types/config';
|
||||||
|
|
||||||
|
interface ConnectionsFormProps {
|
||||||
|
githubConfig: GitHubConfig;
|
||||||
|
giteaConfig: GiteaConfig;
|
||||||
|
setGithubConfig: (update: GitHubConfig | ((prev: GitHubConfig) => GitHubConfig)) => void;
|
||||||
|
setGiteaConfig: (update: GiteaConfig | ((prev: GiteaConfig) => GiteaConfig)) => void;
|
||||||
|
onAutoSaveGitHub?: (config: GitHubConfig) => Promise<void>;
|
||||||
|
onAutoSaveGitea?: (config: GiteaConfig) => Promise<void>;
|
||||||
|
isAutoSavingGitHub?: boolean;
|
||||||
|
isAutoSavingGitea?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ConnectionsForm({
|
||||||
|
githubConfig,
|
||||||
|
giteaConfig,
|
||||||
|
setGithubConfig,
|
||||||
|
setGiteaConfig,
|
||||||
|
onAutoSaveGitHub,
|
||||||
|
onAutoSaveGitea,
|
||||||
|
isAutoSavingGitHub,
|
||||||
|
isAutoSavingGitea,
|
||||||
|
}: ConnectionsFormProps) {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<GitHubConfigForm
|
||||||
|
config={githubConfig}
|
||||||
|
setConfig={setGithubConfig}
|
||||||
|
onAutoSave={onAutoSaveGitHub}
|
||||||
|
isAutoSaving={isAutoSavingGitHub}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<GiteaConfigForm
|
||||||
|
config={giteaConfig}
|
||||||
|
setConfig={setGiteaConfig}
|
||||||
|
onAutoSave={onAutoSaveGitea}
|
||||||
|
isAutoSaving={isAutoSavingGitea}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
47
src/components/config/ScheduleAndCleanupForm.tsx
Normal file
47
src/components/config/ScheduleAndCleanupForm.tsx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ScheduleConfigForm } from './ScheduleConfigForm';
|
||||||
|
import { DatabaseCleanupConfigForm } from './DatabaseCleanupConfigForm';
|
||||||
|
import { Separator } from '../ui/separator';
|
||||||
|
import type { ScheduleConfig, DatabaseCleanupConfig } from '@/types/config';
|
||||||
|
|
||||||
|
interface ScheduleAndCleanupFormProps {
|
||||||
|
scheduleConfig: ScheduleConfig;
|
||||||
|
cleanupConfig: DatabaseCleanupConfig;
|
||||||
|
setScheduleConfig: (update: ScheduleConfig | ((prev: ScheduleConfig) => ScheduleConfig)) => void;
|
||||||
|
setCleanupConfig: (update: DatabaseCleanupConfig | ((prev: DatabaseCleanupConfig) => DatabaseCleanupConfig)) => void;
|
||||||
|
onAutoSaveSchedule?: (config: ScheduleConfig) => Promise<void>;
|
||||||
|
onAutoSaveCleanup?: (config: DatabaseCleanupConfig) => Promise<void>;
|
||||||
|
isAutoSavingSchedule?: boolean;
|
||||||
|
isAutoSavingCleanup?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ScheduleAndCleanupForm({
|
||||||
|
scheduleConfig,
|
||||||
|
cleanupConfig,
|
||||||
|
setScheduleConfig,
|
||||||
|
setCleanupConfig,
|
||||||
|
onAutoSaveSchedule,
|
||||||
|
onAutoSaveCleanup,
|
||||||
|
isAutoSavingSchedule,
|
||||||
|
isAutoSavingCleanup,
|
||||||
|
}: ScheduleAndCleanupFormProps) {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<ScheduleConfigForm
|
||||||
|
config={scheduleConfig}
|
||||||
|
setConfig={setScheduleConfig}
|
||||||
|
onAutoSave={onAutoSaveSchedule}
|
||||||
|
isAutoSaving={isAutoSavingSchedule}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<DatabaseCleanupConfigForm
|
||||||
|
config={cleanupConfig}
|
||||||
|
setConfig={setCleanupConfig}
|
||||||
|
onAutoSave={onAutoSaveCleanup}
|
||||||
|
isAutoSaving={isAutoSavingCleanup}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user