From b9042684cf69d0c58fe69ed604028eb273873c2d Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 19 Feb 2024 10:58:16 +0545 Subject: [PATCH 01/19] fix editProject: formUpdate file extension spelling corrected to xlsx --- .../src/components/ManageProject/EditTab/FormUpdateTab.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/ManageProject/EditTab/FormUpdateTab.tsx b/src/frontend/src/components/ManageProject/EditTab/FormUpdateTab.tsx index 1d798554a9..8a0a1bd240 100644 --- a/src/frontend/src/components/ManageProject/EditTab/FormUpdateTab.tsx +++ b/src/frontend/src/components/ManageProject/EditTab/FormUpdateTab.tsx @@ -29,14 +29,14 @@ const FormUpdateTab = ({ projectId }) => {
{ setUploadForm(updatedFiles); }} - acceptedInput=".xls, .slxs, .xml" + acceptedInput=".xls, .xlsx, .xml" />
+ + +
+
+ value && setFilter((prev) => ({ ...prev, task_id: +value }))} + className="fmtm-text-grey-700 fmtm-text-sm !fmtm-mb-0 fmtm-bg-white" + /> +
+
+ + value && setFilter((prev) => ({ ...prev, review_state: value.toString() })) + } + errorMsg="" + className="fmtm-text-grey-700 fmtm-text-sm !fmtm-mb-0 fmtm-bg-white" + /> +
+
+ + setFilter((prev) => ({ ...prev, submitted_date: format(new Date(date), 'yyyy-MM-dd') })) + } + className="fmtm-text-grey-700 fmtm-text-sm !fmtm-mb-0 fmtm-w-full" + /> +
+
+

+ Submitted By +

+
+ { + setSubmittedBy(e.target.value); + }} + > + search +
+
+
-
-
+ +
+ +
-
+
- + + + + + + handleDownload('csv')} + > +
+

Download as Csv

+ {downloadSubmissionLoading.type === 'csv' && downloadSubmissionLoading.loading && ( + + )} +
+
+ handleDownload('json')} + disabled={downloadSubmissionLoading.type === 'json' && downloadSubmissionLoading.loading} + > +
+

Download as Json

+ {downloadSubmissionLoading.type === 'json' && downloadSubmissionLoading.loading && ( + + )} +
{' '} +
+
+
From 35003f7225c438299fbdf0745e5d9d032934b47d Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Tue, 20 Feb 2024 14:40:24 +0545 Subject: [PATCH 15/19] fix taskService: axios get replace fetch for convertXMLToJOSM service --- src/frontend/src/api/task.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/api/task.ts b/src/frontend/src/api/task.ts index f811e4128b..94fac3c67d 100644 --- a/src/frontend/src/api/task.ts +++ b/src/frontend/src/api/task.ts @@ -184,12 +184,12 @@ export const ConvertXMLToJOSM: Function = (url: string, projectBbox) => { const getConvertXMLToJOSM = async (url) => { try { // checkJOSMOpen - To check if JOSM Editor is Open Or Not. - await CoreModules.axios.get(`http://127.0.0.1:8111/version?jsonp=checkJOSM`); + await fetch(`http://127.0.0.1:8111/version?jsonp=checkJOSM`); //importToJosmEditor - To open JOSM Editor and add base layer To JOSM. - CoreModules.axios.get( + fetch( `http://127.0.0.1:8111/imagery?title=osm&type=tms&url=https://tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png`, ); - await CoreModules.axios.get(`http://127.0.0.1:8111/import?url=${url}`); + await fetch(`http://127.0.0.1:8111/import?url=${url}`); // `http://127.0.0.1:8111/load_and_zoom?left=80.0580&right=88.2015&top=27.9268&bottom=26.3470`; const loadAndZoomParams = { @@ -202,9 +202,11 @@ export const ConvertXMLToJOSM: Function = (url: string, projectBbox) => { new_layer: 'true', layer_name: 'OSM Data', }; - await CoreModules.axios.get(`http://127.0.0.1:8111/zoom`, { - params: loadAndZoomParams, - }); + const queryString = Object.keys(loadAndZoomParams) + .map((key) => key + '=' + loadAndZoomParams[key]) + .join('&'); + + await fetch(`http://127.0.0.1:8111/zoom?${queryString}`); } catch (error: any) { dispatch(CoreModules.TaskActions.SetJosmEditorError('JOSM Error')); // alert(error.response.data); From 03284167b7755f801ce3f40606e03140ce8af866 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Wed, 21 Feb 2024 09:30:07 +0545 Subject: [PATCH 16/19] feat submissionsPage: redirect to respective submissions & task submissions page on button click --- .../ProjectSubmissions/SubmissionsTable.tsx | 11 ++++++++++- .../components/ProjectSubmissions/TaskSubmissions.tsx | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx index 622bec9884..4de96dd440 100644 --- a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx +++ b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx @@ -16,6 +16,7 @@ import Button from '@/components/common/Button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/common/Dropdown'; import { ConvertXMLToJOSM, getDownloadProjectSubmission, getDownloadProjectSubmissionJson } from '@/api/task'; import { Modal } from '../common/Modal'; +import { useNavigate } from 'react-router-dom'; type filterType = { task_id: number | null; @@ -35,6 +36,7 @@ const SubmissionsTable = ({ toggleView }) => { const { windowSize } = windowDimention(); const dispatch = CoreModules.useAppDispatch(); const params = CoreModules.useParams(); + const navigate = useNavigate(); const encodedId = params.projectId; const decodedId = environment.decode(encodedId); const submissionFormFields = CoreModules.useAppSelector((state) => state.submission.submissionFormFields); @@ -52,6 +54,8 @@ const SubmissionsTable = ({ toggleView }) => { const [paginationPage, setPaginationPage] = useState(1); const [submittedBy, setSubmittedBy] = useState(''); + const encodedTaskId = environment.encode(3468); + useEffect(() => { let count = 0; const filters = Object.keys(filter); @@ -404,7 +408,12 @@ const SubmissionsTable = ({ toggleView }) => { rowClassName="updatedRow" dataFormat={(row) => (
- {' '} + { + navigate(`/project/${encodedId}/tasks/${encodedTaskId}/submission/${row?.meta?.instanceID}`); + }} + />{' '} {' '} {' '} {' '} diff --git a/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx b/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx index 4a55aee747..961422e34d 100644 --- a/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx +++ b/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx @@ -6,9 +6,13 @@ import AssetModules from '@/shared/AssetModules.js'; import CoreModules from '@/shared/CoreModules.js'; import { TaskCardSkeletonLoader } from '@/components/ProjectSubmissions/ProjectSubmissionsSkeletonLoader'; import { taskInfoType } from '@/models/submission/submissionModel'; +import { useNavigate, useParams } from 'react-router-dom'; +import environment from '@/environment'; const TaskSubmissions = () => { const dispatch = CoreModules.useAppDispatch(); + const navigate = useNavigate(); + const params = useParams(); const taskInfo: taskInfoType[] = CoreModules.useAppSelector((state) => state.task.taskInfo); const taskLoading = CoreModules.useAppSelector((state) => state.task.taskLoading); const [searchedTaskId, setSearchedTaskId] = useState(''); @@ -52,7 +56,11 @@ const TaskSubmissions = () => {
-
- {viewBy === 'infographics' ? ( + {searchParams.get('tab') === 'infographics' ? ( } /> ) : ( } /> From 84f73f97750d4e0afb31050c75889323aac18303 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Wed, 21 Feb 2024 15:48:36 +0545 Subject: [PATCH 19/19] fix projectSubmissions: navigate to projectSubmissions with searchParams --- src/frontend/src/components/DialogTaskActions.jsx | 2 +- .../src/components/ProjectSubmissions/TaskSubmissions.tsx | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/DialogTaskActions.jsx b/src/frontend/src/components/DialogTaskActions.jsx index 8e7913c7a1..16d5708fb8 100755 --- a/src/frontend/src/components/DialogTaskActions.jsx +++ b/src/frontend/src/components/DialogTaskActions.jsx @@ -129,7 +129,7 @@ export default function Dialog({ taskId, feature, map, view }) { btnType="primary" type="submit" className="fmtm-font-bold !fmtm-rounded fmtm-text-sm !fmtm-py-2 !fmtm-w-full fmtm-flex fmtm-justify-center" - onClick={() => navigate(`/project/${params.id}/tasks/${currentTaskId}`)} + onClick={() => navigate(`/project-submissions/${params.id}?tab=table&task_id=${taskId}`)} />
)} diff --git a/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx b/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx index 961422e34d..6d66fb9007 100644 --- a/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx +++ b/src/frontend/src/components/ProjectSubmissions/TaskSubmissions.tsx @@ -6,13 +6,11 @@ import AssetModules from '@/shared/AssetModules.js'; import CoreModules from '@/shared/CoreModules.js'; import { TaskCardSkeletonLoader } from '@/components/ProjectSubmissions/ProjectSubmissionsSkeletonLoader'; import { taskInfoType } from '@/models/submission/submissionModel'; -import { useNavigate, useParams } from 'react-router-dom'; -import environment from '@/environment'; +import { useSearchParams } from 'react-router-dom'; const TaskSubmissions = () => { const dispatch = CoreModules.useAppDispatch(); - const navigate = useNavigate(); - const params = useParams(); + const [searchParams, setSearchParams] = useSearchParams(); const taskInfo: taskInfoType[] = CoreModules.useAppSelector((state) => state.task.taskInfo); const taskLoading = CoreModules.useAppSelector((state) => state.task.taskLoading); const [searchedTaskId, setSearchedTaskId] = useState(''); @@ -59,7 +57,7 @@ const TaskSubmissions = () => {