baktainer/app/app.rb
James Paterni d68e676de3
Some checks failed
Test and Build Docker Image / test (push) Has been cancelled
Test and Build Docker Image / build (push) Has been cancelled
Enhance dashboard with next backup time, reorganized layout, and pagination
## Dashboard Improvements

### 1. Add Time to Next Backup Display
- Add new `/next-backup` endpoint with cron schedule parsing
- Display time until next backup in human-readable format (e.g., "16 hours")
- Show formatted next backup time (e.g., "07:00am")
- Add next backup info to System Health card with schedule details
- Include format_time_until helper for readable time formatting

### 2. Reorganize Dashboard Layout
- Move "Discovered Containers" section above "Recent Backups"
- Improve workflow by showing monitored containers before backup history
- Better logical flow for users checking system status

### 3. Add Pagination to Recent Backups
- Implement client-side pagination with 10 backups per page
- Add pagination controls with Previous/Next buttons and page info
- Show "Page X of Y" information when multiple pages exist
- Hide pagination when 10 or fewer backups exist
- Maintain all existing backup display functionality

### 4. Load Historical Backups on Startup
- BackupMonitor now scans existing .meta files on initialization
- Loads historical backup data from metadata files into backup history
- Estimates duration for historical backups based on file size
- Maintains chronological order and 1000-record memory limit
- Dashboard now shows complete backup history immediately

### Technical Changes
- Add loadNextBackupTime() function with auto-refresh
- Implement displayBackupsPage() with pagination logic
- Add CSS classes for pagination styling
- Update refreshAll() to include next backup time
- Remove duplicate loadRecentBackups functions
- Add proper error handling for all new endpoints

Dashboard now provides comprehensive backup monitoring with improved
user experience and complete historical data visibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 10:31:09 -04:00

40 lines
No EOL
890 B
Ruby

# frozen_string_literal: true
require 'rubygems'
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
require 'bundler/setup'
require 'baktainer'
require 'baktainer/logger'
require 'baktainer/container'
require 'baktainer/backup_command'
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = 'Usage: baktainer.rb [options]'
opts.on('-N', '--now', 'Run immediately and exit.') do
options[:now] = true
end
end.parse!
LOGGER.info('Starting')
baktainer = Baktainer::Runner.new(
url: ENV['BT_DOCKER_URL'] || 'unix:///var/run/docker.sock',
ssl: ENV['BT_SSL'] || false,
ssl_options: {
ca_file: ENV['BT_CA'],
client_cert: ENV['BT_CERT'],
client_key: ENV['BT_KEY']
}
)
if options[:now]
LOGGER.info('Running backup immediately (--now flag)')
baktainer.perform_backup
LOGGER.info('Backup completed, exiting')
exit 0
else
baktainer.run
end