mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add page with list of all update configs
This commit is contained in:
parent
c5fa76dab0
commit
ac4d5c8c88
@ -301,6 +301,7 @@ def update_config(package):
|
||||
if last_release and last_release.commit_hash:
|
||||
package.update_config.last_commit = last_release.commit_hash
|
||||
|
||||
package.update_config.outdated_at = None
|
||||
package.update_config.auto_created = False
|
||||
|
||||
db.session.commit()
|
||||
@ -328,3 +329,21 @@ def setup_releases(package):
|
||||
return redirect(package.getUpdateConfigURL())
|
||||
|
||||
return render_template("packages/release_wizard.html", package=package)
|
||||
|
||||
|
||||
@bp.route("/users/<username>/update-configs/")
|
||||
@login_required
|
||||
def bulk_update_config(username):
|
||||
user: User = User.query.filter_by(username=username).first()
|
||||
if not user:
|
||||
abort(404)
|
||||
|
||||
if current_user != user and not current_user.rank.atLeast(UserRank.EDITOR):
|
||||
abort(403)
|
||||
|
||||
confs = user.maintained_packages \
|
||||
.filter(Package.state != PackageState.DELETED,
|
||||
Package.update_config.has()) \
|
||||
.order_by(db.asc(Package.title)).all()
|
||||
|
||||
return render_template("packages/bulk_update_conf.html", user=user, confs=confs)
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% macro render_outdated_packages(outdated_packages, current_player) -%}
|
||||
{% macro render_outdated_packages(outdated_packages, current_player, show_config=False) -%}
|
||||
<ul class="list-group mt-3">
|
||||
{% for package in outdated_packages %}
|
||||
{% set config = package.update_config %}
|
||||
@ -18,24 +18,31 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="col-sm">
|
||||
{% if config.trigger == config.trigger.TAG and config.last_tag %}
|
||||
{{ _("New tag: %(tag)s", tag=config.last_tag) }}
|
||||
{% if show_config %}
|
||||
{% set action = "Make release" if config.make_release else "Notification" %}
|
||||
{{ _("On %(trigger)s, do %(action)s", trigger=config.trigger.value, action=action) }}
|
||||
{% else %}
|
||||
{{ _("Git repo has commit %(ref)s", ref=config.last_commit[0:5]) }}
|
||||
{% if config.trigger == config.trigger.TAG and config.last_tag %}
|
||||
{{ _("New tag: %(tag)s", tag=config.last_tag) }}
|
||||
{% else %}
|
||||
{{ _("Git repo has commit %(ref)s", ref=config.last_commit[0:5]) }}
|
||||
{% endif %}
|
||||
<span class="text-muted ml-3">
|
||||
{{ config.outdated_at | datetime }}
|
||||
</span>
|
||||
{% endif %}
|
||||
<span class="text-muted ml-3">
|
||||
{{ config.outdated_at | datetime }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-auto">
|
||||
{% set release_title = config.last_tag or (config.outdated_at | isodate) %}
|
||||
{% if package.checkPerm(current_player, "MAKE_RELEASE") %}
|
||||
<a class="btn btn-sm btn-primary mr-2"
|
||||
href="{{ package.getCreateReleaseURL(title=release_title, ref=config.last_tag or config.last_commit) }}">
|
||||
<i class="fas fa-plus mr-1"></i>
|
||||
{{ _("Release") }}
|
||||
</a>
|
||||
{% if not show_config %}
|
||||
{% set release_title = config.last_tag or (config.outdated_at | isodate) %}
|
||||
{% if package.checkPerm(current_player, "MAKE_RELEASE") %}
|
||||
<a class="btn btn-sm btn-primary mr-2"
|
||||
href="{{ package.getCreateReleaseURL(title=release_title, ref=config.last_tag or config.last_commit) }}">
|
||||
<i class="fas fa-plus mr-1"></i>
|
||||
{{ _("Release") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<a class="btn btn-sm btn-secondary mr-2" href="{{ package.repo }}">
|
||||
|
13
app/templates/packages/bulk_update_conf.html
Normal file
13
app/templates/packages/bulk_update_conf.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ _("%(username)s's Automated Update Detection Configs", username=user.display_name) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<a class="btn btn-secondary float-right" href="/help/update_config/">Help</a>
|
||||
<h1 class="mb-5">{{ self.title() }}</h1>
|
||||
|
||||
{% from "macros/todo.html" import render_outdated_packages %}
|
||||
{{ render_outdated_packages(confs, current_user, show_config=True) }}
|
||||
{% endblock %}
|
@ -35,6 +35,7 @@
|
||||
|
||||
|
||||
<a class="btn btn-secondary float-right" href="/help/update_config/">Help</a>
|
||||
<a class="btn btn-secondary float-right mr-2" href="{{ url_for('packages.bulk_update_config', username=user.username) }}">See all Update Settings</a>
|
||||
<h2>{{ _("Potentially Outdated Packages") }}</h2>
|
||||
{% if outdated_packages %}
|
||||
<p>
|
||||
@ -45,7 +46,6 @@
|
||||
{% from "macros/todo.html" import render_outdated_packages %}
|
||||
{{ render_outdated_packages(outdated_packages, current_user) }}
|
||||
|
||||
|
||||
<h2 class="mt-5">{{ _("Unadded Topics") }}</h2>
|
||||
{% if topics_to_add %}
|
||||
<p>
|
||||
|
Loading…
Reference in New Issue
Block a user