From ded07cf185540680bc9c06f174e807ba0f3f736c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 7 Dec 2022 14:43:49 +0300 Subject: Move indication that tenant is archived to timestamp field on builds and package version details pages --- mod/mod-builds.cxx | 7 ++++- mod/mod-package-version-details.cxx | 7 ++++- mod/page.cxx | 60 ++++++++++++++++++++++++++---------- www/builds-body.css | 1 - www/package-version-details-body.css | 1 - 5 files changed, 56 insertions(+), 20 deletions(-) diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx index ff27c65..6b5c90f 100644 --- a/mod/mod-builds.cxx +++ b/mod/mod-builds.cxx @@ -694,7 +694,12 @@ handle (request& rq, response& rs) "%Y-%m-%d %H:%M:%S %Z", true /* special */, true /* local */) + - " (" + butl::to_string (now - b.timestamp, false) + " ago)"); + " (" + butl::to_string (now - b.timestamp, false) + " ago"); + + if (pb.archived) + ts += ", archived"; + + ts += ')'; s << TABLE(CLASS="proplist build") << TBODY diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index 3a1ce0a..b5d733b 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -618,7 +618,12 @@ handle (request& rq, response& rs) "%Y-%m-%d %H:%M:%S %Z", true /* special */, true /* local */) + - " (" + butl::to_string (now - b.timestamp, false) + " ago)"); + " (" + butl::to_string (now - b.timestamp, false) + " ago"); + + if (tn->archived) + ts += ", archived"; + + ts += ')'; if (b.state == build_state::built) build_db_->load (b, b.results_section); diff --git a/mod/page.cxx b/mod/page.cxx index 7352867..a671346 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -747,10 +747,27 @@ namespace brep << TD << SPAN(CLASS="value"); + // Print the ' | ' separator if this is not the first item and reset the + // `first` flag to false otherwise. + // + bool first (true); + auto separate = [&s, &first] () + { + if (first) + first = false; + else + s << " | "; + }; + if (build_.state == build_state::building) - s << SPAN(CLASS="building") << "building" << ~SPAN << " | "; + { + separate (); + + s << SPAN(CLASS="building") << "building" << ~SPAN; + } else { + // If no unsuccessful operation results available, then print the // overall build status. If there are any operation results available, // then also print unsuccessful operation statuses with the links to the @@ -761,7 +778,10 @@ namespace brep if (build_.results.empty () || *build_.status == result_status::success) { assert (build_.status); - s << SPAN_BUILD_RESULT_STATUS (*build_.status) << " | "; + + separate (); + + s << SPAN_BUILD_RESULT_STATUS (*build_.status); } if (!build_.results.empty ()) @@ -769,6 +789,9 @@ namespace brep for (const auto& r: build_.results) { if (r.status != result_status::success) + { + separate (); + s << SPAN_BUILD_RESULT_STATUS (r.status) << " (" << A << HREF @@ -776,28 +799,33 @@ namespace brep << ~HREF << r.operation << ~A - << ") | "; + << ")"; + } } + separate (); + s << A << HREF << build_log_url (host_, root_, build_) << ~HREF << "log" - << ~A - << " | "; + << ~A; } } - if (archived_) - s << SPAN(CLASS="archived") << "archived" << ~SPAN; - else if (build_.force == (build_.state == build_state::building - ? force_state::forcing - : force_state::forced)) - s << SPAN(CLASS="pending") << "pending" << ~SPAN; - else - s << A - << HREF << build_force_url (host_, root_, build_) << ~HREF - << "rebuild" - << ~A; + if (!archived_) + { + separate (); + + if (build_.force == (build_.state == build_state::building + ? force_state::forcing + : force_state::forced)) + s << SPAN(CLASS="pending") << "pending" << ~SPAN; + else + s << A + << HREF << build_force_url (host_, root_, build_) << ~HREF + << "rebuild" + << ~A; + } s << ~SPAN << ~TD diff --git a/www/builds-body.css b/www/builds-body.css index 65a2acf..b5275c3 100644 --- a/www/builds-body.css +++ b/www/builds-body.css @@ -56,7 +56,6 @@ font-size: 0.94em; } -.build .archived {color: #6c6c6c;} .build .pending {color: #d1943c;} .build .building {color: #d1943c;} .build .success {color: #00bb00;} diff --git a/www/package-version-details-body.css b/www/package-version-details-body.css index 02835d6..dec5652 100644 --- a/www/package-version-details-body.css +++ b/www/package-version-details-body.css @@ -321,7 +321,6 @@ h1, h2, h3 font-size: 0.94em; } -.build .archived {color: #6c6c6c;} .build .pending {color: #d1943c;} .build .building {color: #d1943c;} .build .success {color: #00bb00;} -- cgit v1.1