Skip to content

Commit 46d0eba

Browse files
authored
Merge pull request #828 from simonLeary42/settings-export
use SETTINGS_EXPORT
2 parents 38c1558 + 961ac5d commit 46d0eba

File tree

12 files changed

+29
-35
lines changed

12 files changed

+29
-35
lines changed

coldfront/config/core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@
5757

5858
SETTINGS_EXPORT += [
5959
"ALLOCATION_ACCOUNT_ENABLED",
60-
"CENTER_HELP_URL",
60+
"ALLOCATION_DEFAULT_ALLOCATION_LENGTH",
61+
"ALLOCATION_ENABLE_ALLOCATION_RENEWAL",
6162
"ALLOCATION_EULA_ENABLE",
62-
"RESEARCH_OUTPUT_ENABLE",
63+
"CENTER_HELP_URL",
6364
"GRANT_ENABLE",
64-
"PUBLICATION_ENABLE",
6565
"INVOICE_ENABLED",
6666
"PROJECT_ENABLE_PROJECT_REVIEW",
67+
"PROJECT_INSTITUTION_EMAIL_MAP",
68+
"PUBLICATION_ENABLE",
69+
"RESEARCH_OUTPUT_ENABLE",
6770
]
6871

6972
ADMIN_COMMENTS_SHOW_EMPTY = ENV.bool("ADMIN_COMMENTS_SHOW_EMPTY", default=True)

coldfront/config/plugins/system_monitor.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
#
33
# SPDX-License-Identifier: AGPL-3.0-or-later
44

5-
from coldfront.config.base import INSTALLED_APPS
5+
from coldfront.config.base import INSTALLED_APPS, SETTINGS_EXPORT
66
from coldfront.config.env import ENV
77

88
INSTALLED_APPS += ["coldfront.plugins.system_monitor"]
99

1010
SYSTEM_MONITOR_PANEL_TITLE = ENV.str("SYSMON_TITLE", default="HPC Cluster Status")
1111
SYSTEM_MONITOR_ENDPOINT = ENV.str("SYSMON_ENDPOINT")
12-
SYSTEM_MONITOR_DISPLAY_MORE_STATUS_INFO_LINK = ENV.str("SYSMON_LINK")
13-
SYSTEM_MONITOR_DISPLAY_XDMOD_LINK = ENV.str("SYSMON_XDMOD_LINK")
12+
SYSTEM_MONITOR_DISPLAY_MORE_STATUS_INFO_LINK = ENV.str("SYSMON_LINK", default=None)
13+
SYSTEM_MONITOR_DISPLAY_XDMOD_LINK = ENV.str("SYSMON_XDMOD_LINK", default=None)
14+
15+
SETTINGS_EXPORT += [
16+
"SYSTEM_MONITOR_DISPLAY_MORE_STATUS_INFO_LINK",
17+
"SYSTEM_MONITOR_DISPLAY_XDMOD_LINK",
18+
]

coldfront/core/allocation/templates/allocation/allocation_detail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h3><i class="fas fa-list" aria-hidden="true"></i> Allocation Information</h3>
107107
<span class="badge badge-warning"><i class="far fa-clock" aria-hidden="true"></i>
108108
Expires in {{allocation.expires_in}} day{{allocation.expires_in|pluralize}} - Not renewable
109109
</span>
110-
{% elif is_allowed_to_update_project and ALLOCATION_ENABLE_ALLOCATION_RENEWAL and allocation.status.name == 'Active' and allocation.expires_in <= 60 and allocation.expires_in >= 0 %}
110+
{% elif is_allowed_to_update_project and settings.ALLOCATION_ENABLE_ALLOCATION_RENEWAL and allocation.status.name == 'Active' and allocation.expires_in <= 60 and allocation.expires_in >= 0 %}
111111
<a href="{% url 'allocation-renew' allocation.pk %}">
112112
<span class="badge badge-warning"><i class="fas fa-redo-alt" aria-hidden="true"></i>
113113
Expires in {{allocation.expires_in}} day{{allocation.expires_in|pluralize}} - Click to renew
@@ -477,4 +477,4 @@ <h3 class="d-inline"><i class="fas fa-users" aria-hidden="true"></i> Notificatio
477477
}
478478
})
479479
</script>
480-
{% endblock %}
480+
{% endblock %}

coldfront/core/allocation/templates/allocation/allocation_request_list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2>Allocation Requests</h2>
1919
</p>
2020

2121
<p class="text-justify">
22-
By default, activating an allocation will make it active for {{ ALLOCATION_DEFAULT_ALLOCATION_LENGTH }} days.
22+
By default, activating an allocation will make it active for {{ settings.ALLOCATION_DEFAULT_ALLOCATION_LENGTH }} days.
2323
</p>
2424

2525
{% if allocation_list %}
@@ -32,7 +32,7 @@ <h2>Allocation Requests</h2>
3232
<th scope="col">Project Title</th>
3333
<th scope="col">PI</th>
3434
<th scope="col">Resource</th>
35-
{% if PROJECT_ENABLE_PROJECT_REVIEW %}
35+
{% if settings.PROJECT_ENABLE_PROJECT_REVIEW %}
3636
<th scope="col" class="text-nowrap">Project Review Status</th>
3737
{% endif %}
3838
<th scope="col">Status</th>
@@ -48,7 +48,7 @@ <h2>Allocation Requests</h2>
4848
<td>{{allocation.project.pi.first_name}} {{allocation.project.pi.last_name}}
4949
({{allocation.project.pi.username}})</td>
5050
<td>{{allocation.get_parent_resource}}</td>
51-
{% if PROJECT_ENABLE_PROJECT_REVIEW %}
51+
{% if settings.PROJECT_ENABLE_PROJECT_REVIEW %}
5252
<td class="text-center">{{allocation.project|convert_status_to_icon}}</td>
5353
{% endif %}
5454
<td>{{allocation.status}}</td>

coldfront/core/allocation/views.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ def get_context_data(self, **kwargs):
185185
notes = noteset.all() if self.request.user.is_superuser else noteset.filter(is_private=False)
186186

187187
context["notes"] = notes
188-
context["ALLOCATION_ENABLE_ALLOCATION_RENEWAL"] = ALLOCATION_ENABLE_ALLOCATION_RENEWAL
189188
return context
190189

191190
def get(self, request, *args, **kwargs):
@@ -1224,8 +1223,6 @@ def get_context_data(self, **kwargs):
12241223
context["allocation_renewal_dates"] = allocation_renewal_dates
12251224
context["allocation_status_active"] = AllocationStatusChoice.objects.get(name="Active")
12261225
context["allocation_list"] = allocation_list
1227-
context["PROJECT_ENABLE_PROJECT_REVIEW"] = PROJECT_ENABLE_PROJECT_REVIEW
1228-
context["ALLOCATION_DEFAULT_ALLOCATION_LENGTH"] = ALLOCATION_DEFAULT_ALLOCATION_LENGTH
12291226
return context
12301227

12311228

@@ -1475,7 +1472,6 @@ def get_context_data(self, **kwargs):
14751472
notes = allocation_obj.allocationusernote_set.filter(is_private=False)
14761473

14771474
context["notes"] = notes
1478-
context["ALLOCATION_ENABLE_ALLOCATION_RENEWAL"] = ALLOCATION_ENABLE_ALLOCATION_RENEWAL
14791475
return context
14801476

14811477
def get(self, request, *args, **kwargs):
@@ -1955,7 +1951,6 @@ def get_context_data(self, **kwargs):
19551951
]
19561952
)
19571953
context["allocation_change_list"] = allocation_change_list
1958-
context["PROJECT_ENABLE_PROJECT_REVIEW"] = PROJECT_ENABLE_PROJECT_REVIEW
19591954
return context
19601955

19611956

coldfront/core/project/templates/project/project_archived_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h2>Archived Projects</h2>
8686
<br> <strong>Description: </strong>{{ project.description }}</td>
8787
<td>{{ project.field_of_science.description }}</td>
8888
<td>{{ project.status.name }}</td>
89-
{% if PROJECT_INSTITUTION_EMAIL_MAP %}
89+
{% if settings.PROJECT_INSTITUTION_EMAIL_MAP %}
9090
<p class="card-text text-justify"><strong>Institution: </strong>{{ project.institution }}</p>
9191
{% endif %}
9292
</tr>

coldfront/core/project/templates/project/project_detail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h3 class="card-title">
8181
<span class="badge badge-pill badge-info">project review pending</span>
8282
{% endif %}
8383
</p>
84-
{% if PROJECT_INSTITUTION_EMAIL_MAP %}
84+
{% if settings.PROJECT_INSTITUTION_EMAIL_MAP %}
8585
<p class="card-text text-justify"><strong>Institution: </strong>{{ project.institution }}</p>
8686
{% endif %}
8787
<p class="card-text text-justify"><strong>Created: </strong>{{ project.created|date:"M. d, Y" }}</p>
@@ -225,7 +225,7 @@ <h3 class="d-inline"><i class="fas fa-server" aria-hidden="true"></i> Allocation
225225
<span class="badge badge-warning"><i class="far fa-clock" aria-hidden="true"></i>
226226
Expires in {{allocation.expires_in}} day{{allocation.expires_in|pluralize}} <br> Not renewable
227227
</span>
228-
{% elif is_allowed_to_update_project and ALLOCATION_ENABLE_ALLOCATION_RENEWAL and allocation.status.name == 'Active' and allocation.expires_in <= 60 and allocation.expires_in >= 0 %}
228+
{% elif is_allowed_to_update_project and settings.ALLOCATION_ENABLE_ALLOCATION_RENEWAL and allocation.status.name == 'Active' and allocation.expires_in <= 60 and allocation.expires_in >= 0 %}
229229
<a href="{% url 'allocation-renew' allocation.pk %}">
230230
<span class="badge badge-warning"><i class="fas fa-redo-alt" aria-hidden="true"></i>
231231
Expires in {{allocation.expires_in}} day{{allocation.expires_in|pluralize}} <br> Click to renew

coldfront/core/project/templates/project/project_list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ <h2>Projects</h2>
7171
<a href="?order_by=status&direction=asc&{{filter_parameters}}"><i class="fas fa-sort-up" aria-hidden="true"></i><span class="sr-only">Sort Status asc</span></a>
7272
<a href="?order_by=status&direction=des&{{filter_parameters}}"><i class="fas fa-sort-down" aria-hidden="true"></i><span class="sr-only">Sort Status desc</span></a>
7373
</th>
74-
{% if PROJECT_INSTITUTION_EMAIL_MAP %}
74+
{% if settings.PROJECT_INSTITUTION_EMAIL_MAP %}
7575
<th scope="col" class="text-nowrap">
7676
Institution
7777
<a href="?order_by=id&direction=asc&{{filter_parameters}}"><i class="fas fa-sort-up" aria-hidden="true"></i><span class="sr-only">Sort Institution asc</span></a>
@@ -92,7 +92,7 @@ <h2>Projects</h2>
9292
<td style="text-align: justify; text-justify: inter-word;">{{ project.title }}</td>
9393
<td>{{ project.field_of_science.description }}</td>
9494
<td>{{ project.status.name }}</td>
95-
{% if PROJECT_INSTITUTION_EMAIL_MAP %}
95+
{% if settings.PROJECT_INSTITUTION_EMAIL_MAP %}
9696
<td>{{ project.institution }}</td>
9797
{% endif %}
9898
</tr>

coldfront/core/project/views.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ def get_context_data(self, **kwargs):
215215
context["guage_data"] = guage_data
216216
context["attributes_with_usage"] = attributes_with_usage
217217
context["project_users"] = project_users
218-
context["ALLOCATION_ENABLE_ALLOCATION_RENEWAL"] = ALLOCATION_ENABLE_ALLOCATION_RENEWAL
219-
context["PROJECT_INSTITUTION_EMAIL_MAP"] = PROJECT_INSTITUTION_EMAIL_MAP
220218

221219
try:
222220
context["ondemand_url"] = settings.ONDEMAND_URL
@@ -327,7 +325,6 @@ def get_context_data(self, **kwargs):
327325

328326
context["filter_parameters"] = filter_parameters
329327
context["filter_parameters_with_order_by"] = filter_parameters_with_order_by
330-
context["PROJECT_INSTITUTION_EMAIL_MAP"] = PROJECT_INSTITUTION_EMAIL_MAP
331328

332329
project_list = context.get("project_list")
333330
paginator = Paginator(project_list, self.paginate_by)

coldfront/core/resource/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from django.views.generic import ListView, TemplateView
1616
from django.views.generic.edit import CreateView
1717

18-
from coldfront.config.core import ALLOCATION_EULA_ENABLE
1918
from coldfront.core.resource.forms import ResourceAttributeCreateForm, ResourceAttributeDeleteForm, ResourceSearchForm
2019
from coldfront.core.resource.models import Resource, ResourceAttribute
2120

@@ -308,7 +307,6 @@ def get_context_data(self, **kwargs):
308307

309308
context["filter_parameters"] = filter_parameters
310309
context["filter_parameters_with_order_by"] = filter_parameters_with_order_by
311-
context["ALLOCATION_EULA_ENABLE"] = ALLOCATION_EULA_ENABLE
312310

313311
resource_list = context.get("resource_list")
314312
paginator = Paginator(resource_list, self.paginate_by)

0 commit comments

Comments
 (0)