Skip to content

Commit

Permalink
Merge branch 'vite-upgrade'
Browse files Browse the repository at this point in the history
  • Loading branch information
oakdbca committed Dec 31, 2024
2 parents c09271c + 73ad0e0 commit 38fbc18
Show file tree
Hide file tree
Showing 259 changed files with 66,417 additions and 49,472 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ htmlcov/
.coverage
.coverage*
.cache
.eslintcache
nosetests.xml
coverage.xml
*,cover
Expand Down Expand Up @@ -107,4 +108,4 @@ git_history_recent
*.xls*
*.DAV

private-media/
private-media/
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"editor.formatOnSaveMode": "modifications"
}
"eslint.debug": true,
"eslint.enable": true,
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always",
},
}
32 changes: 19 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
SITE_DOMAIN='dbca.wa.gov.au' \
OSCAR_SHOP_NAME='Parks & Wildlife' \
BPAY_ALLOWED=False \
NODE_MAJOR=20
NODE_MAJOR=20 \
NODE_OPTIONS=--max_old_space_size=4096

FROM builder_base_boranga as apt_packages_boranga

Expand All @@ -27,17 +28,15 @@ RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y \
binutils \
ca-certificates \
bzip2 \
ca-certificates \
curl \
g++ \
gcc \
gdal-bin \
git \
graphviz \
htop \
ipython3 \
libgdal-dev \
libgraphviz-dev \
libmagic-dev \
libpq-dev \
Expand All @@ -47,11 +46,11 @@ RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
patch \
postgresql-client \
python3-dev \
python3-gdal \
python3-pil \
python3-pip \
python3-setuptools \
python3-venv \
software-properties-common \
sqlite3 \
ssh \
sudo \
Expand All @@ -62,6 +61,15 @@ RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
rm -rf /var/lib/apt/lists/* && \
update-ca-certificates

RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable

RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y \
gdal-bin \
libgdal-dev \
python3-gdal

FROM apt_packages_boranga as node_boranga

# install node
Expand Down Expand Up @@ -111,19 +119,17 @@ RUN $VIRTUAL_ENV_PATH/bin/pip3 install --upgrade pip && \
# RUN patch /usr/local/lib/python3.8/dist-packages/django/contrib/gis/geos/libgeos.py /app/libgeos.py.patch
# RUN rm /app/libgeos.py.patch

FROM python_dependencies_boranga as collectstatic_boranga

RUN touch /app/.env && \
$VIRTUAL_ENV_PATH/bin/python manage.py collectstatic --noinput

FROM collectstatic_boranga as build_vue_boranga
FROM python_dependencies_boranga as build_vue_boranga

RUN cd /app/boranga/frontend/boranga; npm ci --omit=dev && \
cd /app/boranga/frontend/boranga; npm run build

FROM build_vue_boranga as launch_boranga
FROM build_vue_boranga as collectstatic_boranga

RUN touch /app/.env && \
$VIRTUAL_ENV_PATH/bin/python manage.py collectstatic --noinput

RUN $VIRTUAL_ENV_PATH/bin/python manage.py collectstatic --noinput
FROM collectstatic_boranga as launch_boranga

EXPOSE 8080
HEALTHCHECK --interval=1m --timeout=5s --start-period=10s --retries=3 CMD ["wget", "-q", "-O", "-", "http://localhost:8080/"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ EMAIL_HOST='smtp.corporateict.domain'
DJANGO_HTTPS=True
DEFAULT_FROM_EMAIL='[email protected]'
ALLOWED_HOSTS=['*']
DEV_APP_BUILD_URL="http://localhost:8080/app.js"
VUE3_ENTRY_SCRIPT="src/main.js"
```

Expand Down Expand Up @@ -159,7 +160,6 @@ SITE_PREFIX=''
SITE_DOMAIN=''
SITE_URL='localhost:8000'
DISABLE_EMAIL=False
DEV_APP_BUILD_URL="http://localhost:8080/app.js"
CONSOLE_EMAIL_BACKEND=True
SUPPORT_EMAIL="[email protected]"
CSRF_MIDDLEWARE_TOKEN='my_csrf_middleware_token'
Expand Down
10 changes: 6 additions & 4 deletions boranga/components/conservation_status/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,11 +1455,13 @@ def add_comms_log(self, request, *args, **kwargs):
serializer = ConservationStatusLogEntrySerializer(data=request.data)
serializer.is_valid(raise_exception=True)
comms = serializer.save()
for f in request.FILES:

# Save the files
for f in request.FILES.getlist("files"):
document = comms.documents.create()
document.check_file(request.FILES[f])
document.name = str(request.FILES[f])
document._file = request.FILES[f]
document.check_file(f)
document.name = str(f)
document._file = f
document.save()

return Response(serializer.data)
Expand Down
105 changes: 97 additions & 8 deletions boranga/components/conservation_status/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from ledger_api_client.ledger_models import EmailUserRO as EmailUser

from boranga.components.emails.emails import TemplateEmailBase
from boranga.components.species_and_communities.models import SystemEmailGroup
from boranga.components.users.email import _log_user_email
from boranga.helpers import (
convert_external_url_to_internal_url,
Expand Down Expand Up @@ -157,9 +158,20 @@ def send_submit_email_notification(request, cs_proposal):
)
url = convert_external_url_to_internal_url(url)

group_type = (
cs_proposal.species.group_type
if cs_proposal.species
else cs_proposal.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

context = {"cs_proposal": cs_proposal, "url": url}

msg = email.send(cs_proposal.assessor_recipients, context=context)
msg = email.send(recipients, context=context)

sender = request.user if request else settings.DEFAULT_FROM_EMAIL

Expand Down Expand Up @@ -427,7 +439,18 @@ def send_approver_decline_email_notification(reason, request, conservation_statu
)
context = {"cs_proposal": conservation_status, "reason": reason, "url": url}

msg = email.send(conservation_status.approver_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand All @@ -450,7 +473,18 @@ def send_approver_propose_delist_email_notification(
)
context = {"cs_proposal": conservation_status, "reason": reason, "url": url}

msg = email.send(conservation_status.approver_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand All @@ -477,7 +511,18 @@ def send_approver_approve_email_notification(request, conservation_status):
"url": url,
}

msg = email.send(conservation_status.approver_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand All @@ -499,7 +544,18 @@ def send_approver_proposed_for_agenda_email_notification(
"assessor_comment": assessor_comment,
}

msg = email.send(conservation_status.approver_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand All @@ -521,7 +577,18 @@ def send_assessor_ready_for_agenda_email_notification(
"assessor_comment": assessor_comment,
}

msg = email.send(conservation_status.assessor_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand Down Expand Up @@ -552,7 +619,18 @@ def send_proposal_approver_sendback_email_notification(request, conservation_sta
"approver_comment": approver_comment,
}

msg = email.send(conservation_status.assessor_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand All @@ -578,7 +656,18 @@ def send_approver_defer_email_notification(request, conservation_status, reason)
"reason": reason,
}

msg = email.send(conservation_status.assessor_recipients, context=context)
group_type = (
conservation_status.species.group_type
if conservation_status.species
else conservation_status.community.group_type
)

recipients = SystemEmailGroup.emails_by_group_and_area(
group_type=group_type,
area=SystemEmailGroup.AREA_CONSERVATION_STATUS,
)

msg = email.send(recipients, context=context)

sender = get_sender_user()

Expand Down
22 changes: 1 addition & 21 deletions boranga/components/conservation_status/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,26 +820,6 @@ def allowed_assessors(self):
)
return users

@property
def assessor_recipients(self):
recipients = []
group_ids = member_ids(
GROUP_NAME_CONSERVATION_STATUS_ASSESSOR, include_superusers=False
)
for id in group_ids:
recipients.append(EmailUser.objects.get(id=id).email)
return recipients

@property
def approver_recipients(self):
recipients = []
group_ids = member_ids(
GROUP_NAME_CONSERVATION_STATUS_APPROVER, include_superusers=False
)
for id in group_ids:
recipients.append(EmailUser.objects.get(id=id).email)
return recipients

@property
def current_conservation_status(self):
if self.species:
Expand Down Expand Up @@ -1969,7 +1949,7 @@ def as_related_item(self):
descriptor=self.related_item_descriptor,
status=self.related_item_status,
action_url=str(
f"<a href=/internal/conservation_status/{self.id} "
f"<a href=/internal/conservation-status/{self.id} "
f'target="_blank">View <i class="bi bi-box-arrow-up-right"></i></a>'
),
)
Expand Down
2 changes: 1 addition & 1 deletion boranga/components/history/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def get(self, request, app_label, component_name, model_name, pk):
Example:
api/history/boranga/species_communities/SpeciesDocument/729
api/history/boranga/species-communities/SpeciesDocument/729
"""
super().get(request, model_name)

Expand Down
6 changes: 4 additions & 2 deletions boranga/components/main/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class HelpTextEntryViewSet(viewsets.ReadOnlyModelViewSet):
def get_queryset(self):
qs = super().get_queryset()
if not self.request.user.is_authenticated:
qs = qs.filter(authenticated_users_only=False, internal_users_only=False)
return qs.exclude(authenticated_users_only=True).exclude(
internal_users_only=True
)
if not helpers.is_internal(self.request):
qs = qs.filter(authenticated_users_only=False)
return qs.exclude(internal_users_only=True)
return qs


Expand Down
8 changes: 4 additions & 4 deletions boranga/components/meetings/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,11 @@ def add_comms_log(self, request, *args, **kwargs):
comms = serializer.save()

# Save the files
for f in request.FILES:
for f in request.FILES.getlist("files"):
document = comms.documents.create()
document.check_file(request.FILES[f])
document.name = str(request.FILES[f])
document._file = request.FILES[f]
document.check_file(f)
document.name = str(f)
document._file = f
document.save()

return Response(serializer.data)
Expand Down
Loading

0 comments on commit 38fbc18

Please sign in to comment.