From 0b08af87af5f429ab5a5184e7080cf19726a0f0b Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sat, 8 Feb 2025 23:00:34 +0100 Subject: [PATCH] Clean up some code --- CHANGELOG.md | 5 +++++ app/assets/stylesheets/application.css | 5 ----- app/javascript/controllers/maps_controller.js | 5 +---- app/javascript/maps/areas.js | 19 ------------------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7deee074..4dc05172 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,11 @@ This will select points tracked between January 1st and January 31st 2025. Then - After deleting one point from the map, other points can now be deleted as well. #723 #678 - Fixed a bug where export file was not being deleted from the server after it was deleted. #808 - After an area was drawn on the map, a popup is now being shown to allow user to provide a name and save the area. #740 +- Docker entrypoints now use database name to fix problem with custom database names. + +### Added + +- `X-Dawarich-Version` header to the `GET /api/v1/health` endpoint response. # 0.23.6 - 2025-02-06 diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 4016ec54..982d94b0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -107,8 +107,3 @@ transform: rotate(360deg); } } - -.clickable-area, -.leaflet-interactive { - cursor: pointer !important; -} diff --git a/app/javascript/controllers/maps_controller.js b/app/javascript/controllers/maps_controller.js index 98fde9ea..2e921c86 100644 --- a/app/javascript/controllers/maps_controller.js +++ b/app/javascript/controllers/maps_controller.js @@ -128,7 +128,7 @@ export default class extends Controller { Heatmap: this.heatmapLayer, "Fog of War": new this.fogOverlay(), "Scratch map": this.scratchLayer, - Areas: this.areasLayer, // Add areasLayer to the control + Areas: this.areasLayer, Photos: this.photoMarkers }; @@ -573,9 +573,6 @@ export default class extends Controller { fillOpacity: 0.5, }, }, - }, - edit: { - featureGroup: this.drawnItems } }); diff --git a/app/javascript/maps/areas.js b/app/javascript/maps/areas.js index a7179297..54e64c59 100644 --- a/app/javascript/maps/areas.js +++ b/app/javascript/maps/areas.js @@ -35,7 +35,6 @@ export function handleAreaCreated(areasLayer, layer, apiKey) { `; - console.log('Binding popup to layer'); layer.bindPopup(formHtml, { maxWidth: "auto", minWidth: 300, @@ -44,20 +43,14 @@ export function handleAreaCreated(areasLayer, layer, apiKey) { className: 'area-form-popup' }).openPopup(); - console.log('Adding layer to areasLayer'); areasLayer.addLayer(layer); // Bind the event handler immediately after opening the popup setTimeout(() => { - console.log('Setting up form handlers'); const form = document.getElementById('circle-form'); const saveButton = document.getElementById('save-area-btn'); const nameInput = document.getElementById('circle-name'); - console.log('Form:', form); - console.log('Save button:', saveButton); - console.log('Name input:', nameInput); - if (!form || !saveButton || !nameInput) { console.error('Required elements not found'); return; @@ -77,28 +70,20 @@ export function handleAreaCreated(areasLayer, layer, apiKey) { e.stopPropagation(); if (!nameInput.value.trim()) { - console.log('Name is empty'); nameInput.classList.add('input-error'); return; } - console.log('Creating FormData'); const formData = new FormData(form); - formData.forEach((value, key) => { - console.log(`FormData: ${key} = ${value}`); - }); - console.log('Calling saveArea'); saveArea(formData, areasLayer, layer, apiKey); }); }, 100); // Small delay to ensure DOM is ready } export function saveArea(formData, areasLayer, layer, apiKey) { - console.log('saveArea called with apiKey:', apiKey); const data = {}; formData.forEach((value, key) => { - console.log('FormData entry:', key, value); const keys = key.split('[').map(k => k.replace(']', '')); if (keys.length > 1) { if (!data[keys[0]]) data[keys[0]] = {}; @@ -108,21 +93,18 @@ export function saveArea(formData, areasLayer, layer, apiKey) { } }); - console.log('Sending fetch request with data:', data); fetch(`/api/v1/areas?api_key=${apiKey}`, { method: 'POST', headers: { 'Content-Type': 'application/json'}, body: JSON.stringify(data) }) .then(response => { - console.log('Received response:', response); if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { - console.log('Area saved successfully:', data); layer.closePopup(); layer.bindPopup(` Name: ${data.name}
@@ -170,7 +152,6 @@ export function deleteArea(id, areasLayer, layer, apiKey) { } export function fetchAndDrawAreas(areasLayer, apiKey) { - console.log('Fetching areas...'); fetch(`/api/v1/areas?api_key=${apiKey}`, { method: 'GET', headers: {