diff --git a/app/deployments/admin.py b/app/deployments/admin.py index af150c82..3dc0d7ad 100644 --- a/app/deployments/admin.py +++ b/app/deployments/admin.py @@ -520,7 +520,12 @@ def queryset(self, request: Any, queryset: QuerySet[Any]) -> QuerySet[Any] | Non class ErddapDatasetAdmin(admin.ModelAdmin): ordering = ["name"] search_fields = ["name", "server__name", "server__base_url"] - list_display = ["name", timeseries_status, "server", "refresh_status"] + list_display = [ + "name", + timeseries_status, + "server", + "refresh_status", + ] list_filter = ["server__name", RefreshStatusListFilter] inlines = [TimeSeriesInline] @@ -551,14 +556,14 @@ def refresh_status(self, obj: ErddapDataset): ) if obj.refresh_attempted < day_ago: return format_html( - "{} ({})", + "{}", "red", last_refreshed, "More than 24 hours ago", ) elif obj.refresh_attempted < hour_ago: return format_html( - "{} ({})", + "{}", "yellow", last_refreshed, "More than 1 hour ago", diff --git a/app/deployments/migrations/0056_erddapdataset_public_name.py b/app/deployments/migrations/0056_erddapdataset_public_name.py new file mode 100644 index 00000000..c0fb0315 --- /dev/null +++ b/app/deployments/migrations/0056_erddapdataset_public_name.py @@ -0,0 +1,22 @@ +# Generated by Django 5.1.3 on 2024-12-04 12:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("deployments", "0055_timeseries_extrema_values"), + ] + + operations = [ + migrations.AddField( + model_name="erddapdataset", + name="public_name", + field=models.CharField( + blank=True, + help_text="The name of the dataset as it should be displayed in the UI", + max_length=256, + null=True, + ), + ), + ] diff --git a/app/deployments/models.py b/app/deployments/models.py index b2059b91..0e888092 100644 --- a/app/deployments/models.py +++ b/app/deployments/models.py @@ -222,6 +222,12 @@ class ErddapDataset(models.Model): max_length=256, help_text="Or as ERDDAP knows it as the Dataset ID. EX: 'Dataset ID: A01_accelerometer_all'", ) + public_name = models.CharField( + max_length=256, + blank=True, + null=True, + help_text="The name of the dataset as it should be displayed in the UI", + ) server = models.ForeignKey(ErddapServer, on_delete=models.CASCADE) healthcheck_url = models.URLField( diff --git a/app/deployments/serializers.py b/app/deployments/serializers.py index ad1c9e89..89544e1b 100644 --- a/app/deployments/serializers.py +++ b/app/deployments/serializers.py @@ -66,6 +66,7 @@ def get_readings(self, obj): "variable": series.variable, "constraints": series.constraints, "dataset": series.dataset.name, + "dataset_public_name": series.dataset.public_name, "start_time": series.start_time, "cors_proxy_url": reverse( "server-proxy",