Skip to content

Commit

Permalink
SS-1327 Add upload size in admin panel (#285)
Browse files Browse the repository at this point in the history
Co-authored-by: Mahbub Ul Alam <mahbub.ul.alam@scilifelab.se>
  • Loading branch information
j-awada and anondo1969 authored Feb 26, 2025
1 parent 7e2c4cd commit 4027832
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
10 changes: 9 additions & 1 deletion apps/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ class K8sUserAppStatusAdmin(admin.ModelAdmin):


class BaseAppAdmin(admin.ModelAdmin):
list_display = (
"name",
"display_owner",
"display_project",
"display_status",
"display_subdomain",
"chart",
"upload_size",
)
# TODO: Test new status properties in admin
list_display = ("name", "display_owner", "display_project", "display_status", "display_subdomain", "chart")
readonly_fields = ("id", "created_on")
list_filter = ["owner", "project", "k8s_user_app_status__status", "chart"]
actions = ["redeploy_apps", "deploy_resources", "delete_resources"]
Expand Down
17 changes: 17 additions & 0 deletions apps/migrations/0028_baseappinstance_upload_size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.1.1 on 2025-02-26 13:48

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("apps", "0027_remove_baseappinstance_app_status"),
]

operations = [
migrations.AddField(
model_name="baseappinstance",
name="upload_size",
field=models.PositiveIntegerField(default=100, help_text="Max upload size in MB"),
),
]
2 changes: 2 additions & 0 deletions apps/models/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def get_status_group(self) -> str:

url = models.URLField(blank=True, null=True)
updated_on = models.DateTimeField(auto_now=True)
upload_size = models.PositiveIntegerField(default=100, help_text="Max upload size in MB")

class Meta:
permissions = [("can_access_app", "Can access app service")]
Expand All @@ -245,6 +246,7 @@ def get_k8s_values(self):
storageClass=settings.STORAGECLASS,
namespace=settings.NAMESPACE,
release=self.subdomain.subdomain if self.subdomain else "deleted", # This is legacy and should be changed
ingress=dict(clientMaxBodySize=f"{self.upload_size}M"),
)

# Add global values
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ui-tests/test-superuser-functionality.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe("Test superuser access", () => {
[
'Jupyter Lab Minimal (Default)',
'Jupyter Lab Data Science',
'Jupyter Lab Pytorch',
'Jupyter Lab PyTorch',
'Jupyter Lab Tensorflow'
].forEach((name) => {
cy.get('@envSelect').contains('option', name);
Expand Down
2 changes: 1 addition & 1 deletion fixtures/projects_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"image": "serve-jupyterlab-datascience:250213-1352",
"repository": "ghcr.io/scilifelabdatacentre"
},
"Jupyter Lab Pytorch": {
"Jupyter Lab PyTorch": {
"app": "jupyter-lab",
"image": "serve-jupyterlab-pytorch:250213-1119",
"repository": "ghcr.io/scilifelabdatacentre"
Expand Down

0 comments on commit 4027832

Please sign in to comment.