From 413027ad5bae65552e3857a9c31ed16844c06f14 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 12 Jun 2024 15:45:27 +0200 Subject: [PATCH] [IMP] runbot_merge: formatting & langage of PR attributes Replace the unclear "unchecked" and "unreviewed" by "missing statuses" and "missing r+", which are hopefully clearer as they better match other lingo. Also increase font for attributes, as size 10 was a bit small. And finally add staging state to caching key, to differentiate "ready" from "staged" pictures in gh's cache. "ready" should not be necessary as it ought be implied by the label. --- runbot_merge/controllers/dashboard.py | 15 ++++++++------- runbot_merge/views/templates.xml | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runbot_merge/controllers/dashboard.py b/runbot_merge/controllers/dashboard.py index 7b62e9d7..6a5dd2de 100644 --- a/runbot_merge/controllers/dashboard.py +++ b/runbot_merge/controllers/dashboard.py @@ -173,7 +173,7 @@ def raster_render(pr): with file_open('web/static/fonts/google/Open_Sans/Open_Sans-Regular.ttf', 'rb') as f: font = ImageFont.truetype(f, size=16, layout_engine=0) f.seek(0) - supfont = ImageFont.truetype(f, size=10, layout_engine=0) + supfont = ImageFont.truetype(f, size=13, layout_engine=0) with file_open('web/static/fonts/google/Open_Sans/Open_Sans-Bold.ttf', 'rb') as f: bold = ImageFont.truetype(f, size=16, layout_engine=0) @@ -203,9 +203,9 @@ def raster_render(pr): # technically label (state + blocked) does not actually impact image # render (though subcomponents of state do) however blocked is useful # to force an etag miss so keeping it - # TODO: blocked includes draft & merge method, maybe should change looks? + etag.update(''.join( - f"(PS){p['label']},{p['closed']},{p['number']},{p['checked']},{p['reviewed']},{p['attached']}" + f"(PS){p['label']},{p['closed']},{p['number']},{p['checked']},{p['reviewed']},{p['attached']},{p['pr'].staging_id.id}" for p in ps['prs'] ).encode()) @@ -214,9 +214,10 @@ def raster_render(pr): _, _, ww, hh = font.getbbox(f" #{p['number']}") w += ww + supfont.getbbox(' '.join(filter(None, [ 'error' if p['pr'].error else '', - '' if p['checked'] else 'unchecked', - '' if p['reviewed'] else 'unreviewed', + '' if p['checked'] else 'missing statuses', + '' if p['reviewed'] else 'missing r+', '' if p['attached'] else 'detached', + 'staged' if p['pr'].staging_id else 'ready' if p['pr']._ready else '', ])))[2] h = max(hh, h) rows[b] = max(rows.get(b, 0), h) @@ -294,8 +295,8 @@ def raster_render(pr): draw.line([(left, bottom-h), (left+w, bottom-h)], fill=ERROR) for attribute in filter(None, [ 'error' if p['pr'].error else '', - '' if p['checked'] else 'unchecked', - '' if p['reviewed'] else 'unreviewed', + '' if p['checked'] else 'missing statuses', + '' if p['reviewed'] else 'missing r+', '' if p['attached'] else 'detached', 'staged' if p['pr'].staging_id else 'ready' if p['pr']._ready else '' ]): diff --git a/runbot_merge/views/templates.xml b/runbot_merge/views/templates.xml index ce661eb9..cdad7aa3 100644 --- a/runbot_merge/views/templates.xml +++ b/runbot_merge/views/templates.xml @@ -594,8 +594,8 @@ action = batches t-attf-class="fa fa-external-link" t-att-href="p['backend_url']" /> - unchecked - unreviewed + missing statuses + missing r+