Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public names to datasets #1271

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/deployments/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -551,14 +556,14 @@ def refresh_status(self, obj: ErddapDataset):
)
if obj.refresh_attempted < day_ago:
return format_html(
"<span style='color: {};' title='{}'>{} ({})</span>",
"<span style='color: {};' title='{}'>{}</span>",
"red",
last_refreshed,
"More than 24 hours ago",
)
elif obj.refresh_attempted < hour_ago:
return format_html(
"<span style='color: {};' title='{}'>{} ({})</span>",
"<span style='color: {};' title='{}'>{}</span>",
"yellow",
last_refreshed,
"More than 1 hour ago",
Expand Down
22 changes: 22 additions & 0 deletions app/deployments/migrations/0056_erddapdataset_public_name.py
Original file line number Diff line number Diff line change
@@ -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,
),
),
]
6 changes: 6 additions & 0 deletions app/deployments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions app/deployments/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading