Skip to content

Commit 9b11c3e

Browse files
divbhasintechknowlogickzeripathsilverwind
authored
#13091 - add new mirror button (#13105)
* added button * got URL params to carry through to service specific migrate pages * do not display add mirror button if mirroring turned off * added corrections by reviewers * Add silverwind's suggestion Co-authored-by: silverwind <[email protected]> Co-authored-by: techknowlogick <[email protected]> Co-authored-by: zeripath <[email protected]> Co-authored-by: silverwind <[email protected]>
1 parent d2ad4de commit 9b11c3e

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

routers/org/home.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ func Home(ctx *context.Context) {
127127
ctx.Data["Members"] = members
128128
ctx.Data["Teams"] = org.Teams
129129

130+
ctx.Data["DisabledMirrors"] = setting.Repository.DisableMirrors
131+
130132
pager := context.NewPagination(int(count), setting.UI.User.RepoPagingNum, page, 5)
131133
pager.SetDefaultParams(ctx)
132134
ctx.Data["Page"] = pager

routers/repo/migrate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ func Migrate(ctx *context.Context) {
2828
ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
2929
serviceType := ctx.QueryInt("service_type")
3030
if serviceType == 0 {
31+
ctx.Data["Org"] = ctx.Query("org")
32+
ctx.Data["Mirror"] = ctx.Query("mirror")
33+
3134
ctx.HTML(200, tplMigrate)
3235
return
3336
}

templates/org/home.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<div class="ui eleven wide column">
2929
{{if .CanCreateOrgRepo}}
3030
<div class="text right">
31+
{{if not .DisabledMirrors}}
32+
<a class="ui green button" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{.i18n.Tr "new_migrate"}}</a>
33+
{{end}}
3134
<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{.i18n.Tr "new_repo"}}</a>
3235
</div>
3336
<div class="ui divider"></div>

templates/repo/migrate/migrate.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<div class="ui three stackable cards">
66
{{range .Services}}
77
<div class="ui card">
8-
<a class="image" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}">
8+
<a class="image" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
99
{{svg (Printf "gitea-%s" .Name) 184}}
1010
</a>
1111
<div class="content">
12-
<a class="header" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}">{{.Title}}</a>
12+
<a class="header" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">{{.Title}}</a>
1313
<div class="description">
1414
{{(Printf "repo.migrate.%s.description" .Name) | $.i18n.Tr }}
1515
</div>

0 commit comments

Comments
 (0)