1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-10 01:19:53 +01:00

feat: track change progression (#10874)

This commit is contained in:
Mateusz Kwasniewski 2025-10-28 09:28:33 +01:00 committed by GitHub
parent 649e5d8ce5
commit 9142ebf82c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ import { formatUnknownError } from 'utils/formatUnknownError';
import { calculateMilestoneStatus } from './milestoneStatusUtils.js';
import { getPendingProgressionData } from './pendingProgressionChanges.js';
import { MilestoneAutomation } from './MilestoneAutomation.tsx';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker.ts';
const StyledConnection = styled('div', {
shouldForwardProp: (prop) => prop !== 'isCompleted',
@ -54,6 +55,16 @@ export interface IReleasePlanMilestoneItemProps {
onUpdate: () => void | Promise<void>;
}
const getTimeUnit = (intervalMinutes: number): 'minutes' | 'hours' | 'days' => {
if (intervalMinutes < 60) {
return 'minutes';
} else if (intervalMinutes < 1440) {
return 'hours';
} else {
return 'days';
}
};
export const ReleasePlanMilestoneItem = ({
milestone,
index,
@ -77,6 +88,7 @@ export const ReleasePlanMilestoneItem = ({
const { changeMilestoneProgression } = useMilestoneProgressionsApi();
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
const { setToastData, setToastApiError } = useToast();
const { trackEvent } = usePlausibleTracker();
const isNotLastMilestone = index < milestones.length - 1;
const isProgressionFormOpen = progressionFormOpenIndex === index;
@ -89,6 +101,14 @@ export const ReleasePlanMilestoneItem = ({
const handleChangeProgression = async (
payload: ChangeMilestoneProgressionSchema,
): Promise<{ shouldReset?: boolean }> => {
trackEvent('release-management', {
props: {
eventType: 'change-progression',
transitionUnit: getTimeUnit(
payload.transitionCondition.intervalMinutes,
),
},
});
if (isChangeRequestConfigured(environment)) {
onAddToChangeRequest({
type: 'changeMilestoneProgression',