diff --git a/.trivyignore b/.trivyignore index 048fbfd363..8d7c9b6b75 100644 --- a/.trivyignore +++ b/.trivyignore @@ -12,3 +12,4 @@ CVE-2023-49468 CVE-2024-0553 CVE-2024-0567 CVE-2024-22201 +CVE-2024-22259 diff --git a/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx b/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx index d33ee64ccc..210a68a92e 100644 --- a/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx +++ b/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx @@ -345,10 +345,11 @@ describe('MetricsStepper', () => { board: { boardId: '', email: '', site: '', token: '', type: 'Jira' }, calendarType: 'Regular Calendar(Weekend Considered)', dateRange: { - endDate: dayjs().endOf('date').add(13, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), + endDate: dayjs().endOf('date').add(0, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), startDate: dayjs().startOf('date').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), }, metrics: ['Velocity'], + pipelineCrews: undefined, pipelineTool: undefined, projectName: 'test project Name', sourceControl: undefined, @@ -377,18 +378,27 @@ describe('MetricsStepper', () => { board: { boardId: '', email: '', site: '', token: '', type: 'Jira' }, calendarType: 'Regular Calendar(Weekend Considered)', dateRange: { - endDate: dayjs().endOf('date').add(13, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), + endDate: dayjs().endOf('date').add(0, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), startDate: dayjs().startOf('date').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), }, metrics: ['Velocity'], + pipelineCrews: undefined, pipelineTool: undefined, projectName: 'test project Name', sourceControl: undefined, - classification: undefined, - crews: undefined, - cycleTime: undefined, + classification: ['mockClassification'], + crews: ['mockUsers'], + cycleTime: { + jiraColumns: [ + { + Testing: 'Done', + }, + ], + treatFlagCardAsBlock: false, + type: 'byColumn', + }, deployment: undefined, - doneStatus: undefined, + doneStatus: ['Done', 'Canceled'], leadTime: undefined, reworkTimesSettings: { rework2State: null, diff --git a/frontend/src/constants/resources.ts b/frontend/src/constants/resources.ts index ece4140aab..8fdcabe803 100644 --- a/frontend/src/constants/resources.ts +++ b/frontend/src/constants/resources.ts @@ -360,3 +360,5 @@ export const ALL_OPTION_META: Record = { label: 'All', key: 'all', }; + +export const DEFAULT_SPRINT_INTERVAL_OFFSET_DAYS = 13; diff --git a/frontend/src/containers/ConfigStep/DateRangePicker/index.tsx b/frontend/src/containers/ConfigStep/DateRangePicker/index.tsx index 76f9f052ee..2815323d9b 100644 --- a/frontend/src/containers/ConfigStep/DateRangePicker/index.tsx +++ b/frontend/src/containers/ConfigStep/DateRangePicker/index.tsx @@ -7,6 +7,7 @@ import { import { selectDateRange, updateDateRange } from '@src/context/config/configSlice'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { StyledDateRangePicker, StyledDateRangePickerContainer } from './style'; +import { DEFAULT_SPRINT_INTERVAL_OFFSET_DAYS } from '@src/constants/resources'; import { useAppDispatch, useAppSelector } from '@src/hooks/useAppDispatch'; import CalendarTodayIcon from '@mui/icons-material/CalendarToday'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; @@ -24,7 +25,18 @@ export const DateRangePicker = () => { dispatch(initDeploymentFrequencySettings()); dispatch(saveUsers([])); }; + const changeStartDate = (value: Nullable) => { + let daysAddToEndDate = DEFAULT_SPRINT_INTERVAL_OFFSET_DAYS; + if (value) { + const currentDate = dayjs(new Date()); + const valueToStartDate = value.startOf('date').format('YYYY-MM-DDTHH:mm:ss.SSSZ'); + const daysBetweenCurrentAndStartDate = currentDate.diff(valueToStartDate, 'days'); + daysAddToEndDate = + daysBetweenCurrentAndStartDate >= DEFAULT_SPRINT_INTERVAL_OFFSET_DAYS + ? DEFAULT_SPRINT_INTERVAL_OFFSET_DAYS + : daysBetweenCurrentAndStartDate; + } dispatch( updateDateRange( isNull(value) @@ -34,7 +46,7 @@ export const DateRangePicker = () => { } : { startDate: value.startOf('date').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), - endDate: value.endOf('date').add(13, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), + endDate: value.endOf('date').add(daysAddToEndDate, 'day').format('YYYY-MM-DDTHH:mm:ss.SSSZ'), }, ), ); @@ -55,6 +67,7 @@ export const DateRangePicker = () => { changeStartDate(newValue as unknown as Dayjs)} @@ -71,8 +84,10 @@ export const DateRangePicker = () => { }} /> changeEndDate(newValue as unknown as Dayjs)} slots={{