diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index e279789..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es6": true, - "jquery": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": "latest", - "ecmaFeatures": { - "impliedStrict": true - } - }, - "rules": { - "indent": [ - "error", - 4 - ], - "quotes": [ - "error", - "single", - { - "avoidEscape": true, - "allowTemplateLiterals": true - } - ], - "semi": [ - 2, - "always" - ] - } -} diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 56b0bce..dce118e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -15,8 +15,8 @@ A clear and concise description of what the bug is. Steps to reproduce the behavior: 1. Go to '...' -2. Click on '....' -3. Scroll down to '....' +2. Click on '...' +3. Scroll down to '...' 4. See error diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5fa500b..c7eeaf6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,6 +15,6 @@ Fixes # (issue) ## Checklist: - [ ] My code follows the style guidelines of this project -- [ ] I have performed a self-review of my own code +- [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have checked my code and corrected any misspellings diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8cae055..ab16d0d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,4 +6,24 @@ updates: directory: "/" target-branch: "master" schedule: - interval: "daily" + interval: "monthly" + commit-message: + # Prefix all commit messages with "[github-actions] " + prefix: "[github-actions] " + labels: + - "github-actions" + - "dependencies" + + # Maintain dependencies for npm + - package-ecosystem: "npm" + directory: "/" + target-branch: "master" + versioning-strategy: increase + schedule: + interval: "monthly" + commit-message: + # Prefix all commit messages with "[npm] " + prefix: "[npm] " + labels: + - "npm" + - "dependencies" diff --git a/.github/workflows/automated-checks.yml b/.github/workflows/automated-checks.yml index 0e2c82b..25dd7ef 100644 --- a/.github/workflows/automated-checks.yml +++ b/.github/workflows/automated-checks.yml @@ -16,39 +16,47 @@ on: - '**' jobs: - # pre-commit Checks + # Run pre-commit Checks pre-commit: name: Pre Commit Checks runs-on: ubuntu-latest steps: + # Checkout the repository - name: Checkout uses: actions/checkout@v4 + # Set up Python - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: 'pyproject.toml' # Read the Python version from the pyproject.toml file + # Set up Node.js + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm install + - name: Run Pre Commit Checks uses: pre-commit/action@v3.0.1 # Run Test Coverage - test-coverage-aa-stable: + test-coverage: needs: [pre-commit] - name: AA Latest (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} with ${{ matrix.database }}) + name: AA Latest (Python ${{ matrix.python-version }} with ${{ matrix.database }}) runs-on: ubuntu-latest strategy: - # Set Python and Django version to test for the stable release of AllianceAuth + # Set Python versions to test against matrix: python-version: - '3.8' - '3.9' - '3.10' - '3.11' - django-version: - - '4.0' + - '3.12' # MySQL versions to test against database: # https://endoflife.date/mysql @@ -58,13 +66,13 @@ jobs: - mariadb:10.4 # Maintained until: 18 June 2024 - mariadb:10.5 # Maintained until: 24 June 2025 - mariadb:10.6 # [LTS] Maintained until: July 2026 - - mariadb:10.10 # Maintained until: November 2023 - mariadb:10.11 # [LTS] Maintained until: February 2028 - mariadb:11.0 # Maintained until: June 2024 - mariadb:11.1 # Maintained until: August 2024 -# continue-on-error: ${{ matrix.python-version == '3.11-dev' }} +# continue-on-error: ${{ matrix.python-version == '3.12' }} + # Set up services services: database: image: ${{ matrix.database }} @@ -76,157 +84,95 @@ jobs: options: --tmpfs /var/lib/mysql steps: + # Checkout the repository - name: Checkout uses: actions/checkout@v4 + # Install redis - name: Install redis run: sudo apt-get install -y redis-tools redis-server + # Verify that redis is up - name: Verify that redis is up run: redis-cli ping + # Set up Python - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + # Install Tox and any other packages - name: Install Tox and any other packages run: | python -m pip install --upgrade pip python -m pip install --upgrade tox tox-gh-actions + # Run Tox with the specified environment - name: Run Tox env: - TOX_ENV: allianceauth-stable + TOX_ENV: allianceauth-latest DB_HOST: 127.0.0.1 DB_USER: root DB_PASSWORD: temp_password_aa_tox_tests - # Run tox using the version of Python in `PATH` run: tox -v -e ${{ env.TOX_ENV }} + # Upload coverage to Codecov - name: Upload Coverage if: ${{ ( - github.event_name == 'pull_request' || - ( - github.event_name == 'push' && - github.ref == 'refs/heads/master' + github.event_name == 'pull_request' + || ( + github.event_name == 'push' + && github.ref == 'refs/heads/master' ) - ) && - ( - matrix.python-version == '3.10' && - matrix.database == 'mariadb:10.11' && - matrix.django-version == '4.0' + ) + && ( + matrix.python-version == '3.10' + && matrix.database == 'mariadb:10.11' ) }} uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml # optional # flags: unittests # optional # name: codecov-umbrella # optional # fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false) -# test-coverage-aa-dev: -# needs: [ test-coverage-aa-stable ] -# name: AA Dev (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} with ${{ matrix.database }}) -# runs-on: ubuntu-latest -# -# strategy: -# # Set Python and Django version to test for the alpha/beta release of AllianceAuth -# matrix: -# # Python versions -# python-version: -# - '3.8' -# - '3.9' -# - '3.10' -# - '3.11' -# # Django versions -# django-version: -# - '4.0' -# # MySQL versions to test against -# database: -# - mysql:5.7 -# - mysql:8.0 -# - mariadb:10.3 -# - mariadb:10.4 -# - mariadb:10.5 -# - mariadb:10.6 -# - mariadb:10.7 -# - mariadb:10.8 -# - mariadb:10.9 -# -# continue-on-error: ${{ matrix.python-version == '3.11' }} -# -# services: -# database: -# image: ${{ matrix.database }} -# env: -# MYSQL_ROOT_PASSWORD: foobar -# MYSQL_DATABASE: tox_allianceauth -# ports: -# - 3306:3306 -# options: --tmpfs /var/lib/mysql -# -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Install redis -# run: sudo apt-get install -y redis-tools redis-server -# -# - name: Verify that redis is up -# run: redis-cli ping -# -# - name: Setup Python ${{ matrix.python-version }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Install Tox and any other packages -# run: | -# python -m pip install --upgrade pip -# python -m pip install --upgrade tox tox-gh-actions -# -# - name: Run Tox -# # Run tox using the version of Python in `PATH` -# run: tox -v -# env: -# DJANGO: ${{ matrix.django-version }} -# ALLIANCEAUTH: testing -# DB_HOST: 127.0.0.1 -# DB_USER: root -# DB_PASSWORD: temp_password_aa_tox_tests - - # Pypi Build Test + # Run PyPi Build Test pypi-build-test: - needs: [ test-coverage-aa-stable ] -# needs: [ test-coverage-aa-stable, test-coverage-aa-dev ] + needs: [ test-coverage ] name: PyPi Build Test runs-on: ubuntu-latest steps: + # Checkout the repository - name: Checkout uses: actions/checkout@v4 + # Set up Python - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: 'pyproject.toml' # Read the Python version from the pyproject.toml file + # Install Tools - name: Install Tools run: | python -m pip install --upgrade pip python -m pip install --upgrade build python -m pip install --upgrade setuptools wheel + # Build Package - name: Package Build env: STACKMANAGER_VERSION: 9999 run: | python -m build + # Upload Build Artifacts - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/potential-duplicates.yml b/.github/workflows/potential-duplicates.yml index 3ee4c8e..19514e4 100644 --- a/.github/workflows/potential-duplicates.yml +++ b/.github/workflows/potential-duplicates.yml @@ -1,3 +1,5 @@ +# Check potential duplicates when an issue is opened or edited. +# # https://github.com/wow-actions/potential-duplicates name: Potential Duplicates @@ -9,6 +11,7 @@ on: jobs: run: runs-on: ubuntu-latest + steps: - uses: wow-actions/potential-duplicates@v1 with: @@ -25,7 +28,7 @@ jobs: state: all # If similarity is higher than this threshold([0,1]), issue will be marked as duplicate. threshold: 0.6 - # Reactions to be add to comment when potential duplicates are detected. + # Reactions to be added to comment when potential duplicates are detected. # Available reactions: "-1", "+1", "confused", "laugh", "heart", "hooray", "rocket", "eyes" reactions: 'eyes, confused' # Comment to post when potential duplicates are detected. diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index cbb5dc2..7182b37 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -7,24 +7,29 @@ on: jobs: release: + # Release to PyPI name: Release on Pypi runs-on: ubuntu-latest steps: + # Checkout the repository - name: Checkout uses: actions/checkout@v4 + # Set up Python - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: 'pyproject.toml' # Read the Python version from the pyproject.toml file + # Install Tools - name: Install Tools run: | python -m pip install --upgrade pip python -m pip install --upgrade build python -m pip install --upgrade setuptools wheel twine + # Package and Upload - name: Package and Upload env: STACKMANAGER_VERSION: ${{ github.event.release.tag_name }} diff --git a/.gitignore b/.gitignore index 8ae1f82..3201ead 100644 --- a/.gitignore +++ b/.gitignore @@ -2,14 +2,15 @@ /dist/ /*.egg-info/ .idea/ +.tox/ +htmlcov/ +node_modules/ *.log *.tmp *.bak *.old __pycache__ - -/.coverage -/htmlcov/ -/.tox/ +.coverage /coverage.xml +alliance_auth.sqlite3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48babdf..4fcaf83 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,8 @@ ci: autoupdate_branch: '' autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' autoupdate_schedule: monthly - skip: [] + skip: + - eslint # Fails due to missing node environment in CI submodules: false # pre-commit setup @@ -206,7 +207,7 @@ repos: name: Django upgrade description: "Upgrade Django code to a target version." args: - - --target-version=4.0 # Minimum supported Django version for AA. Update as needed. + - --target-version=4.2 # Minimum supported Django version for AA. Update as needed. - repo: https://github.com/asottile/pyupgrade rev: v3.15.0 @@ -232,7 +233,7 @@ repos: description: "Check for extraneous `# noqa` comments." - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 5.12.0 hooks: - id: isort name: Isort @@ -307,7 +308,7 @@ repos: description: "Validate the pyproject.toml file." - repo: https://github.com/pylint-dev/pylint - rev: v3.0.3 + rev: v3.0.1 hooks: - id: pylint name: Pylint diff --git a/.stylelintrc.json b/.stylelintrc.json index dd675b0..80ea591 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -2,6 +2,18 @@ "extends": "stylelint-config-standard", "rules": { "color-no-hex": true, + "at-rule-empty-line-before": [ + "always", + { + "except": [ + "blockless-after-same-name-blockless", + "first-nested" + ], + "ignore": [ + "after-comment" + ] + } + ], "number-max-precision": 5, "no-descending-specificity": null, "media-feature-range-notation": "prefix", diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f6d869..b710098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,70 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + + ## \[In Development\] - Unreleased + + +## \[2.0.0-beta.2\] - 2024-03-08 + +> \[!NOTE\] +> +> **This version needs at least Alliance Auth v4.0.0b2!** +> +> Please make sure to update your Alliance Auth instance before +> you install this version, otherwise, an update to Alliance Auth will +> be pulled in unsupervised. + +### Added + +- Dashboard widget for administrative users + +## \[2.0.0-beta.1\] - 2024-02-18 + +> \[!NOTE\] +> +> **This version needs at least Alliance Auth v4.0.0b1!** +> +> Please make sure to update your Alliance Auth instance before +> you install this version, otherwise, an update to Alliance Auth will +> be pulled in unsupervised. + +### Added + +- Compatibility to Alliance Auth v4 + - Bootstrap 5 + - Django 4.2 + +### Removed + +- Compatibility to Alliance Auth v3 + ## \[1.14.2\] - 2023-09-26 ### Added @@ -137,7 +199,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- Category with names containing a space couldn't be opened (e.g. Faction Warfare) +- Category with names containing a space couldn't be opened (e.g., Faction Warfare) ### Changed @@ -242,7 +304,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added -- Warning when ESI status couldn't be loaded, for what ever reason +- Warning when ESI status couldn't be loaded, for whatever reason ## \[0.1.0-alpha.2\] - 2020-10-11 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c8fac1..bc7919a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,23 +24,23 @@ ______________________________________________________________________ ## Development Environment -To develop and test your change you will need a development environment on your +To develop and test your change, you will need a development environment on your local machine. There are many different options to choose from. But please make sure that you can run pre-commit checks and tox tests on your local machine. -If you are on Windows or Linux you can use the [AA guide for setting up a dev +If you are on Windows or Linux, you can use the [AA guide for setting up a dev environment][aa guide for setting up a dev environment]. ## Code Formatting and Linting ### Python -This app is utilizing the [Black code style]. Every commit has to adhere to it. +This app is using the [Black code style]. Every commit has to adhere to it. -When making changes to the source code, please always reformat the changed files in -order to ensure consistent formatting across the code base. +When making changes to the source code, please always reformat the changed files +to ensure consistent formatting across the code base. -To reformat run the following from the app's root directory: +To reformat, run the following from the app's root directory: ```shell pre-commit run black @@ -77,7 +77,7 @@ uglifyjs script.js -o script.min.js --source-map "url='script.min.js.map'" --com ### CSS -The CSS should be written in a modern manner. Colour definitions should be in +The CSS should be written in a modern manner. Color definitions should be in modern RGB(A) (`rgb(255 255 255)`, `rgba(255 255 255 / 50%)`) for example. A linter configuration is declared as `.stylelintrc.json` in the app's root @@ -105,9 +105,9 @@ csso -i styles.css -o styles.min.css -s file This repository uses [pre-commit] to verify compliance with formatting / linting rules. To use: -1. Install `pre-commit` to your system. -1. Run' pre-commit install' inside the app's root directory. -1. You're all done! Code will be checked automatically using git hooks. +- Install `pre-commit` to your system. +- Run' pre-commit install' inside the app's root directory. +- You're all done! Code will be checked automatically using git hooks. You can check if your code to commit adheres to the given style by simply running: @@ -143,7 +143,7 @@ The following will be checked by `pre-commit` (among others): To contribute code via pull request, make sure that you fork the repository and branch your changes from the `master` branch. -We strongly recommend to create a new branch for every new feature or change you +We strongly recommend creating a new branch for every new feature or change you plan to be submitting as merge request. Please make sure to keep the `master` branch of your fork in sync with the main repository to avoid conflicts. @@ -152,7 +152,7 @@ Request) and start a discussion if your idea is generally wanted and considered good addition to the app in general. Please feel free to create your merge request early and while you are still not -finished developing to flag that you are working on a specific topic. Merge request +finished developing to flag that you are working on a specific topic. Merge requests that are not yet ready to review should be marked as DRAFT. You can signal others that your merge request is ready for review by removing the DRAFT flag again. @@ -162,12 +162,12 @@ Please update existing or provide additional unit tests for your changes. Note t your merge request might fail if it reduces the current level of test coverage. We are using [Python unittest] with the Django `TestCase` class for all tests. In -addition we are using some following 3rd party test tools: +addition, we are using some following third party test tools: - django-webtest / [WebTest] - testing the web UI -- [request-mock] - testing requests with the requests library -- [tox] - Running the test suite -- [coverage] - Measuring the test coverage +- [request-mock] — testing requests with the `requests` library +- [tox] — Running the test suite +- [coverage] — Measuring the test coverage ### Checklist @@ -182,7 +182,7 @@ Before you submit a pull request, please make sure that: ## Translation This app is fully translation-ready and translations are handled via [Weblate]. If -you like to contribute to the app's translation or simply improve it, feel free to +you like to contribute to the app's translation or improve it, feel free to register on my [Weblate] instance and start translating. diff --git a/Makefile b/Makefile index 31e2e5d..bd5344f 100644 --- a/Makefile +++ b/Makefile @@ -47,5 +47,10 @@ build_test: tox_tests: export USE_MYSQL=False; \ - tox -v -e allianceauth-stable; \ + tox -v -e allianceauth-latest; \ + rm -rf .tox/ + +tox_tests_testing: + export USE_MYSQL=False; \ + tox -v -e allianceauth-testing; \ rm -rf .tox/ diff --git a/README.md b/README.md index 90099ca..7bdc4a1 100644 --- a/README.md +++ b/README.md @@ -36,19 +36,23 @@ ______________________________________________________________________ ______________________________________________________________________ -![AA ESI Status](https://raw.githubusercontent.com/ppfeufer/aa-esi-status/master/docs/images/aa-esi-status.jpg) +![AA ESI Status](https://raw.githubusercontent.com/ppfeufer/aa-esi-status/master/docs/images/aa-esi-status.jpg "AA ESI Status") ## Installation -> **Note** +> \[!NOTE\] +> +> **AA ESI Status >= 2.0.0 needs at least Alliance Auth v4.0.0!** > -> This app is a plugin for Alliance Auth. If you don't have Alliance Auth running -> already, please install it first before proceeding. (See the official [AA -> installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html) for details) +> Please make sure to update your Alliance Auth instance _before_ you install this +> module or update to the latest version, otherwise an update to Alliance Auth will +> be pulled in unsupervised. > -> AA ESI Status needs at least **Alliance Auth v3.6.1**. Please make sure to meet -> this condition _before_ installing this app, otherwise an update to Alliance Auth -> will be pulled in unsupervised. +> The last version of AA ESI Status that supports Alliance Auth v3 is 1.14.2 + +This app is a plugin for Alliance Auth. If you don't have Alliance Auth running +already, please install it first before proceeding. +(See the official [AA installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html) for details) ### Step 1: Install the App diff --git a/codecov.yml b/codecov.yml index 1b9c96c..db4725c 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,19 +1,21 @@ codecov: - require_ci_to_pass: yes + require_ci_to_pass: true + +comment: + layout: header, reach, changes, diff, files, footer + require_changes: false coverage: precision: 2 + range: + - 70.0 + - 100.0 round: up - range: "70...100" parsers: gcov: branch_detection: - conditional: yes - loop: yes - method: no - macro: no - -comment: - layout: header, reach, changes, diff, files, footer - require_changes: no + conditional: true + loop: true + macro: false + method: false diff --git a/docs/images/aa-esi-status.jpg b/docs/images/aa-esi-status.jpg index 8fd1808..dfc126e 100644 Binary files a/docs/images/aa-esi-status.jpg and b/docs/images/aa-esi-status.jpg differ diff --git a/docs/images/weblate/aa-esi-status_app-name.jpg b/docs/images/weblate/aa-esi-status_app-name.jpg new file mode 100644 index 0000000..51516bb Binary files /dev/null and b/docs/images/weblate/aa-esi-status_app-name.jpg differ diff --git a/docs/images/weblate/aa-esi-status_app-translation-footer.jpg b/docs/images/weblate/aa-esi-status_app-translation-footer.jpg new file mode 100644 index 0000000..17e01d3 Binary files /dev/null and b/docs/images/weblate/aa-esi-status_app-translation-footer.jpg differ diff --git a/docs/images/weblate/aa-esi-status_green-endpoints.jpg b/docs/images/weblate/aa-esi-status_green-endpoints.jpg new file mode 100644 index 0000000..467a672 Binary files /dev/null and b/docs/images/weblate/aa-esi-status_green-endpoints.jpg differ diff --git a/docs/images/weblate/aa-esi-status_red-endpoints.jpg b/docs/images/weblate/aa-esi-status_red-endpoints.jpg new file mode 100644 index 0000000..62499bb Binary files /dev/null and b/docs/images/weblate/aa-esi-status_red-endpoints.jpg differ diff --git a/docs/images/weblate/aa-esi-status_yellow-endpoints.jpg b/docs/images/weblate/aa-esi-status_yellow-endpoints.jpg new file mode 100644 index 0000000..df3493d Binary files /dev/null and b/docs/images/weblate/aa-esi-status_yellow-endpoints.jpg differ diff --git a/esistatus/__init__.py b/esistatus/__init__.py index 71d8fca..2330b64 100644 --- a/esistatus/__init__.py +++ b/esistatus/__init__.py @@ -2,10 +2,8 @@ A couple of variables to use throughout the app """ -# Standard Library -from importlib import metadata +# Django +from django.utils.translation import gettext_lazy as _ -__version__ = metadata.version("aa-esi-status") -__title__ = "ESI Status" - -del metadata +__version__ = "2.0.0-beta.2" +__title__ = _("ESI Status") diff --git a/esistatus/auth_hooks.py b/esistatus/auth_hooks.py index 85b84e1..5b18464 100644 --- a/esistatus/auth_hooks.py +++ b/esistatus/auth_hooks.py @@ -2,15 +2,14 @@ Hook into AA """ -# Django -from django.utils.translation import gettext_lazy as _ - # Alliance Auth from allianceauth import hooks +from allianceauth.hooks import DashboardItemHook from allianceauth.services.hooks import MenuItemHook, UrlHook # AA ESI Status from esistatus import __title__, urls +from esistatus.views import dashboard_widget class AaEsiStatusMenuItem(MenuItemHook): # pylint: disable=too-few-public-methods @@ -22,27 +21,42 @@ def __init__(self): # Setup menu entry for sidebar MenuItemHook.__init__( self, - _(__title__), - "fas fa-signal fa-fw", - "esistatus:index", + text=__title__, + classes="fa-solid fa-signal", + url_name="esistatus:index", navactive=["esistatus:"], ) def render(self, request): """ Check if the user has the permission to view this app + :param request: + :type request: :return: + :rtype: """ return MenuItemHook.render(self, request) +class AaEsiStatusDashboardHook(DashboardItemHook): + """ + This class adds the widget to the dashboard + """ + + def __init__(self): + # Setup dashboard widget + DashboardItemHook.__init__(self=self, view_function=dashboard_widget, order=1) + + @hooks.register("menu_item_hook") def register_menu(): """ Register our menu item - :return: + + :return: The hook + :rtype: AaEsiStatusMenuItem """ return AaEsiStatusMenuItem() @@ -52,7 +66,9 @@ def register_menu(): def register_urls(): """ Register our base url - :return: + + :return: The hook + :rtype: UrlHook """ return UrlHook( @@ -61,3 +77,15 @@ def register_urls(): base_url=r"^esi-status/", excluded_views=["esistatus.views.index"], ) + + +@hooks.register("dashboard_hook") +def register_esi_hook(): + """ + Register our dashboard hook + + :return: The hook + :rtype: AaEsiStatusDashboardHook + """ + + return AaEsiStatusDashboardHook() diff --git a/esistatus/constants.py b/esistatus/constants.py index fee93be..925f8d1 100644 --- a/esistatus/constants.py +++ b/esistatus/constants.py @@ -10,7 +10,7 @@ VERBOSE_NAME = "AA ESI Status for Alliance Auth" -slugified_name: str = slugify(VERBOSE_NAME, allow_unicode=True) +slugified_name: str = slugify(value=VERBOSE_NAME, allow_unicode=True) github_url: str = "https://github.com/ppfeufer/aa-esi-status" USER_AGENT = f"{slugified_name} v{__version__} {github_url}" diff --git a/esistatus/static/esistatus/css/aa-bootstrap-fix.css b/esistatus/static/esistatus/css/aa-bootstrap-fix.css deleted file mode 100644 index 3b8d73e..0000000 --- a/esistatus/static/esistatus/css/aa-bootstrap-fix.css +++ /dev/null @@ -1,13 +0,0 @@ -/* Attempting to fix AA's wrong usage of bootstrap classes -------------------------------------------------------------------------------------- */ -@media all { - #site-body-wrapper.row { - margin-left: 0; - } -} - -@media all and (min-width: 768px) { - #site-body-wrapper.row { - margin-left: -15px; - } -} diff --git a/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css b/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css deleted file mode 100644 index d9ec3d3..0000000 --- a/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css +++ /dev/null @@ -1,2 +0,0 @@ -@media all{#site-body-wrapper.row{margin-left:0}}@media all and (min-width:768px){#site-body-wrapper.row{margin-left:-15px}} -/*# sourceMappingURL=aa-bootstrap-fix.min.css.map */ \ No newline at end of file diff --git a/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css.map b/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css.map deleted file mode 100644 index b168ade..0000000 --- a/esistatus/static/esistatus/css/aa-bootstrap-fix.min.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["aa-bootstrap-fix.css"],"names":[],"mappings":"AAEA,A,WACI,sB,CACI,eAIR,A,iCACI,sB,CACI,mB","file":"aa-bootstrap-fix.css","sourcesContent":["/* Attempting to fix AA's wrong usage of bootstrap classes\n------------------------------------------------------------------------------------- */\n@media all {\n #site-body-wrapper.row {\n margin-left: 0;\n }\n}\n\n@media all and (min-width: 768px) {\n #site-body-wrapper.row {\n margin-left: -15px;\n }\n}\n"]} \ No newline at end of file diff --git a/esistatus/static/esistatus/css/esistatus.css b/esistatus/static/esistatus/css/esistatus.css index 6ad3864..ecea2f5 100644 --- a/esistatus/static/esistatus/css/esistatus.css +++ b/esistatus/static/esistatus/css/esistatus.css @@ -1,25 +1,6 @@ @media all { - .aa-esistatus-header-addition { - display: block; - } - - .aa-esistatus .panel-footer .panel-heading { - cursor: pointer; - } - - .aa-esistatus .panel-footer .panel-default, - .aa-esistatus .panel-footer .panel-default .panel-body p:last-child { + .aa-esistatus .card-footer .card-default, + .aa-esistatus .card-footer .card-default .card-body p:last-child { margin-bottom: 0; } - - .aa-esistatus-footer { - border-top: 1px solid rgb(236 240 241); - font-size: 85%; - margin-top: 1rem; - padding-top: 1rem; - } - - .template-dark-mode .aa-esistatus-footer { - border-color: rgb(70 69 69); - } } diff --git a/esistatus/static/esistatus/css/esistatus.min.css b/esistatus/static/esistatus/css/esistatus.min.css index f859f1d..6ccb2bb 100644 --- a/esistatus/static/esistatus/css/esistatus.min.css +++ b/esistatus/static/esistatus/css/esistatus.min.css @@ -1,2 +1,2 @@ -@media all{.aa-esistatus-header-addition{display:block}.aa-esistatus .panel-footer .panel-heading{cursor:pointer}.aa-esistatus .panel-footer .panel-default,.aa-esistatus .panel-footer .panel-default .panel-body p:last-child{margin-bottom:0}.aa-esistatus-footer{border-top:1px solid rgb(236 240 241);font-size:85%;margin-top:1rem;padding-top:1rem}.template-dark-mode .aa-esistatus-footer{border-color:rgb(70 69 69)}} +@media all{.aa-esistatus .card-footer .card-default,.aa-esistatus .card-footer .card-default .card-body p:last-child{margin-bottom:0}} /*# sourceMappingURL=esistatus.min.css.map */ \ No newline at end of file diff --git a/esistatus/static/esistatus/css/esistatus.min.css.map b/esistatus/static/esistatus/css/esistatus.min.css.map index 842666b..1516242 100644 --- a/esistatus/static/esistatus/css/esistatus.min.css.map +++ b/esistatus/static/esistatus/css/esistatus.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["esistatus.css"],"names":[],"mappings":"AAAA,A,WACI,6B,CACI,a,CAGJ,0C,CACI,c,CAGJ,0C,CACA,mE,CACI,e,CAGJ,oB,CACI,qC,CACA,a,CACA,e,CACA,gB,CAGJ,wC,CACI,4B","file":"esistatus.css","sourcesContent":["@media all {\n .aa-esistatus-header-addition {\n display: block;\n }\n\n .aa-esistatus .panel-footer .panel-heading {\n cursor: pointer;\n }\n\n .aa-esistatus .panel-footer .panel-default,\n .aa-esistatus .panel-footer .panel-default .panel-body p:last-child {\n margin-bottom: 0;\n }\n\n .aa-esistatus-footer {\n border-top: 1px solid rgb(236 240 241);\n font-size: 85%;\n margin-top: 1rem;\n padding-top: 1rem;\n }\n\n .template-dark-mode .aa-esistatus-footer {\n border-color: rgb(70 69 69);\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["esistatus.css"],"names":[],"mappings":"AAAA,A,WACI,wC,CACA,gE,CACI,iB","file":"esistatus.css","sourcesContent":["@media all {\n .aa-esistatus .card-footer .card-default,\n .aa-esistatus .card-footer .card-default .card-body p:last-child {\n margin-bottom: 0;\n }\n}\n"]} \ No newline at end of file diff --git a/esistatus/templates/esistatus/base.html b/esistatus/templates/esistatus/base.html index 53e9fc5..6687404 100644 --- a/esistatus/templates/esistatus/base.html +++ b/esistatus/templates/esistatus/base.html @@ -1,20 +1,28 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} -{% block page_title %}{% translate "ESI Status" %}{% endblock %} +{% block page_title %} + {% translate "ESI Status" %} +{% endblock %} + +{% block header_nav_brand %} + {% translate "ESI Status" %} +{% endblock header_nav_brand %} {% block content %}
-
- {% block aa_esistatus_header %}{% endblock %} -
+ {% if not user.is_authenticated %} +
+ {% block aa_esistatus_header %}{% endblock %} +
+ {% endif %}
{% block aa_esistatus_body %}{% endblock %}
- diff --git a/esistatus/templates/esistatus/dashboard-widget.html b/esistatus/templates/esistatus/dashboard-widget.html new file mode 100644 index 0000000..2cc6be7 --- /dev/null +++ b/esistatus/templates/esistatus/dashboard-widget.html @@ -0,0 +1,26 @@ +
+ + diff --git a/esistatus/templates/esistatus/index.html b/esistatus/templates/esistatus/index.html index 845bf5b..5a9dbd4 100644 --- a/esistatus/templates/esistatus/index.html +++ b/esistatus/templates/esistatus/index.html @@ -1,7 +1,7 @@ {% extends "esistatus/base.html" %} {% load i18n %} -{% load esistatus_versioned_static %} +{% load esistatus %} {% block aa_esistatus_header %} {% translate "ESI Status" as translated_header %} @@ -20,14 +20,15 @@ {% translate "Green Endpoints" as translated_header_green %} {% include 'esistatus/partials/endpoints.html' with title=translated_header_green status="green" data=esi_endpoint_status.green %} {% else %} -

- {% translate "Couldn't read the ESI status. Please try and reload the page. If that doesn't help, it is possible that ESI might be down entirely." %} -

+
+

+ {% translate "Couldn't read the ESI status. Please try and reload the page. If that doesn't help, it is possible that ESI might be down entirely." %} +

+
{% endif %}
{% endblock %} {% block extra_css %} - - + {% endblock %} diff --git a/esistatus/templates/esistatus/partials/dashboard-widget/esi-status.html b/esistatus/templates/esistatus/partials/dashboard-widget/esi-status.html new file mode 100644 index 0000000..428057d --- /dev/null +++ b/esistatus/templates/esistatus/partials/dashboard-widget/esi-status.html @@ -0,0 +1,30 @@ +{% load i18n %} + +
+
+
+ {% translate "ESI Status" %} +
+
+ +
+
+ {% translate "Red Endpoints" as translated_header_red %} + {% include 'esistatus/partials/endpoints.html' with title=translated_header_red status="red" data=esi_endpoint_status.red with_details=False %} + + {% translate "Yellow Endpoints" as translated_header_yellow %} + {% include 'esistatus/partials/endpoints.html' with title=translated_header_yellow status="yellow" data=esi_endpoint_status.yellow with_details=False %} + + {% translate "Green Endpoints" as translated_header_green %} + {% include 'esistatus/partials/endpoints.html' with title=translated_header_green status="green" data=esi_endpoint_status.green with_details=False %} +
+ + +
+
diff --git a/esistatus/templates/esistatus/partials/endpoints.html b/esistatus/templates/esistatus/partials/endpoints.html index e636151..c88c03f 100644 --- a/esistatus/templates/esistatus/partials/endpoints.html +++ b/esistatus/templates/esistatus/partials/endpoints.html @@ -1,40 +1,41 @@ - -
-
-
-

+
+
+
+
{{ title }} -

+
-
- {{ data.count }}
+
+ {{ data.count }}
{{ data.percentage }}
-
diff --git a/esistatus/templates/esistatus/partials/footer/app-translation-footer.html b/esistatus/templates/esistatus/partials/footer/app-translation-footer.html index 2070b47..8dfbecc 100644 --- a/esistatus/templates/esistatus/partials/footer/app-translation-footer.html +++ b/esistatus/templates/esistatus/partials/footer/app-translation-footer.html @@ -1,7 +1,7 @@ {% load i18n %}