diff --git a/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js b/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js index 3ddb602e..5b3a4cf7 100644 --- a/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js +++ b/frontend/src/components/Layout/AIModels/AIModelEditor/Trainings.js @@ -109,13 +109,17 @@ const TrainingsList = (props) => { }, { field: "timeSpan", - headerName: "Time (hrs)", + headerName: "Time", minWidth: 40, flex: 1, valueGetter: (params) => { // console.log("params",params) - if (params.row.status === "FINISHED") - return timeSpan(params.row.started_at, params.row.finished_at); + if (params.row.status === "FINISHED") { + const time = + timeSpan(params.row.started_at, params.row.finished_at) * 1; + if (time < 1) return `${(time * 60).toFixed(1)} mins`; + else return `${time.toFixed(1)} hr(s)`; + } }, }, { diff --git a/frontend/src/components/Layout/Feedback/Feedback.js b/frontend/src/components/Layout/Feedback/Feedback.js index cfa19794..14c852b2 100644 --- a/frontend/src/components/Layout/Feedback/Feedback.js +++ b/frontend/src/components/Layout/Feedback/Feedback.js @@ -176,7 +176,7 @@ const Feedback = (props) => { function getFeatureStyle(feature) { return { - color: "green", + color: "blue", weight: 3, }; } diff --git a/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js b/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js index 805403bc..358a807c 100644 --- a/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js +++ b/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js @@ -66,8 +66,12 @@ function tile2boundingbox(xtile, ytile, zoom) { // } function getFeatureStyle(feature) { - let color = "red"; - if (feature.properties.action !== "INITIAL") { + let color = ""; + if (feature.properties.action === "ACCEPT") { + color = "blue"; + } else if (feature.properties.action === "INITIAL") { + color = "red"; + } else if (feature.properties.action === "JOSM") { color = "green"; } @@ -129,7 +133,7 @@ const EditableGeoJSON = ({ mapref.removeLayer(createdLayer); }; const { accessToken } = useContext(AuthContext); - + const [render, setRender] = useState(Math.random()); const submitFeedback = async (layer) => { try { // console.log("layer", layer); @@ -240,8 +244,9 @@ const EditableGeoJSON = ({ This feedback will be presented on the model (id: ${modelId}, training id: ${trainingId}) for improvements

Comments: -
- +
+ + `; const popup = L.popup() @@ -258,6 +263,17 @@ const EditableGeoJSON = ({ mutateSubmitFeedback(layer); popup.close(); }); + + popupElement + .querySelector("#josmButton") + .addEventListener("click", () => { + feature.properties.action = "JOSM"; + // console.log("popup layer ", layer); + // handle submitting feedback + // mutateSubmitFeedback(layer); + setRender(Math.random()); + popup.close(); + }); } }); }; diff --git a/frontend/src/components/Layout/Start/Prediction/Prediction.js b/frontend/src/components/Layout/Start/Prediction/Prediction.js index 1d8f8074..ce7f068c 100644 --- a/frontend/src/components/Layout/Start/Prediction/Prediction.js +++ b/frontend/src/components/Layout/Start/Prediction/Prediction.js @@ -328,22 +328,27 @@ const Prediction = () => { async function openWithJosm() { setJosmLoading(true); + setError(""); if (!predictions) { setError("No predictions available"); return; } + console.log("predictions for JOSM", predictions); // Remove the "id", action , duplicate and intersect propertiesproperties from each feature in the "features" array const postprocessed_predictions = { ...predictions, - features: predictions.features.map((feature) => { - const { id, action, duplicate, intersect, ...newProps } = - feature.properties; - return { - ...feature, - properties: newProps, - }; - }), + features: predictions.features + .filter((f) => f.properties.action === "JOSM") + .map((feature) => { + const { id, action, duplicate, intersect, ...newProps } = + feature.properties; + // if (action === "JOSM") + return { + ...feature, + properties: newProps, + }; + }), }; try { diff --git a/frontend/src/components/Layout/TrainingDS/DatasetEditor/DatasetMap.js b/frontend/src/components/Layout/TrainingDS/DatasetEditor/DatasetMap.js index 19804fde..59cbe4a5 100644 --- a/frontend/src/components/Layout/TrainingDS/DatasetEditor/DatasetMap.js +++ b/frontend/src/components/Layout/TrainingDS/DatasetEditor/DatasetMap.js @@ -694,7 +694,7 @@ const DatasetMap = (props) => { onDrawStop={_onEditStop} draw={{ polyline: false, - polygon: true, + polygon: false, rectangle: true, circle: false, circlemarker: false, diff --git a/frontend/src/index.css b/frontend/src/index.css index 20c2a1bc..fba2efac 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -79,7 +79,7 @@ code { .feedback-button { - background-color: #4caf50; + background-color: #f44336; margin-top: 2px; color: #fff; border: none; @@ -92,7 +92,7 @@ code { } .feedback-button:last-child { - background-color: #f44336; + background-color: #4caf50; margin-left:2px; }