mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
chore: adjust reminder days (#9810)
This commit is contained in:
parent
150a044207
commit
a22f5d0201
@ -34,6 +34,9 @@ const ActionsBox = styled(Box)(({ theme }) => ({
|
|||||||
|
|
||||||
type ReminderType = 'complete' | 'removeCode' | 'archive' | null;
|
type ReminderType = 'complete' | 'removeCode' | 'archive' | null;
|
||||||
|
|
||||||
|
export const COMPLETE_REMINDER_DAYS = 30;
|
||||||
|
export const REMOVE_CODE_REMINDER_DAYS = 3;
|
||||||
|
|
||||||
export const CleanupReminder: FC<{
|
export const CleanupReminder: FC<{
|
||||||
feature: IFeatureToggle;
|
feature: IFeatureToggle;
|
||||||
onChange: () => void;
|
onChange: () => void;
|
||||||
@ -62,7 +65,10 @@ export const CleanupReminder: FC<{
|
|||||||
const determineReminder = (): ReminderType => {
|
const determineReminder = (): ReminderType => {
|
||||||
if (!currentStage || !isRelevantType) return null;
|
if (!currentStage || !isRelevantType) return null;
|
||||||
|
|
||||||
if (currentStage.name === 'live' && daysInStage > 30) {
|
if (
|
||||||
|
currentStage.name === 'live' &&
|
||||||
|
daysInStage > COMPLETE_REMINDER_DAYS
|
||||||
|
) {
|
||||||
return 'complete';
|
return 'complete';
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -72,7 +78,7 @@ export const CleanupReminder: FC<{
|
|||||||
if (isSafeToArchive(currentStage.environments)) {
|
if (isSafeToArchive(currentStage.environments)) {
|
||||||
return 'archive';
|
return 'archive';
|
||||||
}
|
}
|
||||||
if (daysInStage > 2) {
|
if (daysInStage > REMOVE_CODE_REMINDER_DAYS) {
|
||||||
return 'removeCode';
|
return 'removeCode';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import { isBefore, parseISO, subDays } from 'date-fns';
|
import { isBefore, parseISO, subDays } from 'date-fns';
|
||||||
|
|
||||||
|
// no metrics received in this period
|
||||||
|
const SAFE_TO_ARCHIVE_DAYS = 2;
|
||||||
|
|
||||||
export function isSafeToArchive(
|
export function isSafeToArchive(
|
||||||
environments: Array<{ name: string; lastSeenAt: string }>,
|
environments: Array<{ name: string; lastSeenAt: string }>,
|
||||||
) {
|
) {
|
||||||
const twoDaysAgo = subDays(new Date(), 2);
|
const daysAgo = subDays(new Date(), SAFE_TO_ARCHIVE_DAYS);
|
||||||
|
|
||||||
return environments.every((env) => {
|
return environments.every((env) => {
|
||||||
const lastSeenDate = parseISO(env.lastSeenAt);
|
const lastSeenDate = parseISO(env.lastSeenAt);
|
||||||
|
|
||||||
return isBefore(lastSeenDate, twoDaysAgo);
|
return isBefore(lastSeenDate, daysAgo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user