diff --git a/front/src/api/floris/service.ts b/front/src/api/floris/service.ts index 803705d..66c5573 100644 --- a/front/src/api/floris/service.ts +++ b/front/src/api/floris/service.ts @@ -6,7 +6,9 @@ import { WindmillData } from './types'; import { getWindmillDataRequestParams } from './utils'; export const getWindmillData = (formValues: Partial) => { + const { park } = formValues; const params = getWindmillDataRequestParams(formValues); - const url = `${FLORIS_ENDPOINTS.getWindmillData}?${params}`; + const parkPath = park ? `/${park.id}/` : ''; + const url = `${FLORIS_ENDPOINTS.getWindmillData}${parkPath}?${params}`; return api.get(url); }; diff --git a/front/src/api/floris/utils.ts b/front/src/api/floris/utils.ts index 32841fb..59433fa 100644 --- a/front/src/api/floris/utils.ts +++ b/front/src/api/floris/utils.ts @@ -5,20 +5,25 @@ import { FLORIS_PLOTS } from './constants'; export const getWindmillDataRequestParams = ( formValues: Partial, ) => { - const layoutX = formValues.turbines - ?.map((row) => `layout_x=${row.x}`) - .join('&'); - const layoutY = formValues.turbines - ?.map((row) => `layout_y=${row.y}`) - .join('&'); - const yawAngle = formValues.turbines - ?.map((row) => `yaw_angle=${row.angle}`) - .join('&'); + let params = ''; + if (formValues.turbines) { + const layoutX = formValues.turbines + ?.map((row) => `layout_x=${row.x}`) + .join('&'); + const layoutY = formValues.turbines + ?.map((row) => `layout_y=${row.y}`) + .join('&'); + const yawAngle = formValues.turbines + ?.map((row) => `yaw_angle=${row.angle}`) + .join('&'); + params += `${layoutX}&${layoutY}&${yawAngle}`; + } const plots = Object.values(FLORIS_PLOTS) .filter((_, i) => formValues.plots?.[i]) .map((p) => `plots=${p.name}`) .join('&'); const dateStart = `date_start=${formValues.dateFrom?.substring(0, 10)}`; const dateEnd = `date_end=${formValues.dateTo?.substring(0, 10)}`; - return `${layoutX}&${layoutY}&${yawAngle}&${plots}&${dateStart}&${dateEnd}`; + params += `&${plots}&${dateStart}&${dateEnd}`; + return params; }; diff --git a/front/src/components/ux/floris-form/component.tsx b/front/src/components/ux/floris-form/component.tsx index c5f228f..5d76f02 100644 --- a/front/src/components/ux/floris-form/component.tsx +++ b/front/src/components/ux/floris-form/component.tsx @@ -64,7 +64,13 @@ export function FlorisForm({ const handleManulEntryCheckboxChange = ( event: React.ChangeEvent, ) => { - setIsManualEntry(event.target.checked); + const { checked } = event.target; + setIsManualEntry(checked); + if (checked) { + reset({ ...getValues(), park: undefined }); + } else { + reset({ ...getValues(), turbines: undefined }); + } }; return ( diff --git a/server/public/floris/0056f6b4-f82f-4523-a224-cc8f3b0a8bb9.png b/server/public/floris/0056f6b4-f82f-4523-a224-cc8f3b0a8bb9.png new file mode 100644 index 0000000..4b9bfeb Binary files /dev/null and b/server/public/floris/0056f6b4-f82f-4523-a224-cc8f3b0a8bb9.png differ diff --git a/server/public/floris/184fb09f-4bae-42a3-9691-fad201030766.png b/server/public/floris/184fb09f-4bae-42a3-9691-fad201030766.png new file mode 100644 index 0000000..a4b44d4 Binary files /dev/null and b/server/public/floris/184fb09f-4bae-42a3-9691-fad201030766.png differ diff --git a/server/public/floris/4dfceaf3-2a70-4b93-bfb7-e49dcf2a9ae9.png b/server/public/floris/4dfceaf3-2a70-4b93-bfb7-e49dcf2a9ae9.png new file mode 100644 index 0000000..72c8fb8 Binary files /dev/null and b/server/public/floris/4dfceaf3-2a70-4b93-bfb7-e49dcf2a9ae9.png differ diff --git a/server/public/floris/609bc34a-224b-4d3c-a1fe-404fbb5e4fb0.png b/server/public/floris/609bc34a-224b-4d3c-a1fe-404fbb5e4fb0.png new file mode 100644 index 0000000..3f79c26 Binary files /dev/null and b/server/public/floris/609bc34a-224b-4d3c-a1fe-404fbb5e4fb0.png differ diff --git a/server/public/floris/6172e811-ed32-484b-8e01-71fb8506ead6.png b/server/public/floris/6172e811-ed32-484b-8e01-71fb8506ead6.png new file mode 100644 index 0000000..22dab4f Binary files /dev/null and b/server/public/floris/6172e811-ed32-484b-8e01-71fb8506ead6.png differ diff --git a/server/public/floris/67963f1a-1ae9-458f-a84f-32290e0e3c06.png b/server/public/floris/67963f1a-1ae9-458f-a84f-32290e0e3c06.png new file mode 100644 index 0000000..446fda4 Binary files /dev/null and b/server/public/floris/67963f1a-1ae9-458f-a84f-32290e0e3c06.png differ diff --git a/server/public/floris/7579a4ab-bbc5-4bef-9e21-6adf73774a78.png b/server/public/floris/7579a4ab-bbc5-4bef-9e21-6adf73774a78.png new file mode 100644 index 0000000..0369495 Binary files /dev/null and b/server/public/floris/7579a4ab-bbc5-4bef-9e21-6adf73774a78.png differ diff --git a/server/public/floris/75b3486c-8a18-409e-8fc2-6b7dedc9acaf.png b/server/public/floris/75b3486c-8a18-409e-8fc2-6b7dedc9acaf.png new file mode 100644 index 0000000..3f79c26 Binary files /dev/null and b/server/public/floris/75b3486c-8a18-409e-8fc2-6b7dedc9acaf.png differ diff --git a/server/public/floris/7b47a009-d93d-4b87-9dc2-1e8a9dcfe0ae.png b/server/public/floris/7b47a009-d93d-4b87-9dc2-1e8a9dcfe0ae.png new file mode 100644 index 0000000..1cd91b4 Binary files /dev/null and b/server/public/floris/7b47a009-d93d-4b87-9dc2-1e8a9dcfe0ae.png differ diff --git a/server/public/floris/86b5bb6d-16d4-46cf-a63f-6e92e83debb6.png b/server/public/floris/86b5bb6d-16d4-46cf-a63f-6e92e83debb6.png new file mode 100644 index 0000000..2f6483d Binary files /dev/null and b/server/public/floris/86b5bb6d-16d4-46cf-a63f-6e92e83debb6.png differ diff --git a/server/public/floris/ab071b11-52db-48f8-8ae9-3864df57d927.png b/server/public/floris/ab071b11-52db-48f8-8ae9-3864df57d927.png new file mode 100644 index 0000000..4b9bfeb Binary files /dev/null and b/server/public/floris/ab071b11-52db-48f8-8ae9-3864df57d927.png differ diff --git a/server/public/floris/af4ff8ba-6640-492c-a8d4-7f0fc5f9a5ab.png b/server/public/floris/af4ff8ba-6640-492c-a8d4-7f0fc5f9a5ab.png new file mode 100644 index 0000000..d4d3105 Binary files /dev/null and b/server/public/floris/af4ff8ba-6640-492c-a8d4-7f0fc5f9a5ab.png differ diff --git a/server/public/floris/b946a7f9-b357-4a65-9520-bf025a4dede0.png b/server/public/floris/b946a7f9-b357-4a65-9520-bf025a4dede0.png new file mode 100644 index 0000000..72c8fb8 Binary files /dev/null and b/server/public/floris/b946a7f9-b357-4a65-9520-bf025a4dede0.png differ diff --git a/server/public/floris/d7d8dc29-9330-4658-899c-5e1158a16ba9.png b/server/public/floris/d7d8dc29-9330-4658-899c-5e1158a16ba9.png new file mode 100644 index 0000000..0369495 Binary files /dev/null and b/server/public/floris/d7d8dc29-9330-4658-899c-5e1158a16ba9.png differ diff --git a/server/src/.cache.sqlite b/server/src/.cache.sqlite index 63bf8ca..58eec0d 100644 Binary files a/server/src/.cache.sqlite and b/server/src/.cache.sqlite differ