manager: Use Type/ labels instead of ty/ and don't force types

Allow arbitrary element types via the Type/# labels.
This commit is contained in:
Rahix 2025-05-22 10:09:59 +02:00
parent 81932d2ac1
commit 6d258f489f
2 changed files with 11 additions and 26 deletions

View file

@ -10,7 +10,7 @@ pub struct Element {
/// Description of this element
pub description: String,
/// Type of this element
pub ty: ElementType,
pub ty: String,
/// Completion status of this element.
pub status: ElementStatus,
}
@ -54,7 +54,9 @@ impl Element {
status,
} = self;
let label = format!(r##"<a href='/rahix/techtree-poc/issues/{issue_number}' target='_blank'>#{issue_number}</a> | {status}\n<i>{ty}</i>\n<b>{description}</b>"##);
let label = format!(
r##"<a href='/rahix/techtree-poc/issues/{issue_number}' target='_blank'>#{issue_number}</a> | {status}\n<i>{ty}</i>\n<b>{description}</b>"##
);
let class = match (role, status) {
(Some(SubtreeElementRole::ElementOfInterest), _) => "eoi",
@ -82,23 +84,6 @@ fn mermaid_classes() -> String {
.to_owned()
}
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, serde::Serialize)]
pub enum ElementType {
Equipment,
Process,
Knowledge,
}
impl std::fmt::Display for ElementType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
ElementType::Equipment => "Equipment",
ElementType::Process => "Process",
ElementType::Knowledge => "Knowledge",
})
}
}
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, serde::Serialize)]
pub enum ElementStatus {
Missing,