From 5baba92dd9bbca6cd19bb9e0f7f600aea68f57b9 Mon Sep 17 00:00:00 2001 From: pleyo Date: Sun, 7 Jan 2024 21:45:02 +0100 Subject: [PATCH 1/7] docs: Minor modification to README.md --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b268cc2..4cc0f44 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,28 @@ Metrics are focused on **availability**, with future integration for **performan ```bash python3 -m venv apps source apps/bin/activate + +# psycopg2 lib Apple silicon specific +# brew install openssl +# export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/openssl/lib + pip install -r django/requirements.txt # Generate random SECRET_KEY and inject in .env file SECRET_KEY=$(LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 32) +# Or +# SECRET_KEY=$(openssl rand -base64 64) + echo "SECRET_KEY=$SECRET_KEY" >> .env -# Create superuser to access django admin panel -python django/manage.py createsuperuser +# For development, add DEBUG=1 in .env file +# echo "DEBUG=1" >> .env +# For a first setup, run migrate and createsuperuser python django/manage.py migrate +# Create superuser to access django admin panel (migrate first for the first setup) +python django/manage.py createsuperuser + python django/manage.py tailwind install ``` From ce71f6a81c5690fcb0dba28a8eae59f537c4f006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Mon, 8 Jan 2024 09:42:31 +0100 Subject: [PATCH 2/7] Add #34 to changelog and prepare 0.9.2 --- CHANGELOG.md | 5 +++++ django/core/settings.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d119b6..3869ee6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). See for sample https://raw.githubusercontent.com/favoloso/conventional-changelog-emoji/master/CHANGELOG.md --> + +## [0.9.2] - 2024-MM-DD +### Improvements +- Minor modification to README.md (#34) + ## [0.9.1] - 2023-09-26 ### 🛠 Improvements - Make SSL alert shorter (#30) diff --git a/django/core/settings.py b/django/core/settings.py index b883348..df771a6 100644 --- a/django/core/settings.py +++ b/django/core/settings.py @@ -31,7 +31,7 @@ # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ -VERSION = [0, 9, 1] +VERSION = [0, 9, 2] # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get('SECRET_KEY') From 9d9025a200523e44aa1b491c3caac90225c732ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Sat, 18 May 2024 22:34:51 +0200 Subject: [PATCH 3/7] Update dependencies using pip-review Related to #36 --- django/core/settings.py | 1 + django/requirements.txt | 157 ++++++++++++++++++++++------------------ 2 files changed, 88 insertions(+), 70 deletions(-) diff --git a/django/core/settings.py b/django/core/settings.py index df771a6..29678a3 100644 --- a/django/core/settings.py +++ b/django/core/settings.py @@ -151,6 +151,7 @@ ] MIDDLEWARE = ( + 'allauth.account.middleware.AccountMiddleware', 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/django/requirements.txt b/django/requirements.txt index 099a65b..1d55ad1 100644 --- a/django/requirements.txt +++ b/django/requirements.txt @@ -1,90 +1,107 @@ -alabaster==0.7.12 -anyio==3.6.2 -arrow==1.2.3 -asgiref==3.6.0 -Babel==2.11.0 +alabaster==0.7.16 +annotated-types==0.6.0 +anyio==4.3.0 +arrow==1.3.0 +asgiref==3.8.1 +Babel==2.15.0 binaryornot==0.4.4 -boto3==1.26.48 -botocore==1.29.48 -certifi==2021.5.30 -cffi==1.15.1 +boto3==1.34.108 +botocore==1.34.108 +certifi==2024.2.2 +cffi==1.16.0 chardet==5.2.0 -charset-normalizer==2.0.12 -click==8.1.3 -cookiecutter==2.1.1 -cryptography==3.4.8 +charset-normalizer==3.3.2 +click==8.1.7 +cookiecutter==2.6.0 +cryptography==42.0.7 defusedxml==0.7.1 -dj-database-url==1.2.0 -Django==4.1.5 -django-allauth==0.52.0 -django-browser-reload==1.6.0 -django-cleanup==6.0.0 -django-prometheus==2.2.0 -django-storages==1.13.2 -django-tailwind==3.4.0 -django-timezone-field==6.0 -django-yamlfield==1.2.0 -djangorestframework==3.14.0 -docutils==0.17.1 -fastapi==0.95.0 -gunicorn==20.1.0 +dj-database-url==2.1.0 +Django==4.2.13 +django-allauth==0.63.1 +django-browser-reload==1.12.1 +django-cleanup==8.1.0 +django-prometheus==2.3.1 +django-storages==1.14.3 +django-tailwind==3.6.0 +django-timezone-field==6.1.0 +django-yamlfield==1.2.2 +djangorestframework==3.15.1 +dnspython==2.6.1 +docutils==0.20.1 +email_validator==2.1.1 +exceptiongroup==1.2.1 +fastapi==0.111.0 +fastapi-cli==0.0.3 +gunicorn==22.0.0 h11==0.14.0 -httptools==0.5.0 -humanize==4.8.0 -idna==3.2 +httpcore==1.0.5 +httptools==0.6.1 +httpx==0.27.0 +humanize==4.9.0 +idna==3.7 imagesize==1.4.1 -importlib-metadata==6.0.0 -Jinja2==3.1.2 +importlib_metadata==7.1.0 +Jinja2==3.1.4 jinja2-time==0.2.0 jmespath==1.0.1 livereload==2.6.3 -markdown-it-py==2.1.0 -MarkupSafe==2.1.1 -mdit-py-plugins==0.3.3 +markdown-it-py==3.0.0 +MarkupSafe==2.1.5 +mdit-py-plugins==0.4.1 mdurl==0.1.2 -myst-parser==0.18.1 +myst-parser==3.0.1 oauthlib==3.2.2 -packaging==22.0 -Pillow==9.4.0 +orjson==3.10.3 +packaging==24.0 +pillow==10.3.0 pip-review==1.3.0 poyo==0.5.0 -prometheus-client==0.15.0 -psycopg2==2.9.5 -pycparser==2.21 -pydantic==1.10.7 -Pygments==2.14.0 -PyJWT==2.1.0 -python-dateutil==2.8.2 -python-dotenv==0.19.0 -python-slugify==7.0.0 +prometheus_client==0.20.0 +psycopg2==2.9.9 +pycparser==2.22 +pydantic==2.7.1 +pydantic_core==2.18.2 +Pygments==2.18.0 +PyJWT==2.8.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +python-multipart==0.0.9 +python-slugify==8.0.4 python3-openid==3.2.0 -pytz==2022.7 -PyYAML==6.0 +pytz==2024.1 +PyYAML==6.0.1 requests==2.31.0 -requests-oauthlib==1.3.1 -s3transfer==0.6.0 -sentry-sdk==1.13.0 +requests-oauthlib==2.0.0 +rich==13.7.1 +s3transfer==0.10.1 +sentry-sdk==2.2.0 +shellingham==1.5.4 six==1.16.0 -sniffio==1.3.0 +sniffio==1.3.1 snowballstemmer==2.2.0 -Sphinx==5.3.0 +Sphinx==7.3.7 sphinx-reload==0.2.0 -sphinx-rtd-theme==1.1.1 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.0 +sphinx-rtd-theme==2.0.0 +sphinxcontrib-applehelp==1.0.8 +sphinxcontrib-devhelp==1.0.6 +sphinxcontrib-htmlhelp==2.0.5 +sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sqlparse==0.4.3 -starlette==0.26.1 +sphinxcontrib-qthelp==1.0.7 +sphinxcontrib-serializinghtml==1.1.10 +sqlparse==0.5.0 +starlette==0.37.2 text-unidecode==1.3 -tornado==6.2 -typing_extensions==4.5.0 -urllib3==1.26.16 +tomli==2.0.1 +tornado==6.4 +typer==0.12.3 +types-python-dateutil==2.9.0.20240316 +typing_extensions==4.11.0 +ujson==5.10.0 +urllib3==1.26.18 uvicorn==0.21.1 -uvloop==0.17.0 -watchfiles==0.18.1 -websockets==10.4 -whitenoise==6.3.0 -zipp==3.11.0 +uvloop==0.19.0 +watchfiles==0.21.0 +websockets==12.0 +whitenoise==6.6.0 +zipp==3.18.2 From 5312b58c576c07e02b59672da1aaef6494aa772e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Sat, 18 May 2024 23:37:38 +0200 Subject: [PATCH 4/7] Add Waiting list and update website Related to #37 --- django/core/decorators.py | 20 ++++ django/core/templates/waiting_list.html | 25 +++++ django/dashboard/views.py | 3 + django/incidents/views.py | 3 + django/notifications/views.py | 5 + django/performances/views.py | 7 ++ django/projects/views.py | 7 ++ django/settings/views.py | 3 + django/status/views.py | 4 +- django/website/templates/about-us.html | 21 ++-- django/website/templates/footer.html | 2 +- django/website/templates/pricing.html | 134 +----------------------- docs/conf.py | 4 +- 13 files changed, 96 insertions(+), 142 deletions(-) create mode 100644 django/core/decorators.py create mode 100644 django/core/templates/waiting_list.html diff --git a/django/core/decorators.py b/django/core/decorators.py new file mode 100644 index 0000000..4b1a309 --- /dev/null +++ b/django/core/decorators.py @@ -0,0 +1,20 @@ +from functools import wraps +from django.contrib import messages +from django.shortcuts import redirect +from django.http import HttpResponse +from django.shortcuts import render + +def user_approved_in_waiting_list(user): + if user.is_staff: + return True + return False + +def waiting_list_approved_only(): + def decorator(view): + @wraps(view) + def _wrapped_view(request, *args, **kwargs): + if not user_approved_in_waiting_list(request.user): + return render(request, 'waiting_list.html') + return view(request, *args, **kwargs) + return _wrapped_view + return decorator \ No newline at end of file diff --git a/django/core/templates/waiting_list.html b/django/core/templates/waiting_list.html new file mode 100644 index 0000000..959419b --- /dev/null +++ b/django/core/templates/waiting_list.html @@ -0,0 +1,25 @@ +{% extends 'base.html' %} +{% load socialaccount account tailwind_tags %} + +{% block body %} +
+
+
+
+ +
+
+

You are currently on waiting list You can cancel at any time.

+

+ + Delete your account + + +

+
+
+
+
+{% endblock %} diff --git a/django/dashboard/views.py b/django/dashboard/views.py index 36a96e2..6d266d5 100644 --- a/django/dashboard/views.py +++ b/django/dashboard/views.py @@ -9,10 +9,13 @@ from allauth.socialaccount.models import SocialApp from rest_framework.authtoken.models import Token +from core.decorators import waiting_list_approved_only + from workers.models import Server from incidents.models import Incident @login_required +@waiting_list_approved_only() def dashboard(request): # If user has no project we redirect to /welcome/ diff --git a/django/incidents/views.py b/django/incidents/views.py index 74d52cb..c4587f7 100644 --- a/django/incidents/views.py +++ b/django/incidents/views.py @@ -11,6 +11,7 @@ from rest_framework.decorators import api_view from rest_framework.response import Response +from core.decorators import waiting_list_approved_only from .models import Incident from projects.models import Project from availability.models import Service @@ -18,6 +19,7 @@ from constants import INCIDENT_SEVERITY, INCIDENT_STATUS @login_required +@waiting_list_approved_only() def incidents(request, id, year=None, month=None, day=None): """ List of incidents for a specific projects @@ -93,6 +95,7 @@ def incidents(request, id, year=None, month=None, day=None): @login_required +@waiting_list_approved_only() def incidents_force_online(request, service_id): service = get_object_or_404(Service, pk=service_id) diff --git a/django/notifications/views.py b/django/notifications/views.py index f552608..849f26a 100644 --- a/django/notifications/views.py +++ b/django/notifications/views.py @@ -13,9 +13,11 @@ from projects.models import Project from incidents.models import Incident +from core.decorators import waiting_list_approved_only from django.conf import settings @login_required +@waiting_list_approved_only() def project_notifications(request, id): """ Show current project status @@ -40,6 +42,7 @@ def project_notifications(request, id): }) @login_required +@waiting_list_approved_only() def email_form(request, application_id, email_id=None): email = None @@ -73,6 +76,7 @@ def email_form(request, application_id, email_id=None): }) @login_required +@waiting_list_approved_only() def email_delete(request, application_id, email_id): email = get_object_or_404(Emails, pk=email_id) @@ -81,6 +85,7 @@ def email_delete(request, application_id, email_id): return redirect(reverse('project_notifications', args=[application_id])) @login_required +@waiting_list_approved_only() def messages(request): # If user has no project we redirect to /welcome/ diff --git a/django/performances/views.py b/django/performances/views.py index c1fedfb..0f81a3d 100644 --- a/django/performances/views.py +++ b/django/performances/views.py @@ -10,6 +10,7 @@ from projects.models import Project from .models import Performance, Report from .forms import PerformanceForm +from core.decorators import waiting_list_approved_only def get_domaines_from_performances(performances_list): domains = {} @@ -66,6 +67,7 @@ def find_page(pages, performance, depth=0, path_parent=''): return domains @login_required +@waiting_list_approved_only() def project_performances(request, id): """ Show current project status @@ -81,6 +83,7 @@ def project_performances(request, id): }) @login_required +@waiting_list_approved_only() def performance_form(request, application_id, performance_id=None): """ Create or edit service model @@ -118,6 +121,7 @@ def performance_form(request, application_id, performance_id=None): }) @login_required +@waiting_list_approved_only() def performance_delete(request, application_id, performance_id): """ Delete service model @@ -129,6 +133,7 @@ def performance_delete(request, application_id, performance_id): return redirect(reverse('project_performances', args=[application_id])) @login_required +@waiting_list_approved_only() def performance_rerun(request, application_id, performance_id): """ Delete service model @@ -141,6 +146,7 @@ def performance_rerun(request, application_id, performance_id): return redirect(reverse('project_performances', args=[application_id])+'#noanimations') @login_required +@waiting_list_approved_only() def project_performances_report_viewer(request, id, report_id): """ Show current project status @@ -158,6 +164,7 @@ def project_performances_report_viewer(request, id, report_id): }) @login_required +@waiting_list_approved_only() def performances_all(request): domains = {} diff --git a/django/projects/views.py b/django/projects/views.py index d298786..9850d11 100644 --- a/django/projects/views.py +++ b/django/projects/views.py @@ -16,6 +16,7 @@ from .forms import ProjectForm, ProjectCreateForm +from core.decorators import waiting_list_approved_only from projects.models import Project from availability.models import Service, HTTPCodeService, HTTPMockedCodeService from workers.models import Server @@ -24,6 +25,7 @@ from performances.models import Performance @login_required +@waiting_list_approved_only() def project(request, id): """ Show current project status @@ -53,6 +55,7 @@ def project(request, id): }) @login_required +@waiting_list_approved_only() def project_performances(request, id): """ Show current project status @@ -65,6 +68,7 @@ def project_performances(request, id): }) @login_required +@waiting_list_approved_only() def projects_form(request, id=None): """ Create or edit project model @@ -96,6 +100,7 @@ def projects_form(request, id=None): }) @login_required +@waiting_list_approved_only() def projects_delete(request, id=None): """ Delete project model @@ -106,6 +111,7 @@ def projects_delete(request, id=None): return redirect(reverse('dashboard')) @login_required +@waiting_list_approved_only() def projects_add(request): """ Create or edit project model @@ -125,6 +131,7 @@ def projects_add(request): }) @login_required +@waiting_list_approved_only() def projects_welcome(request): """ Create or edit project model diff --git a/django/settings/views.py b/django/settings/views.py index 41e24ab..a2f1c9a 100644 --- a/django/settings/views.py +++ b/django/settings/views.py @@ -5,9 +5,11 @@ from django.urls import reverse from django.shortcuts import redirect +from core.decorators import waiting_list_approved_only from .forms import TimeZoneForm @login_required +@waiting_list_approved_only() def settings(request): """ Set user settings @@ -21,6 +23,7 @@ def settings(request): }) @login_required +@waiting_list_approved_only() def user_timezone_form(request): """ Create or edit service model diff --git a/django/status/views.py b/django/status/views.py index 22f8c85..343eea7 100644 --- a/django/status/views.py +++ b/django/status/views.py @@ -15,10 +15,11 @@ from constants import INCIDENT_SEVERITY from incidents.models import Incident from projects.models import Project - +from core.decorators import waiting_list_approved_only from django.http import Http404 @login_required +@waiting_list_approved_only() def toggle_public_page(request, application_id): project = get_object_or_404(Project, pk=application_id) @@ -31,6 +32,7 @@ def toggle_public_page(request, application_id): @login_required +@waiting_list_approved_only() def project_status_public(request, id): """ Show current project status diff --git a/django/website/templates/about-us.html b/django/website/templates/about-us.html index 84be395..ba076b6 100644 --- a/django/website/templates/about-us.html +++ b/django/website/templates/about-us.html @@ -20,15 +20,24 @@

About th

Sébastien Barbier

-

Co-Founder

-

Sébastien is a Cloud Software Architect from France currently based in Zurich.

+

Founder

+

Software Engineer currently based in Zurich, Switzerland.

  • - - Twitter - Personal website + + +
  • +
  • + + X +
  • diff --git a/django/website/templates/footer.html b/django/website/templates/footer.html index f75a9b7..7baddfb 100644 --- a/django/website/templates/footer.html +++ b/django/website/templates/footer.html @@ -18,6 +18,6 @@
-

© 2023 FromEdwin, All rights reserved.

+

© 2024 FromEdwin, All rights reserved.

diff --git a/django/website/templates/pricing.html b/django/website/templates/pricing.html index 692bc76..1156191 100644 --- a/django/website/templates/pricing.html +++ b/django/website/templates/pricing.html @@ -7,140 +7,10 @@
-

The right price for you, whoever you are

-

While we are still figuring it out

-
-

Pricing can change anytime, but let's start with something easy.

-
-
-

Hobby

-

- $0 - /month -

-

The perfect plan if you're just getting started with your product.

-
    -
  • - - {{ settings.FREEMIUM_PROJECTS }} projects -
  • - -
  • - - {{ settings.FREEMIUM_AVAILABILITY }} page per project for availablity -
  • - -
  • - - {{ settings.FREEMIUM_PERFORMANCE }} pages per project for performances -
  • - -
  • - - Enable your public page -
  • - -
  • - - Email notifications -
  • -
- Get started today -
- -
-

Pro maker Available soon

- -

- More than $0 - /month -

-

A plan that scales with your rapidly growing business.

-
    -
  • - - More projects -
  • - -
  • - - Many monitor for availability -
  • - -
  • - - Lots of page for performance -
  • - -
  • - - Same as hobby -
  • -
- Coming soon -
-
-
-{% comment %} -
-
-
-

Frequently asked questions

-
-
-
- - -
-
-

I don't know, but the flag is a big plus. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.

-
-
- - -
-
+

We don't know yet

+

Coming soon

-{% endcomment %} {% include 'footer.html' %} diff --git a/docs/conf.py b/docs/conf.py index b758841..8b5a8d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- project = 'FromEdwin' -copyright = '2023, Sébastien Barbier' +copyright = '2024, Sébastien Barbier' author = 'Sébastien Barbier' @@ -60,7 +60,7 @@ # The short X.Y version. version = '0.9' # The full version, including alpha/beta/rc tags. -release = '0.9.1' +release = '0.9.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From a086f68a084e9261656f0491333f0525db1c4638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Sat, 18 May 2024 23:52:19 +0200 Subject: [PATCH 5/7] Fix delete user link --- django/core/middleware.py | 1 + .../templates/user/delete_confirmation.html | 41 ++++++++++--------- .../settings/templates/user/delete_done.html | 37 +++++++++-------- django/settings/views.py | 3 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/django/core/middleware.py b/django/core/middleware.py index 0f2e693..3210727 100644 --- a/django/core/middleware.py +++ b/django/core/middleware.py @@ -10,6 +10,7 @@ def middleware(request): and request.user.projects.count() == 0\ and request.path != '/welcome/'\ and request.path != '/logout/'\ + and request.path != '/settings/user/delete'\ and not request.path.startswith('/admin/')\ and request.path != '/restricted/': response = HttpResponseRedirect('/welcome/') diff --git a/django/settings/templates/user/delete_confirmation.html b/django/settings/templates/user/delete_confirmation.html index a90f4c6..d08ce03 100644 --- a/django/settings/templates/user/delete_confirmation.html +++ b/django/settings/templates/user/delete_confirmation.html @@ -1,27 +1,28 @@ -{% extends 'application.html' %} +{% extends 'base.html' %} {% block title %}Delete your account{% endblock %} -{% block content %} - -
-
-
-

- -

-
-

- Once you delete your account, you will lose all data associated with it. Are you sure you want to delete your account ? -

-
-
- - +{% block body %} +
+ +
+
+

+ +

+
+

+ Once you delete your account, you will lose all data associated with it. Are you sure you want to delete your account ? +

+
+
+ + +
+ {% csrf_token %}
- {% csrf_token %}
-
- + +
{% endblock %} \ No newline at end of file diff --git a/django/settings/templates/user/delete_done.html b/django/settings/templates/user/delete_done.html index 0abee3b..8ed1c23 100644 --- a/django/settings/templates/user/delete_done.html +++ b/django/settings/templates/user/delete_done.html @@ -1,25 +1,26 @@ -{% extends 'application.html' %} +{% extends 'base.html' %} {% block title %}{% endblock %} -{% block content %} - -
-
-
-

-
-
-

Account successfully deleted

-

It is sad to see you leave. We don't have your data anymore but feel free to recreate an account anytime.

-
-
- - Go back home - +{% block body %} +
+
+
+
+

+
+
+

Account successfully deleted

+

It is sad to see you leave. We don't have your data anymore but feel free to recreate an account anytime.

+
+
-
-
+ +
{% endblock %} diff --git a/django/settings/views.py b/django/settings/views.py index a2f1c9a..1c34a98 100644 --- a/django/settings/views.py +++ b/django/settings/views.py @@ -55,9 +55,8 @@ def user_delete(request): """ Create or edit service model """ - if request.POST: - #request.user.delete() + request.user.delete() logout(request) return render(request, 'user/delete_done.html', {}) From 173f4a3f7dda08cc8295a81f802b7481f2a8a8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Sun, 19 May 2024 00:18:24 +0200 Subject: [PATCH 6/7] Improve messages for waiting list and Deleting user account --- django/core/templates/waiting_list.html | 33 +++++++++++-------- django/settings/templates/settings.html | 18 +++++----- .../templates/user/delete_confirmation.html | 2 +- .../settings/templates/user/delete_done.html | 33 ++++++++++--------- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/django/core/templates/waiting_list.html b/django/core/templates/waiting_list.html index 959419b..7188274 100644 --- a/django/core/templates/waiting_list.html +++ b/django/core/templates/waiting_list.html @@ -2,24 +2,29 @@ {% load socialaccount account tailwind_tags %} {% block body %} +
-
- {% endblock %} diff --git a/django/settings/templates/settings.html b/django/settings/templates/settings.html index dec522e..70a3448 100644 --- a/django/settings/templates/settings.html +++ b/django/settings/templates/settings.html @@ -61,15 +61,15 @@
-

- Once you delete your account, you will lose all data associated with it. -

-
- +

+ Once you delete your account, you will lose all data associated with it. +

+
+
diff --git a/django/settings/templates/user/delete_confirmation.html b/django/settings/templates/user/delete_confirmation.html index d08ce03..61e6f30 100644 --- a/django/settings/templates/user/delete_confirmation.html +++ b/django/settings/templates/user/delete_confirmation.html @@ -16,7 +16,7 @@

- +
{% csrf_token %} diff --git a/django/settings/templates/user/delete_done.html b/django/settings/templates/user/delete_done.html index 8ed1c23..de1ac10 100644 --- a/django/settings/templates/user/delete_done.html +++ b/django/settings/templates/user/delete_done.html @@ -4,23 +4,24 @@ {% block body %}
-
-
-
-

-
-
-

Account successfully deleted

-

It is sad to see you leave. We don't have your data anymore but feel free to recreate an account anytime.

-
- +
+
+
+

+ Account successfully deleted +

+
+

+ It is sad to see you leave. We don't have your data anymore but feel free to recreate an account anytime. +

-
+ +
-
+ {% endblock %} From 743c637b6c22b3cb6c77876ac668ac374da7d49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbier?= Date: Mon, 20 May 2024 22:11:18 +0200 Subject: [PATCH 7/7] Fix incident duration calculation Related to #29 --- CHANGELOG.md | 7 +++++-- django/core/settings.py | 1 + django/incidents/handler.py | 2 +- django/incidents/utils.py | 8 +++++++- django/performances/urls.py | 2 -- django/workers/templates/prometheus_template.yml | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3869ee6..d88e2a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,9 +21,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). See for sample https://raw.githubusercontent.com/favoloso/conventional-changelog-emoji/master/CHANGELOG.md --> -## [0.9.2] - 2024-MM-DD +## [0.9.2] - 2024-05-20 ### Improvements -- Minor modification to README.md (#34) +- Fix incident duration calculation (#29) +- Minor modification to README.md (#34) +- Update dependencies (#36) +- Minor updates on website (#37) ## [0.9.1] - 2023-09-26 ### 🛠 Improvements diff --git a/django/core/settings.py b/django/core/settings.py index 29678a3..bb8ce4c 100644 --- a/django/core/settings.py +++ b/django/core/settings.py @@ -46,6 +46,7 @@ IS_SERVICE_DOWN_SCRAPE_INTERVAL_SECONDS = 60 IS_SERVICE_DOWN_TRIGGER_OUTRAGE_MINUTES = 5 +IS_SERVICE_DOWN_TRIGGER_WARNING_MINUTES = 2 # Run Lighthouse every 60 minutes LIGHTHOUSE_SCRAPE_INTERVAL_MINUTES = int(os.environ.get('LIGHTHOUSE_SCRAPE_INTERVAL_MINUTES', 60)) diff --git a/django/incidents/handler.py b/django/incidents/handler.py index fb8cfa9..7441604 100644 --- a/django/incidents/handler.py +++ b/django/incidents/handler.py @@ -28,7 +28,7 @@ def handleAlert(request, alert): incident = Incident( alert_name = alert["labels"]["alertname"], - starts_at = getStartsAt(alert), + starts_at = getStartsAt(alert, settings), ends_at = getEndsAt(alert), status = getStatus(alert), severity = getSeverity(alert), diff --git a/django/incidents/utils.py b/django/incidents/utils.py index 74521c0..5b68ca7 100644 --- a/django/incidents/utils.py +++ b/django/incidents/utils.py @@ -19,8 +19,14 @@ def getSeverity(alert): return INCIDENT_SEVERITY['CRITICAL'] return INCIDENT_SEVERITY['UNKNOWN'] -def getStartsAt(alert): +def getStartsAt(alert, settings): starts_at = timezone.make_aware(timezone.datetime.strptime(alert["startsAt"].split(".")[0], "%Y-%m-%dT%H:%M:%S")) + # Based on the severity, we update starting time to include the time before the alert + severity = getSeverity(alert) + if severity == INCIDENT_SEVERITY['CRITICAL']: + starts_at = starts_at - timedelta(minutes=settings.IS_SERVICE_DOWN_TRIGGER_OUTRAGE_MINUTES) + elif severity == INCIDENT_SEVERITY['WARNING']: + starts_at = starts_at - timedelta(minutes=settings.IS_SERVICE_DOWN_TRIGGER_WARNING_MINUTES) return starts_at def getEndsAt(alert): diff --git a/django/performances/urls.py b/django/performances/urls.py index 130e5b7..9f63f5a 100644 --- a/django/performances/urls.py +++ b/django/performances/urls.py @@ -20,6 +20,4 @@ path('api/request//performance', fetch_performance, name='fetch_performance'), # Report lighthouse performance path('api/report//performance/', save_report, name='fetch_performance'), - # Report lighthouse performance - ] diff --git a/django/workers/templates/prometheus_template.yml b/django/workers/templates/prometheus_template.yml index 85b8a4f..7357f54 100644 --- a/django/workers/templates/prometheus_template.yml +++ b/django/workers/templates/prometheus_template.yml @@ -11,7 +11,7 @@ alerting: alertmanagers: - scheme: http timeout: 10s - api_version: v1 + api_version: v2 {% if server.authbasic.all %}basic_auth: username: {{ server.authbasic.all.0.username }} password: {{ server.authbasic.all.0.password }}{% endif %}