aboutsummaryrefslogtreecommitdiff
path: root/mod/page.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-06-13 17:52:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-06-14 17:51:00 +0300
commit2b31e5cb109e2b009529e97f4fdb4a707cae14f2 (patch)
treeffa46e5d3eaddf151d795d1db6640f6f3cf94838 /mod/page.cxx
parentae4eb4360376a52866b4737ba8f0fc76255821a0 (diff)
Add builds to package version details page
Diffstat (limited to 'mod/page.cxx')
-rw-r--r--mod/page.cxx67
1 files changed, 67 insertions, 0 deletions
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 <libbrep/package.hxx>
#include <libbrep/package-odb.hxx>
+#include <mod/build-config.hxx> // 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::