diff --git a/.app_version b/.app_version index 16235ea2..68d0e0ab 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.19.5 +0.19.6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d488f3..621769eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,41 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +# 0.19.6 - 2024-12-11 + +⚠️ This release introduces a breaking change. ⚠️ + +The `dawarich_shared` volume now being mounted to `/data` instead of `/var/shared` within the container. It fixes Redis data being lost on container restart. + +To change this, you need to update the `docker-compose.yml` file: + +```diff + dawarich_redis: + image: redis:7.0-alpine + container_name: dawarich_redis + command: redis-server + volumes: ++ - dawarich_shared:/data + restart: always + healthcheck: +``` + +Telemetry is now disabled by default. To enable it, you need to set `ENABLE_TELEMETRY` env var to `true`. For those who have telemetry enabled using `DISABLE_TELEMETRY` env var set to `false`, telemetry is now disabled by default. + +### Fixed + +- Flash messages are now being removed after 5 seconds. +- Fixed broken migration that was preventing the app from starting. +- Visits page is now loading a lot faster than before. +- Redis data should now be preserved on container restart. +- Fixed a bug where export files could have double extension, e.g. `file.gpx.gpx`. + +### Changed + +- Places page is now accessible from the Visits & Places tab on the navbar. +- Exporting process is now being logged. +- `ENABLE_TELEMETRY` env var is now used instead of `DISABLE_TELEMETRY` to enable/disable telemetry. + # 0.19.5 - 2024-12-10 ### Fixed diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 3bff5194..48e213d2 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -12,4 +12,11 @@ } */ -@import 'actiontext.css'; \ No newline at end of file +@import 'actiontext.css'; + +@layer components { + .fade-out { + opacity: 0; + transition: opacity 150ms ease-in-out; + } +} diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index cfa0d506..6f9b4c65 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -9,7 +9,8 @@ class ExportsController < ApplicationController end def create - export_name = "export_from_#{params[:start_at].to_date}_to_#{params[:end_at].to_date}.#{params[:file_format]}" + export_name = + "export_from_#{params[:start_at].to_date}_to_#{params[:end_at].to_date}.#{params[:file_format]}" export = current_user.exports.create(name: export_name, status: :created) ExportJob.perform_later(export.id, params[:start_at], params[:end_at], file_format: params[:file_format]) diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index cde2c8fd..a8469831 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -13,12 +13,10 @@ class VisitsController < ApplicationController .where(status:) .includes(%i[suggested_places area]) .order(started_at: order_by) - .group_by { |visit| visit.started_at.to_date } - .map { |k, v| { date: k, visits: v } } @suggested_visits_count = current_user.visits.suggested.count - @visits = Kaminari.paginate_array(visits).page(params[:page]).per(10) + @visits = visits.page(params[:page]).per(10) end def update diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3fe89204..08b341ef 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,10 @@ module ApplicationHelper 'tab-active' if current_page?(link_path) end + def active_visit_places_tab?(controller_name) + 'tab-active' if current_page?(controller: controller_name) + end + def notification_link_color(notification) return 'text-gray-600' if notification.read? diff --git a/app/javascript/controllers/removals_controller.js b/app/javascript/controllers/removals_controller.js index 9d4172df..cf487d07 100644 --- a/app/javascript/controllers/removals_controller.js +++ b/app/javascript/controllers/removals_controller.js @@ -1,7 +1,28 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { + static values = { + timeout: Number + } + + connect() { + if (this.timeoutValue) { + setTimeout(() => { + this.remove() + }, this.timeoutValue) + } + } + remove() { - this.element.remove() + this.element.classList.add('fade-out') + setTimeout(() => { + this.element.remove() + + // Remove the container if it's empty + const container = document.getElementById('flash-messages') + if (container && !container.hasChildNodes()) { + container.remove() + } + }, 150) } } diff --git a/app/jobs/telemetry_sending_job.rb b/app/jobs/telemetry_sending_job.rb index 5b84f11a..7bec3b00 100644 --- a/app/jobs/telemetry_sending_job.rb +++ b/app/jobs/telemetry_sending_job.rb @@ -4,7 +4,7 @@ class TelemetrySendingJob < ApplicationJob queue_as :default def perform - return if ENV['DISABLE_TELEMETRY'] == 'true' + return unless ENV['ENABLE_TELEMETRY'] == 'true' data = Telemetry::Gather.new.call Rails.logger.info("Telemetry data: #{data}") diff --git a/app/services/exports/create.rb b/app/services/exports/create.rb index 2d31a9c0..08181b4d 100644 --- a/app/services/exports/create.rb +++ b/app/services/exports/create.rb @@ -18,7 +18,7 @@ class Exports::Create create_export_file(data) - export.update!(status: :completed, url: "exports/#{export.name}.#{file_format}") + export.update!(status: :completed, url: "exports/#{export.name}") create_export_finished_notification rescue StandardError => e @@ -74,10 +74,16 @@ class Exports::Create def create_export_file(data) dir_path = Rails.root.join('public/exports') - Dir.mkdir(dir_path) unless Dir.exist?(dir_path) - file_path = dir_path.join("#{export.name}.#{file_format}") + FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path) + + file_path = dir_path.join(export.name) + + Rails.logger.info("Creating export file at: #{file_path}") File.open(file_path, 'w') { |file| file.write(data) } + rescue StandardError => e + Rails.logger.error("Failed to create export file: #{e.message}") + raise end end diff --git a/app/services/telemetry/send.rb b/app/services/telemetry/send.rb index 46401294..96f222af 100644 --- a/app/services/telemetry/send.rb +++ b/app/services/telemetry/send.rb @@ -9,7 +9,7 @@ class Telemetry::Send end def call - return if ENV['DISABLE_TELEMETRY'] == 'true' + return unless ENV['ENABLE_TELEMETRY'] == 'true' line_protocol = build_line_protocol response = send_request(line_protocol) diff --git a/app/views/places/index.html.erb b/app/views/places/index.html.erb index 4d93a744..939cca3b 100644 --- a/app/views/places/index.html.erb +++ b/app/views/places/index.html.erb @@ -1,8 +1,9 @@ <% content_for :title, "Places" %>