feat: add maxSyncPeriod configuration to TFS settings
- Introduced maxSyncPeriod option in TfsConfigForm for user-defined synchronization duration. - Updated TfsService to filter pull requests based on the configured maxSyncPeriod. - Enhanced TfsPullRequest type to include 'rejected' status for better PR management. - Set default maxSyncPeriod to '90d' in user preferences and TFS configuration.
This commit is contained in:
@@ -15,6 +15,7 @@ export function TfsConfigForm() {
|
||||
personalAccessToken: '',
|
||||
repositories: [],
|
||||
ignoredRepositories: [],
|
||||
maxSyncPeriod: '90d',
|
||||
});
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [message, setMessage] = useState<{
|
||||
@@ -94,13 +95,14 @@ export function TfsConfigForm() {
|
||||
startTransition(async () => {
|
||||
setMessage(null);
|
||||
// Réinitialiser la config
|
||||
const resetConfig = {
|
||||
const resetConfig: TfsConfig = {
|
||||
enabled: false,
|
||||
organizationUrl: '',
|
||||
projectName: '',
|
||||
personalAccessToken: '',
|
||||
repositories: [],
|
||||
ignoredRepositories: [],
|
||||
maxSyncPeriod: '90d',
|
||||
};
|
||||
|
||||
const result = await saveTfsConfig(resetConfig);
|
||||
@@ -275,6 +277,14 @@ export function TfsConfigForm() {
|
||||
<span className="text-xs">Aucun</span>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-[var(--muted-foreground)]">
|
||||
Période max de sync:
|
||||
</span>{' '}
|
||||
<code className="bg-[var(--background)] px-2 py-1 rounded text-xs">
|
||||
{config?.maxSyncPeriod || '90d'}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -475,6 +485,29 @@ export function TfsConfigForm() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">
|
||||
Période maximale de synchronisation
|
||||
</label>
|
||||
<select
|
||||
value={config.maxSyncPeriod || '90d'}
|
||||
onChange={(e) => updateConfig('maxSyncPeriod', e.target.value)}
|
||||
className="w-full px-3 py-2 border border-[var(--border)] rounded bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:ring-2 focus:ring-[var(--primary)] focus:border-transparent"
|
||||
>
|
||||
<option value="7d">7 jours</option>
|
||||
<option value="30d">30 jours</option>
|
||||
<option value="90d">90 jours (recommandé)</option>
|
||||
<option value="180d">180 jours</option>
|
||||
<option value="1y">1 an</option>
|
||||
<option value="2y">2 ans</option>
|
||||
<option value="3y">3 ans</option>
|
||||
</select>
|
||||
<p className="text-xs text-[var(--muted-foreground)] mt-1">
|
||||
Définit la période maximale pour récupérer les Pull Requests.
|
||||
Les PRs plus anciennes seront ignorées lors de la synchronisation.
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user