: nply/minci

commit 5dbe031f08efd45ea5c4378c3ec90098a844dc70
parent 6a0b2de8db45a56af8047476406f13cbecf58ed6
Author: kristapsdz <kristaps@bsd.lv>
Date: Sat, 14 Mar 2020 14:02:20 +0000

Clean up output to be more readable: quick look on success/fail, mobile version
to be a single line, show more useful uname information.
2 files changed, 69 insertions(+), 41 deletions(-)
M
main.c
|
57
+++++++++++++++++++++++++++++++++++++++++++--------------
M
minci.css
|
53
++++++++++++++++++++++++++---------------------------
diff --git a/main.c b/main.c
@@ -107,6 +107,26 @@ html_open(struct khtmlreq *req, const char *title)
 }
 
 /*
+ * Format the uname fields to have useful (and short) output.
+ */
+static void
+get_html_uname(struct khtmlreq *req, const struct report *p)
+{
+
+	khtml_puts(req, p->unames);
+	khtml_puts(req, " ");
+	khtml_puts(req, p->unamer);
+	khtml_puts(req, " ");
+	khtml_puts(req, p->unamem);
+
+	/* This isn't particularly useful information. */
+#if 0
+	khtml_puts(req, "|");
+	khtml_puts(req, p->unamev);
+#endif
+}
+
+/*
  * Print a block with a time offset of "start" to "given".
  * If "given" is zero, suppress any content printing.
  */

@@ -142,6 +162,9 @@ get_html_last_header(struct khtmlreq *req)
 	khtml_attr(req, KELEM_DIV, 
 		KATTR_CLASS, "row", KATTR__MAX);
 	khtml_attr(req, KELEM_DIV, KATTR_CLASS, 
+		"head report-passfail", KATTR__MAX);
+	khtml_closeelem(req, 1); /* cell */
+	khtml_attr(req, KELEM_DIV, KATTR_CLASS, 
 		"head report-id", KATTR__MAX);
 	khtml_closeelem(req, 1); /* cell */
 	khtml_attr(req, KELEM_DIV, KATTR_CLASS, 

@@ -219,6 +242,15 @@ get_html_last_report(const struct report *p, void *arg)
 		KATTR_CLASS, "row", KATTR__MAX);
 
 	khtml_attr(&r->html, KELEM_DIV, KATTR_CLASS, 
+		"cell report-passfail", KATTR__MAX);
+	khtml_attr(&r->html, KELEM_SPAN, KATTR_CLASS, 
+		p->distcheck ? "report-pass" : "report-fail",
+		KATTR__MAX);
+	khtml_ncr(&r->html, p->distcheck ? 0x2714 : 0x2717);
+	khtml_closeelem(&r->html, 1); /* span */
+	khtml_closeelem(&r->html, 1); /* cell */
+
+	khtml_attr(&r->html, KELEM_DIV, KATTR_CLASS, 
 		"cell report-id", KATTR__MAX);
 	khtml_attr(&r->html, KELEM_A,
 		KATTR_HREF, urlid, KATTR__MAX);

@@ -261,9 +293,7 @@ get_html_last_report(const struct report *p, void *arg)
 
 	khtml_attr(&r->html, KELEM_DIV, KATTR_CLASS, 
 		"cell report-system", KATTR__MAX);
-	khtml_puts(&r->html, p->unames);
-	khtml_puts(&r->html, " ");
-	khtml_puts(&r->html, p->unamer);
+	get_html_uname(&r->html, p);
 	khtml_closeelem(&r->html, 1); /* cell */
 
 	khtml_attr(&r->html, KELEM_DIV,

@@ -376,16 +406,8 @@ get_single_html(struct kreq *r, const struct report *p)
 	khtml_closeelem(&req, 1); /* div */
 
 	khtml_attr(&req, KELEM_DIV, KATTR_CLASS,
-		"lefthead report-system-ext", KATTR__MAX);
-	khtml_puts(&req, p->unames);
-	khtml_puts(&req, " ");
-	khtml_puts(&req, p->unamen);
-	khtml_puts(&req, " ");
-	khtml_puts(&req, p->unamer);
-	khtml_puts(&req, " ");
-	khtml_puts(&req, p->unamev);
-	khtml_puts(&req, " ");
-	khtml_puts(&req, p->unamem);
+		"lefthead report-system", KATTR__MAX);
+	get_html_uname(&req, p);
 	khtml_closeelem(&req, 1); /* div */
 
 	khtml_attr(&req, KELEM_DIV,

@@ -532,8 +554,15 @@ get_last(struct kreq *r, time_t mtime)
 		khtml_puts(&req.html, "Date Reports");
 		khtml_closeelem(&req.html, 1); /* span */
 		khtml_closeelem(&req.html, 1); /* h1 */
-	} else
+	} else {
+		khtml_elem(&req.html, KELEM_SPAN);
 		khtml_puts(&req.html, "CI Dashboard");
+		khtml_closeelem(&req.html, 1); /* span */
+		khtml_ncr(&req.html, 0x203a);
+		khtml_elem(&req.html, KELEM_SPAN);
+		khtml_puts(&req.html, "All Projects");
+		khtml_closeelem(&req.html, 1); /* span */
+	}
 
 	khtml_closeelem(&req.html, 1); /* h1 */
 	khtml_closeelem(&req.html, 1); /* header */
diff --git a/minci.css b/minci.css
@@ -21,9 +21,8 @@ body > header a				{ color: #fff;
 					  margin-left: auto; }
 h1					{ font-size: inherit;
 					  text-align: center; }
-h1 a, h1 span				{ display: inline-block; }
-h1 a					{ margin-right: 0.3rem; }
-h1 span					{ margin-left: 0.3rem; }
+h1 a, h1 span				{ display: inline-block;
+					  margin: 0 0.3rem; }
 .singleton				{ width: calc(100% - 1rem);
 					  max-width: 66rem;
 					  margin-right: auto;

@@ -34,35 +33,38 @@ div.table > :first-child		{ display: none;
 					  font-weight: bold;
 					  text-shadow: 0 0 #000;
 					  color: #fff; }
+.report-pass				{ color: green; }
+.report-fail				{ color: red; }
 .lefthead.report-id,
 .lefthead.project-name,
 .lefthead.project-repo,
 .cell.report-id,
-.cell.report-start,
+.cell.report-passfail,
 .cell.project-name			{ display: inline-block; }
+.cell.report-system			{ white-space: nowrap;
+					  overflow: hidden;
+					  text-overflow: ellipsis; }
+.cell.report-system			{ display: inline; }
 .lefthead.project-name			{ border-right: thin solid #888;
 					  padding-right: 0.5rem;
 					  margin-right: 0.5rem; }
 .lefthead.project-repo::before		{ content: 'repository'; }
 .lefthead.report-id::after,
 .cell.report-start::after,
+.cell.project-name::after,
 .cell.report-id::after			{ content: ', ';
 					  opacity: 0.5;
 					  margin-right: 0.2rem; }
 .lefthead.report-id::before,
 .cell.report-id::before			{ content: '#';
 					  opacity: 0.5; }
-.cell.report-env::before		{ content: 'env'; }
-.cell.report-deps::before		{ content: 'deps'; }
-.cell.report-build::before		{ content: 'build'; }
-.cell.report-regress::before		{ content: 'test'; }
-.cell.report-install::before		{ content: 'install'; }
-.cell.report-dist::before		{ content: 'check'; }
-.cell.report-system::before		{ content: 'System ';
-					  opacity: 0.5; }
-.row					{ padding: 0.5rem; }
+.row					{ padding: 0.5rem;
+					  white-space: nowrap; 
+				  	  overflow: hidden; 
+				  	  text-overflow: ellipsis; }
 .cell					{ padding: 0.25rem 0; }
-.cellgroup				{ display: flex; }
+.cell.report-start,
+.cellgroup				{ display: none; }
 .cellgroup .cell			{ flex: 1; }
 .cellgroup .cell::before		{ display: block;
 					  padding-right: 0;

@@ -108,25 +110,20 @@ div.table > :first-child		{ display: none;
 @media (min-width: 80rem) {
   h1					{ text-align: left; }
   div.table > :first-child,
-  .row					{ display: flex; }
+  .row					{ display: flex;
+	  			  	  padding: 0; }
   .head, .cell				{ width: 4rem;
-					  padding: 0 1rem; }
+					  padding: 0.5rem 1rem; }
+  .head.report-passfail,
+  .cell.report-passfail			{ width: 0.5rem; }
   .head.project-name,
   .cell.project-name			{ width: 8rem; }
   .head.report-start,
   .cell.report-start			{ width: 6rem; }
+  .cell.report-start			{ display: inline-block; }
   .report-system			{ flex: 1; }
-  .cell.project-name::before,
-  .cell.report-start::before,
-  .cell.report-env::before,
-  .cell.report-deps::before,
-  .cell.report-build::before,
-  .cell.report-regress::before,
-  .cell.report-install::before,
-  .cell.report-dist::before,
-  .cell.report-system::before		{ content: none;
-					  padding: 0; }
   .cell.report-start::after,
+  .cell.project-name::after,
   .cell.report-id::after		{ content: none;
 					  margin-right: 0; }
   .head.project-name::before		{ content: 'project'; }

@@ -137,8 +134,8 @@ div.table > :first-child		{ display: none;
   .head.report-regress::before		{ content: 'test'; }
   .head.report-install::before		{ content: 'install'; }
   .head.report-dist::before		{ content: 'check'; }
-  .head.report-system-ext::before,
   .head.report-system::before		{ content: 'system'; }
+  .cellgroup				{ display: flex; }
 }
 
 @media (prefers-color-scheme: dark) {

@@ -147,7 +144,9 @@ div.table > :first-child		{ display: none;
   div.table > :nth-child(odd)		{ background-color: #6d6d6d; }
   a					{ color: yellow; }
   a:visited				{ color: rgb(255, 255, 180); }
+  .report-pass,
   .report-success::before		{ color: rgb(50, 255, 50); }
+  .report-fail,
   .report-failure::before,
   .cellgroup .cell span::after		{ color: rgb(255, 50, 50); }
   .report-log				{ background-color: #000; }