From patchwork Tue Jan 8 12:38:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ali Alnubani X-Patchwork-Id: 1021879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43YsLb2yPfz9sDr for ; Tue, 8 Jan 2019 23:40:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="CsEzwAk5"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43YsLb0qw0zDqVF for ; Tue, 8 Jan 2019 23:40:55 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=2a01:111:f400:fe1f::601; helo=eur01-ve1-obe.outbound.protection.outlook.com; envelope-from=alialnu@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="CsEzwAk5"; dkim-atps=neutral Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0601.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::601]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43YsJG4tg1zDqSF for ; Tue, 8 Jan 2019 23:38:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kPCGMzbctbi61kk3O+vfzQ4LnMNeRpnxTcyp5P+2bkg=; b=CsEzwAk5LX2DH9922meu9XOzQc5sRbsfSzbZtKeKh2esp3KGAosaT6y2Vh6U5Kt1mr49xGTrtYDAlclXdSv6+zqVC8vx83yVYKAQmz6gVAWvjdyd3Rnx9zLEJ4QcEeaQZT4Im6fUlZpa3NFctgVAfpLAYFf73/a1o9HXvS1ETcM= Received: from VI1PR05MB4269.eurprd05.prod.outlook.com (52.133.12.22) by VI1PR05MB6272.eurprd05.prod.outlook.com (20.177.49.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.13; Tue, 8 Jan 2019 12:38:48 +0000 Received: from VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::39c0:bdf5:cba0:8f14]) by VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::39c0:bdf5:cba0:8f14%5]) with mapi id 15.20.1495.011; Tue, 8 Jan 2019 12:38:48 +0000 From: Ali Alnubani To: "patchwork@lists.ozlabs.org" Subject: [PATCH] Beautify check counts in the patch list view Thread-Topic: [PATCH] Beautify check counts in the patch list view Thread-Index: AQHUp08ZWvoIXGEDvUK2rG1ilun5Bg== Date: Tue, 8 Jan 2019 12:38:47 +0000 Message-ID: <20190108123834.2225-7-alialnu@mellanox.com> References: <20190108123834.2225-1-alialnu@mellanox.com> In-Reply-To: <20190108123834.2225-1-alialnu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-clientproxiedby: LO2P265CA0316.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::16) To VI1PR05MB4269.eurprd05.prod.outlook.com (2603:10a6:803:40::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4b98:dc0:51:216:3eff:feac:53b] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB6272; 6:ak9cn1+G8HwGzQ7IC0238s0Ng30L8SrRSMIEz1I8/iyTTomEhrjolHdkKpyW+V37uGu8V/0/UyO2qsdRU+pivfK55FTIbezfP4Ef3gdZfTyhSEpA7AeSSapm8o3bd23Ds9gfmaV4olAOqlIvO2ZQmN0CV7TuDENdnKtfxNJfNni467Up9AgiuPsFmLChqtaqIhetI6+NLMy8PwqQpxNpbrzccma9XyELPdvGlx/aXX9JG6WYKFj11upIDIiIDy1YkAHCBLFUEmrfVaxmb0cJeHgN9Rq/CtapeFqsrvhCTXwJ5PD0zFdozG07twWwtHHZSKJ/uy6nNopeVvm09/ktS/xi60+1jHAgG1034oWW5g20HaXwMyDdDENUznJNkxalAaEuCBaZepPNDX6wZ2VKNqh1JH4o15Ltg6GR2fb9veV1q8vmBaGgioTTIXmTHOE+ZxVjjNYLm7fwNOwEsck5qA==; 5:1/AUx6oeCF5gjPH2j/i0Fb67NOkbErMTnBO3Pw1l+9hu3eQrhcA3/CvlLI7/2gFh6vuxDQPNYxX49Q1j0pWOOnfU9H/hUMSzwuDkqj6WMZUyMIUZD5YrpVuWDJxZvXiIUKlCuHzMKdBTEKBYWh1VV5eybCDxi5xol2vvVOoR1/JNoe0vjRszqGtCcwwzGai0wj+TtoPNrOxgCYbBJQTEow==; 7:a0rnK3j2veKzitnhutoIYh+K+SDqdaX/jS6/Yfdw1pz1JNe6/gvsFwxy85qDZGq1Fi8TuhUksnhx2bU51EZj5od0dZ9QqchBhjj2oDCqtE4iNpSJK1rn+w7sSBhPgx1iUV3BC9f504bZAXBu26VSUw== x-ms-office365-filtering-correlation-id: e87f1f29-f2fd-40af-c1e6-08d675663c19 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600109)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB6272; x-ms-traffictypediagnostic: VI1PR05MB6272: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB6272; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB6272; x-forefront-prvs: 0911D5CE78 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(376002)(39860400002)(366004)(346002)(189003)(199004)(316002)(2616005)(446003)(11346002)(46003)(476003)(2501003)(81156014)(81166006)(8936002)(6512007)(4326008)(25786009)(305945005)(256004)(6116002)(97736004)(7736002)(14444005)(486006)(386003)(6506007)(2351001)(105586002)(52116002)(102836004)(106356001)(76176011)(6916009)(186003)(71200400001)(478600001)(36756003)(68736007)(71190400001)(99286004)(1076003)(2906002)(6486002)(5660300001)(53936002)(8676002)(86362001)(50226002)(1730700003)(5640700003)(14454004)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB6272; H:VI1PR05MB4269.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: sm/wG/FyGG7bMckbneD/k5RqpM9aAsq/B73OPr7r/74wkUuQqYMMeoLhWpWIRpTd33YdNeP1VPs/6hbsw5H3AamLCmYg8sPomY7K2LLT/TAbDsu0GP8ygpyVzjWk8W1mjj4YLfsc9nIICuB/Rjh8dWPpBzxeSUuJ2QD4QRH8hfgVvQaxH9WO9vnQsQYr5zDMRgvyt1gWCSxYf+1rfGioRF0FKmdJrfEJbaKZXAQOCE9nuYXnrCH5UPC2+kmKvF+MpcrWAV6mciMzwSsUFkxQucxWns/1J4E4/jnLkvKZAQvuDztYzDmk1zE/EqwxK7AN spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e87f1f29-f2fd-40af-c1e6-08d675663c19 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2019 12:38:47.3557 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB6272 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Monjalon Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This patch [1] adds colors to the checks in the patch list view. The colors are set based on the check's priority, with FAILURE having the highest priority, followed by WARNING, and then SUCCESS. Only the check with the highest priority and non-zero count will be colored. This is to make failures and warnings more visible. The patch also [2] replaces zero counts with a '-' for FAILUREs and WARNINGs. The SUCCESS count will only be replaced by a '-' when all other checks have zero counts too. Suggested-by: Thomas Monjalon Signed-off-by: Ali Alnubani --- htdocs/css/style.css | 21 +++++++++++++++++++++ patchwork/templatetags/patch.py | 26 +++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 6b2a80a..1c95174 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -240,6 +240,27 @@ table.patchmeta tr th, table.patchmeta tr td { text-decoration: underline; } +.patchlistchecks { + border-radius: 7px; + padding: 3px; +} + +.patchlistchecks.success { + background-color: #82ca9d; +} + +.patchlistchecks.warning { + background-color: #ffc95e; +} + +.patchlistchecks.fail { + background-color: #ff5555; +} + +.patchlistchecks.empty { + padding: 4px; +} + .checks .state { font-weight: bold; color: #ddd; diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index 5d387a4..c57a642 100644 --- a/patchwork/templatetags/patch.py +++ b/patchwork/templatetags/patch.py @@ -36,9 +36,33 @@ def patch_checks(patch): titles = ['Success', 'Warning', 'Fail'] counts = patch.check_count + check_color = {Check.STATE_SUCCESS: "success", + Check.STATE_WARNING: "warning", + Check.STATE_FAIL: "fail"} + + check_elements = [] + if any(counts[state] for state in required): + for state in required: + if counts[state] > 0 and (state == Check.STATE_FAIL or \ + (state == Check.STATE_WARNING and counts[Check.STATE_FAIL] == 0) or \ + (state == Check.STATE_SUCCESS and counts[Check.STATE_WARNING] == 0 and \ + counts[Check.STATE_FAIL] == 0)): + check_elements.append('{}'.format( \ + check_color[state], + str(counts[state]))) + else: + if state == Check.STATE_SUCCESS: + check_elements.append('{}'.format( \ + str(counts[state]))) + else: + check_elements.append('-') + else: + check_elements = ['-'.format(str(counts[state])) \ + for state in required] + return mark_safe('%s' % ( ' / '.join(titles), - ' '.join([str(counts[state]) for state in required]))) + ''.join(check_elements))) @register.filter