Skip to content

Commit 4ab2b82

Browse files
committed
feat: add quarantine button on project details
A button that re-uses the malware routes. We can create bespoke routes and views for quarantine manipulation if we find that using this feature leads to confusing redirects, but for now I'm opting for simpler implementation. Signed-off-by: Mike Fiedler <[email protected]>
1 parent 1752128 commit 4ab2b82

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

warehouse/admin/templates/admin/projects/delete.html

+42-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<div class="card card-danger collapsed-card">
2121
<div class="card-header">
22-
<h3 class="card-title">Delete Project</h3>
22+
<h3 class="card-title">Delete / Quarantine Project</h3>
2323
<div class="card-tools">
2424
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i></button>
2525
</div>
@@ -29,6 +29,7 @@ <h3 class="card-title">Delete Project</h3>
2929
<p>
3030
Deleting will irreversibly delete this project along with
3131
<a href="{{ request.route_path('admin.project.releases', project_name=project_name) }}">{{ project.releases|length() }} releases</a>.
32+
Consider Quarantine if you want to keep the project but make it unavailable.
3233
</p>
3334
<div class="form-group col-sm-12">
3435
<label for="confirm_project_name">
@@ -39,9 +40,49 @@ <h3 class="card-title">Delete Project</h3>
3940
</div>
4041

4142
<div class="card-footer">
43+
<div class="float-left">
44+
<button type="button"
45+
class="btn btn-block btn-outline-warning"
46+
data-toggle="modal"
47+
data-target="#modal-quarantine">Quarantine Project</button>
48+
</div>
4249
<div class="float-right">
4350
<button type="submit" class="btn btn-primary" title="{{ 'Deleting requires superuser privileges' if not request.has_permission(Permissions.AdminProjectsDelete) }}" {{ "disabled" if not request.has_permission(Permissions.AdminProjectsDelete) }}>Confirm</button>
4451
</div>
4552
</div>
4653
</div>
4754
</form>
55+
56+
<div class="modal fade" id="modal-quarantine">
57+
<div class="modal-dialog modal-quarantine">
58+
<form id="quarantine"
59+
action="{{ request.route_path('admin.malware_reports.project.verdict_quarantine', project_name=project_name) }}"
60+
method="post">
61+
<input name="csrf_token"
62+
type="hidden"
63+
value="{{ request.session.get_csrf_token() }}">
64+
<div class="modal-content">
65+
<div class="modal-header bg-warning">
66+
<h4 class="modal-title">Quarantine Project</h4>
67+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
68+
<span aria-hidden="true">×</span>
69+
</button>
70+
</div>
71+
<div class="modal-body">
72+
<p>
73+
Confirming that <code>{{ project_name }}</code> needs further examination.
74+
</p>
75+
<p>
76+
This will remove the Project from being installable,
77+
and prohibit the Project from being changed by the Owner.
78+
</p>
79+
</div>
80+
<div class="modal-footer justify-content-between">
81+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
82+
<button type="submit" class="btn btn-warning">Verdict: Quarantine Project</button>
83+
</div>
84+
</div>
85+
</form>
86+
</div>
87+
</div>
88+
<!-- /.modal -->

0 commit comments

Comments
 (0)