From 9d50600f7ca9f900f8bfdcd30668c7ee47b2c176 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 2 Dec 2022 20:13:45 +0300 Subject: Reflect that build tenant is archived on builds and package version details pages --- libbrep/build.hxx | 1 + mod/mod-builds.cxx | 14 +++++++------- mod/mod-package-version-details.cxx | 2 +- mod/page.cxx | 8 +++++--- mod/page.hxx | 8 ++++++-- www/builds-body.css | 1 + www/package-version-details-body.css | 1 + 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/libbrep/build.hxx b/libbrep/build.hxx index dfd0e55..eaceebc 100644 --- a/libbrep/build.hxx +++ b/libbrep/build.hxx @@ -388,6 +388,7 @@ namespace brep struct package_build { shared_ptr build; + bool archived; // True if the tenant the build belongs to is archived. }; #pragma db view \ diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx index 095dee3..ff27c65 100644 --- a/mod/mod-builds.cxx +++ b/mod/mod-builds.cxx @@ -538,7 +538,7 @@ handle (request& rq, response& rs) // printing the builds. // count = 0; - vector> builds; + vector builds; builds.reserve (page_configs); // Prepare the package build prepared query. @@ -644,9 +644,9 @@ handle (request& rq, response& rs) // we don't increment the counter in this case. // if (find_if (builds.begin (), builds.end (), - [&b] (const shared_ptr& pb) + [&b] (const package_build& pb) { - return b->id == pb->id; + return b->id == pb.build->id; }) != builds.end ()) continue; @@ -660,7 +660,7 @@ handle (request& rq, response& rs) r.log.clear (); } - builds.push_back (move (b)); + builds.push_back (move (pb)); --print; } @@ -686,9 +686,9 @@ handle (request& rq, response& rs) // Enclose the subsequent tables to be able to use nth-child CSS selector. // s << DIV; - for (const shared_ptr& pb: builds) + for (const package_build& pb: builds) { - const build& b (*pb); + const build& b (*pb.build); string ts (butl::to_string (b.timestamp, "%Y-%m-%d %H:%M:%S %Z", @@ -711,7 +711,7 @@ handle (request& rq, response& rs) if (b.interactive) // Note: can only be present for the building state. s << TR_VALUE ("login", *b.interactive); - s << TR_BUILD_RESULT (b, host, root); + s << TR_BUILD_RESULT (b, pb.archived, host, root); // In the global view mode add the tenant builds link. Note that the // global view (and the link) makes sense only in the multi-tenant mode. diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index b158228..3a1ce0a 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -639,7 +639,7 @@ handle (request& rq, response& rs) if (b.interactive) // Note: can only be present for the building state. s << TR_VALUE ("login", *b.interactive); - s << TR_BUILD_RESULT (b, host, root) + s << TR_BUILD_RESULT (b, tn->archived, host, root) << ~TBODY << ~TABLE; diff --git a/mod/page.cxx b/mod/page.cxx index e2a8b84..7352867 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -787,9 +787,11 @@ namespace brep } } - if (build_.force == (build_.state == build_state::building - ? force_state::forcing - : force_state::forced)) + 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 diff --git a/mod/page.hxx b/mod/page.hxx index acfbe5b..0a5d359 100644 --- a/mod/page.hxx +++ b/mod/page.hxx @@ -474,14 +474,18 @@ namespace brep class TR_BUILD_RESULT { public: - TR_BUILD_RESULT (const build& b, const string& h, const dir_path& r): - build_ (b), host_ (h), root_ (r) {} + TR_BUILD_RESULT (const build& b, + bool a, + const string& h, + const dir_path& r): + build_ (b), archived_ (a), host_ (h), root_ (r) {} void operator() (xml::serializer&) const; private: const build& build_; + bool archived_; const string& host_; const dir_path& root_; }; diff --git a/www/builds-body.css b/www/builds-body.css index b5275c3..65a2acf 100644 --- a/www/builds-body.css +++ b/www/builds-body.css @@ -56,6 +56,7 @@ 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 dec5652..02835d6 100644 --- a/www/package-version-details-body.css +++ b/www/package-version-details-body.css @@ -321,6 +321,7 @@ 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