mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-21 23:21:26 +01:00
merge with master
This commit is contained in:
commit
fa18ab3a75
@ -30,6 +30,6 @@ notifications:
|
||||
- name: harbor
|
||||
disabled: false
|
||||
url: http://ui/service/notifications
|
||||
timeout: 500ms
|
||||
timeout: 3000ms
|
||||
threshold: 5
|
||||
backoff: 1s
|
||||
|
@ -127,6 +127,10 @@ func (ra *RepJobAPI) Delete() {
|
||||
ra.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
|
||||
if job == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("job %d not found", ra.jobID))
|
||||
}
|
||||
|
||||
if job.Status == models.JobPending || job.Status == models.JobRunning {
|
||||
ra.CustomAbort(http.StatusBadRequest, fmt.Sprintf("job is %s, can not be deleted", job.Status))
|
||||
}
|
||||
|
@ -222,6 +222,10 @@ func (ra *RepositoryAPI) GetTags() {
|
||||
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||
}
|
||||
|
||||
if project == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||
}
|
||||
|
||||
if project.Public == 0 {
|
||||
userID := ra.ValidateUser()
|
||||
if !checkProjectPermission(userID, project.ProjectID) {
|
||||
|
@ -107,6 +107,12 @@ func (b *BaseController) Prepare() {
|
||||
if _, err := os.Stat(filepath.Join("static", "resources", "js", "harbor.app.min.js")); os.IsNotExist(err) {
|
||||
b.UseCompressedJS = false
|
||||
}
|
||||
|
||||
selfRegistration := strings.ToLower(os.Getenv("SELF_REGISTRATION"))
|
||||
if selfRegistration == "on" {
|
||||
b.SelfRegistration = true
|
||||
}
|
||||
b.Data["SelfRegistration"] = b.SelfRegistration
|
||||
}
|
||||
|
||||
// Forward to setup layout and template for content for a page.
|
||||
|
@ -11,7 +11,7 @@ type SignUpController struct {
|
||||
|
||||
// Get renders sign up page
|
||||
func (suc *SignUpController) Get() {
|
||||
if suc.AuthMode != "db_auth" {
|
||||
if suc.AuthMode != "db_auth" || !suc.SelfRegistration {
|
||||
suc.CustomAbort(http.StatusUnauthorized, "Status unauthorized.")
|
||||
}
|
||||
suc.Data["AddNew"] = false
|
||||
|
@ -195,7 +195,7 @@ func GetTopRepos(countNum int) ([]models.TopRepo, error) {
|
||||
for i := 0; i < len(list); i++ {
|
||||
for _, v := range usrnameList {
|
||||
if v.RepoName == list[i].RepoName {
|
||||
list[i].Creator = v.Creator
|
||||
// list[i].Creator = v.Creator
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -770,9 +770,11 @@ func TestGetTopRepos(t *testing.T) {
|
||||
if topRepos[0].AccessCount != 1 {
|
||||
t.Errorf("error occured in get top reop's access count, expected: %v, actual: %v", 1, topRepos[0].AccessCount)
|
||||
}
|
||||
if topRepos[0].Creator != currentUser.Username {
|
||||
t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator)
|
||||
}
|
||||
/*
|
||||
if topRepos[0].Creator != currentUser.Username {
|
||||
t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator)
|
||||
}
|
||||
*/
|
||||
err = ToggleProjectPublicity(currentProject.ProjectID, publicityOff)
|
||||
if err != nil {
|
||||
t.Errorf("Error occurred in ToggleProjectPublicity: %v", err)
|
||||
|
@ -19,5 +19,5 @@ package models
|
||||
type TopRepo struct {
|
||||
RepoName string `json:"name"`
|
||||
AccessCount int64 `json:"count"`
|
||||
Creator string `json:"creator"`
|
||||
// Creator string `json:"creator"`
|
||||
}
|
||||
|
@ -18,8 +18,7 @@
|
||||
<table class="table table-pane table-header">
|
||||
<thead>
|
||||
<th width="60%">// 'repository_name' | tr //</th>
|
||||
<th width="15%">// 'count' | tr //</th>
|
||||
<th width="25%">// 'creator' | tr //</th>
|
||||
<th width="40%">// 'count' | tr //</th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
@ -30,7 +29,7 @@
|
||||
<td colspan="5" height="120px" class="empty-hint" ng-if="vm.top10Repositories.length === 0"><h4 class="text-muted">// 'no_top_repositories' | tr //</h4></td>
|
||||
</tr>
|
||||
<tr ng-if="vm.top10Repositories.length > 0" ng-repeat="t in vm.top10Repositories">
|
||||
<td width="60%">//t.name//</td><td width="15%">//t.count//</td><td width="25%">//t.creator === '' ? '-' : t.creator //</td>
|
||||
<td width="60%">//t.name//</td><td width="40%">//t.count//</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="col-sm-offset-1 col-sm-10">
|
||||
<div class="pull-right">
|
||||
<button type="submit" class="btn btn-default" ng-click="vm.doSignIn(user)" loading-progress hide-target="false" toggle-in-progress="vm.signInTIP">// 'sign_in' | tr //</button>
|
||||
{{ if eq .AuthMode "db_auth" }}
|
||||
{{ if and (eq .AuthMode "db_auth") (eq .SelfRegistration true) }}
|
||||
<button type="button" class="btn btn-success" ng-click="vm.doSignUp()">// 'sign_up' | tr //</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user