From 62eaed8eaf33b8d4e705e72da5eeaefadcb1b3d5 Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:48:00 +0545 Subject: [PATCH] fix: project org UI issues (#1230) * fix editProject: formUpdate file extension spelling corrected to xlsx * fix header: activeTab selection based on url pathname * refactor primaryAppBar: unnecessary commented code remove * feat assetModules: tuneIcon add * feat shadcnDropdown: shadcn dropdown add * fix select: zIndex add to selectContent * fix submissionsFilter: UI enhancement * fix submissionTable: logic add to handle Point & object to display dynamic table * feat submissionsTable: buttons add * fix modal: modal props type add * fix taskService: josmService comment update * feat projectSubmissions: uploadToJosm api integration & modalOpen on josmError * fix dropdown: dropdownMenu UI fix * feat submissionTable: download as csv & json dropdown add on download option * fix taskService: axios get replace fetch for convertXMLToJOSM service --- src/frontend/package.json | 2 + src/frontend/pnpm-lock.yaml | 138 +++++++++ src/frontend/src/api/task.ts | 16 +- .../ManageProject/EditTab/FormUpdateTab.tsx | 4 +- .../ProjectSubmissions/SubmissionsTable.tsx | 268 +++++++++++++----- .../src/components/common/Dropdown.tsx | 185 ++++++++++++ src/frontend/src/components/common/Modal.tsx | 7 +- src/frontend/src/components/common/Select.tsx | 2 +- src/frontend/src/shared/AssetModules.js | 2 + src/frontend/src/utilities/PrimaryAppBar.tsx | 47 +-- 10 files changed, 554 insertions(+), 117 deletions(-) create mode 100644 src/frontend/src/components/common/Dropdown.tsx diff --git a/src/frontend/package.json b/src/frontend/package.json index 5d65bc8a84..ac9f85ee11 100755 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -54,6 +54,8 @@ "@mui/system": "^5.14.12", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dropdown-menu": "^2.0.6", + "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-progress": "^1.0.3", "@radix-ui/react-select": "^1.2.2", "@radix-ui/react-switch": "^1.0.3", diff --git a/src/frontend/pnpm-lock.yaml b/src/frontend/pnpm-lock.yaml index 31db273d5b..34474e9fd6 100644 --- a/src/frontend/pnpm-lock.yaml +++ b/src/frontend/pnpm-lock.yaml @@ -38,6 +38,12 @@ dependencies: '@radix-ui/react-dialog': specifier: ^1.0.5 version: 1.0.5(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-dropdown-menu': + specifier: ^2.0.6 + version: 2.0.6(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-icons': + specifier: ^1.3.0 + version: 1.3.0(react@17.0.2) '@radix-ui/react-progress': specifier: ^1.0.3 version: 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) @@ -2448,6 +2454,33 @@ packages: react-dom: 17.0.2(react@17.0.2) dev: false + /@radix-ui/react-dropdown-menu@2.0.6(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-i6TuFOoWmLWq+M/eCLGd/bQ2HfAX1RJgvrBQ6AQLmzfvsLdefxbWu8G9zczcPFfcSPehz9GcpF6K9QYreFV8hA==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.1 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-compose-refs': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-context': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-id': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-menu': 2.0.6(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-use-controllable-state': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@types/react': 17.0.67 + '@types/react-dom': 17.0.21 + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + dev: false + /@radix-ui/react-focus-guards@1.0.1(@types/react@17.0.67)(react@17.0.2): resolution: {integrity: sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==} peerDependencies: @@ -2508,6 +2541,14 @@ packages: react-dom: 17.0.2(react@17.0.2) dev: false + /@radix-ui/react-icons@1.3.0(react@17.0.2): + resolution: {integrity: sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==} + peerDependencies: + react: ^16.x || ^17.x || ^18.x + dependencies: + react: 17.0.2 + dev: false + /@radix-ui/react-id@1.0.1(@types/react@17.0.67)(react@17.0.2): resolution: {integrity: sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==} peerDependencies: @@ -2523,6 +2564,44 @@ packages: react: 17.0.2 dev: false + /@radix-ui/react-menu@2.0.6(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-BVkFLS+bUC8HcImkRKPSiVumA1VPOOEC5WBMiT+QAVsPzW1FJzI9KnqgGxVDPBcql5xXrHkD3JOVoXWEXD8SYA==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.1 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-collection': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-compose-refs': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-context': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-direction': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-dismissable-layer': 1.0.5(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-focus-guards': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-focus-scope': 1.0.4(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-id': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-popper': 1.1.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-portal': 1.0.4(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-presence': 1.0.1(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-roving-focus': 1.0.4(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-slot': 1.0.2(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@types/react': 17.0.67 + '@types/react-dom': 17.0.21 + aria-hidden: 1.2.3 + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + react-remove-scroll: 2.5.5(@types/react@17.0.67)(react@17.0.2) + dev: false + /@radix-ui/react-popper@1.1.2(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): resolution: {integrity: sha512-1CnGGfFi/bbqtJZZ0P/NQY20xdG3E0LALJaLUEoKwPLwl6PPPfbeiCqMVQnhoFRAxjJj4RpBRJzDmUgsex2tSg==} peerDependencies: @@ -2553,6 +2632,36 @@ packages: react-dom: 17.0.2(react@17.0.2) dev: false + /@radix-ui/react-popper@1.1.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-cKpopj/5RHZWjrbF2846jBNacjQVwkP068DfmgrNJXpvVWrOvlAmE9xSiy5OqeE+Gi8D9fP+oDhUnPqNMY8/5w==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.1 + '@floating-ui/react-dom': 2.0.8(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-arrow': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-compose-refs': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-context': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-use-rect': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-use-size': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/rect': 1.0.1 + '@types/react': 17.0.67 + '@types/react-dom': 17.0.21 + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + dev: false + /@radix-ui/react-portal@1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): resolution: {integrity: sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==} peerDependencies: @@ -2660,6 +2769,35 @@ packages: react-dom: 17.0.2(react@17.0.2) dev: false + /@radix-ui/react-roving-focus@1.0.4(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-2mUg5Mgcu001VkGy+FfzZyzbmuUWzgWkj3rvv4yu+mLw03+mTzbxZHvfcGyFp2b8EkQeMkpRQ5FiA2Vr2O6TeQ==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.1 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-collection': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-compose-refs': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-context': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-direction': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-id': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2) + '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@radix-ui/react-use-controllable-state': 1.0.1(@types/react@17.0.67)(react@17.0.2) + '@types/react': 17.0.67 + '@types/react-dom': 17.0.21 + react: 17.0.2 + react-dom: 17.0.2(react@17.0.2) + dev: false + /@radix-ui/react-select@1.2.2(@types/react-dom@17.0.21)(@types/react@17.0.67)(react-dom@17.0.2)(react@17.0.2): resolution: {integrity: sha512-zI7McXr8fNaSrUY9mZe4x/HC0jTLY9fWNhO1oLWYMQGDXuV4UCivIGTxwioSzO0ZCYX9iSLyWmAh/1TOmX3Cnw==} peerDependencies: diff --git a/src/frontend/src/api/task.ts b/src/frontend/src/api/task.ts index 629fa90a99..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`); - //importToJosmEditor - To open JOSM Editor and add XML of Project Submission To JOSM. - CoreModules.axios.get( + await fetch(`http://127.0.0.1:8111/version?jsonp=checkJOSM`); + //importToJosmEditor - To open JOSM Editor and add base layer To JOSM. + 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); 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 }) => {
+ Please verify if JOSM is running on your computer and the remote control is enabled. +
+Submitted By
-+ Submitted By +
+Download as Csv
+ {downloadSubmissionLoading.type === 'csv' && downloadSubmissionLoading.loading && ( +Download as Json
+ {downloadSubmissionLoading.type === 'json' && downloadSubmissionLoading.loading && ( +