This series is a continuation of labels series published by Stephen Finucane back in 2018.
Changes since v2: - Implemented a command for relabeling existing patches - Added a labels filter with autocomplete - Added a labels filter to the API - Updated selectize to the latest version - Dropped "parser: Remove matching label from subject prefixes". I believe that the code was unused anyway. If the point was to remove labels from patch subject text, then I'm not sure if it was a good idea. I have started implementing series -> patch labels inheritance. It's not included in this series as I'm not sure how it should work. As I understand it, the name of the series may be changed as new patches are parsed. I'm also not sure where in the UI users could see/modify labels for series. This version uses a many-to-many relation for storing labels assigned to a patch, like in v2. I understand that there is a performance concern as this could cause excessive JOINs in queries. From what I can see, Django only uses JOINs when patches are filtered by labels. When patches are just listed without any filters, a separate query to the patch-labels table is executed instead of a JOIN, that query seems to be rather cheap. I have a POC alternative version that uses JSON columns to store an array with labels inside the patches table. So far it's not obvious to me that the JSON version is better performance-wise (in my tests it sometimes was, sometimes not, especially on MySQL, that could be an issue with my setup or the tests). Downsides: the code is more complex, and I think there may be some issues around update atomicity. Some of the commits from v2 were modified beyond just rebase and formatting. I have retained the original author for commits from v2. I'm submitting these patches now, I have added myself to Signed-off-by. I'm not sure if this is 100% OK, so please let me know. Sponsored-By: The Linux Foundation Closes: #22 Franciszek Stachura (8): REST: Fix bug 335 tests filters: Add label query filter REST: Add filtering by labels to API htdocs: Update selectize to 0.15.2 filters: Add autocomplete to labels filter forms: Selectize label input in update forms management: Add relabel command docs: Add information on labels Stephen Finucane (7): fields: Add ColorField models: Add submission labels parser: Extract and save labels admin: Add label views views: Populate 'project' attribute of PatchForm views: Add patch labels to web UI REST: Expose Patch.labels .gitattributes | 2 + docs/api/schemas/latest/patchwork.yaml | 14 ++ docs/api/schemas/patchwork.j2 | 18 +++ docs/api/schemas/v1.4/patchwork.yaml | 14 ++ docs/deployment/management.rst | 27 ++++ docs/usage/overview.rst | 23 ++++ htdocs/README.rst | 2 +- htdocs/css/selectize.bootstrap3.css | Bin 8266 -> 13155 bytes htdocs/css/style.css | 8 ++ htdocs/js/selectize.min.js | Bin 56433 -> 55382 bytes patchwork/admin.py | 18 +++ patchwork/api/cover.py | 9 +- patchwork/api/filters.py | 20 +++ patchwork/api/patch.py | 10 +- patchwork/fields.py | 24 ++++ patchwork/filters.py | 73 ++++++++++- patchwork/fixtures/default_labels.xml | 9 ++ patchwork/forms.py | 57 +++++++- patchwork/management/commands/relabel.py | 75 +++++++++++ patchwork/migrations/0049_add_patch_labels.py | 74 +++++++++++ patchwork/models.py | 58 ++++++++- patchwork/parser.py | 18 +++ .../templates/patchwork/partials/filters.html | 44 +++++++ .../patchwork/partials/patch-forms.html | 17 +++ .../patchwork/partials/patch-list.html | 1 + patchwork/templates/patchwork/submission.html | 6 + patchwork/templatetags/patch.py | 28 ++++ patchwork/tests/unit/api/test_cover.py | 28 +++- patchwork/tests/unit/api/test_patch.py | 78 ++++++++++- patchwork/tests/unit/test_parser.py | 16 +++ patchwork/tests/unit/views/test_patch.py | 123 ++++++++++++++++++ patchwork/tests/utils.py | 23 ++++ patchwork/views/__init__.py | 11 +- patchwork/views/patch.py | 6 +- .../notes/labels-6d0096c7d8505627.yaml | 18 +++ 35 files changed, 938 insertions(+), 14 deletions(-) create mode 100644 .gitattributes create mode 100644 patchwork/fixtures/default_labels.xml create mode 100644 patchwork/management/commands/relabel.py create mode 100644 patchwork/migrations/0049_add_patch_labels.py create mode 100644 releasenotes/notes/labels-6d0096c7d8505627.yaml -- 2.55.0 _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
