From c282f47d2fdf2628bb59ff6ec1d7b49ae8fe5f5c Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 20 Jun 2023 03:37:40 +0000 Subject: automatic import of python-django-statusboard --- .gitignore | 1 + python-django-statusboard.spec | 604 +++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 606 insertions(+) create mode 100644 python-django-statusboard.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..dd1a5e8 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/django-statusboard-0.13.0.tar.gz diff --git a/python-django-statusboard.spec b/python-django-statusboard.spec new file mode 100644 index 0000000..7ad749f --- /dev/null +++ b/python-django-statusboard.spec @@ -0,0 +1,604 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-statusboard +Version: 0.13.0 +Release: 1 +Summary: Django app to show system status +License: GPLv2+ +URL: http://github.com/edigiacomo/django-statusboard +Source0: https://mirrors.aliyun.com/pypi/web/packages/5c/01/8a66a5415ccaed88b58591abc049cf01ace35c6887ff3c200ded82f3ca12/django-statusboard-0.13.0.tar.gz +BuildArch: noarch + +Requires: python3-django +Requires: python3-djangorestframework +Requires: python3-django-model-utils +Requires: python3-pytz + +%description +# statusboard + +[![Build Status](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml) +[![Pypi](https://img.shields.io/pypi/v/django-statusboard.svg)](https://pypi.python.org/pypi/django-statusboard/) +[![codecov](https://codecov.io/gh/edigiacomo/django-statusboard/branch/main/graph/badge.svg)](https://codecov.io/gh/edigiacomo/django-statusboard) +[![Documentation Status](https://readthedocs.org/projects/django-statusboard/badge/?version=stable)](https://django-statusboard.readthedocs.io/en/stable/?badge=stable) + +Status page application with browser and REST API interface. + +## Installation + +Install the package + +```sh +pip install django-statusboard +``` + +Add the following applications to your Django projects + +```python +INSTALLED_APPS += [ + 'django.contrib.humanize', + 'django.contrib.staticfiles', + 'rest_framework', + 'statusboard', +] +``` + +Update your urlconf: + +```python +# myproject/urls.py +urlpatterns += [ + url(r'^statusboard/$', include('statusboard.urls')), +] +``` + +Update your database + +```sh +./manage migrate +``` + +## Configuration + +You can configure the app using the dict `STATUSBOARD` in `settings.py`: + +```python +from django.templatetags.static import static + +STATUSBOARD = { + "INCIDENT_DAYS_IN_INDEX": 7, + "OPEN_INCIDENT_IN_INDEX": True, + "AUTO_REFRESH_INDEX_SECONDS": 0, + "FAVICON_DEFAULT": static('statusboard/images/statusboard-icon-default.png'), + "FAVICON_INDEX_DICT": { + 0: static('statusboard/images/statusboard-icon-operational.png'), + 1: static('statusboard/images/statusboard-icon-performance.png'), + 2: static('statusboard/images/statusboard-icon-partial.png'), + 3: static('statusboard/images/statusboard-icon-major.png'), + }, +} +``` + +* `INCIDENT_DAYS_IN_INDEX`: number of days to show in index (1 = today). +* `OPEN_INCIDENT_IN_INDEX`: show not fixed incidents in index, whether or not + the incident is older than `INCIDENT_DAYS_IN_INDEX`. +* `AUTO_REFRESH_INDEX_SECONDS`: auto refresh home page every N seconds (0 = disabled). +* `FAVICON_DEFAULT`: default favicon. +* `FAVICON_INDEX_DICT`: favicon for index, based on the worst status (default: + `FAVICON_DEFAULT`). The keys `(0, 1, 2, 3)` are the status values (see `SERVICE_STATUSES` in `statusboard/models.py`). + +## Customize pages + +The following blocks are customizable in `statusboard/base.html`: + +* `title`: title of the page +* `branding`: branding in fixed navbar +* `bootstrap_theme`: bootstrap theme +* `header`: header of the page +* `userlinks`: links in the header +* `footer`: footer div +* `style`: `CSS` files +* `script`: JavaScript files + +To customize the default style, create the file `statusboard/base.html` that +extends the original base template and customize some blocks, e.g.: + +``` +{% extends "statusboard/base.html" %} + +{% load static %} + +{% block title %} +A.C.M.E. statuspage +{% endblock %} + +{% block branding %} + +{% endblock %} + +{% block bootstrap_theme %} + + +{% endblock %} +``` + +### Example: change branding and title + +Create a `statusboard/base.html` in one of your templates dir: + +``` +{% extends `statusboard/base.html %} + +{% block title %} +ACME, Inc. +{% endblock %} + +{% block branding %} +ACME status +{% endblock %} +``` + +## Notifications + +`django-statusboard` doesn't provide an out-of-the-box notification system, but +it's easy to implement using [django signals](https://docs.djangoproject.com/en/dev/topics/signals/) or you can use [django-statusboard-notify](https://github.com/edigiacomo/django-statusboard-notify) that provides some builtin notifications (e.g. email, Telegram). + +Moreover, `django-statusboard` tracks the previous status of a service +(`Service._status`). + +```python +from django.dispatch import receiver +from django.db.models.signals import post_save +from django.core.mail import mail_admins + +from statusboard import Service + +@receiver(post_save, sender=Service) +def notify_service_update(sender, instance, **kwargs): + # Send an email to admins if the service is getting worse, otherwise do nothing. + if instance.status > instance._status: + mail_admins("Alert", "Service {} is {}".format(instance.name, instance.get_status_display())) +``` + +## REST API + +`django-statusboard` comes with a set of REST API to manage its models, based on [Django REST Framework](https://www.django-rest-framework.org/) `ModelViewSet`: + +* `/api/v0.1/servicegroup/` +* `/api/v0.1/service/` +* `/api/v0.1/incident/` +* `/api/v0.1/incidentupdate/` +* `/api/v0.1/maintenance/` + +## Development + +### Running tests + +``` +$ DJANGO_SETTINGS_MODULE=tests.test_settings python manage.py test +``` + +### Update i18n + +``` +$ cd statusboard && django-admin makemessages -l LOCALE +``` + + + +## Contact and copyright information + +Copyright (C) 2019-2023 Emanuele Di Giacomo + +django-statusboard is licensed under GPLv2+. + + +%package -n python3-django-statusboard +Summary: Django app to show system status +Provides: python-django-statusboard +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-statusboard +# statusboard + +[![Build Status](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml) +[![Pypi](https://img.shields.io/pypi/v/django-statusboard.svg)](https://pypi.python.org/pypi/django-statusboard/) +[![codecov](https://codecov.io/gh/edigiacomo/django-statusboard/branch/main/graph/badge.svg)](https://codecov.io/gh/edigiacomo/django-statusboard) +[![Documentation Status](https://readthedocs.org/projects/django-statusboard/badge/?version=stable)](https://django-statusboard.readthedocs.io/en/stable/?badge=stable) + +Status page application with browser and REST API interface. + +## Installation + +Install the package + +```sh +pip install django-statusboard +``` + +Add the following applications to your Django projects + +```python +INSTALLED_APPS += [ + 'django.contrib.humanize', + 'django.contrib.staticfiles', + 'rest_framework', + 'statusboard', +] +``` + +Update your urlconf: + +```python +# myproject/urls.py +urlpatterns += [ + url(r'^statusboard/$', include('statusboard.urls')), +] +``` + +Update your database + +```sh +./manage migrate +``` + +## Configuration + +You can configure the app using the dict `STATUSBOARD` in `settings.py`: + +```python +from django.templatetags.static import static + +STATUSBOARD = { + "INCIDENT_DAYS_IN_INDEX": 7, + "OPEN_INCIDENT_IN_INDEX": True, + "AUTO_REFRESH_INDEX_SECONDS": 0, + "FAVICON_DEFAULT": static('statusboard/images/statusboard-icon-default.png'), + "FAVICON_INDEX_DICT": { + 0: static('statusboard/images/statusboard-icon-operational.png'), + 1: static('statusboard/images/statusboard-icon-performance.png'), + 2: static('statusboard/images/statusboard-icon-partial.png'), + 3: static('statusboard/images/statusboard-icon-major.png'), + }, +} +``` + +* `INCIDENT_DAYS_IN_INDEX`: number of days to show in index (1 = today). +* `OPEN_INCIDENT_IN_INDEX`: show not fixed incidents in index, whether or not + the incident is older than `INCIDENT_DAYS_IN_INDEX`. +* `AUTO_REFRESH_INDEX_SECONDS`: auto refresh home page every N seconds (0 = disabled). +* `FAVICON_DEFAULT`: default favicon. +* `FAVICON_INDEX_DICT`: favicon for index, based on the worst status (default: + `FAVICON_DEFAULT`). The keys `(0, 1, 2, 3)` are the status values (see `SERVICE_STATUSES` in `statusboard/models.py`). + +## Customize pages + +The following blocks are customizable in `statusboard/base.html`: + +* `title`: title of the page +* `branding`: branding in fixed navbar +* `bootstrap_theme`: bootstrap theme +* `header`: header of the page +* `userlinks`: links in the header +* `footer`: footer div +* `style`: `CSS` files +* `script`: JavaScript files + +To customize the default style, create the file `statusboard/base.html` that +extends the original base template and customize some blocks, e.g.: + +``` +{% extends "statusboard/base.html" %} + +{% load static %} + +{% block title %} +A.C.M.E. statuspage +{% endblock %} + +{% block branding %} + +{% endblock %} + +{% block bootstrap_theme %} + + +{% endblock %} +``` + +### Example: change branding and title + +Create a `statusboard/base.html` in one of your templates dir: + +``` +{% extends `statusboard/base.html %} + +{% block title %} +ACME, Inc. +{% endblock %} + +{% block branding %} +ACME status +{% endblock %} +``` + +## Notifications + +`django-statusboard` doesn't provide an out-of-the-box notification system, but +it's easy to implement using [django signals](https://docs.djangoproject.com/en/dev/topics/signals/) or you can use [django-statusboard-notify](https://github.com/edigiacomo/django-statusboard-notify) that provides some builtin notifications (e.g. email, Telegram). + +Moreover, `django-statusboard` tracks the previous status of a service +(`Service._status`). + +```python +from django.dispatch import receiver +from django.db.models.signals import post_save +from django.core.mail import mail_admins + +from statusboard import Service + +@receiver(post_save, sender=Service) +def notify_service_update(sender, instance, **kwargs): + # Send an email to admins if the service is getting worse, otherwise do nothing. + if instance.status > instance._status: + mail_admins("Alert", "Service {} is {}".format(instance.name, instance.get_status_display())) +``` + +## REST API + +`django-statusboard` comes with a set of REST API to manage its models, based on [Django REST Framework](https://www.django-rest-framework.org/) `ModelViewSet`: + +* `/api/v0.1/servicegroup/` +* `/api/v0.1/service/` +* `/api/v0.1/incident/` +* `/api/v0.1/incidentupdate/` +* `/api/v0.1/maintenance/` + +## Development + +### Running tests + +``` +$ DJANGO_SETTINGS_MODULE=tests.test_settings python manage.py test +``` + +### Update i18n + +``` +$ cd statusboard && django-admin makemessages -l LOCALE +``` + + + +## Contact and copyright information + +Copyright (C) 2019-2023 Emanuele Di Giacomo + +django-statusboard is licensed under GPLv2+. + + +%package help +Summary: Development documents and examples for django-statusboard +Provides: python3-django-statusboard-doc +%description help +# statusboard + +[![Build Status](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/edigiacomo/django-statusboard/actions/workflows/build.yml) +[![Pypi](https://img.shields.io/pypi/v/django-statusboard.svg)](https://pypi.python.org/pypi/django-statusboard/) +[![codecov](https://codecov.io/gh/edigiacomo/django-statusboard/branch/main/graph/badge.svg)](https://codecov.io/gh/edigiacomo/django-statusboard) +[![Documentation Status](https://readthedocs.org/projects/django-statusboard/badge/?version=stable)](https://django-statusboard.readthedocs.io/en/stable/?badge=stable) + +Status page application with browser and REST API interface. + +## Installation + +Install the package + +```sh +pip install django-statusboard +``` + +Add the following applications to your Django projects + +```python +INSTALLED_APPS += [ + 'django.contrib.humanize', + 'django.contrib.staticfiles', + 'rest_framework', + 'statusboard', +] +``` + +Update your urlconf: + +```python +# myproject/urls.py +urlpatterns += [ + url(r'^statusboard/$', include('statusboard.urls')), +] +``` + +Update your database + +```sh +./manage migrate +``` + +## Configuration + +You can configure the app using the dict `STATUSBOARD` in `settings.py`: + +```python +from django.templatetags.static import static + +STATUSBOARD = { + "INCIDENT_DAYS_IN_INDEX": 7, + "OPEN_INCIDENT_IN_INDEX": True, + "AUTO_REFRESH_INDEX_SECONDS": 0, + "FAVICON_DEFAULT": static('statusboard/images/statusboard-icon-default.png'), + "FAVICON_INDEX_DICT": { + 0: static('statusboard/images/statusboard-icon-operational.png'), + 1: static('statusboard/images/statusboard-icon-performance.png'), + 2: static('statusboard/images/statusboard-icon-partial.png'), + 3: static('statusboard/images/statusboard-icon-major.png'), + }, +} +``` + +* `INCIDENT_DAYS_IN_INDEX`: number of days to show in index (1 = today). +* `OPEN_INCIDENT_IN_INDEX`: show not fixed incidents in index, whether or not + the incident is older than `INCIDENT_DAYS_IN_INDEX`. +* `AUTO_REFRESH_INDEX_SECONDS`: auto refresh home page every N seconds (0 = disabled). +* `FAVICON_DEFAULT`: default favicon. +* `FAVICON_INDEX_DICT`: favicon for index, based on the worst status (default: + `FAVICON_DEFAULT`). The keys `(0, 1, 2, 3)` are the status values (see `SERVICE_STATUSES` in `statusboard/models.py`). + +## Customize pages + +The following blocks are customizable in `statusboard/base.html`: + +* `title`: title of the page +* `branding`: branding in fixed navbar +* `bootstrap_theme`: bootstrap theme +* `header`: header of the page +* `userlinks`: links in the header +* `footer`: footer div +* `style`: `CSS` files +* `script`: JavaScript files + +To customize the default style, create the file `statusboard/base.html` that +extends the original base template and customize some blocks, e.g.: + +``` +{% extends "statusboard/base.html" %} + +{% load static %} + +{% block title %} +A.C.M.E. statuspage +{% endblock %} + +{% block branding %} + +{% endblock %} + +{% block bootstrap_theme %} + + +{% endblock %} +``` + +### Example: change branding and title + +Create a `statusboard/base.html` in one of your templates dir: + +``` +{% extends `statusboard/base.html %} + +{% block title %} +ACME, Inc. +{% endblock %} + +{% block branding %} +ACME status +{% endblock %} +``` + +## Notifications + +`django-statusboard` doesn't provide an out-of-the-box notification system, but +it's easy to implement using [django signals](https://docs.djangoproject.com/en/dev/topics/signals/) or you can use [django-statusboard-notify](https://github.com/edigiacomo/django-statusboard-notify) that provides some builtin notifications (e.g. email, Telegram). + +Moreover, `django-statusboard` tracks the previous status of a service +(`Service._status`). + +```python +from django.dispatch import receiver +from django.db.models.signals import post_save +from django.core.mail import mail_admins + +from statusboard import Service + +@receiver(post_save, sender=Service) +def notify_service_update(sender, instance, **kwargs): + # Send an email to admins if the service is getting worse, otherwise do nothing. + if instance.status > instance._status: + mail_admins("Alert", "Service {} is {}".format(instance.name, instance.get_status_display())) +``` + +## REST API + +`django-statusboard` comes with a set of REST API to manage its models, based on [Django REST Framework](https://www.django-rest-framework.org/) `ModelViewSet`: + +* `/api/v0.1/servicegroup/` +* `/api/v0.1/service/` +* `/api/v0.1/incident/` +* `/api/v0.1/incidentupdate/` +* `/api/v0.1/maintenance/` + +## Development + +### Running tests + +``` +$ DJANGO_SETTINGS_MODULE=tests.test_settings python manage.py test +``` + +### Update i18n + +``` +$ cd statusboard && django-admin makemessages -l LOCALE +``` + + + +## Contact and copyright information + +Copyright (C) 2019-2023 Emanuele Di Giacomo + +django-statusboard is licensed under GPLv2+. + + +%prep +%autosetup -n django-statusboard-0.13.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-statusboard -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot - 0.13.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..742fef9 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +3327775c795ce02a793beb7bc2ebc1cf django-statusboard-0.13.0.tar.gz -- cgit v1.2.3