mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
adding dormant and gone filters
This commit is contained in:
parent
af8f81c058
commit
1d1abdac6d
2 changed files with 70 additions and 0 deletions
|
@ -994,3 +994,69 @@ def admin_instances():
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site)
|
menu_topics=menu_topics(), site=g.site)
|
||||||
|
|
||||||
|
@bp.route('/instances/dormant', methods=['GET', 'POST'])
|
||||||
|
@login_required
|
||||||
|
@permission_required('change instance settings')
|
||||||
|
def admin_instances_dormant():
|
||||||
|
page = request.args.get('page', 1, type=int)
|
||||||
|
search = request.args.get('search', '')
|
||||||
|
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
||||||
|
|
||||||
|
instances = Instance.query.order_by(Instance.domain)
|
||||||
|
user_model = User
|
||||||
|
community_model = Community
|
||||||
|
|
||||||
|
instances = instances.filter(Instance.dormant == True)
|
||||||
|
|
||||||
|
if search:
|
||||||
|
instances = instances.filter(Instance.domain.ilike(f"%{search}%"))
|
||||||
|
|
||||||
|
# Pagination
|
||||||
|
instances = instances.paginate(page=page,
|
||||||
|
per_page=250 if current_user.is_authenticated and not low_bandwidth else 50,
|
||||||
|
error_out=False)
|
||||||
|
next_url = url_for('admin.admin_instances', page=instances.next_num) if instances.has_next else None
|
||||||
|
prev_url = url_for('admin.admin_instances', page=instances.prev_num) if instances.has_prev and page != 1 else None
|
||||||
|
|
||||||
|
return render_template('admin/instances.html', instances=instances,
|
||||||
|
title=_('Dormant Instances'), search=search,
|
||||||
|
next_url=next_url, prev_url=prev_url,
|
||||||
|
low_bandwidth=low_bandwidth,
|
||||||
|
user_model=user_model, community_model=community_model,
|
||||||
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
|
menu_topics=menu_topics(), site=g.site)
|
||||||
|
|
||||||
|
@bp.route('/instances/gone-forever', methods=['GET', 'POST'])
|
||||||
|
@login_required
|
||||||
|
@permission_required('change instance settings')
|
||||||
|
def admin_instances_gone_forever():
|
||||||
|
page = request.args.get('page', 1, type=int)
|
||||||
|
search = request.args.get('search', '')
|
||||||
|
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
||||||
|
|
||||||
|
instances = Instance.query.order_by(Instance.domain)
|
||||||
|
user_model = User
|
||||||
|
community_model = Community
|
||||||
|
|
||||||
|
instances = instances.filter(Instance.gone_forever == True)
|
||||||
|
|
||||||
|
if search:
|
||||||
|
instances = instances.filter(Instance.domain.ilike(f"%{search}%"))
|
||||||
|
|
||||||
|
# Pagination
|
||||||
|
instances = instances.paginate(page=page,
|
||||||
|
per_page=250 if current_user.is_authenticated and not low_bandwidth else 50,
|
||||||
|
error_out=False)
|
||||||
|
next_url = url_for('admin.admin_instances', page=instances.next_num) if instances.has_next else None
|
||||||
|
prev_url = url_for('admin.admin_instances', page=instances.prev_num) if instances.has_prev and page != 1 else None
|
||||||
|
|
||||||
|
return render_template('admin/instances.html', instances=instances,
|
||||||
|
title=_('Gone Forever Instances'), search=search,
|
||||||
|
next_url=next_url, prev_url=prev_url,
|
||||||
|
low_bandwidth=low_bandwidth,
|
||||||
|
user_model=user_model, community_model=community_model,
|
||||||
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
|
menu_topics=menu_topics(), site=g.site)
|
|
@ -13,6 +13,10 @@
|
||||||
<form method="get">
|
<form method="get">
|
||||||
<input type="search" name="search"> <input type="submit" name="submit" value="Search">
|
<input type="search" name="search"> <input type="submit" name="submit" value="Search">
|
||||||
</form>
|
</form>
|
||||||
|
Status Filter:
|
||||||
|
<a href="{{ url_for('admin.admin_instances') }}">Online</a> |
|
||||||
|
<a href="{{ url_for('admin.admin_instances_dormant') }}">Dormant</a> |
|
||||||
|
<a href="{{ url_for('admin.admin_instances_gone_forever') }}">Gone Forever</a> |
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Domain</th>
|
<th>Domain</th>
|
||||||
|
|
Loading…
Add table
Reference in a new issue