mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 12:15:20 +01:00
Include the registry info in the project summary API for proxy cache project
Include the registry info in the project summary API for proxy cache project Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
af3a638980
commit
d7327d8d8e
@ -3877,6 +3877,8 @@ definitions:
|
|||||||
used:
|
used:
|
||||||
$ref: "#/definitions/ResourceList"
|
$ref: "#/definitions/ResourceList"
|
||||||
description: The used status of the quota
|
description: The used status of the quota
|
||||||
|
registry:
|
||||||
|
$ref: "#/definitions/Registry"
|
||||||
User:
|
User:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/pkg/quota/types"
|
"github.com/goharbor/harbor/src/pkg/quota/types"
|
||||||
|
"github.com/goharbor/harbor/src/replication/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -211,5 +212,6 @@ type ProjectSummary struct {
|
|||||||
GuestCount int64 `json:"guest_count"`
|
GuestCount int64 `json:"guest_count"`
|
||||||
LimitedGuestCount int64 `json:"limited_guest_count"`
|
LimitedGuestCount int64 `json:"limited_guest_count"`
|
||||||
|
|
||||||
Quota *QuotaSummary `json:"quota,omitempty"`
|
Quota *QuotaSummary `json:"quota,omitempty"`
|
||||||
|
Registry *model.Registry `json:"registry"`
|
||||||
}
|
}
|
||||||
|
@ -571,6 +571,18 @@ func (p *ProjectAPI) Summary() {
|
|||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
if p.project.RegistryID > 0 {
|
||||||
|
registry, err := replication.RegistryMgr.Get(p.project.RegistryID)
|
||||||
|
if err != nil {
|
||||||
|
log.Warningf("failed to get registry %d: %v", p.project.RegistryID, err)
|
||||||
|
} else {
|
||||||
|
if registry != nil {
|
||||||
|
registry.Credential = nil
|
||||||
|
summary.Registry = registry
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p.Data["json"] = summary
|
p.Data["json"] = summary
|
||||||
p.ServeJSON()
|
p.ServeJSON()
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
common_model "github.com/goharbor/harbor/src/common/models"
|
|
||||||
"github.com/goharbor/harbor/src/replication"
|
"github.com/goharbor/harbor/src/replication"
|
||||||
"github.com/goharbor/harbor/src/replication/dao/models"
|
"github.com/goharbor/harbor/src/replication/dao/models"
|
||||||
"github.com/goharbor/harbor/src/replication/event"
|
"github.com/goharbor/harbor/src/replication/event"
|
||||||
@ -58,10 +57,8 @@ func (r *ReplicationPolicyAPI) List() {
|
|||||||
// TODO: support more query
|
// TODO: support more query
|
||||||
query := &model.PolicyQuery{
|
query := &model.PolicyQuery{
|
||||||
Name: r.GetString("name"),
|
Name: r.GetString("name"),
|
||||||
Pagination: common_model.Pagination{
|
Page: page,
|
||||||
Page: page,
|
Size: size,
|
||||||
Size: size,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
total, policies, err := replication.PolicyCtl.List(query)
|
total, policies, err := replication.PolicyCtl.List(query)
|
||||||
|
@ -3,7 +3,6 @@ package dao
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
common_models "github.com/goharbor/harbor/src/common/models"
|
|
||||||
"github.com/goharbor/harbor/src/replication/dao/models"
|
"github.com/goharbor/harbor/src/replication/dao/models"
|
||||||
"github.com/goharbor/harbor/src/replication/model"
|
"github.com/goharbor/harbor/src/replication/model"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -106,10 +105,8 @@ func TestGetPolicies(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Name: tt.args.name,
|
Name: tt.args.name,
|
||||||
Namespace: tt.args.namespace,
|
Namespace: tt.args.namespace,
|
||||||
Pagination: common_models.Pagination{
|
Page: tt.args.page,
|
||||||
Page: tt.args.page,
|
Size: tt.args.pageSize,
|
||||||
Size: tt.args.pageSize,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}...)
|
}...)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
|
@ -17,7 +17,6 @@ package model
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/astaxie/beego/validation"
|
"github.com/astaxie/beego/validation"
|
||||||
"github.com/goharbor/harbor/src/common/models"
|
|
||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -168,5 +167,6 @@ type PolicyQuery struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
SrcRegistry int64
|
SrcRegistry int64
|
||||||
DestRegistry int64
|
DestRegistry int64
|
||||||
models.Pagination
|
Page int64
|
||||||
|
Size int64
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user