From e153cf07c34b1497906348df84a556851693c77f Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 10 Sep 2020 02:29:10 +0800 Subject: [PATCH] Add a migrate service type switch page (#12697) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a migrat service type switch page * Improve translations * remove images * Fix images * remove extra create repo button on dashboard * Follow reviewers' opinions * Fix frontend lint * Remove wrong submit file * Fix tests * Adjust the size of image * Apply suggestions from code review Co-authored-by: 赵智超 <1012112796@qq.com> * Remove username and password from migration of github/gitlab * Improve docs * Improve interface docs Co-authored-by: 赵智超 <1012112796@qq.com> Co-authored-by: techknowlogick --- integrations/repo_migrate_test.go | 8 +- modules/structs/repo.go | 13 +- options/locale/locale_en-US.ini | 7 +- public/img/svg/gitea-git.svg | 1 + public/img/svg/gitea-github.svg | 1 + public/img/svg/gitea-gitlab.svg | 1 + routers/repo/migrate.go | 173 ++++++++++++++++++ routers/repo/repo.go | 150 +-------------- routers/repo/view.go | 2 +- templates/repo/migrate/git.tmpl | 103 +++++++++++ .../{migrate.tmpl => migrate/github.tmpl} | 26 +-- templates/repo/migrate/gitlab.tmpl | 137 ++++++++++++++ templates/repo/migrate/migrate.tmpl | 23 +++ templates/repo/{ => migrate}/migrating.tmpl | 0 templates/user/dashboard/repolist.tmpl | 8 - web_src/js/features/migration.js | 14 +- web_src/less/_repository.less | 4 + web_src/less/themes/theme-arc-green.less | 16 ++ web_src/svg/gitea-git.svg | 1 + web_src/svg/gitea-github.svg | 1 + web_src/svg/gitea-gitlab.svg | 1 + 21 files changed, 481 insertions(+), 209 deletions(-) create mode 100644 public/img/svg/gitea-git.svg create mode 100644 public/img/svg/gitea-github.svg create mode 100644 public/img/svg/gitea-gitlab.svg create mode 100644 routers/repo/migrate.go create mode 100644 templates/repo/migrate/git.tmpl rename templates/repo/{migrate.tmpl => migrate/github.tmpl} (83%) create mode 100644 templates/repo/migrate/gitlab.tmpl create mode 100644 templates/repo/migrate/migrate.tmpl rename templates/repo/{ => migrate}/migrating.tmpl (100%) create mode 100644 web_src/svg/gitea-git.svg create mode 100644 web_src/svg/gitea-github.svg create mode 100644 web_src/svg/gitea-gitlab.svg diff --git a/integrations/repo_migrate_test.go b/integrations/repo_migrate_test.go index a9970655e..5a02b4ba0 100644 --- a/integrations/repo_migrate_test.go +++ b/integrations/repo_migrate_test.go @@ -5,15 +5,17 @@ package integrations import ( + "fmt" "net/http" "net/http/httptest" "testing" + "code.gitea.io/gitea/modules/structs" "github.com/stretchr/testify/assert" ) func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName string) *httptest.ResponseRecorder { - req := NewRequest(t, "GET", "/repo/migrate") + req := NewRequest(t, "GET", fmt.Sprintf("/repo/migrate?service_type=%d", structs.PlainGitService)) // render plain git migration page resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) @@ -28,8 +30,8 @@ func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName str "clone_addr": cloneAddr, "uid": uid, "repo_name": repoName, - }, - ) + "service": fmt.Sprintf("%d", structs.PlainGitService), + }) resp = session.MakeRequest(t, req, http.StatusFound) return resp diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 808d2ffbc..f751c0078 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -5,6 +5,7 @@ package structs import ( + "strings" "time" ) @@ -205,17 +206,7 @@ const ( // Name represents the service type's name // WARNNING: the name have to be equal to that on goth's library func (gt GitServiceType) Name() string { - switch gt { - case GithubService: - return "github" - case GiteaService: - return "gitea" - case GitlabService: - return "gitlab" - case GogsService: - return "gogs" - } - return "" + return strings.ToLower(gt.Title()) } // Title represents the service type's proper title diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ce3537505..80308214d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -720,6 +720,7 @@ migrate_items_milestones = Milestones migrate_items_labels = Labels migrate_items_issues = Issues migrate_items_pullrequests = Pull Requests +migrate_items_merge_requests = Merge Requests migrate_items_releases = Releases migrate_repo = Migrate Repository migrate.clone_address = Migrate / Clone From URL @@ -729,11 +730,15 @@ migrate.permission_denied = You are not allowed to import local repositories. migrate.invalid_local_path = "The local path is invalid. It does not exist or is not a directory." migrate.failed = Migration failed: %v migrate.lfs_mirror_unsupported = Mirroring LFS objects is not supported - use 'git lfs fetch --all' and 'git lfs push --all' instead. -migrate.migrate_items_options = Authentication is needed to migrate items from a service that supports them. +migrate.migrate_items_options = Access Token is required to migrate additional items migrated_from = Migrated from %[2]s migrated_from_fake = Migrated From %[1]s +migrate.migrate = Migrate From %s migrate.migrating = Migrating from %s ... migrate.migrating_failed = Migrating from %s failed. +migrate.github.description = Migrating data from Github.com or Github Enterprise. +migrate.git.description = Migrating or Mirroring git data from Git services +migrate.gitlab.description = Migrating data from GitLab.com or Self-Hosted gitlab server. mirror_from = mirror of forked_from = forked from diff --git a/public/img/svg/gitea-git.svg b/public/img/svg/gitea-git.svg new file mode 100644 index 000000000..c716b1b28 --- /dev/null +++ b/public/img/svg/gitea-git.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/svg/gitea-github.svg b/public/img/svg/gitea-github.svg new file mode 100644 index 000000000..0ed1d44b5 --- /dev/null +++ b/public/img/svg/gitea-github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/svg/gitea-gitlab.svg b/public/img/svg/gitea-gitlab.svg new file mode 100644 index 000000000..a72a37823 --- /dev/null +++ b/public/img/svg/gitea-gitlab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/routers/repo/migrate.go b/routers/repo/migrate.go new file mode 100644 index 000000000..497f2ce36 --- /dev/null +++ b/routers/repo/migrate.go @@ -0,0 +1,173 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Copyright 2020 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package repo + +import ( + "strings" + + "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/auth" + "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/migrations" + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/task" + "code.gitea.io/gitea/modules/util" +) + +const ( + tplMigrate base.TplName = "repo/migrate/migrate" +) + +// Migrate render migration of repository page +func Migrate(ctx *context.Context) { + ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...) + serviceType := ctx.QueryInt("service_type") + if serviceType == 0 { + ctx.HTML(200, tplMigrate) + return + } + + ctx.Data["Title"] = ctx.Tr("new_migrate") + ctx.Data["private"] = getRepoPrivate(ctx) + ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate + ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors + ctx.Data["mirror"] = ctx.Query("mirror") == "1" + ctx.Data["wiki"] = ctx.Query("wiki") == "1" + ctx.Data["milestones"] = ctx.Query("milestones") == "1" + ctx.Data["labels"] = ctx.Query("labels") == "1" + ctx.Data["issues"] = ctx.Query("issues") == "1" + 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.GitServiceType(serviceType) + + ctxUser := checkContextUser(ctx, ctx.QueryInt64("org")) + if ctx.Written() { + return + } + ctx.Data["ContextUser"] = ctxUser + + ctx.HTML(200, base.TplName("repo/migrate/"+structs.GitServiceType(serviceType).Name())) +} + +func handleMigrateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form *auth.MigrateRepoForm) { + switch { + case migrations.IsRateLimitError(err): + ctx.RenderWithErr(ctx.Tr("form.visit_rate_limit"), tpl, form) + case migrations.IsTwoFactorAuthError(err): + ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form) + case models.IsErrReachLimitOfRepo(err): + ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form) + case models.IsErrRepoAlreadyExist(err): + ctx.Data["Err_RepoName"] = true + ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form) + case models.IsErrNameReserved(err): + ctx.Data["Err_RepoName"] = true + ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), tpl, form) + case models.IsErrNamePatternNotAllowed(err): + ctx.Data["Err_RepoName"] = true + ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tpl, form) + default: + remoteAddr, _ := form.ParseRemoteAddr(owner) + err = util.URLSanitizedError(err, remoteAddr) + if strings.Contains(err.Error(), "Authentication failed") || + strings.Contains(err.Error(), "Bad credentials") || + strings.Contains(err.Error(), "could not read Username") { + ctx.Data["Err_Auth"] = true + ctx.RenderWithErr(ctx.Tr("form.auth_failed", err.Error()), tpl, form) + } else if strings.Contains(err.Error(), "fatal:") { + ctx.Data["Err_CloneAddr"] = true + ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", err.Error()), tpl, form) + } else { + ctx.ServerError(name, err) + } + } +} + +// 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"] = form.Service + ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...) + + ctxUser := checkContextUser(ctx, form.UID) + if ctx.Written() { + return + } + ctx.Data["ContextUser"] = ctxUser + + if ctx.HasError() { + ctx.HTML(200, tplMigrate) + return + } + + remoteAddr, err := form.ParseRemoteAddr(ctx.User) + if err != nil { + if models.IsErrInvalidCloneAddr(err) { + ctx.Data["Err_CloneAddr"] = true + addrErr := err.(models.ErrInvalidCloneAddr) + switch { + case addrErr.IsURLError: + ctx.RenderWithErr(ctx.Tr("form.url_error"), tplMigrate, &form) + case addrErr.IsPermissionDenied: + ctx.RenderWithErr(ctx.Tr("repo.migrate.permission_denied"), tplMigrate, &form) + case addrErr.IsInvalidPath: + ctx.RenderWithErr(ctx.Tr("repo.migrate.invalid_local_path"), tplMigrate, &form) + default: + ctx.ServerError("Unknown error", err) + } + } else { + ctx.ServerError("ParseRemoteAddr", err) + } + return + } + + var opts = migrations.MigrateOptions{ + OriginalURL: form.CloneAddr, + GitServiceType: structs.GitServiceType(form.Service), + CloneAddr: remoteAddr, + RepoName: form.RepoName, + Description: form.Description, + Private: form.Private || setting.Repository.ForcePrivate, + Mirror: form.Mirror && !setting.Repository.DisableMirrors, + AuthUsername: form.AuthUsername, + AuthPassword: form.AuthPassword, + AuthToken: form.AuthToken, + Wiki: form.Wiki, + Issues: form.Issues, + Milestones: form.Milestones, + Labels: form.Labels, + Comments: form.Issues || form.PullRequests, + PullRequests: form.PullRequests, + Releases: form.Releases, + } + if opts.Mirror { + opts.Issues = false + opts.Milestones = false + opts.Labels = false + opts.Comments = false + opts.PullRequests = false + opts.Releases = false + } + + err = models.CheckCreateRepository(ctx.User, ctxUser, opts.RepoName) + if err != nil { + handleMigrateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form) + return + } + + err = task.MigrateRepository(ctx.User, ctxUser, opts) + if err == nil { + ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + opts.RepoName) + return + } + + handleMigrateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form) +} diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 5fc081a6f..9a4fbfa13 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -17,19 +17,14 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/migrations" "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/task" - "code.gitea.io/gitea/modules/util" repo_service "code.gitea.io/gitea/services/repository" "github.com/unknwon/com" ) const ( - tplCreate base.TplName = "repo/create" - tplMigrate base.TplName = "repo/migrate" + tplCreate base.TplName = "repo/create" ) // MustBeNotEmpty render when a repo is a empty git dir @@ -254,149 +249,6 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form) } -// Migrate render migration of repository page -func Migrate(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("new_migrate") - ctx.Data["private"] = getRepoPrivate(ctx) - ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate - ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors - ctx.Data["mirror"] = ctx.Query("mirror") == "1" - ctx.Data["wiki"] = ctx.Query("wiki") == "1" - ctx.Data["milestones"] = ctx.Query("milestones") == "1" - ctx.Data["labels"] = ctx.Query("labels") == "1" - ctx.Data["issues"] = ctx.Query("issues") == "1" - 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() { - return - } - ctx.Data["ContextUser"] = ctxUser - - ctx.HTML(200, tplMigrate) -} - -func handleMigrateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form *auth.MigrateRepoForm) { - switch { - case migrations.IsRateLimitError(err): - ctx.RenderWithErr(ctx.Tr("form.visit_rate_limit"), tpl, form) - case migrations.IsTwoFactorAuthError(err): - ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form) - case models.IsErrReachLimitOfRepo(err): - ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form) - case models.IsErrRepoAlreadyExist(err): - ctx.Data["Err_RepoName"] = true - ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form) - case models.IsErrNameReserved(err): - ctx.Data["Err_RepoName"] = true - ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), tpl, form) - case models.IsErrNamePatternNotAllowed(err): - ctx.Data["Err_RepoName"] = true - ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tpl, form) - default: - remoteAddr, _ := form.ParseRemoteAddr(owner) - err = util.URLSanitizedError(err, remoteAddr) - if strings.Contains(err.Error(), "Authentication failed") || - strings.Contains(err.Error(), "Bad credentials") || - strings.Contains(err.Error(), "could not read Username") { - ctx.Data["Err_Auth"] = true - ctx.RenderWithErr(ctx.Tr("form.auth_failed", err.Error()), tpl, form) - } else if strings.Contains(err.Error(), "fatal:") { - ctx.Data["Err_CloneAddr"] = true - ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", err.Error()), tpl, form) - } else { - ctx.ServerError(name, err) - } - } -} - -// 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() { - return - } - ctx.Data["ContextUser"] = ctxUser - - if ctx.HasError() { - ctx.HTML(200, tplMigrate) - return - } - - remoteAddr, err := form.ParseRemoteAddr(ctx.User) - if err != nil { - if models.IsErrInvalidCloneAddr(err) { - ctx.Data["Err_CloneAddr"] = true - addrErr := err.(models.ErrInvalidCloneAddr) - switch { - case addrErr.IsURLError: - ctx.RenderWithErr(ctx.Tr("form.url_error"), tplMigrate, &form) - case addrErr.IsPermissionDenied: - ctx.RenderWithErr(ctx.Tr("repo.migrate.permission_denied"), tplMigrate, &form) - case addrErr.IsInvalidPath: - ctx.RenderWithErr(ctx.Tr("repo.migrate.invalid_local_path"), tplMigrate, &form) - default: - ctx.ServerError("Unknown error", err) - } - } else { - ctx.ServerError("ParseRemoteAddr", err) - } - return - } - - var opts = migrations.MigrateOptions{ - OriginalURL: form.CloneAddr, - GitServiceType: structs.GitServiceType(form.Service), - CloneAddr: remoteAddr, - RepoName: form.RepoName, - Description: form.Description, - Private: form.Private || setting.Repository.ForcePrivate, - Mirror: form.Mirror && !setting.Repository.DisableMirrors, - AuthUsername: form.AuthUsername, - AuthPassword: form.AuthPassword, - AuthToken: form.AuthToken, - Wiki: form.Wiki, - Issues: form.Issues, - Milestones: form.Milestones, - Labels: form.Labels, - Comments: true, - PullRequests: form.PullRequests, - Releases: form.Releases, - } - if opts.Mirror { - opts.Issues = false - opts.Milestones = false - opts.Labels = false - opts.Comments = false - opts.PullRequests = false - opts.Releases = false - } - - err = models.CheckCreateRepository(ctx.User, ctxUser, opts.RepoName) - if err != nil { - handleMigrateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form) - return - } - - err = task.MigrateRepository(ctx.User, ctxUser, opts) - if err == nil { - ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + opts.RepoName) - return - } - - handleMigrateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form) -} - // Action response for actions to a repository func Action(ctx *context.Context) { var err error diff --git a/routers/repo/view.go b/routers/repo/view.go index a05c0b136..3e2a57415 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -34,7 +34,7 @@ const ( tplRepoHome base.TplName = "repo/home" tplWatchers base.TplName = "repo/watchers" tplForks base.TplName = "repo/forks" - tplMigrating base.TplName = "repo/migrating" + tplMigrating base.TplName = "repo/migrate/migrating" ) type namedBlob struct { diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl new file mode 100644 index 000000000..34a1c7bd0 --- /dev/null +++ b/templates/repo/migrate/git.tmpl @@ -0,0 +1,103 @@ +{{template "base/head" .}} +
+
+
+
+ {{.CsrfTokenHtml}} +

+ {{.i18n.Tr "repo.migrate.migrate" .service.Title}} + +

+
+ {{template "base/alert" .}} +
+ + + + {{.i18n.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{.i18n.Tr "repo.migrate.clone_local_path"}}{{end}} + {{if .LFSActive}}
{{.i18n.Tr "repo.migrate.lfs_mirror_unsupported"}}{{end}} +
+
+
+ + +
+ +
+ + +
+ +
+ +
+ {{if .DisableMirrors}} + + + {{else}} + + + {{end}} +
+
+ +
+ +
+ + +
+ +
+ + +
+
+ +
+ {{if .IsForcedPrivate}} + + + {{else}} + + + {{end}} +
+
+
+ + +
+ +
+ + + {{.i18n.Tr "cancel"}} +
+
+
+
+
+
+{{template "base/footer" .}} diff --git a/templates/repo/migrate.tmpl b/templates/repo/migrate/github.tmpl similarity index 83% rename from templates/repo/migrate.tmpl rename to templates/repo/migrate/github.tmpl index d5a31a680..cf84ad39e 100644 --- a/templates/repo/migrate.tmpl +++ b/templates/repo/migrate/github.tmpl @@ -5,7 +5,8 @@
{{.CsrfTokenHtml}}

- {{.i18n.Tr "new_migrate"}} + {{.i18n.Tr "repo.migrate.migrate" .service.Title}} +

{{template "base/alert" .}} @@ -18,31 +19,10 @@
-
- - -
-
- - -
- -
- - -
+ {{svg "octicon-question" 16}}
diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl new file mode 100644 index 000000000..427a1e05d --- /dev/null +++ b/templates/repo/migrate/gitlab.tmpl @@ -0,0 +1,137 @@ +{{template "base/head" .}} +
+
+
+ + {{.CsrfTokenHtml}} +

+ {{.i18n.Tr "repo.migrate.migrate" .service.Title}} + +

+
+ {{template "base/alert" .}} +
+ + + + {{.i18n.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{.i18n.Tr "repo.migrate.clone_local_path"}}{{end}} + {{if .LFSActive}}
{{.i18n.Tr "repo.migrate.lfs_mirror_unsupported"}}{{end}} +
+
+ +
+ + + {{svg "octicon-question" 16}} +
+ +
+ +
+ {{if .DisableMirrors}} + + + {{else}} + + + {{end}} +
+
+ + {{.i18n.Tr "repo.migrate.migrate_items_options"}} +
+
+ +
+ + +
+
+ + +
+
+
+ +
+ + +
+
+ + +
+
+
+ +
+ + +
+
+ + +
+
+
+ +
+ +
+ + +
+ +
+ + +
+
+ +
+ {{if .IsForcedPrivate}} + + + {{else}} + + + {{end}} +
+
+
+ + +
+ +
+ + + {{.i18n.Tr "cancel"}} +
+
+ +
+
+
+{{template "base/footer" .}} diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl new file mode 100644 index 000000000..1521620b0 --- /dev/null +++ b/templates/repo/migrate/migrate.tmpl @@ -0,0 +1,23 @@ +{{template "base/head" .}} +
+
+
+
+ {{range .Services}} +
+ + {{svg (Printf "gitea-%s" .Name) 184}} + +
+ {{.Title}} +
+ {{(Printf "repo.migrate.%s.description" .Name) | $.i18n.Tr }} +
+
+
+ {{end}} +
+
+
+
+{{template "base/footer" .}} diff --git a/templates/repo/migrating.tmpl b/templates/repo/migrate/migrating.tmpl similarity index 100% rename from templates/repo/migrating.tmpl rename to templates/repo/migrate/migrating.tmpl diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index ca055e9d8..ce4a97a36 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -25,14 +25,6 @@

{{.i18n.Tr "home.my_repos"}} ${reposTotalCount} - {{if or (not .ContextUser.IsOrganization) .IsOrganizationOwner}} - - {{end}}