Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D850AE00D0A; Tue, 24 May 2016 04:55:53 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E11E9E00D0C for ; Tue, 24 May 2016 04:53:17 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 24 May 2016 04:53:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,359,1459839600"; d="scan'208";a="961194461" Received: from icarus.isw.intel.com ([10.237.224.37]) by orsmga001.jf.intel.com with ESMTP; 24 May 2016 04:53:17 -0700 From: Belen Barros Pena To: toaster@yoctoproject.org Date: Tue, 24 May 2016 12:39:34 +0100 Message-Id: <1464090003-23469-78-git-send-email-belen.barros.pena@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464090003-23469-1-git-send-email-belen.barros.pena@linux.intel.com> References: <1464090003-23469-1-git-send-email-belen.barros.pena@linux.intel.com> Subject: [PATCH 077/106] toaster: Project builds empty state 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: Tue, 24 May 2016 11:55:53 -0000 Create an empty state for the "Project builds" page. Signed-off-by: Michael Wood Signed-off-by: Belen Barros Pena --- bitbake/lib/toaster/toastergui/static/js/table.js | 24 ++++++++++++++-------- bitbake/lib/toaster/toastergui/tables.py | 8 ++++++++ .../templates/projectbuilds-toastertable.html | 15 +++++++++++--- .../toaster/toastergui/templates/toastertable.html | 4 ++++ bitbake/lib/toaster/toastergui/widgets.py | 3 ++- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js index 5e3171f..6888c71 100644 --- a/bitbake/lib/toaster/toastergui/static/js/table.js +++ b/bitbake/lib/toaster/toastergui/static/js/table.js @@ -75,14 +75,21 @@ function tableInit(ctx){ if (tableData.total === 0){ tableContainer.hide(); - if ($("#no-results-special-"+ctx.tableName).length > 0) { - /* use this page's special no-results form instead of the default */ - $("#no-results-search-input-"+ctx.tableName).val(tableParams.search); - $("#no-results-special-"+ctx.tableName).show(); - $("#results-found-"+ctx.tableName).hide(); - } else { - $("#new-search-input-"+ctx.tableName).val(tableParams.search); - $("#no-results-"+ctx.tableName).show(); + /* No results caused by a search returning nothing */ + if (tableParams.search) { + if ($("#no-results-special-"+ctx.tableName).length > 0) { + /* use this page's special no-results form instead of the default */ + $("#no-results-search-input-"+ctx.tableName).val(tableParams.search); + $("#no-results-special-"+ctx.tableName).show(); + $("#results-found-"+ctx.tableName).hide(); + } else { + $("#new-search-input-"+ctx.tableName).val(tableParams.search); + $("#no-results-"+ctx.tableName).show(); + } + } + else { + /* No results caused by there being no data */ + $("#empty-state-"+ctx.tableName).show(); } table.trigger("table-done", [tableData.total, tableParams]); @@ -90,6 +97,7 @@ function tableInit(ctx){ } else { tableContainer.show(); $("#no-results-"+ctx.tableName).hide(); + $("#empty-state-"+ctx.tableName).hide(); } setupTableChrome(tableData); diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index bbdd258..d1906c1 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -1424,6 +1424,7 @@ class ProjectBuildsTable(BuildsTable): super(ProjectBuildsTable, self).__init__(*args, **kwargs) self.title = 'All project builds' self.mrb_type = 'project' + self.empty_state = "This project has no builds" # set from the querystring self.project_id = None @@ -1466,4 +1467,11 @@ class ProjectBuildsTable(BuildsTable): context['mru'] = Build.get_recent(project) context['project'] = project + self.setup_queryset(**kwargs) + if self.queryset.count() == 0 and \ + project.build_set.filter(outcome=Build.IN_PROGRESS).count() > 0: + context['build_in_progress_none_completed'] = True + else: + context['build_in_progress_none_completed'] = False + return context diff --git a/bitbake/lib/toaster/toastergui/templates/projectbuilds-toastertable.html b/bitbake/lib/toaster/toastergui/templates/projectbuilds-toastertable.html index b9348eb..6d27668 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectbuilds-toastertable.html +++ b/bitbake/lib/toaster/toastergui/templates/projectbuilds-toastertable.html @@ -24,8 +24,10 @@

- {% url 'projectbuilds' project.id as xhr_table_url %} - {% include 'toastertable.html' %} + {% if not build_in_progress_none_completed %} + {% url 'projectbuilds' project.id as xhr_table_url %} + {% include 'toastertable.html' %} + {% endif %}