diff --git a/src/frontend/src/api/Project.js b/src/frontend/src/api/Project.js index 6386e5df6e..302f2c17e3 100755 --- a/src/frontend/src/api/Project.js +++ b/src/frontend/src/api/Project.js @@ -63,11 +63,11 @@ export const ProjectById = (url, existingProjectList, projectId) => { }; }; -export const DownloadProjectForm = (url, payload) => { +export const DownloadProjectForm = (url, payload, projectId) => { return async (dispatch) => { dispatch(ProjectActions.SetDownloadProjectFormLoading({ type: payload, loading: true })); - const fetchProjectForm = async (url, payload) => { + const fetchProjectForm = async (url, payload, projectId) => { try { let response; if (payload === 'form') { @@ -79,7 +79,7 @@ export const DownloadProjectForm = (url, payload) => { } const a = document.createElement('a'); a.href = window.URL.createObjectURL(response.data); - a.download = `Project_form.${payload === 'form' ? '.xls' : '.geojson'}`; + a.download = `${payload === 'form' ? `project_form_${projectId}.xls` : `task_polygons_${projectId}.geojson`}`; a.click(); dispatch(ProjectActions.SetDownloadProjectFormLoading({ type: payload, loading: false })); } catch (error) { @@ -88,7 +88,7 @@ export const DownloadProjectForm = (url, payload) => { dispatch(ProjectActions.SetDownloadProjectFormLoading({ type: payload, loading: false })); } }; - await fetchProjectForm(url, payload); + await fetchProjectForm(url, payload, projectId); }; }; export const DownloadDataExtract = (url, payload) => { diff --git a/src/frontend/src/components/ProjectDetails/ProjectOptions.tsx b/src/frontend/src/components/ProjectDetails/ProjectOptions.tsx index 77560b1e90..ca9be1c368 100644 --- a/src/frontend/src/components/ProjectDetails/ProjectOptions.tsx +++ b/src/frontend/src/components/ProjectDetails/ProjectOptions.tsx @@ -19,11 +19,19 @@ const ProjectOptions = ({ setToggleGenerateModal }) => { const handleDownload = (downloadType) => { if (downloadType === 'form') { dispatch( - DownloadProjectForm(`${import.meta.env.VITE_API_URL}/projects/download_form/${decodedId}/`, downloadType), + DownloadProjectForm( + `${import.meta.env.VITE_API_URL}/projects/download_form/${decodedId}/`, + downloadType, + decodedId, + ), ); } else if (downloadType === 'geojson') { dispatch( - DownloadProjectForm(`${import.meta.env.VITE_API_URL}/projects/${decodedId}/download_tasks`, downloadType), + DownloadProjectForm( + `${import.meta.env.VITE_API_URL}/projects/${decodedId}/download_tasks`, + downloadType, + decodedId, + ), ); } }; diff --git a/src/frontend/src/components/createnewproject/SplitTasks.tsx b/src/frontend/src/components/createnewproject/SplitTasks.tsx index 0991862a4d..49b1806ae5 100644 --- a/src/frontend/src/components/createnewproject/SplitTasks.tsx +++ b/src/frontend/src/components/createnewproject/SplitTasks.tsx @@ -255,7 +255,11 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo

{/* */} - +
}