Skip to content

Commit

Permalink
ubccr#193: In the allocation section of a project, the information co…
Browse files Browse the repository at this point in the history
…lumn for an entry will display its slurm_account_name, freeipa_group name, Cloud Account Name and/or its Cloud Storage Quota. If an entry doesn't have any of these attributes, its description will be used to fill out the information column instead.
  • Loading branch information
brisco17 committed Jun 2, 2021
1 parent 941e87a commit 9f55ba1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions coldfront/core/allocation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ def get_information(self):
html_string += '%s: %s <br>' % (
attribute.allocation_attribute_type.name, attribute.value)

if attribute.allocation_attribute_type.name == "freeipa_group":
html_string += '%s: %s <br>' % (
attribute.allocation_attribute_type.name, attribute.value)

if attribute.allocation_attribute_type.name == "Cloud Account Name":
html_string += '%s: %s <br>' % (
attribute.allocation_attribute_type.name, attribute.value)

if hasattr(attribute, 'allocationattributeusage'):
try:
percent = round(float(attribute.allocationattributeusage.value) /
Expand Down
4 changes: 4 additions & 0 deletions coldfront/core/project/templates/project/project_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ <h3 class="d-inline"><i class="fas fa-server" aria-hidden="true"></i> Allocation
<tr>
<td>{{ allocation.get_parent_resource.name }}</td>
<td>{{ allocation.get_parent_resource.resource_type.name }}</td>
{% if allocation.get_information != '' %}
<td class="text-nowrap">{{allocation.get_information}}</td>
{% else %}
<td class="text-nowrap">{{allocation.description}}</td>
{% endif %}
{% if allocation.status.name == 'Active' %}
<td class="text-success">{{ allocation.status.name }}</td>
{% elif allocation.status.name == 'Expired' or allocation.status.name == 'Denied' %}
Expand Down

0 comments on commit 9f55ba1

Please sign in to comment.