Add UI sync status indicator with pending badge
- Create htmx-powered partial template for sync status display - Show Online/Offline indicator with color coding (green/red) - Display pending changes count badge when there are unsynced items - Add Sync button to push pending changes (appears only when needed) - Auto-refresh every 30 seconds via htmx polling - Replace JavaScript-based sync indicator with server-rendered partial - Integrate SyncStatusPartial handler with template rendering Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -331,7 +331,10 @@ func setupRouter(db *gorm.DB, cfg *config.Config, local *localdb.LocalDB, dbUser
|
||||
exportHandler := handlers.NewExportHandler(exportService, configService, componentService)
|
||||
pricingHandler := handlers.NewPricingHandler(db, pricingService, alertService, componentRepo, priceRepo, statsRepo)
|
||||
pricelistHandler := handlers.NewPricelistHandler(pricelistService, local)
|
||||
syncHandler := handlers.NewSyncHandler(local, syncService, db)
|
||||
syncHandler, err := handlers.NewSyncHandler(local, syncService, db, "web/templates")
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("creating sync handler: %w", err)
|
||||
}
|
||||
|
||||
// Setup handler (for reconfiguration)
|
||||
setupHandler, err := handlers.NewSetupHandler(local, "web/templates")
|
||||
@@ -418,6 +421,7 @@ func setupRouter(db *gorm.DB, cfg *config.Config, local *localdb.LocalDB, dbUser
|
||||
partials := router.Group("/partials")
|
||||
{
|
||||
partials.GET("/components", webHandler.ComponentsPartial)
|
||||
partials.GET("/sync-status", syncHandler.SyncStatusPartial)
|
||||
}
|
||||
|
||||
// API routes
|
||||
|
||||
Reference in New Issue
Block a user