Skip to content

Commit

Permalink
Merge development (#222)
Browse files Browse the repository at this point in the history
* bugfixes: Fix bug when setting end_date_extension,
* Docs and docstrings
* Update Django version and dependency versions
* UI updates: Updated color of deny button, fix button presentation for allocation_change_list
* Refactors: template complex list views and note creation views
* add Factory-based testing to core and plugins, remove testing fixtures
* Comms changes: change NESE email templates, Changes to expiring email subject and first line, Move email helper functions to utils, Remove uncessary checks for EMAIL_ENABLED, Updates to admin email template and logic
* Permissions changes: comment out Add/Remove User buttons, add UI element permissions
* add success message after post of allocation request
* add ability to update Allocation/Project notes, add working Department note model and views
  • Loading branch information
claire-peters authored Jun 5, 2023
1 parent cd6d3b2 commit 87277b7
Show file tree
Hide file tree
Showing 231 changed files with 7,788 additions and 5,122 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ coldfront.db-journal
django-q.log
*.csv
media/reports*
.devcontainer/*
.bin/*
9 changes: 8 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"

# Build documentation with MkDocs
mkdocs:
configuration: docs/mkdocs.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
39 changes: 38 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# ColdFront Changelog

## [1.1.4] - 2023-02-11

- Datepicker changed to flatpickr. Remove jquery-ui [#438](https://github.com/ubccr/coldfront/issues/438)
- Combined email expiry notifications [#413](https://github.com/ubccr/coldfront/pull/413)
- Remove obsolete arguments in signal defs [#422](https://github.com/ubccr/coldfront/pull/422)
- Allow sorting of users on detail page [#408](https://github.com/ubccr/coldfront/issues/408)
- Fix approve button deleting description text [#433](https://github.com/ubccr/coldfront/issues/433)
- Add Project Attributes [#466](https://github.com/ubccr/coldfront/pull/466)
- Slurm plugin: fix allocations in pending renewal status [#176](https://github.com/ubccr/coldfront/issues/176)
- Update list displayes to sort case insensitive throughout front end [#393](https://github.com/ubccr/coldfront/issues/393)
- Fix FreeIPA plugin not recognizing usernames greater than 11 characters [#416](https://github.com/ubccr/coldfront/issues/416)
- Send signal if allocation status is revoked [#474](https://github.com/ubccr/coldfront/issues/474)
- Upgrade to Django 3.2.17
- Allow configuration of session timeout [#452](https://github.com/ubccr/coldfront/issues/452)
- Increase max length for user first_name [#490](https://github.com/ubccr/coldfront/pull/490)

## [1.1.3] - 2022-07-07

- Fix erronous allocation change request error message [#428](https://github.com/ubccr/coldfront/issues/428)
- Upgrade bootstrap and move to static assets [#405](https://github.com/ubccr/coldfront/issues/405)
- Allow changes on allocations in the test dataset
- Add new ColdFront logos and branding [#431](https://github.com/ubccr/coldfront/pull/431)

## [1.1.2] - 2022-07-06

- Fix "Select all" toggle for allocations [#396](https://github.com/ubccr/coldfront/issues/396)
- Fixed allocation expiration task bug [#401](https://github.com/ubccr/coldfront/pull/401)
- Fix new user sorting [#395](https://github.com/ubccr/coldfront/issues/395)
- Fix allocation approved status [#379](https://github.com/ubccr/coldfront/issues/379)
- Add notes on project detail page [#194](https://github.com/ubccr/coldfront/issues/194)
- Add partial match for attribute search [#421](https://github.com/ubccr/coldfront/pull/421)
- Fix miscellaneous config issues [#414](https://github.com/ubccr/coldfront/issues/414)
- Upgrade to Django 3.2.14

## [1.1.1] - 2022-04-26

- Fix grant export to only download those found under search [#222](https://github.com/ubccr/coldfront/issues/222)
Expand Down Expand Up @@ -89,4 +123,7 @@
[1.0.4]: https://github.com/ubccr/coldfront/releases/tag/v1.0.4
[1.1.0]: https://github.com/ubccr/coldfront/releases/tag/v1.1.0
[1.1.1]: https://github.com/ubccr/coldfront/releases/tag/v1.1.1
[Unreleased]: https://github.com/ubccr/coldfront/compare/v1.1.1...HEAD
[1.1.2]: https://github.com/ubccr/coldfront/releases/tag/v1.1.2
[1.1.3]: https://github.com/ubccr/coldfront/releases/tag/v1.1.3
[1.1.4]: https://github.com/ubccr/coldfront/releases/tag/v1.1.4
[Unreleased]: https://github.com/ubccr/coldfront/compare/v1.1.4...HEAD
3 changes: 1 addition & 2 deletions Dockerfile-ifx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:experimental
FROM python:3.6
FROM python:3.8

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -24,7 +24,6 @@ ARG IFXEC_COMMIT=0c09c90890fb87d4db22c635a6c403c89e1a957f
ARG IFXBILLING_COMMIT=58d07688e52b4c63fb93a903cbb8a1e5ed24ea34

RUN --mount=type=ssh pip install --upgrade pip && \
pip install 'Django>3,<4' && \
pip install django-author==1.0.2 && \
pip install git+ssh://[email protected]/harvardinformatics/ifxurls.git@${IFXURLS_COMMIT} && \
pip install git+ssh://[email protected]/harvardinformatics/nanites.client.git@${NANITES_CLIENT_COMMIT} && \
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
![ColdFront](docs/pages/images/logo-lg.png)

# ColdFront - Resource Allocation System

[![Documentation Status](https://readthedocs.org/projects/coldfront/badge/?version=latest)](https://coldfront.readthedocs.io/en/latest/?badge=latest)

ColdFront is an open source resource allocation system designed to provide a
ColdFront is an open source resource and allocation management system designed to provide a
central portal for administration, reporting, and measuring scientific impact
of HPC resources. ColdFront was created to help HPC centers manage access to a
diverse set of resources across large groups of users and provide a rich set of
extensible meta data for comprehensive reporting. ColdFront is written in
Python and released under the GPLv3 license.
of cyberinfrastructure resources. ColdFront was created to help high performance computing (HPC) centers manage access to a diverse set of resources across large groups of users and provide a rich set of
extensible meta data for comprehensive reporting. The flexiblity of ColdFront allows centers to manage and automate their policies and procedures within the framework provided or extend the functionality with [plugins](docs/pages/index.md#extensibility). ColdFront is written in Python and released under the GPLv3 license.

## Features

- Allocation based system for managing access to resources
- Collect Project, Grant, and Publication data from users
- Define custom attributes on resources and allocations
- Self-service portal for users to request access to resources for their research group
- Collection of Project, Grant, and Publication data from users
- Center director approval system and annual project review process
- Email notifications for expiring/renewing access to resources
- Integration with 3rd party systems for automation and access control
- Center director approval system and annual project reviews
- Ability to define custom attributes on resources and allocations
- Integration with 3rd party systems for automation, access control, and other system provisioning tasks

[Read more](docs/pages/index.md)

## Community Supported Plugins

- [OpenStack Plugin](https://github.com/nerc-project/coldfront-plugin-openstack)
- [Keycloak User Search](https://github.com/nerc-project/coldfront-plugin-keycloak)
- [Starfish Plugin](https://github.com/fasrc/coldfront/tree/master/coldfront/plugins/sftocf)
- [Starfish Plugin](https://github.com/fasrc/sftocf)

_Submit a PR to add your plugin to the list above._

Expand Down
2 changes: 1 addition & 1 deletion coldfront/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sys

__version__ = '1.1.1'
__version__ = '1.1.4'
VERSION = __version__


Expand Down
2 changes: 1 addition & 1 deletion coldfront/config/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
SU_LOGIN_CALLBACK = "coldfront.core.utils.common.su_login_callback"
SU_LOGOUT_REDIRECT_URL = "/su/login/"

SESSION_COOKIE_AGE = 60 * 30
SESSION_COOKIE_AGE = ENV.int('SESSION_INACTIVITY_TIMEOUT', default=60 * 60)
SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_SAMESITE = 'Strict'
## Need to test with True
Expand Down
6 changes: 5 additions & 1 deletion coldfront/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Base Django settings for ColdFront project.
"""
import os
import sys
import coldfront
from django.core.exceptions import ImproperlyConfigured
from django.core.management.utils import get_random_secret_key
Expand Down Expand Up @@ -53,11 +54,14 @@
]

# Additional Apps
# Hack to fix fontawesome. Will be fixed in version 6
sys.modules['fontawesome_free'] = __import__('fontawesome-free')
INSTALLED_APPS += [
'crispy_forms',
'sslserver',
'django_q',
'simple_history',
'fontawesome_free',
'mathfilters',
# 'debug_toolbar',
# 'ifxuser',
Expand Down Expand Up @@ -161,7 +165,7 @@
raise ImproperlyConfigured('SITE_TEMPLATES should be a path to a directory')

CRISPY_TEMPLATE_PACK = 'bootstrap4'
SETTINGS_EXPORT = []
SETTINGS_EXPORT = ['INSTALLED_APPS']

STATIC_URL = '/static/'
STATIC_ROOT = ENV.str('STATIC_ROOT', default=PROJECT_ROOT('static_root'))
Expand Down
9 changes: 5 additions & 4 deletions coldfront/config/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#------------------------------------------------------------------------------
# General Center Information
#------------------------------------------------------------------------------
CENTER_NAME = ENV.str('CENTER_NAME', default='HPC Resources')
CENTER_NAME = ENV.str('CENTER_NAME', default='HPC Center')
CENTER_HELP_URL = ENV.str('CENTER_HELP_URL', default='help-page')
CENTER_PROJECT_RENEWAL_HELP_URL = ENV.str('CENTER_PROJECT_RENEWAL_HELP_URL', default='')
CENTER_BASE_URL = ENV.str('CENTER_BASE_URL', default='')
Expand Down Expand Up @@ -51,7 +51,8 @@
ALLOCATION_ACCOUNT_MAPPING = ENV.dict('ALLOCATION_ACCOUNT_MAPPING', default={})

SETTINGS_EXPORT += [
'ALLOCATION_ACCOUNT_ENABLED'
'ALLOCATION_ACCOUNT_ENABLED',
'CENTER_HELP_URL'
]

ADMIN_COMMENTS_SHOW_EMPTY = ENV.bool('ADMIN_COMMENTS_SHOW_EMPTY', default=True)
Expand Down Expand Up @@ -91,7 +92,7 @@
Phone: (xxx) xxx-xxx
"""

ACCOUNT_CREATION_TEXT = '''University faculty can submit a help ticket to request an account.
ACCOUNT_CREATION_TEXT = """University faculty can submit a help ticket to request an account.
Please see <a href="#">instructions on our website</a>. Staff, students, and external collaborators must
request an account through a university faculty member.
'''
"""
1 change: 1 addition & 0 deletions coldfront/config/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
EMAIL_OPT_OUT_INSTRUCTION_URL = ENV.str('EMAIL_OPT_OUT_INSTRUCTION_URL', default='')
EMAIL_ALLOCATION_EXPIRING_NOTIFICATION_DAYS = ENV.list('EMAIL_ALLOCATION_EXPIRING_NOTIFICATION_DAYS', cast=int, default=[7, 14, 30])
EMAIL_SIGNATURE = ENV.str('EMAIL_SIGNATURE', default='', multiline=True)
EMAIL_ADMINS_ON_ALLOCATION_EXPIRE = ENV.bool('EMAIL_ADMINS_ON_ALLOCATION_EXPIRE', default=False)
4 changes: 2 additions & 2 deletions coldfront/config/plugins/ldap_fasrc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''
"""
FASRC-specific LDAP plugin settings
'''
"""
from django.core.exceptions import ImproperlyConfigured

from coldfront.config.env import ENV
Expand Down
1 change: 0 additions & 1 deletion coldfront/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'email.py',
]


# ColdFront plugin settings
plugin_configs = {
'PLUGIN_SLURM': 'plugins/slurm.py',
Expand Down
33 changes: 21 additions & 12 deletions coldfront/core/allocation/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django import forms
from django.db.models.functions import Lower
from django.shortcuts import get_object_or_404

from coldfront.core.allocation.models import (Allocation, AllocationAccount,
Expand All @@ -17,9 +18,9 @@


class AllocationForm(forms.Form):
DEFAULT_DESCRIPTION = '''
DEFAULT_DESCRIPTION = """
We do not have information about your research. Please provide a detailed description of your work and update your field of science. Thank you!
'''
"""
resource = forms.ModelChoiceField(queryset=None, empty_label=None)
quantity = forms.IntegerField(required=True)
justification = forms.CharField(widget=forms.Textarea)
Expand All @@ -29,7 +30,7 @@ class AllocationForm(forms.Form):
def __init__(self, request_user, project_pk, *args, **kwargs):
super().__init__(*args, **kwargs)
project_obj = get_object_or_404(Project, pk=project_pk)
self.fields['resource'].queryset = get_user_resources(request_user)
self.fields['resource'].queryset = get_user_resources(request_user).order_by(Lower("name"))
self.fields['quantity'].initial = 1
user_query_set = project_obj.projectuser_set.select_related('user').filter(
status__name__in=['Active', ]).order_by("user__username")
Expand All @@ -46,7 +47,7 @@ def __init__(self, request_user, project_pk, *args, **kwargs):

class AllocationUpdateForm(forms.Form):
status = forms.ModelChoiceField(
queryset=AllocationStatusChoice.objects.all().order_by('name'), empty_label=None)
queryset=AllocationStatusChoice.objects.all().order_by(Lower("name")), empty_label=None)
start_date = forms.DateField(
label='Start Date',
widget=forms.DateInput(attrs={'class': 'datepicker'}),
Expand Down Expand Up @@ -74,20 +75,20 @@ def clean(self):

class AllocationInvoiceUpdateForm(forms.Form):
status = forms.ModelChoiceField(queryset=AllocationStatusChoice.objects.filter(name__in=[
'Payment Pending', 'Payment Requested', 'Paid']).order_by('name'), empty_label=None)
'Payment Pending', 'Payment Requested', 'Payment Declined', 'Paid']).order_by(Lower("name")), empty_label=None)


class AllocationAddUserForm(forms.Form):
username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
selected = forms.BooleanField(initial=False, required=False)


class AllocationRemoveUserForm(forms.Form):
username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
selected = forms.BooleanField(initial=False, required=False)
Expand All @@ -111,16 +112,16 @@ class AllocationSearchForm(forms.Form):
label='Username', max_length=100, required=False)
resource_type = forms.ModelChoiceField(
label='Resource Type',
queryset=ResourceType.objects.all().order_by('name'),
queryset=ResourceType.objects.all().order_by(Lower("name")),
required=False)
resource_name = forms.ModelMultipleChoiceField(
label='Resource Name',
queryset=Resource.objects.filter(
is_allocatable=True).order_by('name'),
is_allocatable=True).order_by(Lower("name")),
required=False)
allocation_attribute_name = forms.ModelChoiceField(
label='Allocation Attribute Name',
queryset=AllocationAttributeType.objects.all().order_by('name'),
queryset=AllocationAttributeType.objects.all().order_by(Lower("name")),
required=False)
allocation_attribute_value = forms.CharField(
label='Allocation Attribute Value', max_length=100, required=False)
Expand All @@ -134,7 +135,7 @@ class AllocationSearchForm(forms.Form):
required=False)
status = forms.ModelMultipleChoiceField(
widget=forms.CheckboxSelectMultiple,
queryset=AllocationStatusChoice.objects.all().order_by('name'),
queryset=AllocationStatusChoice.objects.all().order_by(Lower("name")),
required=False)
show_all_allocations = forms.BooleanField(initial=False, required=False)

Expand All @@ -147,7 +148,7 @@ class AllocationReviewUserForm(forms.Form):
)

username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
user_status = forms.ChoiceField(choices=ALLOCATION_REVIEW_USER_CHOICES)
Expand Down Expand Up @@ -241,3 +242,11 @@ class AllocationChangeNoteForm(forms.Form):
required=False,
widget=forms.Textarea,
help_text="Leave any feedback about the allocation change request.")

class AllocationAttributeCreateForm(forms.ModelForm):
class Meta:
model = AllocationAttribute
fields = '__all__'
def __init__(self, *args, **kwargs):
super(AllocationAttributeCreateForm, self).__init__(*args, **kwargs)
self.fields['allocation_attribute_type'].queryset = self.fields['allocation_attribute_type'].queryset.order_by(Lower('name'))
Loading

0 comments on commit 87277b7

Please sign in to comment.