Skip to content

Commit

Permalink
WIP: rework group manager interface (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo committed Oct 29, 2024
1 parent 6a3947c commit c0efa24
Show file tree
Hide file tree
Showing 15 changed files with 946 additions and 382 deletions.
4 changes: 2 additions & 2 deletions usersec/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def __init__(self, group, *args, **kwargs):
]

self.fields["members"] = forms.ChoiceField(choices=choices)
self.fields["members"].widget.attrs["class"] = "form-control"
self.fields["members"].widget.attrs["class"] = "form-select"


class ProjectSelectForm(forms.Form):
Expand Down Expand Up @@ -583,4 +583,4 @@ def __init__(self, user, *args, **kwargs):
if not choices:
self.fields["projects"].disabled = True

self.fields["projects"].widget.attrs["class"] = "form-control"
self.fields["projects"].widget.attrs["class"] = "form-select"
209 changes: 209 additions & 0 deletions usersec/migrations/0027_hpcgroup_date_modified_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# Generated by Django 4.2.13 on 2024-07-18 07:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("usersec", "0026_termsandconditions"),
]

operations = [
migrations.AddField(
model_name="hpcgroup",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupchangerequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupchangerequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupcreaterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupcreaterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupdeleterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupdeleterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupinvitation",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupinvitationversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcgroupversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcproject",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectchangerequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectchangerequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectcreaterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectcreaterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectdeleterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectdeleterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectinvitation",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectinvitationversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcprojectversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuser",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuserchangerequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuserchangerequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcusercreaterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcusercreaterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuserdeleterequest",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuserdeleterequestversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
migrations.AddField(
model_name="hpcuserversion",
name="date_modified",
field=models.DateTimeField(
auto_now=True, help_text="DateTime of last modification"
),
),
]
13 changes: 12 additions & 1 deletion usersec/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ class Meta:
#: Date created
date_created = models.DateTimeField(auto_now_add=True, help_text="DateTime of creation")

#: Date modified
date_modified = models.DateTimeField(auto_now=True, help_text="DateTime of last modification")


# ------------------------------------------------------------------------------
# HpcUser related
Expand Down Expand Up @@ -1060,6 +1063,14 @@ def display_status(self):

return mapping.get(self.status, "unknown status")

def get_request_type(self):
cls_name = self.__class__.__name__
name = cls_name.replace("Request", "").replace("Hpc", "")
ret = re.findall(r"[A-Z](?:[a-z]+|[A-Z]*(?=[A-Z]|$))", name)
if ret:
return " ".join(ret)
return self.__class__.__name__


# HpcGroupRequest related
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -1541,7 +1552,7 @@ class Meta:
max_length=512,
help_text=(
"Concise description of what kind of computations are required for the project on the "
"cluster",
"cluster"
),
null=True,
blank=True,
Expand Down
14 changes: 6 additions & 8 deletions usersec/templates/usersec/hpcgroupchangerequest_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ <h2>
</div>
{% endfor %}

{% if update %}
<a class="btn btn-secondary"
href="{{ object|get_detail_url:user }}"
>
<i class="iconify" data-icon="mdi:arrow-left-bold"></i>
Cancel
</a>
{% endif %}
<a class="btn btn-secondary"
href="{% url 'home' %}"
>
<i class="iconify" data-icon="mdi:arrow-left-bold"></i>
Cancel
</a>
<button class="btn btn-primary" type="submit" id="id_submit_button">
{% if update %}
{% if admin %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ <h2>
{{ field }}
{% if field.label == "Select Members" %}
<button class="btn btn-secondary" type="button" id="addMember">
<i class="iconify" data-icon="mdi:plus"></i>
Add
</button>
{% endif %}
Expand Down
Loading

0 comments on commit c0efa24

Please sign in to comment.