From 68622aebfe7cf52d4c65de118665269c023461b9 Mon Sep 17 00:00:00 2001 From: Omran NAJJAR Date: Mon, 27 May 2024 13:01:42 +0200 Subject: [PATCH 1/4] fix #246 with dynamic API base --- .../components/Layout/Feedback/FeedbackAOI.js | 4 +++- .../Layout/TrainingDS/DatasetEditor/AOI.js | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Layout/Feedback/FeedbackAOI.js b/frontend/src/components/Layout/Feedback/FeedbackAOI.js index 4469037f..20839512 100644 --- a/frontend/src/components/Layout/Feedback/FeedbackAOI.js +++ b/frontend/src/components/Layout/Feedback/FeedbackAOI.js @@ -282,7 +282,9 @@ const FeedbackAOI = (props) => { props.sourceImagery ? "custom:" + props.sourceImagery : "Bing" - }&disable_features=boundaries&gpx=https://fair-dev.hotosm.org/api/v1/feedback-aoi/gpx/${ + }&disable_features=boundaries&gpx=${ + process.env.REACT_APP_API_BASE + }/feedback-aoi/gpx/${ layer.id }&map=10.70/18.9226/81.6991`; console.log(url); diff --git a/frontend/src/components/Layout/TrainingDS/DatasetEditor/AOI.js b/frontend/src/components/Layout/TrainingDS/DatasetEditor/AOI.js index 5f8be66d..53f28be8 100644 --- a/frontend/src/components/Layout/TrainingDS/DatasetEditor/AOI.js +++ b/frontend/src/components/Layout/TrainingDS/DatasetEditor/AOI.js @@ -183,7 +183,9 @@ const AOI = (props) => { props.oamImagery ? "custom:" + props.oamImagery.url : "Bing" - }&datasets=fbRoads,msBuildings&disable_features=boundaries&map=16.00/17.9253/120.4841&gpx=&gpx=https://fair-dev.hotosm.org/api/v1/aoi/gpx/${ + }&datasets=fbRoads,msBuildings&disable_features=boundaries&map=16.00/17.9253/120.4841&gpx=&gpx=${ + process.env.REACT_APP_API_BASE + }/aoi/gpx/${ layer.aoiId }`, "_blank", @@ -275,9 +277,9 @@ const AOI = (props) => { props.oamImagery ? "custom:" + props.oamImagery.url : "Bing" - }&disable_features=boundaries&gpx=https://fair-dev.hotosm.org/api/v1/aoi/gpx/${ - layer.aoiId - }&map=10.70/18.9226/81.6991`, + }&disable_features=boundaries&gpx=${ + process.env.REACT_APP_API_BASE + }/aoi/gpx/${layer.aoiId}&map=10.70/18.9226/81.6991`, "_blank", "noreferrer" ); @@ -286,7 +288,8 @@ const AOI = (props) => { {/* */} OSM logo @@ -365,8 +368,8 @@ const AOI = (props) => { {props.mapLayers && props.mapLayers.length === 0 && ( - No TAs yet, start creating one by clicking Draw a rectangle, 3rd down at the top - left of the image/map + No TAs yet, start creating one by clicking Draw a rectangle, 3rd + down at the top left of the image/map )} From b642e9ad1fdba3c9329057cd06a0794244adfe05 Mon Sep 17 00:00:00 2001 From: Omran NAJJAR Date: Thu, 30 May 2024 12:10:57 +0200 Subject: [PATCH 2/4] showing dataset size from the chip count field in trainngs table --- .../Layout/AIModels/AIModelEditor/Trainings.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js b/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js index 5b3a4cf7..e53d032d 100644 --- a/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js +++ b/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js @@ -50,7 +50,7 @@ const TrainingsList = (props) => { if (res.error) setError(res.error.response.statusText); else { - // console.log("gettraining", res.data); + //console.log("gettraining", res.data); return res.data; } @@ -123,17 +123,11 @@ const TrainingsList = (props) => { }, }, { - field: "c", + field: "chips_length", headerName: "DS size", flex: 1, renderCell: (params) => { - if (params.row.status === "FINISHED") - return ( - - ); + return <>{`${params.value === 0 ? "" : params.value}`}; }, }, { From 483c18b1851673f6964d585c249193ed70f9332e Mon Sep 17 00:00:00 2001 From: Omran NAJJAR Date: Thu, 30 May 2024 12:23:34 +0200 Subject: [PATCH 3/4] adding hashtags when opening JOSM using env variables --- frontend/src/components/Layout/Start/Prediction/Prediction.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/Layout/Start/Prediction/Prediction.js b/frontend/src/components/Layout/Start/Prediction/Prediction.js index 519c594c..0716def0 100644 --- a/frontend/src/components/Layout/Start/Prediction/Prediction.js +++ b/frontend/src/components/Layout/Start/Prediction/Prediction.js @@ -383,6 +383,10 @@ const Prediction = () => { loadurl.searchParams.set("top", bounds._northEast.lat); loadurl.searchParams.set("left", bounds._southWest.lng); loadurl.searchParams.set("right", bounds._northEast.lng); + loadurl.searchParams.set( + "changeset_hashtags", + process.env.REACT_APP_HASHTAG_PREFIX + ); const loadResponse = await fetch(loadurl); if (!josmResponse.ok) { From 05fa247a576f907dd17bc91fadf44da2446a4919 Mon Sep 17 00:00:00 2001 From: Omran NAJJAR Date: Thu, 30 May 2024 12:26:11 +0200 Subject: [PATCH 4/4] Adding new env var to samples --- frontend/.env_sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/.env_sample b/frontend/.env_sample index 79ee0133..a7b64f82 100644 --- a/frontend/.env_sample +++ b/frontend/.env_sample @@ -2,4 +2,5 @@ REACT_APP_CONNECT_ID= REACT_APP_TM_API=https://tasking-manager-tm4-production-api.hotosm.org/api/v2/projects/PROJECT_ID/tasks/ REACT_APP_ENV=Dev REACT_APP_API_BASE=http://127.0.0.1:8000/api/v1 -REACT_APP_PREDICTOR_API_BASE=http://127.0.0.1:8001 \ No newline at end of file +REACT_APP_PREDICTOR_API_BASE=http://127.0.0.1:8001 +REACT_APP_HASHTAG_PREFIX="#fAIr;#hotosm-fAIr" \ No newline at end of file