Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5ED4FE00BB6; Mon, 11 Jan 2016 03:05:59 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.65 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8EBFBE00B7D for ; Mon, 11 Jan 2016 03:05:33 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 11 Jan 2016 03:05:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,552,1444719600"; d="scan'208";a="890733018" Received: from bjmcgrat-mobl3.amr.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.6.89]) by fmsmga002.fm.intel.com with ESMTP; 11 Jan 2016 03:05:31 -0800 From: Elliot Smith To: toaster@yoctoproject.org Date: Mon, 11 Jan 2016 11:04:46 +0000 Message-Id: <1452510291-21616-18-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1452510291-21616-1-git-send-email-elliot.smith@intel.com> References: <1452510291-21616-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 17/22] toaster: toastergui Set default visible and hideable columns X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2016 11:05:59 -0000 Incorrect columns were shown by default in the "all builds", "project builds" and "all projects" pages. Set the "hidden" property on columns in these tables to hide the correct columns. Add a set_column_hidden() method to ToasterTable so that the "hidden" property can be overridden for the machines column in the project builds page (it shares a superclass with all builds). Make the time column on all builds page hideable. [YOCTO #8738] Signed-off-by: Elliot Smith --- bitbake/lib/toaster/toastergui/tables.py | 23 ++++++++++++++++++++--- bitbake/lib/toaster/toastergui/widgets.py | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index a3568a7..caf7e8d 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -814,7 +814,7 @@ class ProjectsTable(ToasterTable): last project build. If the project has no \ builds, this shows the date the project was \ created.', - hideable=True, + hideable=False, orderable=True, static_data_name='updated', static_data_template=last_activity_on_template) @@ -838,7 +838,7 @@ class ProjectsTable(ToasterTable): self.add_column(title='Number of builds', help_text='The number of builds which have been run \ for the project', - hideable=True, + hideable=False, orderable=False, static_data_name='number_of_builds', static_data_template=number_of_builds_template) @@ -871,6 +871,7 @@ class ProjectsTable(ToasterTable): help_text='The number of warnings encountered during \ the last project build (if any)', hideable=True, + hidden=True, orderable=False, static_data_name='warnings', static_data_template=warnings_template) @@ -879,6 +880,7 @@ class ProjectsTable(ToasterTable): help_text='The root file system types produced by \ the last project build', hideable=True, + hidden=True, orderable=False, static_data_name='image_files', static_data_template=image_files_template) @@ -1078,6 +1080,7 @@ class BuildsTable(ToasterTable): self.add_column(title='Started on', help_text='The date and time when the build started', hideable=True, + hidden=True, orderable=True, filter_name='started_on_filter', static_data_name='started_on', @@ -1118,7 +1121,8 @@ class BuildsTable(ToasterTable): self.add_column(title='Time', help_text='How long the build took to finish', - hideable=False, + hideable=True, + hidden=True, orderable=False, static_data_name='time', static_data_template=time_template) @@ -1330,6 +1334,19 @@ class ProjectBuildsTable(BuildsTable): # set from the querystring self.project_id = None + def setup_columns(self, *args, **kwargs): + """ + Project builds table doesn't show the machines column by default + """ + + super(ProjectBuildsTable, self).setup_columns(*args, **kwargs) + + # hide the machine column + self.set_column_hidden('Machine', True) + + # allow the machine column to be hidden by the user + self.set_column_hideable('Machine', True) + def setup_queryset(self, *args, **kwargs): """ NOTE: self.project_id must be set before calling super(), diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index d9328d4..d2ef5d3 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py @@ -168,6 +168,24 @@ class ToasterTable(TemplateView): 'computation': computation, }) + def set_column_hidden(self, title, hidden): + """ + Set the hidden state of the column to the value of hidden + """ + for col in self.columns: + if col['title'] == title: + col['hidden'] = hidden + break + + def set_column_hideable(self, title, hideable): + """ + Set the hideable state of the column to the value of hideable + """ + for col in self.columns: + if col['title'] == title: + col['hideable'] = hideable + break + def render_static_data(self, template, row): """Utility function to render the static data template""" -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.