Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Briefing] Ajout des images de la carte au pdf #1954

Merged
merged 13 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.dev.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ FRONTEND_SENTRY_ENV=dev
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=localhost
FRONTEND_SENTRY_AUTH_TOKEN=DUMMY_TOKEN
FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED=false

################################################################################
# Feature flags
Expand Down Expand Up @@ -130,4 +131,4 @@ FRONTEND_OIDC_REDIRECT_URI=http://localhost:3000/login
# MATOMO

FRONTEND_MATOMO_URL=
FRONTEND_MATOMO_ID=
FRONTEND_MATOMO_ID=
3 changes: 2 additions & 1 deletion .env.infra.example
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=
FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED=
FRONTEND_REPORTING_FORM_AUTO_UPDATE=
FRONTEND_DASHBOARD_ENABLED=
FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED=

################################################################################
# Version
Expand All @@ -129,4 +130,4 @@ FRONTEND_OIDC_REDIRECT_URI=
# MATOMO

FRONTEND_MATOMO_URL=
FRONTEND_MATOMO_ID=
FRONTEND_MATOMO_ID=
1 change: 1 addition & 0 deletions .env.test.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=true
FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED=true
FRONTEND_REPORTING_FORM_AUTO_UPDATE=true
FRONTEND_DASHBOARD_ENABLED=true
FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED=true

################################################################################
# Version
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
- FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED=${FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED}
- FRONTEND_REPORTING_FORM_AUTO_UPDATE=${FRONTEND_REPORTING_FORM_AUTO_UPDATE}
- FRONTEND_DASHBOARD_ENABLED=${FRONTEND_DASHBOARD_ENABLED}
- FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED=${FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED}
- FRONTEND_OIDC_AUTHORITY=${MONITORENV_OIDC_ISSUER_URI}
- FRONTEND_OIDC_CLIENT_ID=${MONITORENV_OIDC_CLIENT_ID}
- FRONTEND_OIDC_ENABLED=${MONITORENV_OIDC_ENABLED}
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.frontend.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=
FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED=
FRONTEND_REPORTING_FORM_AUTO_UPDATE=
FRONTEND_DASHBOARD_ENABLED=
FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED=

################################################################################
# Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ context('Side Window > Dashboard > Edit Dashboard', () => {

cy.intercept('PUT', `/bff/v1/dashboards`).as('saveDashboard')

cy.clickButton('Enregistrer le tableau')
cy.clickButton('Enregistrer le tableau', { withoutScroll: true })

cy.wait('@saveDashboard').then(interception => {
if (!interception.response) {
Expand Down
1 change: 1 addition & 0 deletions frontend/cypress/e2e/utils/visitSideWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function visitSideWindow(isAutoSaveEnabled = 'true') {
Cypress.env('CYPRESS_MISSION_FORM_AUTO_UPDATE', 'true')
Cypress.env('CYPRESS_REPORTING_FORM_AUTO_SAVE_ENABLED', 'true')
Cypress.env('CYPRESS_FRONTEND_DASHBOARD_ENABLED', 'true')
Cypress.env('CYPRESS_FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED', 'true')
}
})
}
1,408 changes: 741 additions & 667 deletions frontend/package-lock.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion frontend/src/domain/entities/layers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export enum MonitorEnvLayers {
DRAW_DASHBOARD = 'DRAW_DASHBOARD',
DRAW_VIGILANCE_AREA = 'DRAW_VIGILANCE_AREA',
EEZ = 'EEZ',
EXPORT_PDF = 'EXPORT_PDF',
FACADES = 'FACADES',
FAO = 'FAO',
HOVERED_MISSION = 'HOVERED_MISSION',
Expand Down Expand Up @@ -281,7 +282,7 @@ export const Layers: Record<MonitorEnvLayers, Layer> = {
zIndex: 1400
},
[MonitorEnvLayers.DRAW_DASHBOARD]: {
code: MonitorEnvLayers.DASHBOARD,
code: MonitorEnvLayers.DRAW_DASHBOARD,
zIndex: 1300
},
[MonitorEnvLayers.DASHBOARD]: {
Expand All @@ -299,6 +300,10 @@ export const Layers: Record<MonitorEnvLayers, Layer> = {
[MonitorEnvLayers.AREA_ICON]: {
code: MonitorEnvLayers.AREA_ICON,
zIndex: 1500
},
[MonitorEnvLayers.EXPORT_PDF]: {
code: MonitorEnvLayers.EXPORT_PDF,
zIndex: 1500
}
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED: string
readonly FRONTEND_DASHBOARD_ENABLED: string
readonly FRONTEND_GEOSERVER_NAMESPACE: string
readonly FRONTEND_GEOSERVER_REMOTE_URL: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Accent, Button, Dialog, Icon, TextInput, THEME } from '@mtes-mct/monito
import { useState } from 'react'
import styled from 'styled-components'

import { GeneratePdfButton } from '../../Pdf/GeneratePdfButton'
import { GeneratePdfButton as GeneratePdfWithoutImagesButton } from '../../Pdf/v1/GeneratePdfButton'
import { GeneratePdfButton } from '../../Pdf/v2/GeneratePdfButton'

import type { DashboardType } from '@features/Dashboard/slice'

Expand All @@ -14,6 +15,7 @@ type FooterProps = {
}

export function Footer({ dashboardForm: [key, dashboard] }: FooterProps) {
const isBriefWithImagesEnabled = import.meta.env.FRONTEND_DASHBOARD_BRIEF_IMAGES_ENABLED === 'true'
const dispatch = useAppDispatch()

const [isSaveDialogOpen, setIsSaveDialogOpen] = useState(false)
Expand Down Expand Up @@ -91,7 +93,11 @@ export function Footer({ dashboardForm: [key, dashboard] }: FooterProps) {
</DeleteButton>

<ButtonsWrapper>
<GeneratePdfButton dashboard={dashboard.dashboard} />
{isBriefWithImagesEnabled ? (
<GeneratePdfButton dashboard={dashboard.dashboard} />
) : (
<GeneratePdfWithoutImagesButton dashboard={dashboard.dashboard} />
)}

<Button accent={Accent.SECONDARY} Icon={Icon.Save} onClick={handleSave}>
Enregistrer le tableau
Expand Down
Loading
Loading