manager: Don't hardcode repository URL
This commit is contained in:
parent
d0c8389c3b
commit
24e834dde3
2 changed files with 19 additions and 9 deletions
|
|
@ -46,7 +46,12 @@ impl Element {
|
|||
attributes.join(", ")
|
||||
}
|
||||
|
||||
fn to_mermaid_node(&self, index: ElementIndex, role: Option<SubtreeElementRole>) -> String {
|
||||
fn to_mermaid_node(
|
||||
&self,
|
||||
index: ElementIndex,
|
||||
role: Option<SubtreeElementRole>,
|
||||
repo_url: &str,
|
||||
) -> String {
|
||||
let Element {
|
||||
issue_number,
|
||||
description,
|
||||
|
|
@ -55,7 +60,7 @@ impl Element {
|
|||
} = 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>"##
|
||||
r##"<a href='{repo_url}/issues/{issue_number}' target='_blank'>#{issue_number}</a> | {status}\n<i>{ty}</i>\n<b>{description}</b>"##
|
||||
);
|
||||
|
||||
let class = match (role, status) {
|
||||
|
|
@ -163,13 +168,13 @@ impl Tree {
|
|||
format!("{:?}", dot)
|
||||
}
|
||||
|
||||
pub fn to_mermaid(&self) -> String {
|
||||
pub fn to_mermaid(&self, repo_url: &str) -> String {
|
||||
let mut mermaid = String::new();
|
||||
mermaid.push_str("flowchart BT\n");
|
||||
mermaid.push_str(&mermaid_classes());
|
||||
|
||||
for index in self.graph.node_indices() {
|
||||
mermaid.push_str(&self.graph[index].to_mermaid_node(index, None));
|
||||
mermaid.push_str(&self.graph[index].to_mermaid_node(index, None, repo_url));
|
||||
mermaid.push_str("\n");
|
||||
}
|
||||
|
||||
|
|
@ -287,14 +292,18 @@ impl<'a> Subtree<'a> {
|
|||
format!("{:?}", dot)
|
||||
}
|
||||
|
||||
pub fn to_mermaid(&self) -> String {
|
||||
pub fn to_mermaid(&self, repo_url: &str) -> String {
|
||||
let mut mermaid = String::new();
|
||||
mermaid.push_str("flowchart BT\n");
|
||||
mermaid.push_str(&mermaid_classes());
|
||||
|
||||
for index in self.graph.node_indices() {
|
||||
let node = &self.graph[index];
|
||||
mermaid.push_str(&node.element.to_mermaid_node(index, Some(node.role)));
|
||||
mermaid.push_str(
|
||||
&node
|
||||
.element
|
||||
.to_mermaid_node(index, Some(node.role), repo_url),
|
||||
);
|
||||
mermaid.push_str("\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue