[front-2]: fix
@ -6,7 +6,9 @@ import { WindmillData } from './types';
|
|||||||
import { getWindmillDataRequestParams } from './utils';
|
import { getWindmillDataRequestParams } from './utils';
|
||||||
|
|
||||||
export const getWindmillData = (formValues: Partial<FlorisFormValues>) => {
|
export const getWindmillData = (formValues: Partial<FlorisFormValues>) => {
|
||||||
|
const { park } = formValues;
|
||||||
const params = getWindmillDataRequestParams(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<WindmillData>(url);
|
return api.get<WindmillData>(url);
|
||||||
};
|
};
|
||||||
|
@ -5,20 +5,25 @@ import { FLORIS_PLOTS } from './constants';
|
|||||||
export const getWindmillDataRequestParams = (
|
export const getWindmillDataRequestParams = (
|
||||||
formValues: Partial<FlorisFormValues>,
|
formValues: Partial<FlorisFormValues>,
|
||||||
) => {
|
) => {
|
||||||
const layoutX = formValues.turbines
|
let params = '';
|
||||||
?.map((row) => `layout_x=${row.x}`)
|
if (formValues.turbines) {
|
||||||
.join('&');
|
const layoutX = formValues.turbines
|
||||||
const layoutY = formValues.turbines
|
?.map((row) => `layout_x=${row.x}`)
|
||||||
?.map((row) => `layout_y=${row.y}`)
|
.join('&');
|
||||||
.join('&');
|
const layoutY = formValues.turbines
|
||||||
const yawAngle = formValues.turbines
|
?.map((row) => `layout_y=${row.y}`)
|
||||||
?.map((row) => `yaw_angle=${row.angle}`)
|
.join('&');
|
||||||
.join('&');
|
const yawAngle = formValues.turbines
|
||||||
|
?.map((row) => `yaw_angle=${row.angle}`)
|
||||||
|
.join('&');
|
||||||
|
params += `${layoutX}&${layoutY}&${yawAngle}`;
|
||||||
|
}
|
||||||
const plots = Object.values(FLORIS_PLOTS)
|
const plots = Object.values(FLORIS_PLOTS)
|
||||||
.filter((_, i) => formValues.plots?.[i])
|
.filter((_, i) => formValues.plots?.[i])
|
||||||
.map((p) => `plots=${p.name}`)
|
.map((p) => `plots=${p.name}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
const dateStart = `date_start=${formValues.dateFrom?.substring(0, 10)}`;
|
const dateStart = `date_start=${formValues.dateFrom?.substring(0, 10)}`;
|
||||||
const dateEnd = `date_end=${formValues.dateTo?.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;
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,13 @@ export function FlorisForm({
|
|||||||
const handleManulEntryCheckboxChange = (
|
const handleManulEntryCheckboxChange = (
|
||||||
event: React.ChangeEvent<HTMLInputElement>,
|
event: React.ChangeEvent<HTMLInputElement>,
|
||||||
) => {
|
) => {
|
||||||
setIsManualEntry(event.target.checked);
|
const { checked } = event.target;
|
||||||
|
setIsManualEntry(checked);
|
||||||
|
if (checked) {
|
||||||
|
reset({ ...getValues(), park: undefined });
|
||||||
|
} else {
|
||||||
|
reset({ ...getValues(), turbines: undefined });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
BIN
server/public/floris/0056f6b4-f82f-4523-a224-cc8f3b0a8bb9.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
server/public/floris/184fb09f-4bae-42a3-9691-fad201030766.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
server/public/floris/4dfceaf3-2a70-4b93-bfb7-e49dcf2a9ae9.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
server/public/floris/609bc34a-224b-4d3c-a1fe-404fbb5e4fb0.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
server/public/floris/6172e811-ed32-484b-8e01-71fb8506ead6.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
server/public/floris/67963f1a-1ae9-458f-a84f-32290e0e3c06.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
server/public/floris/7579a4ab-bbc5-4bef-9e21-6adf73774a78.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
server/public/floris/75b3486c-8a18-409e-8fc2-6b7dedc9acaf.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
server/public/floris/7b47a009-d93d-4b87-9dc2-1e8a9dcfe0ae.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
server/public/floris/86b5bb6d-16d4-46cf-a63f-6e92e83debb6.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
server/public/floris/ab071b11-52db-48f8-8ae9-3864df57d927.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
server/public/floris/af4ff8ba-6640-492c-a8d4-7f0fc5f9a5ab.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
server/public/floris/b946a7f9-b357-4a65-9520-bf025a4dede0.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
server/public/floris/d7d8dc29-9330-4658-899c-5e1158a16ba9.png
Normal file
After Width: | Height: | Size: 29 KiB |