From e2264d6c34de011753913dd9b447b3d38649619c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 16 May 2017 17:41:28 +0300 Subject: Adjust builds page style --- mod/mod-build-log.cxx | 11 +++++++--- mod/mod-builds.cxx | 48 ++++++++++++++++++++++++++---------------- mod/mod-repository-details.cxx | 19 +++++------------ mod/mod-repository-root.cxx | 7 ++++++ 4 files changed, 50 insertions(+), 35 deletions(-) (limited to 'mod') 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 #include +#include // to_stream() + #include #include @@ -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; + : "") << 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 #include +#include // to_string() + #include #include @@ -22,7 +24,6 @@ #include // *_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 () : "") + << 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 -#include // tzset() - -#include #include // max() #include @@ -14,7 +11,7 @@ #include #include -#include +#include // to_string() #include #include @@ -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 +#include // tzset() + #include #include @@ -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:: -- cgit v1.1