Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo committed Nov 13, 2024
1 parent 47084b5 commit 0aa2b33
Show file tree
Hide file tree
Showing 39 changed files with 1,103 additions and 1,632 deletions.
7 changes: 2 additions & 5 deletions adminsec/templates/adminsec/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@

<h2 class="mb-5 mt-5">
<span class="fw-light">
Welcome {% if user.first_name or user.last_name %} {{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}
&mdash;
Welcome {% if user.first_name or user.last_name %} {{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}!
</span>
Open Requests
<a href="{% url 'adminsec:termsandconditions-list' %}" class="btn btn-secondary float-end">
<i class="iconify" data-icon="mdi:format-list-bulleted"></i>
Terms &amp; Conditions
</a>
</h2>

{% include "usersec/modules/request_grid.html" %}
{% include "adminsec/requests.html" %}

{% endblock content %}
35 changes: 35 additions & 0 deletions adminsec/templates/adminsec/requests.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% load common %}

<table class="table">
<thead>
<tr>
<th>Request Type</th>
<th>Requester</th>
<th>Created</th>
<th>Modified</th>
</tr>
</thead>
<tbody>
{% for obj in pending_requests %}
<tr>
<td>
<a href="{{ obj|get_detail_url:user }}" class="btn btn-dark btn-sm">
<i class="iconify" data-icon="mdi:eye"></i>
{{ obj.get_request_type }}
</a>
</td>
<td>{{ obj.requester.name }}</td>
<td>{{ obj.date_created|date:"Y-m-d H:i" }}</td>
<td>{{ obj.date_modified|date:"Y-m-d H:i" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="4" class="text-center">
<em class="text-muted">No pending requests.</em>
</td>
</tr>
{% endfor %}
</tbody>
</table>


53 changes: 23 additions & 30 deletions adminsec/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unicodedata
from datetime import datetime
from itertools import chain

from django.conf import settings
from django.contrib import messages
Expand Down Expand Up @@ -174,32 +175,16 @@ def get_context_data(self, **kwargs):
# Used as switch in template
context["admin"] = True

# Add open HpcGroupCreateRequest
context["hpcgroupcreaterequests"] = HpcGroupCreateRequest.objects.active()

# Add open HpcUserCreateRequest
context["hpcusercreaterequests"] = HpcUserCreateRequest.objects.active()

# Add open HpcProjectCreateRequest
context["hpcprojectcreaterequests"] = HpcProjectCreateRequest.objects.active()

# Add open HpcUserChangeRequest
context["hpcuserchangerequests"] = HpcUserChangeRequest.objects.active()

# Add open HpcGroupChangeRequest
context["hpcgroupchangerequests"] = HpcGroupChangeRequest.objects.active()

# Add open HpcProjectChangeRequest
context["hpcprojectchangerequests"] = HpcProjectChangeRequest.objects.active()

# Add open HpcGroupDeleteRequest
context["hpcgroupdeleterequests"] = None

# Add open HpcUserDeleteRequest
context["hpcuserdeleterequests"] = None

# Add open HpcProjectDeleteRequest
context["hpcprojectdeleterequests"] = None
context["pending_requests"] = list(
chain(
HpcGroupCreateRequest.objects.active(),
HpcGroupChangeRequest.objects.active(),
HpcProjectCreateRequest.objects.active(),
HpcProjectChangeRequest.objects.active(),
HpcUserCreateRequest.objects.active(),
HpcUserChangeRequest.objects.active(),
)
)

return context

Expand Down Expand Up @@ -240,6 +225,7 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["hpc_group_name_suggestion"] = obj.name if obj.name else name
tier1_work = folders.get("tier1_work")
tier1_scratch = folders.get("tier1_scratch")
Expand Down Expand Up @@ -490,6 +476,7 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["admin"] = True
return context

Expand Down Expand Up @@ -659,6 +646,7 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["admin"] = True
return context

Expand Down Expand Up @@ -822,6 +810,7 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["hpc_project_name_suggestion"] = name
tier1_work = folders.get("tier1_work")
tier1_scratch = folders.get("tier1_scratch")
Expand Down Expand Up @@ -970,12 +959,14 @@ def post(self, request, *args, **kwargs):
creator=self.request.user,
status=OBJECT_STATUS_ACTIVE,
expiration=obj.expiration,
delegate=obj.delegate,
)
project.members.add(obj.group.owner)
project.version_history.last().members.add(obj.group.owner)
members = list(obj.members.all())
project.members.add(*members)
project.get_latest_version().members.add(*members)

# Create invitations for users
for member in obj.members.all():
for member in members:
if member == obj.group.owner:
continue

Expand Down Expand Up @@ -1084,6 +1075,7 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["admin"] = True
return context

Expand Down Expand Up @@ -1237,14 +1229,15 @@ def get_context_data(self, **kwargs):
context["is_active"] = obj.is_active()
context["is_revision"] = obj.is_revision()
context["is_revised"] = obj.is_revised()
context["is_archived"] = obj.is_archived()
context["admin"] = True
return context


class HpcProjectChangeRequestRevisionView(HpcPermissionMixin, UpdateView):
"""HPC project change request revision view."""

template_name = "usersec/hpcprojectchangerequest_form.html"
template_name = "usersec/hpcprojectcreaterequest_form.html"
model = HpcProjectChangeRequest
form_class = HpcProjectChangeRequestForm
slug_field = "uuid"
Expand Down
2 changes: 1 addition & 1 deletion hpcaccess/static/js/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function mergeToJson() {
var content = []
$(".mergeToJson").each(function () {
content.push('"' + $(this).attr("name") + '": "' + $(this).val() + '"');
content.push('"' + $(this).attr("name") + '": ' + $(this).val());
});
$("#id_resources_requested").val("{" + content.join(", ") + "}")
}
Expand Down
14 changes: 6 additions & 8 deletions hpcaccess/templates/pages/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

{% block content %}
<div class="container-fluid">

<p>
Welcome to <hb>HPC Access</hb>.
</p>
<p>
<h2 class="mt-5">
Welcome to <strong>HPC Access</strong>!
</h2>
<p class="mt-4">
This website allows users of the <strong>BIH HPC cluster</strong> to
</p>
<ul>
Expand All @@ -24,8 +23,8 @@
<li>create projects with dedicated and collaborative storage resources,</li>
<li>and make requests for additional group/project resources.</li>
</ul>
<hr />
<p>
<hr class="mt-4" />
<p class="mt-4">
Please log in using your Charité or MDC account.
</p>

Expand All @@ -40,7 +39,6 @@
<select id="login-domain" name="domain" class="form-select">
<option value="CHARITE">Charité</option>
<option value="MDC-BERLIN">MDC</option>
<option value=""></option>
</select>
</div>
<input type="password" name="password" id="login-password"
Expand Down
Loading

0 comments on commit 0aa2b33

Please sign in to comment.