From 211321fb936683815c4033fdfb9ac46af8a3b357 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Thu, 27 Aug 2020 20:36:37 -0500 Subject: Git migration UX (#12619) * Initial work Signed-off-by: jolheiser * Implementation Signed-off-by: jolheiser * Fix gitlab and token cloning Signed-off-by: jolheiser * Imports and JS Signed-off-by: jolheiser * Fix test Signed-off-by: jolheiser * Linting Signed-off-by: jolheiser * Generate swagger Signed-off-by: jolheiser * Move mirror toggle and rename options Signed-off-by: jolheiser Co-authored-by: Lauris BH Co-authored-by: Lunny Xiao --- modules/structs/repo.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'modules/structs/repo.go') diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 217a6f74ad..808d2ffbc8 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -218,6 +218,32 @@ func (gt GitServiceType) Name() string { return "" } +// Title represents the service type's proper title +func (gt GitServiceType) Title() string { + switch gt { + case GithubService: + return "GitHub" + case GiteaService: + return "Gitea" + case GitlabService: + return "GitLab" + case GogsService: + return "Gogs" + case PlainGitService: + return "Git" + } + return "" +} + +// TokenAuth represents whether a service type supports token-based auth +func (gt GitServiceType) TokenAuth() bool { + switch gt { + case GithubService, GiteaService, GitlabService: + return true + } + return false +} + var ( // SupportedFullGitService represents all git services supported to migrate issues/labels/prs and etc. // TODO: add to this list after new git service added @@ -233,6 +259,7 @@ type MigrateRepoOption struct { CloneAddr string `json:"clone_addr" binding:"Required"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` + AuthToken string `json:"auth_token"` // required: true UID int `json:"uid" binding:"Required"` // required: true -- cgit v1.2.3