From 6eb678374b583079a0a08b7ed0c9ca220c0c0434 Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Fri, 7 Apr 2023 08:11:02 +0800 Subject: Refactor authors dropdown (send get request from frontend to avoid long wait time) (#23890) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now the authors search dropdown might take a long time to load if amount of authors is huge. Example: (In the video below, there are about 10000 authors, and it takes about 10 seconds to open the author dropdown) https://user-images.githubusercontent.com/17645053/229422229-98aa9656-3439-4f8c-9f4e-83bd8e2a2557.mov Possible improvements can be made, which will take 2 steps (Thanks to @wolfogre for advice): Step 1: Backend: Add a new api, which returns a limit of 30 posters with matched prefix. Frontend: Change the search behavior from frontend search(fomantic search) to backend search(when input is changed, send a request to get authors matching the current search prefix) Step 2: Backend: Optimize the api in step 1 using indexer to support fuzzy search. This PR is implements the first step. The main changes: 1. Added api: `GET /{type:issues|pulls}/posters` , which return a limit of 30 users with matched prefix (prefix sent as query). If `DEFAULT_SHOW_FULL_NAME` in `custom/conf/app.ini` is set to true, will also include fullnames fuzzy search. 2. Added a tooltip saying "Shows a maximum of 30 users" to the author search dropdown 3. Change the search behavior from frontend search to backend search After: https://user-images.githubusercontent.com/17645053/229430960-f88fafd8-fd5d-4f84-9df2-2677539d5d08.mov Fixes: https://github.com/go-gitea/gitea/issues/22586 --------- Co-authored-by: wxiaoguang Co-authored-by: silverwind --- templates/repo/issue/list.tmpl | 19 +++++++++---------- templates/repo/issue/milestone_issues.tmpl | 19 +++++++++---------- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) (limited to 'templates/repo') diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index cfc9a93048..06cc3aba91 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "repo/header" .}}
@@ -117,7 +117,11 @@
-
@@ -150,7 +149,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}}{{template "repo/search_name" .}} + {{avatar $.Context . 20}}{{template "repo/search_name" .}} {{end}}
@@ -299,7 +298,7 @@
{{range .Assignees}}
- {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context . 20}} {{.GetDisplayName}}
{{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 2ca2fa2bce..148a23db66 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "repo/header" .}}
@@ -71,7 +71,11 @@
-
@@ -104,7 +103,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" .}} + {{avatar $.Context . 20}}{{template "repo/search_name" .}} {{end}}
@@ -190,7 +189,7 @@
{{range .Assignees}}
- {{avatar $.Context . 28 "gt-mr-2"}} + {{avatar $.Context . 20}} {{.GetDisplayName}}
{{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 25df29e5fb..521d6ba1d3 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -254,7 +254,7 @@ {{end}} {{svg "octicon-check"}} - {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}} + {{avatar $.Context . 20 "gt-mr-3"}}{{template "repo/search_name" .}} {{end}} -- cgit v1.2.3