Skip to content

Commit

Permalink
Fixed #310: referenced base image
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Sep 8, 2023
1 parent 86d32b9 commit 225d3bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions manager/manager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,6 @@
("en", _lz("English")),
("fr", _lz("French")),
]

BASE_IMAGE_URL = os.getenv("BASE_IMAGE_URL", "1.0.1")
BASE_IMAGE_ROOTFS_SIZE = int(os.getenv("BASE_IMAGE_ROOTFS_SIZE", "2449473536"))
6 changes: 6 additions & 0 deletions manager/manager/templates/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
{% load manager %}

{% block content %}
<h3>Base Image</h3>
<ul>
<li>Version: <code>{{ base_image.url }}</code></li>
<li><code>{{ base_image.rootfs_size }}</code> ({{ base_image.rootfs_size|human_size }})</li>
</ul>

<h3>{% blocktrans %}Organizations{% endblocktrans %}</h3>
<p class="info">{% blocktrans %}Organizations holds the configurations, orders and units.{% endblocktrans %}</p>
{% if organizations %}
Expand Down
8 changes: 5 additions & 3 deletions manager/manager/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.contrib import messages
from django.shortcuts import render, redirect
from django.utils.translation import gettext as _, gettext_lazy as _lz
from django.conf import settings

from manager.decorators import staff_required
from manager.models import Organization, Profile, Media
Expand Down Expand Up @@ -125,6 +126,10 @@ def dashboard(request):
"organizations": Organization.objects.all(),
"profiles": Profile.objects.all(),
"medias": Media.objects.all(),
"base_image": {
"url": settings.BASE_IMAGE_URL,
"rootfs_size": settings.BASE_IMAGE_ROOTFS_SIZE,
},
}

forms_map = {
Expand All @@ -139,7 +144,6 @@ def dashboard(request):
context[key] = value(prefix=key)

if request.method == "POST" and request.POST.get("form") in forms_map.keys():

# which form is being saved?
form_key = request.POST.get("form")
context[form_key] = forms_map.get(form_key)(request.POST, prefix=form_key)
Expand All @@ -161,7 +165,6 @@ def dashboard(request):

@staff_required
def toggle_account(request, username):

profile = Profile.get_or_none(username)
if profile is None:
raise Http404(_("Profile not found"))
Expand Down Expand Up @@ -189,7 +192,6 @@ def toggle_account(request, username):

@staff_required
def delete_account(request, username):

profile = Profile.get_or_none(username)
if profile is None:
raise Http404(_("Profile not found"))
Expand Down

0 comments on commit 225d3bf

Please sign in to comment.