Skip to content

Commit

Permalink
Merge pull request #439 from MTES-MCT/fix-rescue-jeanne-barret
Browse files Browse the repository at this point in the history
fix: fix validation for ActionRescueEntity
  • Loading branch information
lwih authored Nov 19, 2024
2 parents d690b9e + b88adff commit 5608e8a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ data class ActionRescueEntity(

@MandatoryForStats
override val startDateTimeUtc: Instant,
@MandatoryForStats
override val endDateTimeUtc: Instant? = null,

@MandatoryForStats
Expand Down
24 changes: 12 additions & 12 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FC } from 'react'
import DateRangePicker from '@common/components/elements/dates/daterange-picker.tsx'
import { DateRange } from '@mtes-mct/monitor-ui/types/definitions'
import useMissionDates from '@features/pam/mission/hooks/use-mission-dates.tsx'
import { useParams } from 'react-router-dom'

type PatchableMonitorDateRangeProps = {
Expand All @@ -17,11 +16,9 @@ const PatchableMonitorDateRange: FC<PatchableMonitorDateRangeProps> = ({
startDateTimeUtc,
endDateTimeUtc,
label,
isLight,
dateValidation
isLight
}) => {
const { missionId } = useParams()

Check warning on line 21 in frontend/src/features/common/components/elements/patchable-monitor-daterange.tsx

View workflow job for this annotation

GitHub Actions / build-and-test-frontend

'missionId' is assigned a value but never used
const missionDates = useMissionDates(missionId)

const onChangeDates = (value?: DateRange) => {
if (value) {
Expand All @@ -34,7 +31,6 @@ const PatchableMonitorDateRange: FC<PatchableMonitorDateRangeProps> = ({
return (
<DateRangePicker
selectedRange={[startDateTimeUtc, endDateTimeUtc]}
allowedRange={dateValidation ? missionDates : undefined}
label={label}
withTime={true}
isCompact={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ import ControlSecurityForm from '../controls/control-security-form.tsx'
import ActionHeader from './action-header.tsx'
import { ActionDetailsProps } from './action-mapping.ts'
import { DateRange } from '@mtes-mct/monitor-ui/types/definitions'
import useMissionDates from '@features/pam/mission/hooks/use-mission-dates.tsx'

type ActionControlNavProps = ActionDetailsProps

const ActionControlNav: React.FC<ActionControlNavProps> = ({ action }) => {
const navigate = useNavigate()
const { missionId, actionId } = useParams()
const isMissionFinished = useIsMissionFinished(missionId)
const missionDates = useMissionDates(missionId)
const [observationsValue, setObservationsValue] = useState<string | undefined>(undefined)
const [identityControlledPersonValue, setIdentityControlledPersonValue] = useState<string | undefined>(undefined)
const [vesselIdentifierValue, setVesselIdentifierValue] = useState<string | undefined>(undefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import { ActionDetailsProps } from './action-mapping.ts'
import ActionHeader from './action-header.tsx'
import useIsMissionFinished from '../../../hooks/use-is-mission-finished.tsx'
import DatePicker from '@common/components/elements/dates/date-picker.tsx'
import useMissionDates from '@features/pam/mission/hooks/use-mission-dates.tsx'

type ActionStatusFormProps = ActionDetailsProps

const ActionStatusForm: React.FC<ActionStatusFormProps> = ({ action }) => {
const navigate = useNavigate()
const { missionId, actionId } = useParams()
const missionDates = useMissionDates(missionId)
const isMissionFinished = useIsMissionFinished(missionId)

const { data: navAction, loading, error } = useActionById(actionId, missionId, action.source, action.type)
Expand Down Expand Up @@ -110,7 +108,6 @@ const ActionStatusForm: React.FC<ActionStatusFormProps> = ({ action }) => {
onChange={async (nextUtcDate: Date) => {
await onChange(nextUtcDate)('startDateTimeUtc')
}}
allowedRange={missionDates}
/>
</Stack.Item>
<Stack.Item grow={3}>
Expand Down

0 comments on commit 5608e8a

Please sign in to comment.