Skip to content

Commit

Permalink
[views] Add tracked checkbox to Scheduler parameters
Browse files Browse the repository at this point in the history
Fixes #170
  • Loading branch information
msimacek committed Nov 8, 2017
1 parent 61a3604 commit 4198889
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions koschei/frontend/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class AddPackagesForm(EmptyForm):


class EditPackageForm(EmptyForm):
tracked = CheckBoxField('tracked')
collection_id = IntegerField(
'collection_id',
widget=HiddenInput(),
Expand Down
6 changes: 6 additions & 0 deletions koschei/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def to_ts(col):

if not form:
form = forms.EditPackageForm(
tracked=package.tracked,
collection_id=package.collection_id,
manual_priority=package.manual_priority,
arch_override=(package.arch_override or '').split(' '),
Expand Down Expand Up @@ -831,6 +832,11 @@ def edit_package(name):
else:
data.set_group_content(session, group, [package.name], delete=True)

if form.tracked.data is not None:
data.set_package_attribute(
session, package, 'tracked',
form.tracked.data,
)
if form.manual_priority.data is not None:
data.set_package_attribute(
session, package, 'manual_priority',
Expand Down
9 changes: 9 additions & 0 deletions templates/package-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ <h3 class="card-title">Scheduler parameters</h3>
</ul>
{% endif %}
<div class="row">
<div class="col-sm-6">Tracked by Koschei</div>
<div class="col-sm-6">{{ package.tracked }}</div>

<div class="col-sm-6">Current priority</div>
<div class="col-sm-6">{{ package.current_priority|int }}</div>

Expand All @@ -106,6 +109,12 @@ <h4 class="card-title">Configure scheduling</h4>
<form method="post" action="{{ url_for('edit_package', name=package.name) }}">
{{ form.csrf_token }}
{{ form.collection_id() }}
<div class="form-group row">
<div class="col-sm-6">Tracked by Koschei</div>
<div class="col-sm-6">
{{ form.tracked(class="form-check") }}
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">Manual priority</div>
<div class="col-sm-6">
Expand Down
3 changes: 3 additions & 0 deletions test/frontend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def test_edit_package(self):
collection_id=package.collection_id,
manual_priority=123,
arch_override='x86_64, i386',
tracked__present='1',
),
follow_redirects=True,
)
Expand All @@ -361,9 +362,11 @@ def test_edit_package(self):
self.assertEqual(123, package.manual_priority)
self.assertEqual('x86_64 i386', package.arch_override)
self.assertEqual(False, package.skip_resolution)
self.assertEqual(False, package.tracked)
self.assert_action_log(
"Package rnv (collection f25): manual_priority set from 0 to 123",
"Package rnv (collection f25): arch_override set from None to x86_64 i386",
"Package rnv (collection f25): tracked set from True to False",
)

@authenticate
Expand Down

0 comments on commit 4198889

Please sign in to comment.