Mercurial > bitten > bitten-test
changeset 255:42f555e1d648
Show the build status for the latest changeset for every build configuration on the main build status page. Closes #21.
author | cmlenz |
---|---|
date | Wed, 05 Oct 2005 18:11:57 +0000 |
parents | 27ed440902f9 |
children | aa942e2c7243 |
files | bitten/trac_ext/htdocs/bitten.css bitten/trac_ext/templates/bitten_config.cs bitten/trac_ext/web_ui.py |
diffstat | 3 files changed, 97 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/trac_ext/htdocs/bitten.css +++ b/bitten/trac_ext/htdocs/bitten.css @@ -17,6 +17,38 @@ #content.build h2.deactivated { text-decoration: line-through; } #content.build #prefs { line-height: 1.4em; } +#content.build table.builds { border-collapse: separate; + border-top: 1px solid #666; table-layout: fixed; +} +#content.build table.builds caption { font-weight: bold; text-align: left; } +#content.build table.builds th { padding: 0 .25em; text-align: left; + vertical-align: top; +} +#content.build table.builds th p { color: #666; font-size: smaller; + margin-top: 0; +} +#content.build table.builds th p.message { font-style: italic; } +#content.build table.builds td { color: #999; border: 1px solid; + padding: .25em .5em; vertical-align: top; +} +#content.build table.builds td :link, #content.build table.builds td :visited { + font-weight: bold; +} +#content.build table.builds td.completed { background: #9d9; border-color: #696; + color: #393; +} +#content.build table.builds td.failed { background: #d99; border-color: #966; + color: #933; +} +#content.build table.builds td.in-progress { background: #dd9; + border-color: #996; color: #993; +} +#content.build table.builds td p { font-size: smaller; margin-top: 0; } +#content.build table.builds .status { color: #000; } +#content.build table.builds .system { font-size: smaller; line-height: 1.2em; + margin: .5em 0; +} + #content.build form.config { margin-top: 1em; } #content.build form.config th { text-align: left; } #content.build form.config fieldset { margin-bottom: 1em; }
--- a/bitten/trac_ext/templates/bitten_config.cs +++ b/bitten/trac_ext/templates/bitten_config.cs @@ -40,6 +40,38 @@ if:config.description ?><div class="description"><?cs var:config.description ?></div><?cs /if ?><?cs + if:len(config.builds) ?> + <table class="builds"><caption>Latest builds</caption><tr> + <th><a href="<?cs var:config.youngest_rev.href ?>">[<?cs + var:config.youngest_rev.id ?>]</a> by <?cs + var:config.youngest_rev.author ?><p class="date"><?cs + var:config.youngest_rev.date ?></p><p class="message"><?cs + var:config.youngest_rev.message ?></p> + </th><?cs + each:build = config.builds ?><td class="<?cs + var:build.cls ?>"><?cs + if:build.status != 'pending' ?><a href="<?cs var:build.href ?>"><?cs + var:name(build) ?></a><p class="date"><?cs + var:build.stopped ?></p><div class="system"> + <strong class="ipnr"><?cs var:build.slave.name ?></strong> (<?cs + var:build.slave.ipnr ?>)<br /><?cs + var:build.slave.os.name ?> <?cs var:build.slave.os.version ?><?cs + if:build.slave.machine || build.slave.processor ?> / <?cs + alt:build.slave.processor ?><?cs + var:build.slave.machine ?><?cs + /alt ?><?cs + /if ?></div><strong class="status"><?cs + if:build.status == 'completed' ?>Success<?cs + elif:build.status == 'failed' ?>Failed<?cs + elif:build.status == 'in-progress' ?>In-progress<?cs + /if ?></strong><?cs + else ?><?cs var:name(build) ?><br /> + <p class="nobuild">No build yet</p><?cs + /if ?> + </td><?cs + /each ?> + </tr></table><?cs + /if ?><?cs /each ?><?cs if:config.can_create ?><div class="buttons"> <form method="get" action=""><div>
--- a/bitten/trac_ext/web_ui.py +++ b/bitten/trac_ext/web_ui.py @@ -18,11 +18,12 @@ import pkg_resources from trac.core import * from trac.Timeline import ITimelineEventProvider -from trac.util import escape, pretty_timedelta, format_date, format_datetime +from trac.util import escape, pretty_timedelta, format_date, format_datetime, \ + shorten_line from trac.web import IRequestHandler from trac.web.chrome import INavigationContributor, ITemplateProvider, \ add_link, add_stylesheet -from trac.wiki import wiki_to_html +from trac.wiki import wiki_to_html, wiki_to_oneliner from bitten.model import BuildConfig, TargetPlatform, Build, BuildStep, \ BuildLog, Report from bitten.queue import collect_changes @@ -30,7 +31,8 @@ from bitten.trac_ext.api import ILogFormatter, IReportSummarizer from bitten.util import xmlio -_status_label = {Build.IN_PROGRESS: 'in progress', +_status_label = {Build.PENDING: 'pending', + Build.IN_PROGRESS: 'in progress', Build.SUCCESS: 'completed', Build.FAILURE: 'failed'} @@ -329,17 +331,42 @@ show_all = True req.hdf['config.show_all'] = show_all - configurations = BuildConfig.select(self.env, include_inactive=show_all) - for idx, config in enumerate(configurations): + configs = BuildConfig.select(self.env, include_inactive=show_all) + for idx, config in enumerate(configs): + prefix = 'configs.%d' % idx description = config.description if description: description = wiki_to_html(description, self.env, req) - req.hdf['configs.%d' % idx] = { + req.hdf[prefix] = { 'name': config.name, 'label': config.label or config.name, 'active': config.active, 'path': config.path, 'description': description, 'href': self.env.href.build(config.name), } + if not config.active: + continue + + repos = self.env.get_repository(req.authname) + repos.sync() + prev_rev = None + for platform, rev, build in collect_changes(repos, config): + if rev != prev_rev: + if prev_rev is None: + chgset = repos.get_changeset(rev) + req.hdf[prefix + '.youngest_rev'] = { + 'id': rev, 'href': self.env.href.changeset(rev), + 'author': escape(chgset.author), + 'date': format_datetime(chgset.date), + 'message': wiki_to_oneliner( + shorten_line(chgset.message), self.env) + } + else: + break + prev_rev = rev + if build: + build_hdf = _build_to_hdf(self.env, req, build) + req.hdf[prefix + '.builds.%s' % platform.name] = build_hdf + req.hdf['page.mode'] = 'overview' req.hdf['config.can_create'] = req.perm.has_permission('BUILD_CREATE')