add max width to column
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,12 +4,12 @@ use zoidberg_lib::types::{Job, Worker};
|
|||||||
// TODO: write nicer frontend
|
// TODO: write nicer frontend
|
||||||
pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
||||||
let jobs_html: String = String::from("<table class=\"table is-hoverable\">")
|
let jobs_html: String = String::from("<table class=\"table is-hoverable\">")
|
||||||
+ "<thead><tr><th><td>ID</td><td>command</td><td>status</td></th></tr></thead><tbody>"
|
+ "<thead><tr><th>ID</th><th style=\"width: 150px;\">command</th><th>status</th></tr></thead><tbody>"
|
||||||
+ &jobs
|
+ &jobs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|j| {
|
.map(|j| {
|
||||||
format!(
|
format!(
|
||||||
"<tr><th></th><td>{}</td><td>{}</td><td>{}</td></tr>",
|
"<tr><td>{}</td><td>{}</td><td>{}</td></tr>",
|
||||||
j.id, j.cmd, j.status
|
j.id, j.cmd, j.status
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -18,7 +18,7 @@ pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
|||||||
+ "</tbody></table>";
|
+ "</tbody></table>";
|
||||||
|
|
||||||
let workers_html: String = String::from("<table class=\"table is-hoverable\">")
|
let workers_html: String = String::from("<table class=\"table is-hoverable\">")
|
||||||
+ "<thead><tr><th><td>ID</td><td>last heartbeat</td></th></tr></thead><tbody>"
|
+ "<thead><tr><th>ID</th><th>last heartbeat</th></tr></thead><tbody>"
|
||||||
+ &workers
|
+ &workers
|
||||||
.iter()
|
.iter()
|
||||||
.map(|w| {
|
.map(|w| {
|
||||||
@@ -27,12 +27,19 @@ pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
|||||||
} else {
|
} else {
|
||||||
String::from("")
|
String::from("")
|
||||||
};
|
};
|
||||||
format!("<tr><th></th><td>{}</td><td>{}</td></tr>", w.id, ts)
|
format!("<tr><td>{}</td><td>{}</td></tr>", w.id, ts)
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("\n")
|
.join("\n")
|
||||||
+ "</tbody></table>";
|
+ "</tbody></table>";
|
||||||
|
|
||||||
|
let style = r#"<style>
|
||||||
|
td {
|
||||||
|
max-width: 40vw;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
</style>"#;
|
||||||
|
|
||||||
let _debug_html = r#"<style>
|
let _debug_html = r#"<style>
|
||||||
*:not(path):not(g) {{
|
*:not(path):not(g) {{
|
||||||
color: hsla(210, 100%, 100%, 0.9) !important;
|
color: hsla(210, 100%, 100%, 0.9) !important;
|
||||||
@@ -56,6 +63,7 @@ pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
|||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
||||||
{}
|
{}
|
||||||
|
{}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section class="section">
|
<section class="section">
|
||||||
@@ -83,7 +91,7 @@ pub fn render(jobs: &[Job], workers: &[Worker]) -> String {
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"#,
|
"#,
|
||||||
_debug_html, jobs_html, workers_html
|
style, _debug_html, jobs_html, workers_html
|
||||||
);
|
);
|
||||||
page
|
page
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user