[LNT] r299477 - Regression delete
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 15:27:35 PDT 2017
Author: cmatthews
Date: Tue Apr 4 17:27:35 2017
New Revision: 299477
URL: http://llvm.org/viewvc/llvm-project?rev=299477&view=rev
Log:
Regression delete
This adds a bulk delete feature to the regression listing page.
Modified:
lnt/trunk/lnt/server/ui/regression_views.py
lnt/trunk/lnt/server/ui/templates/v4_regression_list.html
Modified: lnt/trunk/lnt/server/ui/regression_views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/regression_views.py?rev=299477&r1=299476&r2=299477&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/regression_views.py (original)
+++ lnt/trunk/lnt/server/ui/regression_views.py Tue Apr 4 17:27:35 2017
@@ -158,15 +158,11 @@ def v4_regression_list():
ts = request.get_testsuite()
form = MergeRegressionForm(request.form)
machine_filter = request.args.get('machine_filter')
+ state_filter = int(request.args.get('state', RegressionState.ACTIVE))
+ # Merge requested regressions.
if request.method == 'POST' and \
request.form['merge_btn'] == "Merge Regressions":
- regressions_id_to_merge = form.regression_checkboxes.data
- regressions = ts.query(ts.Regression) \
- .filter(ts.Regression.id.in_(regressions_id_to_merge)).all()
- reg_inds = ts.query(ts.RegressionIndicator) \
- .filter(ts.RegressionIndicator.regression_id.in_(
- regressions_id_to_merge)) \
- .all()
+ reg_inds, regressions = _get_regressions_from_selected_form(form, ts)
links = []
target = 0
for i, r in enumerate(regressions):
@@ -187,8 +183,19 @@ def v4_regression_list():
ts.commit()
flash("Created: " + new_regress.title, FLASH_SUCCESS)
return redirect(v4_url_for("v4_regression_detail", id=new_regress.id))
+ # Delete requested regressions.
+ if request.method == 'POST' and \
+ request.form['merge_btn'] == "Delete Regressions":
+ reg_inds, regressions = _get_regressions_from_selected_form(form, ts)
+ titles = [r.title for r in regressions]
+ for res_ind in reg_inds:
+ ts.delete(res_ind)
+ for reg in regressions:
+ ts.delete(reg)
+ ts.commit()
+ flash(' Deleted: '.join(titles), FLASH_SUCCESS)
+ return redirect(v4_url_for("v4_regression_list", state=state_filter))
- state_filter = int(request.args.get('state', RegressionState.ACTIVE))
q = ts.query(ts.Regression)
title = "All Regressions"
if state_filter != -1:
@@ -232,6 +239,7 @@ def v4_regression_list():
highlight=request.args.get('highlight'),
title=title,
RegressionState=RegressionState,
+ state_filter=state_filter,
form=form,
sizes=regression_sizes,
impacts=impacts,
@@ -239,6 +247,17 @@ def v4_regression_list():
analysis=lnt.server.reporting.analysis)
+def _get_regressions_from_selected_form(form, ts):
+ regressions_id_to_merge = form.regression_checkboxes.data
+ regressions = ts.query(ts.Regression) \
+ .filter(ts.Regression.id.in_(regressions_id_to_merge)).all()
+ reg_inds = ts.query(ts.RegressionIndicator) \
+ .filter(ts.RegressionIndicator.regression_id.in_(
+ regressions_id_to_merge)) \
+ .all()
+ return reg_inds, regressions
+
+
class EditRegressionForm(Form):
title = StringField(u'Title', validators=[DataRequired()])
bug = StringField(u'Bug', validators=[DataRequired()])
Modified: lnt/trunk/lnt/server/ui/templates/v4_regression_list.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_regression_list.html?rev=299477&r1=299476&r2=299477&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_regression_list.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_regression_list.html Tue Apr 4 17:27:35 2017
@@ -10,7 +10,7 @@
<h3>Regressions List: {{title}}</h3>
-<form method="POST" action="{{ v4_url_for("v4_regression_list", state=10) }}">
+<form method="POST" action="{{ v4_url_for("v4_regression_list", state=state_filter) }}">
<table id="regression_list" class="table table-striped table-hover table-condensed">
@@ -52,7 +52,9 @@
<!-- Button to trigger modal -->
<a href="#mergeRegressionModal" role="button" class="btn" data-toggle="modal">Merge</a>
-
+ <!-- Button to trigger modal -->
+<a href="#delRegressionModal" role="button" class="btn" data-toggle="modal">Delete</a>
+
<!-- Modal -->
<div id="mergeRegressionModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mergeRegressionModal" aria-hidden="true">
<div class="modal-header">
@@ -70,6 +72,25 @@
</div>
</div>
+
+<!-- Modal -->
+<div id="delRegressionModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="delRegressionModal" aria-hidden="true">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">Ã</button>
+ <h3 id="editRegressionModal">Delete Regression(s)</h3>
+ </div>
+
+ <div class="modal-body">
+ Delete selected changes. Are you sure?
+ </div>
+ <div class="modal-footer">
+ <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
+ <input name="merge_btn" class="btn btn-primary" type="submit" value="Delete Regressions">
+ </div>
+ </div>
+</div>
+
+
</form>
<script type="text/javascript">
More information about the llvm-commits
mailing list