Skip to content

Commit

Permalink
Merge branch 'master' into reorder-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier authored Aug 1, 2024
2 parents 97d986a + 48148f3 commit 75dade8
Show file tree
Hide file tree
Showing 42 changed files with 247 additions and 125 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Open a bug report
title: "[bug] "
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of the bug or unexpected behavior.

**Steps To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**System Informatioon:**
- OS: [e.g. Ubuntu 24.04 LTS]
- Python Version: [e.g. Python 3.11.2]
- Django Version: [e.g. Django 4.2.5]
- Browser and Browser Version (if applicable): [e.g. Chromium v126.0.6478.126]
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[feature] "
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Question
about: Please use the Discussion Forum to ask questions
title: "[question] "
labels: question
assignees: ''

---

Please use the [Discussion Forum](https://github.com/orgs/openwisp/discussions) to ask questions.

We will take care of moving the discussion to a more relevant repository if needed.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
commit-message:
prefix: "[deps] "
- package-ecosystem: "github-actions" # Check for GitHub Actions updates
directory: "/" # The root directory where the Ansible role is located
schedule:
interval: "monthly" # Check for updates weekly
commit-message:
prefix: "[ci] "
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Checklist

- [ ] I have read the [OpenWISP Contributing Guidelines](http://openwisp.io/docs/developer/contributing.html).
- [ ] I have manually tested the changes proposed in this pull request.
- [ ] I have written new test cases for new code and/or updated existing tests for changes to existing code.
- [ ] I have updated the documentation.

## Reference to Existing Issue

Closes #<issue-number>.

Please [open a new issue](https://github.com/openwisp/openwisp-network-topology/issues/new/choose) if there isn't an existing issue yet.

## Description of Changes

Please describe these changes.

## Screenshot

Please include any relevant screenshots.
88 changes: 39 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ on:
jobs:
build:
name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

services:
redis:
image: redis
ports:
- 6379:6379

strategy:
fail-fast: false
Expand All @@ -27,77 +33,61 @@ jobs:
- django~=4.2.0

steps:
- name: Install system packages
run: |
sudo apt update &&
sudo apt -qq install \
sqlite3 \
gdal-bin \
libproj-dev \
libgeos-dev \
libspatialite-dev \
spatialite-bin \
libsqlite3-mod-spatialite
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system packages
- name: Install Dependencies
id: deps
run: |
sudo apt update
sudo apt-get -qq -y install sqlite3 gdal-bin libproj-dev \
libgeos-dev libspatialite-dev spatialite-bin \
sudo apt update -qq
sudo apt -qq install \
sqlite3 \
gdal-bin \
libproj-dev \
libgeos-dev \
libspatialite-dev \
spatialite-bin \
libsqlite3-mod-spatialite
- name: Install python system packages
run: pip install -U pip wheel setuptools

- name: Start InfluxDB and Redis container
run: docker-compose up -d influxdb redis

- name: Install test dependencies
run: |
pip install -U -r requirements-test.txt
pip install --force-reinstall https://github.com/openwisp/openwisp-controller/tarball/master
- name: Install openwisp-network-topology
run: |
pip install -U pip wheel setuptools
pip install -U -e .
pip install -U -r requirements-test.txt
pip install ${{ matrix.django-version }}
# start influxdb
docker compose up -d influxdb
- name: QA checks
run: ./run-qa-checks

- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run runtests.py --parallel
WIFI_MESH=1 coverage run runtests.py
WIFI_MESH=1 coverage run runtests.py --parallel
SAMPLE_APP=1 coverage run ./runtests.py --parallel
coverage combine
SAMPLE_APP=1 ./runtests.py --parallel --keepdb
coverage xml
- name: Upload Coverage
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: |
python-${{ matrix.python-version }}-${{ matrix.django-version }}
COVERALLS_PARALLEL: true
if: ${{ success() }}
uses: coverallsapp/github-action@v2
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.env.env }}
github-token: ${{ secrets.GITHUB_TOKEN }}

coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
14 changes: 6 additions & 8 deletions openwisp_network_topology/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def _message(self, request, rows, suffix, level=messages.SUCCESS):
)
self.message_user(request, '{0} {1}'.format(prefix, suffix), level=level)

@admin.action(
description=_('Update selected topologies (FETCH strategy only)'),
permissions=['change'],
)
def update_selected(self, request, queryset):
items = list(queryset)
failed = []
Expand Down Expand Up @@ -196,22 +200,16 @@ def update_selected(self, request, queryset):
message = _("ignored (not using FETCH strategy)")
self._message(request, total_ignored, message, level=messages.WARNING)

update_selected.short_description = _(
'Update selected topologies (FETCH strategy only)'
)

@admin.action(description=_('Publish selected topologies'), permissions=['change'])
def publish_selected(self, request, queryset):
rows_updated = queryset.update(published=True)
self._message(request, rows_updated, _('successfully published'))

publish_selected.short_description = _('Publish selected topologies')

@admin.action(description=_('Unpublish selected items'), permissions=['change'])
def unpublish_selected(self, request, queryset):
rows_updated = queryset.update(published=False)
self._message(request, rows_updated, _('successfully unpublished'))

unpublish_selected.short_description = _('Unpublish selected items')

def visualize_view(self, request, pk):
graph_url, history_url = self.get_graph_urls(request, pk)
context = self.admin_site.each_context(request)
Expand Down
1 change: 0 additions & 1 deletion openwisp_network_topology/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class RequireAuthentication(APIView):

if app_settings.TOPOLOGY_API_AUTH_REQUIRED:
authentication_classes = [
SessionAuthentication,
Expand Down
1 change: 0 additions & 1 deletion openwisp_network_topology/base/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


class AbstractTopology(ShareableOrgMixin, TimeStampedEditableModel):

label = models.CharField(_('label'), max_length=64)
parser = models.CharField(
_('format'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.TOPOLOGY_TOPOLOGY_MODEL),
('topology_device', '0001_initial'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _add_permission_to_group(group, models, operations):


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.TOPOLOGY_TOPOLOGY_MODEL),
('topology_device', '0002_wifimesh'),
Expand Down
2 changes: 2 additions & 0 deletions openwisp_network_topology/integrations/device/overrides.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import swapper
from django.utils.translation import gettext_lazy as _

Node = swapper.load_model('topology', 'Node')
Link = swapper.load_model('topology', 'Link')
Expand Down Expand Up @@ -107,6 +108,7 @@ def link_get_queryset(cls, qs):


Node.get_name = get_name
Node.get_name.short_description = _('label')
Node.get_organization_id = node_get_organization_id
Node.get_queryset = node_get_queryset
Link.get_queryset = link_get_queryset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
from django.test import TransactionTestCase
from django.urls import reverse
from django.utils.module_loading import import_string
from openwisp_ipam.tests import CreateModelsMixin as SubnetIpamMixin

from openwisp_controller.config.tests.utils import (
CreateConfigTemplateMixin,
TestVpnX509Mixin,
TestWireguardVpnMixin,
TestZeroTierVpnMixin,
)
from openwisp_ipam.tests import CreateModelsMixin as SubnetIpamMixin

from openwisp_network_topology.tests.utils import CreateGraphObjectsMixin
from openwisp_users.tests.utils import TestOrganizationMixin
from openwisp_utils.admin_theme.dashboard import DASHBOARD_CHARTS, DASHBOARD_TEMPLATES
Expand Down Expand Up @@ -626,3 +626,8 @@ def test_topology_admin(self):
reverse(f'{self.prefix}_topology_change', args=[topology.id])
)
self.assertNotContains(response, 'Wifi mesh')

def test_topology_get_name_desc(self):
response = self.client.get(reverse(f'{self.prefix}_node_changelist'))
self.assertNotContains(response, '<span>Get name</span>', html=True)
self.assertContains(response, '<span>Label</span>', html=True)
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_mesh_id_changed(self):
)
# Change mesh_id reported in the monitoring data
mesh_data = deepcopy(SIMPLE_MESH_DATA)
for (device, interfaces) in zip(devices, mesh_data.values()):
for device, interfaces in zip(devices, mesh_data.values()):
interfaces[0]['wireless']['ssid'] = 'New Mesh'
response = self.client.post(
'{0}?key={1}&time={2}'.format(
Expand Down
4 changes: 2 additions & 2 deletions openwisp_network_topology/integrations/device/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import swapper
from openwisp_ipam.tests import CreateModelsMixin as SubnetIpamMixin

from openwisp_controller.config.tests.utils import (
CreateConfigTemplateMixin,
TestVpnX509Mixin,
TestWireguardVpnMixin,
)
from openwisp_ipam.tests import CreateModelsMixin as SubnetIpamMixin

from openwisp_network_topology.tests.utils import CreateGraphObjectsMixin
from openwisp_users.tests.utils import TestOrganizationMixin

Expand Down
1 change: 0 additions & 1 deletion openwisp_network_topology/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
1 change: 0 additions & 1 deletion openwisp_network_topology/migrations/0002_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Migration(migrations.Migration):

dependencies = [('topology', '0001_initial')]

operations = [
Expand Down
Loading

0 comments on commit 75dade8

Please sign in to comment.