Skip to content

Commit 5b598dc

Browse files
authored
Préavis - Correction du téléchargement des autorisations de débarquement (#3518)
## Linked issues - Préavis - Correction du téléchargement des autorisations de débarquement ---- - [ ] Tests E2E (Cypress)
2 parents 62d9ae7 + 8b37bec commit 5b598dc

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

frontend/cypress/e2e/side_window/logbook_prior_notification_form/form.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { editSideWindowPriorNotification } from '../manual_prior_notification_fo
44

55
context('Side Window > Logbook Prior Notification Form > Form', () => {
66
it('Should not update the form with a PUT request on first render', () => {
7-
cy.intercept('PUT', '/bff/v1/prior_notifications/logbook/FAKE_OPERATION_109*', cy.spy().as('updateForm'))
7+
cy.intercept('PUT', '/bff/v1/prior_notifications/logbook/FAKE_OPERATION_114*', cy.spy().as('updateForm'))
88

9-
editSideWindowPriorNotification(`L'ANCRE`, 'FAKE_OPERATION_109')
9+
editSideWindowPriorNotification(`LA MER À BOIRE`, 'FAKE_OPERATION_114')
1010

11-
cy.contains(`L'ANCRE SÈCHE (CFR106)`).should('be.visible')
11+
cy.contains(`LA MER À BOIRE (CFR110)`).should('be.visible')
1212

1313
cy.get('@updateForm').should('not.have.been.called')
1414

@@ -17,7 +17,7 @@ context('Side Window > Logbook Prior Notification Form > Form', () => {
1717
cy.get('@updateForm').should('have.been.calledOnce')
1818

1919
// Reset
20-
cy.request('PUT', `/bff/v1/prior_notifications/logbook/FAKE_OPERATION_109?operationDate=${dayjs().toISOString()}`, {
20+
cy.request('PUT', `/bff/v1/prior_notifications/logbook/FAKE_OPERATION_114?operationDate=${dayjs().toISOString()}`, {
2121
body: {
2222
authorTrigram: null,
2323
note: null

frontend/src/features/Logbook/LogbookMessage.types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export namespace LogbookMessage {
1515
ircs: string | undefined
1616
isCorrectedByNewerMessage: boolean
1717
isDeleted: boolean
18-
isManuallyCreated: boolean
1918
isSentByFailoverSoftware: boolean
2019
message: MessageBase | undefined
2120
messageType: MessageType

frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/Content.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export function Content({ detail, isValidatingOnChange, onClose, onSubmit, onVer
193193
{!!detail && (
194194
<DownloadButton
195195
isDisabled={isPriorNotificationFormDirty}
196+
isManuallyCreated={detail.isManuallyCreated}
196197
pnoLogbookMessage={detail.logbookMessage}
197198
reportId={detail.reportId}
198199
/>

frontend/src/features/PriorNotification/components/PriorNotificationCard/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ export function PriorNotificationCard({
123123
Fermer
124124
</Button>
125125

126-
<DownloadButton pnoLogbookMessage={detail.logbookMessage} reportId={detail.reportId} />
126+
<DownloadButton
127+
isManuallyCreated={detail.isManuallyCreated}
128+
pnoLogbookMessage={detail.logbookMessage}
129+
reportId={detail.reportId}
130+
/>
127131

128132
{footerChildren}
129133
</Footer>

frontend/src/features/PriorNotification/components/shared/DownloadButton/__tests__/getHtmlContent.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('PriorNotificationCard/utils.getHtmlContent()', () => {
2222
ircs: undefined,
2323
isCorrectedByNewerMessage: false,
2424
isDeleted: false,
25-
isManuallyCreated: true,
2625
isSentByFailoverSoftware: false,
2726
message: {
2827
authorTrigram: undefined,

frontend/src/features/PriorNotification/components/shared/DownloadButton/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ import type { LogbookMessage } from '@features/Logbook/LogbookMessage.types'
1414

1515
type DownloadButtonProps = Readonly<{
1616
isDisabled?: boolean
17+
isManuallyCreated: boolean
1718
pnoLogbookMessage: LogbookMessage.PnoLogbookMessage
1819
reportId: string
1920
}>
20-
export function DownloadButton({ isDisabled = false, pnoLogbookMessage, reportId }: DownloadButtonProps) {
21+
export function DownloadButton({
22+
isDisabled = false,
23+
isManuallyCreated,
24+
pnoLogbookMessage,
25+
reportId
26+
}: DownloadButtonProps) {
2127
const isSuperUser = useIsSuperUser()
2228
const getGearsApiQuery = useGetGearsQuery()
2329
const { isError } = useGetPriorNotificationPDFQuery(reportId, RTK_ONE_MINUTE_POLLING_QUERY_OPTIONS)
@@ -28,7 +34,7 @@ export function DownloadButton({ isDisabled = false, pnoLogbookMessage, reportId
2834
getAlpha2CodeFromAlpha2or3Code(pnoLogbookMessage.flagState),
2935
pnoLogbookMessage.externalReferenceNumber
3036
) &&
31-
pnoLogbookMessage.isManuallyCreated
37+
isManuallyCreated
3238
const pdfUrl = `/api/v1/prior_notifications/pdf/${reportId}`
3339

3440
const gearsWithName = useMemo(() => {

0 commit comments

Comments
 (0)