Class: Aidp::Harness::UI::JobMonitorFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/harness/ui/job_monitor.rb

Overview

Formats job monitor display

Instance Method Summary collapse

Constructor Details

#initializeJobMonitorFormatter

Returns a new instance of JobMonitorFormatter.



365
366
367
# File 'lib/aidp/harness/ui/job_monitor.rb', line 365

def initialize
  @pastel = Pastel.new
end

Instance Method Details

#format_callback_error(callback, error_message) ⇒ Object



479
480
481
# File 'lib/aidp/harness/ui/job_monitor.rb', line 479

def format_callback_error(callback, error_message)
  @pastel.red("❌ Callback error: #{error_message}")
end

#format_job_error(error_message) ⇒ Object



463
464
465
# File 'lib/aidp/harness/ui/job_monitor.rb', line 463

def format_job_error(error_message)
  @pastel.red("#{error_message}")
end

#format_job_priority(priority) ⇒ Object



407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/aidp/harness/ui/job_monitor.rb', line 407

def format_job_priority(priority)
  case priority
  when :low
    @pastel.blue("🔽 Low")
  when :normal
    @pastel.blue("➡️ Normal")
  when :high
    @pastel.yellow("🔼 High")
  when :urgent
    @pastel.red("🚨 Urgent")
  else
    @pastel.blue("#{priority.to_s.capitalize}")
  end
end

#format_job_priority_short(priority) ⇒ Object



422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/aidp/harness/ui/job_monitor.rb', line 422

def format_job_priority_short(priority)
  case priority
  when :low
    @pastel.blue("🔽")
  when :normal
    @pastel.blue("➡️")
  when :high
    @pastel.yellow("🔼")
  when :urgent
    @pastel.red("🚨")
  else
    @pastel.blue("")
  end
end

#format_job_progress(progress) ⇒ Object



437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/aidp/harness/ui/job_monitor.rb', line 437

def format_job_progress(progress)
  progress_int = progress.to_i
  if progress_int >= 100
    @pastel.green("100%")
  elsif progress_int >= 75
    @pastel.blue("#{progress_int}%")
  elsif progress_int >= 50
    @pastel.yellow("#{progress_int}%")
  else
    @pastel.blue("#{progress_int}%")
  end
end

#format_job_progress_short(progress) ⇒ Object



450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/aidp/harness/ui/job_monitor.rb', line 450

def format_job_progress_short(progress)
  progress_int = progress.to_i
  if progress_int >= 100
    @pastel.green("100%")
  elsif progress_int >= 75
    @pastel.blue("#{progress_int}%")
  elsif progress_int >= 50
    @pastel.yellow("#{progress_int}%")
  else
    @pastel.blue("#{progress_int}%")
  end
end

#format_job_status(status) ⇒ Object



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/aidp/harness/ui/job_monitor.rb', line 369

def format_job_status(status)
  case status
  when :pending
    @pastel.yellow("⏳ Pending")
  when :running
    @pastel.blue("🔄 Running")
  when :completed
    @pastel.green("✅ Completed")
  when :failed
    @pastel.red("❌ Failed")
  when :cancelled
    @pastel.red("🚫 Cancelled")
  when :retrying
    @pastel.yellow("🔄 Retrying")
  else
    @pastel.blue("#{status.to_s.capitalize}")
  end
end

#format_job_status_short(status) ⇒ Object



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/aidp/harness/ui/job_monitor.rb', line 388

def format_job_status_short(status)
  case status
  when :pending
    @pastel.yellow("")
  when :running
    @pastel.blue("🔄")
  when :completed
    @pastel.green("")
  when :failed
    @pastel.red("")
  when :cancelled
    @pastel.red("🚫")
  when :retrying
    @pastel.yellow("🔄")
  else
    @pastel.blue("")
  end
end

#format_monitoring_error(error_message) ⇒ Object



475
476
477
# File 'lib/aidp/harness/ui/job_monitor.rb', line 475

def format_monitoring_error(error_message)
  @pastel.red("❌ Monitoring error: #{error_message}")
end

#format_monitoring_started(interval_seconds) ⇒ Object



467
468
469
# File 'lib/aidp/harness/ui/job_monitor.rb', line 467

def format_monitoring_started(interval_seconds)
  @pastel.green("✅ Job monitoring started (interval: #{interval_seconds}s)")
end

#format_monitoring_stoppedObject



471
472
473
# File 'lib/aidp/harness/ui/job_monitor.rb', line 471

def format_monitoring_stopped
  @pastel.red("❌ Job monitoring stopped")
end

#format_monitoring_summary(summary) ⇒ Object



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/aidp/harness/ui/job_monitor.rb', line 483

def format_monitoring_summary(summary)
  result = []
  result << @pastel.bold(@pastel.blue("📊 Job Monitoring Summary"))
  result << "Total jobs: #{@pastel.bold(summary[:total_jobs])}"
  result << "Monitoring: #{summary[:monitoring_active] ? "Active" : "Inactive"}"
  result << "Total events: #{@pastel.blue(summary[:total_events])}"

  if summary[:jobs_by_status].any?
    result << "Jobs by status:"
    summary[:jobs_by_status].each do |status, count|
      result << "  #{@pastel.blue("#{status}: #{count}")}"
    end
  end

  result.join("\n")
end