summaryrefslogtreecommitdiff
path: root/patchwork/templates
Commit message (Collapse)AuthorAge
* templates: Use form.as_table in registration template.Christopher Baines2021-02-27
| | | | | This should make changes to the registration form easier. I'm particularly thinking about adding in the Django simple math captcha.
* templates: Replace ifequal and ifnotequal with ifAndrew Donnellan2020-08-28
| | | | | | | | Django 3.1 deprecates the ifequal and ifnotequal tags, for removal in 4.0. Replace all occurrences of ifequal and ifnotequal with if. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* models, templates: Add patch relationsMete Polat2020-03-16
| | | | | | | | | | | | | | | | Introduces the ability to add relations between patches. Relations are displayed in the details page of a patch under 'Related'. Related patches located in another projects can be viewed as well. Changes to relations are tracked in events. Currently the display of this is very bare in the API but that will be fixed in a subsequent patch: this is the minimum required to avoid throwing errors when you view the events feed. Signed-off-by: Mete Polat <metepolat2000@gmail.com> [dja: address some review comments from Stephen, add an admin view, move to using Events, misc tidy-ups.] Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Combine series and related rowMete Polat2019-12-27
| | | | | | | | | Move the series patch list from row 'Related' to 'Series'. This allows us to use the 'Related' row for actually showing submission relations instead. Signed-off-by: Mete Polat <metepolat2000@gmail.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* templates: Get rid of type attribute in script tagsAndrew Donnellan2019-11-05
| | | | | | | | | | | In HTML5, the type attribute of a script tag is optional if it's JavaScript. Remove all occurrences. The only real gain is slightly smaller page output, but it also shuts up validators that like to be noisy about this. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Move download buttons outside h1 tagAndrew Donnellan2019-11-05
| | | | | | | | It's not valid to put a <div> inside an <h1>. Move the download buttons in the submission template outside the <h1> tag. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Fix mismatched close tagsAndrew Donnellan2019-10-29
| | | | | | | There's a </td> rather than </th> in the bundle list. Fix it. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* Remove invalid symlinkStephen Finucane2019-09-27
| | | | | | | This was missed when moving pwclient to a separate repo. Fix it now. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 90e85f9d ("Remove pwclient")
* Move to msgid based URLsDaniel Axtens2019-09-25
| | | | | | | | | | | | | | | | | | | | | | | | Migrate our URL schema as follows: Patches: /project/<linkname>/patch/<msgid>/ Cover Letters: /project/<linkname>/cover/<msgid>/ The usual sub-resources (mbox, raw) hang off those URLs. The old style URLs (/patch/NNN/*, /cover/NNN/*) redirect appropriately. I haven't attempted to do anything meaningful with series, and I have dropped any attempt to provide a generic message-id lookup or search functionality. One step at a time. Our database still stores message ids as with angle brackets; we just work around that rather than trying to migrate. That too can come later if we think the pain is justified. Partially-closes: #106 Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Reported-by-but-I-don't-want-to-spam: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* models: Add commit_url_format to ProjectMichael Ellerman2019-08-30
| | | | | | | | | | | | Add a new field to Project, commit_url_format, which specifies a format string that can be used to generate a link to a particular commit for a project. This is used in the display of a patch, to render the patch's commit as a clickable link back to the commit on the SCM website. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Add mailing list archive link to patch detail pageAndrew Donnellan2019-08-22
| | | | | | | | Add a link to the mailing list archive link to the patch detail page. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* models, templates: Add project list archive URL fieldAndrew Donnellan2019-08-22
| | | | | | | | | | Add a field to link to a project's mailing list archive, and display it on the project info page. Add the new field to the patchwork project in the supplied example fixture. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* about: Display admin contact detailsAndrew Donnellan2019-07-05
| | | | | | | | | Display the list of admins on the about page. Add an ADMINS_HIDE option if you don't want the details displayed publicly. Closes: #282 ("Display contact details for patchwork instance admins") Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* Remove pwclientStephen Finucane2019-06-17
| | | | | | | | | Let's start managing this via a separate project, which will allow the client to evolve separately from the server. No redirect is added for the old '/pwclient' URL as it seems wiser to return a HTTP 404 error code. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Fix pwclientrc sampleStephen Finucane2019-06-17
| | | | | | | | INI files should use 'key = value' values, not 'key: value'. Correct this and fix some other whitespace issues. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #277
* filters: re-add the possibility of filtering undelegated patchesMauro Carvalho Chehab2019-06-05
| | | | | | | | | | | | | | | The filters.py redesign that happened for patchwork 1.1 removed a functionality that we use a lot: to filter patches that weren't delegated to anyone. Also, it is a way harder to find someone to delegate with a free text input. Use, instead a combo-box just like before. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: f439f541 ("Add delegate filter autocomplete support") Closes: #60 [stephenfin: Rework release note and fix some style issues]
* models: Convert Series-Patch relationship to 1:NStephen Finucane2018-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Late in the development of the series feature, it was decided that there were advantages to allowing an N:M relationship between series and patches. This would allow us to do things like create complete series where a sole vN patch was sent to a list rather than the full series. After some time using series in the wild, it's apparent that such features are very difficult to implement correctly and will likely never be implemented. As such, it's time to start cleaning up the mess, paving the way for things like an improved tagging feature. There are some significant changes to the model required: - models.py, migrations/0027, migrations/0028, migrations/0029 The migrations make the following changes: 1. - Add 'Patch.series_alt' and 'Patch.number' fields. 2. - Populate the 'Patch.series_alt' and 'Patch.number' fields from their 'SeriesPatch' equivalents. 3. - Remove the 'SeriesPatch' model. - Rename 'Patch.series_alt' to 'Patch.series'. - Change 'Series.cover_letter' to a 'OneToOneField' since a cover letter can no longer be assigned to multiple series. Note that the migrations have to be split into multiple parts as the combined migration raises an OperationalError as below. (1072, "Key column 'series_alt_id' doesn't exist in table") This is due to Django's penchant for creating indexes for newly created fields, as noted here: https://stackoverflow.com/q/35158530/ Aside from the model changes, there are numerous other changes required: - admin.py Reflect model changes for the 'PatchInline' inline used by 'SeriesAdmin' - api/cover.py, api/patch.py Update the 'series' field for the cover letter and patch resources to reflect the model changes. A 'to_representation' function is added in both cases to post-process this field and make it look like a list again. This is necessary to avoid breaking clients. - parser.py Update to reflect the replacement of 'SeriesPatch' with 'Patch'. - signals.py Update to filter on changes to 'Patch' instead of 'SeriesPatch'. This requires some reworking due to how we set these fields now, as we can no longer receive on 'post_save' signals for 'SeriesPatch' and must instead watch for 'pre_save' on 'Patch', which is what we do for delegate and state changes on same. - templates/patchwork/*.html Remove logic that handled multiple series in favour of the (simpler) single series logic. - tests/* Modify the 'create_series_patch' helper to reflect the removal of the 'SeriesPatch' model. This entire helper will be removed in a future change. Improve some tests to cover edge cases that were highlighted during development Unfortunately, all of the above changes must go in at the same time, otherwise we end up with either (a) broken views, API etc. or (b) split brain because we need to keep the new single-series fields alongside the older multi-series fields and models while we rework the views. It's unfortunate but there's not much to be done here. Signed-off-by: Stephen Finucane <stephen@that.guru> Tested-by: Daniel Axtens <dja@axtens.net>
* templates: Don't show forced filtersStephen Finucane2018-10-13
| | | | | | No point in showing a filter that you can't change. Signed-off-by: Stephen Finucane <stephen@that.guru>
* filters: Pre-populate delegate, submitter filtersStephen Finucane2018-10-13
| | | | | | | | | | | This appears to have got lost in the transition to 'selectize.js'. In brief, this will ensure that a previously selected delegate or submitter is still enabled post-filtering. For more information, see [1]. [1] https://stackoverflow.com/a/45124779 Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #78
* filters: Return dictionariesStephen Finucane2018-10-13
| | | | | | | This makes it a little easier to figure out what filters are active and will be used in a future patch. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Avoid recursive callStephen Finucane2018-10-01
| | | | | | | | | | | | | | We had registered an event handler on a checkbox in table header which would call a function, 'checkboxes', on all checkboxes within that table. This function, in turn, causes does its work and then triggers event handlers for all modified checkboxes which include the original table header checkbox. This resulted in the original event calling itself recursively. Resolve this by only modifying the checkboxes in the table body. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 44fe7bae ("js: Allow shift-select of checkboxes")
* templates: Remove trailing newlinesStephen Finucane2018-09-29
| | | | | | | These got added accidentally during merge. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 45fa5c5c ("templates: Move additional email subjects to templates")
* templates: Remove 'email_sent' attributeStephen Finucane2018-09-29
| | | | | | Further normalization to ensure all related code paths use similar code. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Move additional email subjects to templatesStephen Finucane2018-09-29
| | | | | | Use a uniform pattern for this stuff. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Keep only whole templates in the top-levelStephen Finucane2018-09-29
| | | | | | | Again, this should make this a little more understandable as it ensures a rough mapping exists between views and template names. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Rename additional templatesStephen Finucane2018-09-29
| | | | | | Make ALL the things consistent. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Move mails to separate directoryStephen Finucane2018-09-29
| | | | | | | | This makes things a little easier to parse. A couple of templates are renamed and the 'register.mail' template, which appears to be unused since commit f1e089f7, is removed. Signed-off-by: Stephen Finucane <stephen@that.guru>
* models: Remove 'latest_series'Stephen Finucane2018-09-10
| | | | | | | | This is only used in a single view (where it probably shouldn't be used) and some tests. It's an anti-pattern that makes it too easy to shoot yourself in the foot. Remove it. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Optimise fetching checks when displaying a patchStewart Smith2018-09-10
| | | | | | | | | | | | | Prior to this patch, a typical /patch// query for linuxppc-dev (which has about half a dozen checks per patch) took around 20 queries and 16.5ms in the database. About half of those queries were fetching the checks and who did the check. We can just do one query to get all that needed information, so we do that. This brings a page load down to 10 queries in 12ms. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* Fetch all series for patch/cover viewingStewart Smith2018-09-10
| | | | | | | | | | | | | | | | | | | e.g. a 10 comment patch goes from 26 queries in 17-20ms down to 20 queries in 12ms. A 67 comment cover letter goes from 14 queries in 16ms down to 8 queries in 8ms. So, effectively, a near 2x perf improvement. Previously, at several points we were asking for the latest series and then asking for all the series. Since there just usually aren't *that* many series, fetch them all and take the first one if we need to. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [stephenfin: Fix typos in the template and ensure patches from all series are shown] Signed-off-by: Stephen Finucane <stephen@that.guru>
* 4x performance improvement for viewing patch with many commentsStewart Smith2018-08-31
| | | | | | | | | | | | | | | | | | | | | | Using the example of id:20180720035941.6844-1-khandual@linux.vnet.ibm.com with my test dataset of a chunk of a variety of mailing lists, has this cover letter have 67 comments from a variety of people. Thus, it's on the larger side of things. Originally, displaying the /patch/550/ for this (redirected to /cover) would take 81 SQL queries in ~60ms on my laptop. After this optimisation, it's down to 14 queries in 14ms. When the cache is cold, it's down to 32ms from 83ms. The effect of this patch is to execute a join in the database to get the submitter information for each comment at the same time as getting all the comments rather than doing a one-by-one lookup after the fact. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* Revert "api: Only provide JSON version of events list"Stephen Finucane2018-05-12
| | | | | | | | | | | | | This reverts commit 90d9ee14e73e8ec9248e89c788d64867c4a4bb74. The root cause of this performance issue was not the use of the JSONRenderer but rather the population of filter forms. The latter is now disabled, meaning we can start using the original renderer. Signed-off-by: Stephen Finucane <stephen@that.guru> Cc: Daniel Axtens <dja@axtens.net> Acked-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Daniel Axtens <dja@axtens.net>
* api: Only provide JSON version of events listDaniel Axtens2018-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Something is very, very slow in the d-r-f browsable API events renderer. In my MySQL test (~33k patches), the CPU time to render the events list is ~11s, and the time taken by SQL queries is only ~3s. If the JSON renderer is used, that drops to 0.2s for the entire page (because less CPU is used, and - for some as yet unknown reason - a *very* expensive db query is dropped.) In my PostgreSQL test (~100k patches), the results are even more stark: 30s of CPU time and 0.2s of DB time goes to 0.25s for the entire page. Something is seriously, seriously wrong with whatever d-r-f is doing. So, simply render the event list as unlinked JSON for now. There are a few followups we should do, but this is an important start - no-one should be able to DoS a patchwork server by just enumerating the events! In particular, we should find out: - why postgres and mysql behaviour is so different. - what on earth d-r-f is doing that makes rendering the pretty-printed version so incredibly slow. Signed-off-by: Daniel Axtens <dja@axtens.net>
* Avoid timezone confusionVeronika Kabatova2018-03-08
| | | | | | | | | | | | | | | | | | | | | | | Patchwork saves patches, comments etc with UTC timezone and reports this time when opening the patch details. However, internally generated processes such as events are reported with the instance's local time. There's nothing wrong with that and making PW timezone-aware would add useless complexity, but in a world-wide collaboration a lot of confusion may arise as the timezone is not reported at all. Instance's local time might be very different from the local time of CI integrating with PW, which is different from the local time of person dealing with it etc. Use UTC everywhere by default instead of UTC for sumbissions and local timezone for internally generated events (which is not reported). Signed-off-by: Veronika Kabatova <vkabatov@redhat.com> [dja: - squash 2 patches: https://patchwork.ozlabs.org/patch/876744/ https://patchwork.ozlabs.org/patch/877815/ - minor changes to both patches - rejig order of migrations and adjust wording: "happened sooner" -> "happened earlier"] Tested-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Daniel Axtens <dja@axtens.net>
* Remove support for Django 1.6, 1.7Stephen Finucane2018-01-04
| | | | | | | | | | | | These versions are massively outdated and the only reason for keeping them was to allow installation on RHEL 7 using the version provided via EPEL. No one's actually using this so just kill it. This also allows us to remove support for django-filter 0.11, which was only retained for use with these older versions of Django. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
* templates: Add click-to-copy patch ID ("mpe mode") to patch detail pageAndrew Donnellan2018-01-04
| | | | | | | | | Similar to what we already do on the patch list page, display the patch ID on the patch detail page and make it a click-to-copy button. Closes: #115 ("Show copy-able patch ID ("mpe mode") on patch detail page") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* views: Don't render token section of user profile if REST API disabledAndrew Donnellan2018-01-04
| | | | | | | | | | | | | | | | In profile.html, if settings.ENABLE_REST_API == False, trying to render a link to the generate_token page will raise a NoReverseMatch exception, so we shouldn't render that. In any case, if the REST API is disabled, we really shouldn't render the API token section of the page at all. Only render the API token and generation link if settings.ENABLE_REST_API is True. Reported-by: Tomas Novotny <tomas@novotny.cz> Closes: #138 ("NoReverseMatch exception on user login with disabled REST API") Fixes: 85c8f369204a ("views: Provide a way to view, (re)generate tokens") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* views: Provide a way to view, (re)generate tokensAndrew Donnellan2017-06-14
| | | | | | | Integrate token support into the web UI. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* htdocs: Add clipboard.jsStephen Finucane2017-06-14
| | | | | | | | | | We provide our own, much smaller implementation of this currently. However, we want to be able to implement slightly different variants of this elsewhere and using an existing library helps avoid reinventing the wheel and lets us use already battle-tested code. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
* Fix typo in 'bundles' templateStephen Finucane2017-06-09
| | | | Fixes: d1c605f ("views: Stop using Bundle.public_url")
* views: Display correct download links for coversStephen Finucane2017-05-30
| | | | | | | This means using the correct link for the cover mbox and not displaying one for the non-existent diff. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Use compat.cycle everywhereStephen Finucane2017-05-18
| | | | | | | We missed this previously and now it's breaking Django 1.6. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 8ae7705 ("templates: Resolve cycle issues with Django 1.10")
* Display count of patchesDaniel Axtens2017-04-15
| | | | | | | | | Minor UI tweak - show the number of patches left in the current view. Suggested-by: Stewart Smith <stewart@linux.vnet.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* 'mpe mode': click to copy patch IDsDaniel Axtens2017-04-15
| | | | | | | | | | | | | If 'Show Patch IDs' is turned on in settings, add an extra column to the patch list, with buttons showing the patch IDs. The buttons copy the patch IDs to the clipboard. JavaScript inspired by https://github.com/Triforcey/clip-j and many many StackOverflow answers. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* Put download buttons at the top as wellDaniel Axtens2017-04-15
| | | | | | | Suggested by a few people. Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* views: Link to project from bundle-listStephen Finucane2017-04-05
| | | | | | Simple usability improvement. Signed-off-by: Stephen Finucane <stephen@that.guru>
* views: Use bundle-detail for public URLsStephen Finucane2017-04-05
| | | | | | | | | | | | | | | | | | | | In 'd1c605f', we reworked the 'bundle-list' view to use the new 'Bundle.get_mbox_url' function instead of the 'Bundle.public_url'. However, these are not the same thing. The latter referred to the 'bundle-detail' view, while the former referred to the 'bundle-mbox' view. The easiest fix would be to simply revert that patch. However, it turns out that 'public_url' isn't actually needed. Commit '5d0140ef' removed a divide between public and non-public URLs for bundles, meaning we can actually use an existing function - 'get_absolute_url' - instead. This also presents the opportunity to clean up the 'bundle-list' page, favouring a simple public/is-not-public marker and only a single URL. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: d1c605f9 ("views: Stop using Bundle.public_url") Closes-bug: #92
* templates: Add "download series" linksStephen Finucane2017-04-04
| | | | | | | | This will allow users to download entire series including the current patch. Since a patch can belong to many series a dropdown is used. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
* templates: Use buttons for patch download linksStephen Finucane2017-04-04
| | | | | | | | | | | We'll make use of this to enable downloading of patches with mboxes. In addition, the 'hide' link for patches and cover letters is removed. There's no way to enable this by default and the use cases are dubious at best. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
* views: Stop using Bundle.public_urlStephen Finucane2017-03-20
| | | | | | | | We now have 'get_mbox_url' which is consistent with patches. Let's drop the older one. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Andy Doan <andy.doan@linaro.org>