diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-10-13 21:23:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-13 21:23:14 +0800 |
commit | f2a3abc683ad4b2177b7c7c6160a2c0b4316120a (patch) | |
tree | 3b92f34b9bb9a015072f511dc5cf6340af18eda5 /templates | |
parent | 0a96e59884ca5c4fedc8c3d166d97f35b245ad6e (diff) | |
download | gitea-f2a3abc683ad4b2177b7c7c6160a2c0b4316120a.tar.gz gitea-f2a3abc683ad4b2177b7c7c6160a2c0b4316120a.zip |
Move migrating repository from frontend to backend (#6200)
* move migrating to backend
* add loading image when migrating and fix tests
* fix format
* fix lint
* add redis task queue support and improve docs
* add redis vendor
* fix vet
* add database migrations and fix app.ini sample
* add comments for task section on app.ini.sample
* Update models/migrations/v84.go
Co-Authored-By: lunny <xiaolunwen@gmail.com>
* Update models/repo.go
Co-Authored-By: lunny <xiaolunwen@gmail.com>
* move migrating to backend
* add loading image when migrating and fix tests
* fix fmt
* add redis task queue support and improve docs
* fix fixtures
* fix fixtures
* fix duplicate function on index.js
* fix tests
* rename repository statuses
* check if repository is being create when SSH request
* fix lint
* fix template
* some improvements
* fix template
* unified migrate options
* fix lint
* fix loading page
* refactor
* When gitea restart, don't restart the running tasks because we may have servel gitea instances, that may break the migration
* fix js
* Update models/repo.go
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* fix tests
* rename ErrTaskIsNotExist to ErrTaskDoesNotExist
* delete release after add one on tests to make it run happy
* fix tests
* fix tests
* improve codes
* fix lint
* fix lint
* fix migrations
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/header.tmpl | 144 | ||||
-rw-r--r-- | templates/repo/migrating.tmpl | 31 |
2 files changed, 104 insertions, 71 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index fc7f1b660c..9fb3e32899 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -16,93 +16,95 @@ {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{MirrorAddress $.Mirror}}">{{MirrorAddress $.Mirror}}</a></div>{{end}} {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}} </div> - <div class="repo-buttons"> - <div class="ui labeled button" tabindex="0"> - <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}"> - <i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}} - </a> - <a class="ui basic label" href="{{.Link}}/watchers"> - {{.NumWatches}} - </a> - </div> - <div class="ui labeled button" tabindex="0"> - <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}"> - <i class="icon star{{if not $.IsStaringRepo}} outline{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}} - </a> - <a class="ui basic label" href="{{.Link}}/stars"> - {{.NumStars}} - </a> - </div> - {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}} - <div class="ui labeled button {{if and ($.IsSigned) (not $.CanSignedUserFork)}}disabled-repo-button{{end}}" tabindex="0"> - <a class="ui compact basic button {{if or (not $.IsSigned) (not $.CanSignedUserFork)}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{ else }} data-content="{{$.i18n.Tr "repo.fork_guest_user" }}" href="{{AppSubUrl}}/user/login?redirect_to={{AppSubUrl}}/repo/fork/{{.ID}}" {{end}} data-position="top center" data-variation="tiny"> - <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} + {{if not .IsBeingCreated}} + <div class="repo-buttons"> + <div class="ui labeled button" tabindex="0"> + <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}"> + <i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}} </a> - <a class="ui basic label" href="{{.Link}}/forks"> - {{.NumForks}} + <a class="ui basic label" href="{{.Link}}/watchers"> + {{.NumWatches}} </a> </div> - {{end}} - </div> + <div class="ui labeled button" tabindex="0"> + <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}"> + <i class="icon star{{if not $.IsStaringRepo}} outline{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}} + </a> + <a class="ui basic label" href="{{.Link}}/stars"> + {{.NumStars}} + </a> + </div> + {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}} + <div class="ui labeled button {{if and ($.IsSigned) (not $.CanSignedUserFork)}}disabled-repo-button{{end}}" tabindex="0"> + <a class="ui compact basic button {{if or (not $.IsSigned) (not $.CanSignedUserFork)}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{ else }} data-content="{{$.i18n.Tr "repo.fork_guest_user" }}" href="{{AppSubUrl}}/user/login?redirect_to={{AppSubUrl}}/repo/fork/{{.ID}}" {{end}} data-position="top center" data-variation="tiny"> + <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} + </a> + <a class="ui basic label" href="{{.Link}}/forks"> + {{.NumForks}} + </a> + </div> + {{end}} + </div> + {{end}} </div><!-- end grid --> </div><!-- end container --> {{end}} - <div class="ui tabs container"> - <div class="ui tabular stackable menu navbar"> - {{if .Permission.CanRead $.UnitTypeCode}} - <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}"> - <i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}} - </a> - {{end}} - - {{if .Permission.CanRead $.UnitTypeIssues}} - <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues"> - <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span> + {{if not .Repository.IsBeingCreated}} + <div class="ui tabular stackable menu navbar"> + {{if .Permission.CanRead $.UnitTypeCode}} + <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}"> + <i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}} </a> - {{end}} - - {{if .Permission.CanRead $.UnitTypeExternalTracker}} - <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer"> - <i class="octicon octicon-link-external"></i> {{.i18n.Tr "repo.issues"}} </span> - </a> - {{end}} + {{end}} - {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} - <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> - <i class="octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span> - </a> - {{end}} + {{if .Permission.CanRead $.UnitTypeIssues}} + <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues"> + <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span> + </a> + {{end}} - {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }} - <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> - <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases}}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases}}</span> - </a> - {{end}} + {{if .Permission.CanRead $.UnitTypeExternalTracker}} + <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer"> + <i class="octicon octicon-link-external"></i> {{.i18n.Tr "repo.issues"}} </span> + </a> + {{end}} - {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}} - <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}> - <i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}} - </a> - {{end}} + {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} + <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> + <i class="octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span> + </a> + {{end}} - {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}} - <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity"> - <i class="octicon octicon-pulse"></i> {{.i18n.Tr "repo.activity"}} + {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }} + <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> + <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases}}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases}}</span> </a> - {{end}} + {{end}} - {{template "custom/extra_tabs" .}} + {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}} + <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}> + <i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}} + </a> + {{end}} - {{if .Permission.IsAdmin}} - <div class="right menu"> - <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings"> - <i class="octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}} + {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}} + <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity"> + <i class="octicon octicon-pulse"></i> {{.i18n.Tr "repo.activity"}} </a> - </div> - {{end}} - </div> + {{end}} + + {{template "custom/extra_tabs" .}} + + {{if .Permission.IsAdmin}} + <div class="right menu"> + <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings"> + <i class="octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}} + </a> + </div> + {{end}} + </div> + {{end}} </div> <div class="ui tabs divider"></div> - </div> diff --git a/templates/repo/migrating.tmpl b/templates/repo/migrating.tmpl new file mode 100644 index 0000000000..34031d5653 --- /dev/null +++ b/templates/repo/migrating.tmpl @@ -0,0 +1,31 @@ +{{template "base/head" .}} +<div class="repository quickstart"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="ui grid"> + <div class="sixteen wide column content"> + {{template "base/alert" .}} + <div class="home"> + <div class="ui stackable middle very relaxed page grid"> + <div id="repo_migrating" class="sixteen wide center aligned centered column" repo="{{.Repo.Repository.FullName}}"> + <div> + <img src="{{AppSubUrl}}/img/loading.png"/> + </div> + </div> + </div> + <div class="ui stackable middle very relaxed page grid"> + <div class="sixteen wide center aligned centered column"> + <div id="repo_migrating_progress"> + <p>{{.i18n.Tr "repo.migrate.migrating" .CloneAddr | Safe}}</p> + </div> + <div id="repo_migrating_failed"> + <p>{{.i18n.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} |