Git migration UX (#12619)
* Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Implementation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix gitlab and token cloning Signed-off-by: jolheiser <john.olheiser@gmail.com> * Imports and JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Linting Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move mirror toggle and rename options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
ed2f6e137b
commit
211321fb93
20 changed files with 273 additions and 181 deletions
|
@ -7,7 +7,6 @@ package repo
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -269,6 +268,9 @@ func Migrate(ctx *context.Context) {
|
|||
ctx.Data["pull_requests"] = ctx.Query("pull_requests") == "1"
|
||||
ctx.Data["releases"] = ctx.Query("releases") == "1"
|
||||
ctx.Data["LFSActive"] = setting.LFS.StartServer
|
||||
// Plain git should be first
|
||||
ctx.Data["service"] = structs.PlainGitService
|
||||
ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
|
||||
|
||||
ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
|
||||
if ctx.Written() {
|
||||
|
@ -316,6 +318,9 @@ func handleMigrateError(ctx *context.Context, owner *models.User, err error, nam
|
|||
// MigratePost response for migrating from external git repository
|
||||
func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
// Plain git should be first
|
||||
ctx.Data["service"] = structs.PlainGitService
|
||||
ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
|
||||
|
||||
ctxUser := checkContextUser(ctx, form.UID)
|
||||
if ctx.Written() {
|
||||
|
@ -349,15 +354,9 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
|||
return
|
||||
}
|
||||
|
||||
var gitServiceType = structs.PlainGitService
|
||||
u, err := url.Parse(form.CloneAddr)
|
||||
if err == nil && strings.EqualFold(u.Host, "github.com") {
|
||||
gitServiceType = structs.GithubService
|
||||
}
|
||||
|
||||
var opts = migrations.MigrateOptions{
|
||||
OriginalURL: form.CloneAddr,
|
||||
GitServiceType: gitServiceType,
|
||||
GitServiceType: structs.GitServiceType(form.Service),
|
||||
CloneAddr: remoteAddr,
|
||||
RepoName: form.RepoName,
|
||||
Description: form.Description,
|
||||
|
@ -365,6 +364,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
|||
Mirror: form.Mirror && !setting.Repository.DisableMirrors,
|
||||
AuthUsername: form.AuthUsername,
|
||||
AuthPassword: form.AuthPassword,
|
||||
AuthToken: form.AuthToken,
|
||||
Wiki: form.Wiki,
|
||||
Issues: form.Issues,
|
||||
Milestones: form.Milestones,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue