openwisp / openwisp/openwisp-controller

[feature] Allow assigning tags to a device/config from the web UI

Open
#711 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
773
Forks
315
Avg merge
2d 16h
Merged PRs (30d)
14

Description

⚠️ Not suited for new contributors.

The template tags feature is useful and powerful, it somewhat overlaps with the group template feature but it has a key difference:

  • a device can only be in one group, one group can define only one set of templates
  • a device could be tagged with multiple tags, a template can have multiple tags

Therefore combining groups and tags can be very powerful.

The logic of template tags already exists since the early versions of OpenWISP but it is designed so that tags have to be defined in the agent configuration and work only during registration, which is not that user friendly.

We should allow viewing and editing the tags from the web UI which will be more user friendly and easy to use.

We must decice whether we want to put the tags on the device model or the config model.
We could set it at device level, as the group info, so that in the future we could use tags for things that are not strictly related to configuration only. I think this could work well.

The registration API right now reads the tags coming from the OpenWISP agent and assign any template which is tagged with those tags. We will have to change this part to also write the tags in the device model.

We have to add the logic which sets the template tags in the django models, there's already logic in the controller registration API view, I think we should move that logic to the model, the API will just write the tags and the model code will do the rest.

We have to change the admin so that it shows and allows to edit the tags.
We also have to change the REST API view to do the same (device list view and device detail view).

We also have to change the device and template admin/API to allow filtering by tags.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing template-tag logic in the controller registration API view, then review the Django models, admin, and device list and detail REST API views. The work is done when tags can be viewed, edited, and filtered through the web UI and API, registration persists device tags, and tagged templates continue to apply correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
api, backend, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.