Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1850)

Unified Diff: appengine/findit/handlers/flake/filter_flake.py

Issue 2208143002: [Findit] Filters for dashboard (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/infra/infra into dashboard-filter Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/handlers/flake/test/filter_flake_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/handlers/flake/filter_flake.py
diff --git a/appengine/findit/handlers/flake/filter_flake.py b/appengine/findit/handlers/flake/filter_flake.py
new file mode 100644
index 0000000000000000000000000000000000000000..a387261d37b919ef474657852c6bcd47bbf4d979
--- /dev/null
+++ b/appengine/findit/handlers/flake/filter_flake.py
@@ -0,0 +1,61 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from google.appengine.ext import ndb
+
+from common.base_handler import BaseHandler
+from common.base_handler import Permission
+from model.flake.master_flake_analysis import MasterFlakeAnalysis
+
+
+def FilterMasterFlakeAnalysis(master_flake_analysis_query, master_name,
+ builder_name, build_number, step_name, test_name):
+ if master_name:
+ master_flake_analysis_query = master_flake_analysis_query.filter(
+ MasterFlakeAnalysis.master_name == master_name)
+ if builder_name:
+ master_flake_analysis_query = master_flake_analysis_query.filter(
+ MasterFlakeAnalysis.builder_name == builder_name)
+ if build_number:
+ master_flake_analysis_query = master_flake_analysis_query.filter(
+ MasterFlakeAnalysis.build_number == build_number)
+ if step_name:
+ master_flake_analysis_query = master_flake_analysis_query.filter(
+ MasterFlakeAnalysis.step_name == step_name)
+ if test_name:
+ master_flake_analysis_query = master_flake_analysis_query.filter(
+ MasterFlakeAnalysis.test_name == test_name)
+ return master_flake_analysis_query.fetch()
+
+
+class FilterFlake(BaseHandler):
+ PERMISSION_LEVEL = Permission.CORP_USER
+
+ def HandleGet(self):
+ master_name = self.request.get('master_name').strip()
+ builder_name = self.request.get('builder_name').strip()
+ build_number = self.request.get('build_number').strip()
+ if build_number:
+ build_number = int(build_number)
+ step_name = self.request.get('step_name').strip()
+ test_name = self.request.get('test_name').strip()
+
+ master_flake_analyses = FilterMasterFlakeAnalysis(
+ MasterFlakeAnalysis.query(), master_name, builder_name, build_number,
+ step_name, test_name)
+ data = {'master_flake_analyses': []}
+
+ for master_flake_analysis in master_flake_analyses:
+ data['master_flake_analyses'].append({
+ 'master_name': master_flake_analysis.master_name,
+ 'builder_name': master_flake_analysis.builder_name,
+ 'build_number': master_flake_analysis.build_number,
+ 'step_name': master_flake_analysis.step_name,
+ 'test_name': master_flake_analysis.test_name
+ })
+
+ return {
+ 'template': 'flake/dashboard.html',
+ 'data': data
+ }
« no previous file with comments | « no previous file | appengine/findit/handlers/flake/test/filter_flake_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698