From 2f0e79e6393df13930eaa419273d24dc2ef36cfa Mon Sep 17 00:00:00 2001 From: HesterG Date: Fri, 21 Jul 2023 19:20:04 +0800 Subject: Use frontend fetch for branch dropdown component (#25719) - Send request to get branch/tag list, use loading icon when waiting for response. - Only fetch when the first time branch/tag list shows. - For backend, removed assignment to `ctx.Data["Branches"]` and `ctx.Data["Tags"]` from `context/repo.go` and passed these data wherever needed. - Changed some `v-if` to `v-show` and used native `svg` as mentioned in https://github.com/go-gitea/gitea/pull/25719#issuecomment-1631712757 to improve perfomance when there are a lot of branches. - Places Used the dropdown component: Repo Home Page Screen Shot 2023-07-06 at 12 17 51 Commits Page Screen Shot 2023-07-06 at 12 18 34 Specific commit -> operations -> cherry-pick Screen Shot 2023-07-06 at 12 23 28 Release Page Screen Shot 2023-07-06 at 12 25 05 - Demo https://github.com/go-gitea/gitea/assets/17645053/d45d266b-3eb0-465a-82f9-57f78dc5f9f3 - Note: UI of dropdown menu could be improved in another PR as it should apply to more dropdown menus. Fix #14180 --------- Co-authored-by: silverwind Co-authored-by: wxiaoguang --- web_src/js/components/RepoBranchTagSelector.vue | 95 +++++++++++++++++-------- web_src/js/modules/toast.js | 2 +- web_src/js/svg.js | 8 ++- 3 files changed, 72 insertions(+), 33 deletions(-) (limited to 'web_src/js') diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue index 4fc3936244..e6e72e3886 100644 --- a/web_src/js/components/RepoBranchTagSelector.vue +++ b/web_src/js/components/RepoBranchTagSelector.vue @@ -11,7 +11,7 @@ -