Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Issue #509 + #510] Series views #589

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

andrepapoti
Copy link

@andrepapoti andrepapoti commented Apr 23, 2024

Description

This PR adds a new series-list and series-detail view.
Some projects can have hundreds of patches actives at once, by giving the user the ability to have an overview of all of the series makes knowing what's the current state of a project much more simple.
Series-list also allows the user to apply changes to all of the patches of a determined series, making the management of them easier
Added navigation within a series for the patch-detail view

Related

@stephenfin
Copy link
Member

Sorry for the absurd delay getting to this: my free time for Patchwork is pretty much zero recently... 😅

I've taken a look at this locally but have yet to go into depth on it. There are two obvious issues starting out though. Firstly, you need to do some serious work on the queries: I loaded up the patchwork archives (following the guide in our development docs and loading the series-list page took over 7 seconds and ~3050 queries (:smile:). Secondly, the current iteration of the UI doesn't work and it scrolls past the edge of the screen. I would suggest the following changes:

  • Series Name should be the first column and called Series, as we do for patch list and Patch
  • Rather than showing cover letter text (expensive and, as things stand, rather ugly), show a unicode tick if there's a cover letter present.
  • Shorten Number of Patches to Patches
  • Get rid of the bulk update widget: it's too complicated to represent in a list view (IMO) and users can either click into the series to do that or use the API

Other changes:

  • /series/{series} should be /project/{project}/series/{series} to map with patches
  • /project/patchwork/series-list/ should be /project/patchwork/series/, and we should rename /project/patchwork/list/ to /project/patchwork/patches/ (with an alias in place).
  • We need a different icon for the series view link in the top toolbar (tbh, we also need a different icon for the patch view but that's not your issue)

This is rather beefy PR so if you have the ability to do, I'd suggest submitting v2 via the mailing list if you have the ability/know-how to do so. That'll be easier for me to review. Feel free to stick to GitHub if you can't/aren't comfortable using the mailing list though 🙂

This view is meant to give a quickoverview on a project since some of
them can have hundreds of patches actives.
This view also allows the user to apply changes on all of the series
patches at once

Signed-off-by: andrepapoti <[email protected]>
@andrepapoti
Copy link
Author

andrepapoti commented Aug 1, 2024

@stephenfin I've completed the adjustments you specified and also added pagination to the series list, the page is displaying 100 series at once and It's making 7 requests per page.
I've also made the adjustments for the table display and endpoint urls.
I can send this patch via email as well but it may be interesting to keep the discussion on github since the PR is tracking issues that are registered on this repository.

@hero24
Copy link

hero24 commented Oct 23, 2024

@andrepapoti I gave this a run. Main issue I have noticed is the default sorting, patches in Series view should be sorted from newest to the oldest, like they are in patches. It doesnt really make sense to have it sorted the other way around.

Should a navigation bar within a patch - next/previous be visible If there is a single patch in a series,?

edit: Finally on the sorting bit, patches view allows for sorting by different tables (submitter, state, date etc.) and it allows to reverse sorting as well, so that if something is sorted by date (oldest -> newest), if one clicks date again it changes to newest->oldest, or if one clicks on patch, then it sorts it alphabetically by patch name. I think it would be nice to have that in series view as well, to keep it constant.

Comment on lines +1 to +5
# Patchwork - automated patch tracking system
# Copyright (C) 2012 Jeremy Kerr <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? For example is the year in copyright correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this header, I'll change it to the correct one

'id',
)
.select_related('project')
.order_by('date')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be reversed then to sort it from newest to oldest?
Also are we fetching all of them or are we skipping the archived ones?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Also, the query needs more work. I'm seeing ~300 queries for listing series (once I remove the lookup for series-detail from above and am able to render the page).

Screen Shot 2024-11-01 at 11 08 32

This is a problem. Fortunately it should be easy join. If you click on that SQL tab, you'll see a description of the (many) queries:

Screen Shot 2024-11-01 at 11 08 58

Clicking on one of these, we can see an example of the kind of issue:

Screen Shot 2024-11-01 at 11 09 09

That indicates that you need to join on submitter also, which you can do with select_related. You also need to join on patches and a few others. You should be able to get this down to < 30 queries once you resolve these.

@andrepapoti
Copy link
Author

Should a navigation bar within a patch - next/previous be visible If there is a single patch in a series,?

There is no planned design for the task, I kept each button disabled if there are no next/previous values, but if you believe it's best to remove them I don't have any issues with it

Regarding the sorting I'll add a new commit to this MR to allow the user to change it by clicking on the table

Copy link
Member

@stephenfin stephenfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queries still need work, and I have a few other comments on top of @hero24's comments, but this is getting there.

Comment on lines +68 to +70
<a href="{% url 'series-detail' project_id=project.linkname series_id=series.id %}">
{{ series.name|default:"[no subject]"|truncatechars:100 }}
</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be present in the first commit since the corresponding view doesn't exist yet.

Screen Shot 2024-11-01 at 11 03 09

Can you drop the <a> tags and just print the name here. You can re-add the <a> tags in the commit that adds the series-detail view.

{% endif %}

<th>
<span class="colinactive">Series</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need the colinactive stuff since this is only used for bundles, which don't apply to series.

Suggested change
<span class="colinactive">Series</span>
<span>Series</span>

Below also.

Comment on lines 34 to 38
path(
'project/<project_id>/list/',
'project/<project_id>/patches/',
patch_views.patch_list,
name='patch-list',
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you rename this you need to provide a redirect. There are existing examples of redirects here. Don't forget to preserve query string arguments though since those matter here but didn't matter for fetching e.g. patch mboxes.

This should also be a separate commit, ideally placed before this one in the series.

'id',
)
.select_related('project')
.order_by('date')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Also, the query needs more work. I'm seeing ~300 queries for listing series (once I remove the lookup for series-detail from above and am able to render the page).

Screen Shot 2024-11-01 at 11 08 32

This is a problem. Fortunately it should be easy join. If you click on that SQL tab, you'll see a description of the (many) queries:

Screen Shot 2024-11-01 at 11 08 58

Clicking on one of these, we can see an example of the kind of issue:

Screen Shot 2024-11-01 at 11 09 09

That indicates that you need to join on submitter also, which you can do with select_related. You also need to join on patches and a few others. You should be able to get this down to < 30 queries once you resolve these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fold this into the previous patch 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests for this also.

Comment on lines +2 to +5
prelude: >
Some projects can have hundreds of patches actives at once, by giving the user
the ability to have an overview of all of the series makes knowing what's the
current state of a project much more simple.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prelude section is used to provide a high level overview of a release. Only a maintainer should create one of these. You can drop this.

Comment on lines +8 to +11
Add series-list view, a view containing all of the series for a project and that also
implements the SeriesBulkUpdatePatchesForm, allowing the user to edit all of the patches
within a series using the web ui.
Add series-detail view, a view containing details about a series and all of it's patches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be a little more generic here since series-list and series-detail mean nothing to a user of Patchwork that hasn't read the code. How about:

A series view is now available, allowing users to list available series and
view details of individual series.

Comment on lines +31 to +32
<a
class="btn btn-default {% if not previous_submission %} disabled {% endif %}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you put this on one line like above

Comment on lines +33 to +34
{% if previous_submission %} href="{% url 'patch-detail' project_id=project.linkname msgid=previous_submission.encoded_msgid %}" {% endif %}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@hero24
Copy link

hero24 commented Nov 1, 2024

Just to make this clear. As it is the series view aren't exactly appealing, they show every patch series that has been ever submitted. Series should have states - open/closed, so they can be filtered on the web interface.
As mentioned before, series should be sorted by date descending by default, and possibly only series that have state == open should be displayed by default. Because this sounds like a design decision it possibly should be discussed/clarified on mailing list if two states (is_open = True/False) is ok, or if there is a need for lets say new/open/closed/archived set of states like there is for patch. (Personally I think two are fine, but it's no harm asking the community what they think before making a decision).

@mchehab
Copy link
Contributor

mchehab commented Dec 9, 2024

Sorry for the absurd delay getting to this: my free time for Patchwork is pretty much zero recently... 😅

I've taken a look at this locally but have yet to go into depth on it. There are two obvious issues starting out though. Firstly, you need to do some serious work on the queries: I loaded up the patchwork archives (following the guide in our development docs and loading the series-list page took over 7 seconds and ~3050 queries (:smile:). Secondly, the current iteration of the UI doesn't work and it scrolls past the edge of the screen. I would suggest the following changes:

* `Series Name` should be the first column and called `Series`, as we do for patch list and `Patch`

* Rather than showing cover letter text (expensive and, as things stand, rather ugly), show a unicode tick if there's a cover letter present.

* Shorten `Number of Patches` to `Patches`

* Get rid of the bulk update widget: it's too complicated to represent in a list view (IMO) and users can either click into the series to do that or use the API

Other changes:

* `/series/{series}` should be `/project/{project}/series/{series}` to map with patches

* `/project/patchwork/series-list/` should be `/project/patchwork/series/`, and we should rename `/project/patchwork/list/` to `/project/patchwork/patches/` (with an alias in place).

* We need a different icon for the series view link in the top toolbar (tbh, we also need a different icon for the patch view but that's not your issue)

This is rather beefy PR so if you have the ability to do, I'd suggest submitting v2 via the mailing list if you have the ability/know-how to do so. That'll be easier for me to review. Feel free to stick to GitHub if you can't/aren't comfortable using the mailing list though 🙂

Did some tests on it today, as we're very interested on having a series view for patchwork.linuxtv.org.

My comments (didn't look at the code, just at the results), after testing on a development instance we use to check for patchwork issues before migrations:

  1. Patch series require a filter. In the case of media, we have 66 pages of patch series since 2019-05 (most already applied);
  2. The patch series should be reversed, with new series at the top;
  3. by default, it should show only series with action required;
  4. Cover letter needs to be shown at the series detail pages, together with any e-mail replies. The rationale is that it is common for people to reply to the cover letter - either with acked-by/reviewed-by or due to other issues that affects the entire series;
  5. It should also display at the view a summary of CI test results (S/W/F fields) from patches view, as, for projects using CI integration, it is important to know if the series was already tested. See for instance, our usage of S/W/F at:
    https://patchwork.linuxtv.org/project/linux-media/list/

@mchehab
Copy link
Contributor

mchehab commented Dec 9, 2024

Btw, some patch series are shown as without any patches because patches aren't at "Action required" states:

image

Changing the filter makes them appear again:

image

IMO, it should use keep using the same filter that Series would have (se my previous comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add patch navigation within a series Series view
4 participants