• v1.2.3 99fd80bca7

    mchus released this 2026-02-10 11:11:10 +03:00 | 78 commits to main since this release

    Summary

    Unified synchronization functionality with event-driven UI updates. Resolved user confusion about duplicate sync buttons by implementing a single sync source with automatic page refreshes.

    Changes

    Main Feature: Sync Event System

    • Added sync-completed event in base.html's syncAction() function
      • Dispatched after successful /api/sync/all or /api/sync/push
      • Includes endpoint and response data in event detail
      • Enables pages to react automatically to sync completion

    Configs Page (configs.html)

    • Removed "Импорт с сервера" button - duplicate functionality no longer needed
    • Updated layout - changed from 2-column grid to single button layout
    • Removed importConfigsFromServer() function - functionality now handled by navbar sync
    • Added sync-completed event listener:
      • Automatically reloads configurations list after sync
      • Resets pagination to first page
      • New configurations appear immediately without manual refresh

    Projects Page (projects.html)

    • Wrapped initialization in DOMContentLoaded:
      • Moved loadProjects() and all event listeners inside handler
      • Ensures DOM is fully loaded before accessing elements
    • Added sync-completed event listener:
      • Automatically reloads projects list after sync
      • New projects appear immediately without manual refresh

    Pricelists Page (pricelists.html)

    • Added sync-completed event listener to existing DOMContentLoaded:
      • Automatically reloads pricelists when sync completes
      • Maintains existing permissions and modal functionality

    Benefits

    User Experience

    • Single "Синхронизация" button in navbar - no confusion about sync sources
    • Automatic list updates after sync - no need for manual F5 refresh
    • Consistent behavior across all pages (configs, projects, pricelists)
    • Better feedback: toast notification + automatic UI refresh

    Architecture

    • Event-driven loose coupling between navbar and pages
    • Easy to extend to other pages (just add event listener)
    • No backend changes needed
    • Production-ready

    Breaking Changes

    • /api/configs/import endpoint still works but UI button removed
      • Users should use navbar "Синхронизация" button instead
      • Backend API remains unchanged for backward compatibility

    Files Modified

    1. web/templates/base.html - Added sync-completed event dispatch
    2. web/templates/configs.html - Event listener + removed duplicate UI
    3. web/templates/projects.html - DOMContentLoaded wrapper + event listener
    4. web/templates/pricelists.html - Event listener for auto-refresh

    Stats: 4 files changed, 59 insertions(+), 65 deletions(-)

    Commits

    • 99fd80b - feat: unify sync functionality with event-driven UI updates

    Testing Checklist

    • Configs page: New configurations appear after navbar sync
    • Projects page: New projects appear after navbar sync
    • Pricelists page: Pricelists refresh after navbar sync
    • Both /api/sync/all and /api/sync/push trigger updates
    • Toast notifications still show correctly
    • Sync status indicator updates
    • Error handling (423, network errors) still works
    • Mode switching (Active/Archive) works correctly
    • Backward compatibility maintained

    Known Issues

    None - implementation is production-ready

    Migration Notes

    No migration needed. Changes are frontend-only and backward compatible:

    • Old /api/configs/import endpoint still functional
    • No database schema changes
    • No configuration changes needed
    Downloads