From 2b31e5cb109e2b009529e97f4fdb4a707cae14f2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 13 Jun 2017 17:52:42 +0300 Subject: Add builds to package version details page --- mod/page.cxx | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'mod/page.cxx') diff --git a/mod/page.cxx b/mod/page.cxx index 73c56be..291dfb4 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -18,6 +18,8 @@ #include #include +#include // build_log_url() + using namespace std; using namespace xml; using namespace web; @@ -584,6 +586,71 @@ namespace brep << ~TR; } + // BUILD_RESULT + // + void TR_BUILD_RESULT:: + operator() (serializer& s) const + { + s << TR(CLASS="result") + << TH << "result" << ~TH + << TD + << SPAN(CLASS="value"); + + if (build_.state == build_state::building) + s << "building | "; + 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 + // respective logs, followed with a link to the operation's combined + // log. Print the forced package rebuild link afterwards, unless the + // package build is already pending. + // + if (build_.results.empty () || *build_.status == result_status::success) + { + assert (build_.status); + s << SPAN_BUILD_RESULT_STATUS (*build_.status) << " | "; + } + + if (!build_.results.empty ()) + { + for (const auto& r: build_.results) + { + if (r.status != result_status::success) + s << SPAN_BUILD_RESULT_STATUS (r.status) << " (" + << A + << HREF + << build_log_url (host_, root_, build_, &r.operation) + << ~HREF + << r.operation + << ~A + << ") | "; + } + + s << A + << HREF << build_log_url (host_, root_, build_) << ~HREF + << "log" + << ~A + << " | "; + } + } + + if (build_.force == (build_.state == build_state::building + ? force_state::forcing + : force_state::forced)) + s << "pending"; + else + s << A + << HREF << force_rebuild_url (host_, root_, build_) << ~HREF + << "rebuild" + << ~A; + + s << ~SPAN + << ~TD + << ~TR; + } + // SPAN_COMMENT // void SPAN_COMMENT:: -- cgit v1.1