aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-16 17:41:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-16 17:41:28 +0300
commite2264d6c34de011753913dd9b447b3d38649619c (patch)
tree799211a14a4ba8d5a9d3f8d35b71a502a6ff0c3f
parent5163436b00711318baea4fc0ad43a4de8222354a (diff)
Adjust builds page style
-rw-r--r--mod/mod-build-log.cxx11
-rw-r--r--mod/mod-builds.cxx48
-rw-r--r--mod/mod-repository-details.cxx19
-rw-r--r--mod/mod-repository-root.cxx7
-rw-r--r--www/builds-body.css4
5 files changed, 53 insertions, 36 deletions
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 687a554..b998f8d 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -9,6 +9,8 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <libbutl/timestamp.hxx> // to_stream()
+
#include <web/module.hxx>
#include <libbrep/build.hxx>
@@ -208,15 +210,18 @@ handle (request& rq, response& rs)
os << "package: " << b->package_name << endl
<< "version: " << b->package_version << endl
- << "config: " << b->configuration << endl
<< "toolchain: " << b->toolchain_name << '-' << b->toolchain_version
<< endl
+ << "config: " << b->configuration << endl
<< "machine: " << *b->machine << " (" << *b->machine_summary << ")"
<< endl
<< "target: " << (i->second->target
? i->second->target->string ()
- : "default") << endl
- << endl;
+ : "<default>") << endl
+ << "timestamp: ";
+
+ butl::to_stream (os, b->timestamp, "%Y-%m-%d %H:%M:%S%[.N] %Z", true, true);
+ os << endl << endl;
if (op.empty ())
{
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index 6ffb517..6b6ab08 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -9,6 +9,8 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <libbutl/timestamp.hxx> // to_string()
+
#include <web/xhtml.hxx>
#include <web/module.hxx>
@@ -22,7 +24,6 @@
#include <mod/build-config.hxx> // *_url()
using namespace std;
-using namespace butl;
using namespace bbot;
using namespace odb::core;
using namespace brep::cli;
@@ -137,16 +138,21 @@ handle (request& rq, response& rs)
assert (i != build_conf_map_->end ());
const build_config& c (*i->second);
+ string ts (butl::to_string (b.timestamp,
+ "%Y-%m-%d %H:%M:%S%[.N] %Z",
+ true, true));
+
s << TABLE(CLASS="proplist build")
<< TBODY
<< TR_NAME (b.package_name, string (), root)
<< TR_VERSION (b.package_name, b.package_version, root)
- << TR_VALUE ("config", b.configuration)
<< TR_VALUE ("toolchain",
b.toolchain_name + '-' +
b.toolchain_version.string ())
+ << TR_VALUE ("config", b.configuration)
<< TR_VALUE ("machine", *b.machine)
- << TR_VALUE ("target", c.target ? c.target->string () : "default")
+ << TR_VALUE ("target", c.target ? c.target->string () : "<default>")
+ << TR_VALUE ("timestamp", ts)
<< TR(CLASS="result")
<< TH << "result" << ~TH
<< TD
@@ -160,42 +166,48 @@ handle (request& rq, response& rs)
build_db_->load (b, b.results_section);
- // If no results available, then print the overall build status.
- // Otherwise print unsuccessful operations statuses with the links to the
+ // If no unsuccessful operations results available, then print the
+ // overall build status. If there are any operations results available,
+ // then also print unsuccessful operations statuses with the links to the
// respective logs, followed with a link to the operations combined log.
- // Print the forced package rebuild link afterwards.
+ // Print the forced package rebuild link afterwards, unless the package
+ // build is already pending.
//
- if (b.results.empty ())
+ if (b.results.empty () || *b.status == result_status::success)
{
assert (b.status);
- s << SPAN_BUILD_RESULT_STATUS (*b.status);
+ s << SPAN_BUILD_RESULT_STATUS (*b.status) << " | ";
}
- else
+
+ if (!b.results.empty ())
{
for (const auto& r: b.results)
{
if (r.status != result_status::success)
- s << SPAN_BUILD_RESULT_STATUS (r.status) << '('
+ s << SPAN_BUILD_RESULT_STATUS (r.status) << " ("
<< A
<< HREF
<< build_log_url (host, root, b, &r.operation)
<< ~HREF
<< r.operation
<< ~A
- << ')' << ' ';
+ << ") | ";
}
s << A
<< HREF << build_log_url (host, root, b) << ~HREF
- << "all"
- << ~A;
+ << "log"
+ << ~A
+ << " | ";
}
- s << ' '
- << A
- << HREF << force_rebuild_url (host, root, b) << ~HREF
- << "rebuild"
- << ~A;
+ if (b.forced)
+ s << "pending";
+ else
+ s << A
+ << HREF << force_rebuild_url (host, root, b) << ~HREF
+ << "rebuild"
+ << ~A;
}
s << ~SPAN
diff --git a/mod/mod-repository-details.cxx b/mod/mod-repository-details.cxx
index f4027b6..b8b88bc 100644
--- a/mod/mod-repository-details.cxx
+++ b/mod/mod-repository-details.cxx
@@ -4,9 +4,6 @@
#include <mod/mod-repository-details.hxx>
-#include <time.h> // tzset()
-
-#include <sstream>
#include <algorithm> // max()
#include <libstudxml/serializer.hxx>
@@ -14,7 +11,7 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
-#include <libbutl/timestamp.hxx>
+#include <libbutl/timestamp.hxx> // to_string()
#include <web/xhtml.hxx>
#include <web/module.hxx>
@@ -53,8 +50,6 @@ init (scanner& s)
if (options_->root ().empty ())
options_->root (dir_path ("/"));
-
- tzset (); // To use butl::to_stream() later on.
}
bool brep::repository_details::
@@ -125,14 +120,10 @@ handle (request& rq, response& rs)
s << *BR;
}
- ostringstream o;
- butl::to_stream (o,
- max (r.packages_timestamp, r.repositories_timestamp),
- "%Y-%m-%d %H:%M:%S%[.N] %Z",
- true,
- true);
-
- s << o.str ()
+ s << butl::to_string (max (r.packages_timestamp, r.repositories_timestamp),
+ "%Y-%m-%d %H:%M:%S%[.N] %Z",
+ true,
+ true)
<< ~P;
if (r.description)
diff --git a/mod/mod-repository-root.cxx b/mod/mod-repository-root.cxx
index cb0b82f..c661b91 100644
--- a/mod/mod-repository-root.cxx
+++ b/mod/mod-repository-root.cxx
@@ -4,6 +4,8 @@
#include <mod/mod-repository-root.hxx>
+#include <time.h> // tzset()
+
#include <sstream>
#include <web/module.hxx>
@@ -193,6 +195,11 @@ namespace brep
if (options_->root ().empty ())
options_->root (dir_path ("/"));
+
+ // To use libbutl timestamp printing functions later on (specifically in
+ // sub-modules, while handling requests).
+ //
+ tzset ();
}
bool repository_root::
diff --git a/www/builds-body.css b/www/builds-body.css
index 67ed9a3..a69bb5a 100644
--- a/www/builds-body.css
+++ b/www/builds-body.css
@@ -23,7 +23,7 @@
}
.build:nth-child(even) {background-color: rgba(0, 0, 0, 0.07);}
-.build th {width: 6.4em;}
+.build th {width: 7.0em;}
.build tr.name td .value,
.build tr.version td .value,
@@ -31,6 +31,7 @@
.build tr.toolchain td .value,
.build tr.machine td .value,
.build tr.target td .value,
+.build tr.timestamp td .value,
.build tr.result td .value
{
/* <code> style. */
@@ -38,6 +39,7 @@
font-size: 0.94em;
}
+.build .success {color: #00bb00;}
.build .warning {color: #ffa500;}
.build .error {color: #ff0000;}
.build .abort {color: #ff0000;}