- Add safety checks to Zig build - Add TUI with job management and narrative views - Add WebSocket support and export services - Add smart configuration defaults - Update API routes with security headers - Update SECURITY.md with comprehensive policy - Add Makefile security scanning targets
64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
// Package model provides TUI data structures and state management
|
|
package model
|
|
|
|
import (
|
|
"github.com/charmbracelet/bubbles/list"
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
// Status colors for job list items
|
|
var (
|
|
// StatusRunningColor is green for running jobs
|
|
StatusRunningColor = lipgloss.Color("#2ecc71")
|
|
// StatusPendingColor is yellow for pending jobs
|
|
StatusPendingColor = lipgloss.Color("#f1c40f")
|
|
// StatusFailedColor is red for failed jobs
|
|
StatusFailedColor = lipgloss.Color("#e74c3c")
|
|
// StatusFinishedColor is blue for completed jobs
|
|
StatusFinishedColor = lipgloss.Color("#3498db")
|
|
// StatusQueuedColor is gray for queued jobs
|
|
StatusQueuedColor = lipgloss.Color("#95a5a6")
|
|
)
|
|
|
|
// StatusColor returns the color for a job status
|
|
func StatusColor(status JobStatus) lipgloss.Color {
|
|
switch status {
|
|
case StatusRunning:
|
|
return StatusRunningColor
|
|
case StatusPending:
|
|
return StatusPendingColor
|
|
case StatusFailed:
|
|
return StatusFailedColor
|
|
case StatusFinished:
|
|
return StatusFinishedColor
|
|
case StatusQueued:
|
|
return StatusQueuedColor
|
|
default:
|
|
return lipgloss.Color("#ffffff")
|
|
}
|
|
}
|
|
|
|
// NewJobListDelegate creates a styled delegate for the job list
|
|
func NewJobListDelegate() list.DefaultDelegate {
|
|
delegate := list.NewDefaultDelegate()
|
|
delegate.Styles.SelectedTitle = delegate.Styles.SelectedTitle.
|
|
Foreground(lipgloss.Color("170")).
|
|
Bold(true)
|
|
delegate.Styles.SelectedDesc = delegate.Styles.SelectedDesc.
|
|
Foreground(lipgloss.Color("246"))
|
|
return delegate
|
|
}
|
|
|
|
// JobListTitleStyle returns the style for the job list title
|
|
func JobListTitleStyle() lipgloss.Style {
|
|
return lipgloss.NewStyle().
|
|
Bold(true).
|
|
Foreground(lipgloss.AdaptiveColor{Light: "#2980b9", Dark: "#7aa2f7"}).
|
|
Padding(0, 0, 1, 0)
|
|
}
|
|
|
|
// SpinnerStyle returns the style for the spinner
|
|
func SpinnerStyle() lipgloss.Style {
|
|
return lipgloss.NewStyle().
|
|
Foreground(lipgloss.AdaptiveColor{Light: "#2980b9", Dark: "#7aa2f7"})
|
|
}
|