#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum View {
Overview,
Jobs,
Insights,
Capacity,
Settings,
}
impl View {
pub const ALL: [View; 5] = [
View::Overview,
View::Jobs,
View::Insights,
View::Capacity,
View::Settings,
];
pub fn title(self) -> &'static str {
match self {
View::Overview => "Overview",
View::Jobs => "Jobs",
View::Insights => "Insights",
View::Capacity => "Capacity",
View::Settings => "Settings",
}
}
pub fn sections(self) -> &'static [Section] {
match self {
View::Overview | View::Insights => &[],
View::Jobs => &[Section::History, Section::Records],
View::Capacity => &[Section::Sizing, Section::Caches],
View::Settings => &[Section::Config],
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Section {
History,
Records,
Sizing,
Caches,
Config,
}
impl Section {
pub fn title(self) -> &'static str {
match self {
Section::History => "History",
Section::Records => "Records",
Section::Sizing => "Sizing",
Section::Caches => "Caches",
Section::Config => "Config",
}
}
pub fn view(self) -> View {
match self {
Section::History | Section::Records => View::Jobs,
Section::Sizing | Section::Caches => View::Capacity,
Section::Config => View::Settings,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Feature {
Attention,
LogOutline,
LogSearch,
JobSearch,
Timeline,
Comparison,
Insights,
Caches,
Doctor,
Config,
}
impl Feature {
pub fn unsupported(self) -> String {
let what = match self {
Feature::Attention => "attention",
Feature::LogOutline => "log outline",
Feature::LogSearch => "log search",
Feature::JobSearch => "search, sort and record filter",
Feature::Timeline => "timeline",
Feature::Comparison => "comparison",
Feature::Insights => "insights",
Feature::Caches => "caches",
Feature::Doctor => "doctor",
Feature::Config => "config",
};
format!("{what}: {NOT_SUPPORTED}")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Column {
Id,
Outcome,
Job,
Repository,
Branch,
Queued,
Waited,
Ran,
MemoryPeak,
Cpu,
Written,
Made,
Size,
Workflow,
Record,
}
impl Column {
pub fn title(self) -> &'static str {
match self {
Column::Id => "ID",
Column::Outcome => "Outcome",
Column::Job => "Job",
Column::Repository => "Repository",
Column::Branch => "Branch",
Column::Queued => "Queued",
Column::Waited => "Waited",
Column::Ran => "Ran",
Column::MemoryPeak => "Memory peak",
Column::Cpu => "CPU",
Column::Written => "Written",
Column::Made => "Made",
Column::Size => "Size",
Column::Workflow => "Workflow",
Column::Record => "Record",
}
}
}
pub const JOBS_HEADING: &str = "Jobs";
pub const NOT_SUPPORTED: &str = "not supported by this runnerd";