diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0561a80fd..5161d3048 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -656,11 +656,6 @@ paths: format: int32 required: true description: Relevant project ID. - - name: detail - in: query - type: boolean - required: false - description: Get detail info or not. - name: q in: query type: string @@ -682,7 +677,7 @@ paths: - Products responses: 200: - description: If detail is false, the response body is a string array which contains the names of repositories, or the response body contains an object array as described in schema. + description: Get repositories successfully. schema: type: array items: @@ -742,16 +737,11 @@ paths: type: string required: true description: Relevant repository name. - - name: detail - in: query - type: boolean - required: false - description: If detail is true, the manifests is returned too. tags: - Products responses: 200: - description: If detail is false, the response body is a string array, or the response body contains the manifest informations as described in schema. + description: Get tags successfully. schema: type: array items: @@ -851,16 +841,11 @@ paths: format: int32 required: false description: The number of the requested public repositories, default is 10 if not provided. - - name: detail - in: query - type: boolean - required: false - description: Get detail info or not. tags: - Products responses: 200: - description: If detail is true, the response is described as the schema, or the response contains a TopRepo array. + description: Get popular repositories successfully. schema: type: array items: diff --git a/src/common/dao/repository.go b/src/common/dao/repository.go index 4cd8ec630..6191bccbc 100644 --- a/src/common/dao/repository.go +++ b/src/common/dao/repository.go @@ -103,7 +103,8 @@ func GetRepositoryByProjectName(name string) ([]*models.RepoRecord, error) { return repos, err } -//GetTopRepos returns the most popular repositories +//GetTopRepos returns the most popular repositories whose project ID is +// in projectIDs func GetTopRepos(projectIDs []int64, n int) ([]*models.RepoRecord, error) { repositories := []*models.RepoRecord{} _, err := GetOrmer().QueryTable(&models.RepoRecord{}). diff --git a/src/common/dao/repository_test.go b/src/common/dao/repository_test.go index e13cee3ef..94a769c3e 100644 --- a/src/common/dao/repository_test.go +++ b/src/common/dao/repository_test.go @@ -17,7 +17,6 @@ package dao import ( "fmt" "testing" - "time" "github.com/stretchr/testify/require" "github.com/vmware/harbor/src/common/models" @@ -170,47 +169,25 @@ func TestGetTopRepos(t *testing.T) { require.NoError(GetOrmer().Rollback()) }() - admin, err := GetUser(models.User{Username: "admin"}) - require.NoError(err) - - user := models.User{ - Username: "user", - Password: "user", - Email: "user@test.com", - } - userID, err := Register(user) - require.NoError(err) - user.UserID = int(userID) - - // - // public project with 1 repository - // non-public project with 2 repositories visible by admin - // non-public project with 1 repository visible by admin and user - // deleted public project with 1 repository - // + projectIDs := []int64{} project1 := models.Project{ - OwnerID: admin.UserID, - Name: "project1", - CreationTime: time.Now(), - OwnerName: admin.Username, - Public: 0, + OwnerID: 1, + Name: "project1", + Public: 0, } project1.ProjectID, err = AddProject(project1) require.NoError(err) + projectIDs = append(projectIDs, project1.ProjectID) project2 := models.Project{ - OwnerID: user.UserID, - Name: "project2", - CreationTime: time.Now(), - OwnerName: user.Username, - Public: 0, + OwnerID: 1, + Name: "project2", + Public: 0, } project2.ProjectID, err = AddProject(project2) require.NoError(err) - - err = AddRepository(*repository) - require.NoError(err) + projectIDs = append(projectIDs, project2.ProjectID) repository1 := &models.RepoRecord{ Name: fmt.Sprintf("%v/repository1", project1.Name), @@ -219,8 +196,6 @@ func TestGetTopRepos(t *testing.T) { err = AddRepository(*repository1) require.NoError(err) require.NoError(IncreasePullCount(repository1.Name)) - repository1, err = GetRepositoryByName(repository1.Name) - require.NoError(err) repository2 := &models.RepoRecord{ Name: fmt.Sprintf("%v/repository2", project1.Name), @@ -230,8 +205,6 @@ func TestGetTopRepos(t *testing.T) { require.NoError(err) require.NoError(IncreasePullCount(repository2.Name)) require.NoError(IncreasePullCount(repository2.Name)) - repository2, err = GetRepositoryByName(repository2.Name) - require.NoError(err) repository3 := &models.RepoRecord{ Name: fmt.Sprintf("%v/repository3", project2.Name), @@ -242,49 +215,11 @@ func TestGetTopRepos(t *testing.T) { require.NoError(IncreasePullCount(repository3.Name)) require.NoError(IncreasePullCount(repository3.Name)) require.NoError(IncreasePullCount(repository3.Name)) - repository3, err = GetRepositoryByName(repository3.Name) - require.NoError(err) - deletedPublicProject := models.Project{ - OwnerID: admin.UserID, - Name: "public-deleted", - CreationTime: time.Now(), - OwnerName: admin.Username, - Public: 1, - } - deletedPublicProject.ProjectID, err = AddProject(deletedPublicProject) - require.NoError(err) - deletedPublicRepository1 := &models.RepoRecord{ - Name: fmt.Sprintf("%v/repository1", deletedPublicProject.Name), - ProjectID: deletedPublicProject.ProjectID, - } - err = AddRepository(*deletedPublicRepository1) - require.NoError(err) - err = DeleteProject(deletedPublicProject.ProjectID) - require.NoError(err) - - var topRepos []*models.RepoRecord - - // anonymous should retrieve public non-deleted repositories - topRepos, err = GetTopRepos(NonExistUserID, 100) - require.NoError(err) - require.Len(topRepos, 1) - require.Equal(topRepos[0].Name, repository.Name) - - // admin should retrieve all repositories - topRepos, err = GetTopRepos(admin.UserID, 100) - require.NoError(err) - require.Len(topRepos, 4) - - // user should retrieve visible repositories - topRepos, err = GetTopRepos(user.UserID, 100) - require.NoError(err) - require.Len(topRepos, 2) - - // limit by count - topRepos, err = GetTopRepos(admin.UserID, 3) + topRepos, err := GetTopRepos(projectIDs, 100) require.NoError(err) require.Len(topRepos, 3) + require.Equal(topRepos[0].Name, repository3.Name) } func TestGetTotalOfRepositoriesByProject(t *testing.T) { diff --git a/src/common/models/toprepo.go b/src/common/models/toprepo.go deleted file mode 100644 index 275f72bbb..000000000 --- a/src/common/models/toprepo.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2017 VMware, Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package models diff --git a/src/common/security/rbac/context_test.go b/src/common/security/rbac/context_test.go index ef297c1be..55832a50e 100644 --- a/src/common/security/rbac/context_test.go +++ b/src/common/security/rbac/context_test.go @@ -33,6 +33,18 @@ func (f *fakePM) IsPublic(projectIDOrName interface{}) bool { func (f *fakePM) GetRoles(username string, projectIDOrName interface{}) []int { return f.roles[projectIDOrName.(string)] } +func (f *fakePM) Get(projectIDOrName interface{}) *models.Project { + return nil +} +func (f *fakePM) Exist(projectIDOrName interface{}) bool { + return false +} +func (f *fakePM) GetPublic() []models.Project { + return []models.Project{} +} +func (f *fakePM) GetByMember(username string) []models.Project { + return []models.Project{} +} func TestIsAuthenticated(t *testing.T) { // unauthenticated diff --git a/src/ui/api/harborapi_test.go b/src/ui/api/harborapi_test.go index 4ab7f368d..56cc0cf8d 100644 --- a/src/ui/api/harborapi_test.go +++ b/src/ui/api/harborapi_test.go @@ -30,6 +30,7 @@ import ( "github.com/vmware/harbor/src/common/models" "github.com/vmware/harbor/src/common/utils" "github.com/vmware/harbor/src/ui/config" + "github.com/vmware/harbor/src/ui/filter" "github.com/vmware/harbor/tests/apitests/apilib" // "strconv" // "strings" @@ -86,6 +87,8 @@ func init() { beego.BConfig.WebConfig.Session.SessionOn = true beego.TestBeegoInit(apppath) + beego.InsertFilter("/*", beego.BeforeRouter, filter.SecurityFilter) + beego.Router("/api/search/", &SearchAPI{}) beego.Router("/api/projects/", &ProjectAPI{}, "get:List;post:Post;head:Head") beego.Router("/api/projects/:id", &ProjectAPI{}, "delete:Delete;get:Get") @@ -473,8 +476,8 @@ func (a testapi) PutProjectMember(authInfo usrInfo, projectID string, userID str //-------------------------Repositories Test---------------------------------------// //Return relevant repos of projectID -func (a testapi) GetRepos(authInfo usrInfo, projectID, - keyword, detail string) (int, interface{}, error) { +func (a testapi) GetRepos(authInfo usrInfo, projectID, keyword string) ( + int, interface{}, error) { _sling := sling.New().Get(a.basePath) path := "/api/repositories/" @@ -483,13 +486,11 @@ func (a testapi) GetRepos(authInfo usrInfo, projectID, type QueryParams struct { ProjectID string `url:"project_id"` - Detail string `url:"detail"` Keyword string `url:"q"` } _sling = _sling.QueryStruct(&QueryParams{ ProjectID: projectID, - Detail: detail, Keyword: keyword, }) code, body, err := request(_sling, jsonAcceptHeader, authInfo) @@ -498,15 +499,7 @@ func (a testapi) GetRepos(authInfo usrInfo, projectID, } if code == http.StatusOK { - if detail == "1" || detail == "true" { - repositories := []repoResp{} - if err = json.Unmarshal(body, &repositories); err != nil { - return 0, nil, err - } - return code, repositories, nil - } - - repositories := []string{} + repositories := []repoResp{} if err = json.Unmarshal(body, &repositories); err != nil { return 0, nil, err } @@ -517,21 +510,13 @@ func (a testapi) GetRepos(authInfo usrInfo, projectID, } //Get tags of a relevant repository -func (a testapi) GetReposTags(authInfo usrInfo, repoName, - detail string) (int, interface{}, error) { +func (a testapi) GetReposTags(authInfo usrInfo, repoName string) (int, interface{}, error) { _sling := sling.New().Get(a.basePath) path := fmt.Sprintf("/api/repositories/%s/tags", repoName) _sling = _sling.Path(path) - type QueryParams struct { - Detail string `url:"detail"` - } - - _sling = _sling.QueryStruct(&QueryParams{ - Detail: detail, - }) httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo) if err != nil { return 0, nil, err @@ -541,15 +526,7 @@ func (a testapi) GetReposTags(authInfo usrInfo, repoName, return httpStatusCode, body, nil } - if detail == "true" || detail == "1" { - result := []detailedTagResp{} - if err := json.Unmarshal(body, &result); err != nil { - return 0, nil, err - } - return http.StatusOK, result, nil - } - - result := []string{} + result := []tagResp{} if err := json.Unmarshal(body, &result); err != nil { return 0, nil, err } @@ -569,8 +546,7 @@ func (a testapi) GetReposManifests(authInfo usrInfo, repoName string, tag string } //Get public repositories which are accessed most -func (a testapi) GetReposTop(authInfo usrInfo, count, - detail string) (int, interface{}, error) { +func (a testapi) GetReposTop(authInfo usrInfo, count string) (int, interface{}, error) { _sling := sling.New().Get(a.basePath) path := "/api/repositories/top" @@ -578,13 +554,11 @@ func (a testapi) GetReposTop(authInfo usrInfo, count, _sling = _sling.Path(path) type QueryParams struct { - Count string `url:"count"` - Detail string `url:"detail"` + Count string `url:"count"` } _sling = _sling.QueryStruct(&QueryParams{ - Count: count, - Detail: detail, + Count: count, }) code, body, err := request(_sling, jsonAcceptHeader, authInfo) if err != nil { @@ -595,15 +569,7 @@ func (a testapi) GetReposTop(authInfo usrInfo, count, return code, body, err } - if detail == "true" || detail == "1" { - result := []*repoResp{} - if err = json.Unmarshal(body, &result); err != nil { - return 0, nil, err - } - return http.StatusOK, result, nil - } - - result := []*models.TopRepo{} + result := []*repoResp{} if err = json.Unmarshal(body, &result); err != nil { return 0, nil, err } diff --git a/src/ui/api/repository.go b/src/ui/api/repository.go index 0f46dd301..99690e4a2 100644 --- a/src/ui/api/repository.go +++ b/src/ui/api/repository.go @@ -164,7 +164,7 @@ func (ra *RepositoryAPI) Delete() { return } - rc, err := ra.initRepositoryClient(ra.SecurityCxt.GetUsername(), repoName) + rc, err := ra.initRepositoryClient(repoName) if err != nil { log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err) ra.CustomAbort(http.StatusInternalServerError, "internal error") @@ -288,7 +288,7 @@ func (ra *RepositoryAPI) GetTags() { } } - client, err := ra.initRepositoryClient(ra.SecurityCxt.GetUsername(), repoName) + client, err := ra.initRepositoryClient(repoName) if err != nil { log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err) ra.CustomAbort(http.StatusInternalServerError, "internal error") @@ -383,7 +383,7 @@ func (ra *RepositoryAPI) GetManifests() { } } - rc, err := ra.initRepositoryClient(ra.SecurityCxt.GetUsername(), repoName) + rc, err := ra.initRepositoryClient(repoName) if err != nil { log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err) ra.CustomAbort(http.StatusInternalServerError, "internal error") @@ -445,14 +445,14 @@ func getManifest(client *registry.Repository, return result, nil } -func (ra *RepositoryAPI) initRepositoryClient(username, repoName string) (r *registry.Repository, err error) { +func (ra *RepositoryAPI) initRepositoryClient(repoName string) (r *registry.Repository, err error) { endpoint, err := config.RegistryURL() if err != nil { return nil, err } - return NewRepositoryClient(endpoint, true, username, repoName, - "repository", repoName, "pull", "push", "*") + return NewRepositoryClient(endpoint, true, ra.SecurityCxt.GetUsername(), + repoName, "repository", repoName, "pull", "push", "*") } //GetTopRepos returns the most populor repositories diff --git a/src/ui/api/repository_test.go b/src/ui/api/repository_test.go index c05e40da8..bdaf72d41 100644 --- a/src/ui/api/repository_test.go +++ b/src/ui/api/repository_test.go @@ -18,7 +18,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/vmware/harbor/src/common/models" ) func TestGetRepos(t *testing.T) { @@ -27,12 +26,11 @@ func TestGetRepos(t *testing.T) { apiTest := newHarborAPI() projectID := "1" keyword := "hello-world" - detail := "true" fmt.Println("Testing Repos Get API") //-------------------case 1 : response code = 200------------------------// fmt.Println("case 1 : response code = 200") - code, repositories, err := apiTest.GetRepos(*admin, projectID, keyword, detail) + code, repositories, err := apiTest.GetRepos(*admin, projectID, keyword) if err != nil { t.Errorf("failed to get repositories: %v", err) } else { @@ -41,14 +39,14 @@ func TestGetRepos(t *testing.T) { assert.Equal(int(1), len(repos), "the length of repositories should be 1") assert.Equal(repos[0].Name, "library/hello-world", "unexpected repository name") } else { - t.Error("the response should return more info as detail is true") + t.Error("unexpected reponse") } } //-------------------case 2 : response code = 404------------------------// fmt.Println("case 2 : response code = 404:project not found") projectID = "111" - httpStatusCode, _, err := apiTest.GetRepos(*admin, projectID, keyword, detail) + httpStatusCode, _, err := apiTest.GetRepos(*admin, projectID, keyword) if err != nil { t.Error("Error whihle get repos by projectID", err.Error()) t.Log(err) @@ -56,27 +54,10 @@ func TestGetRepos(t *testing.T) { assert.Equal(int(404), httpStatusCode, "httpStatusCode should be 404") } - //-------------------case 3 : response code = 200------------------------// - fmt.Println("case 3 : response code = 200") - projectID = "1" - detail = "false" - code, repositories, err = apiTest.GetRepos(*admin, projectID, keyword, detail) - if err != nil { - t.Errorf("failed to get repositories: %v", err) - } else { - assert.Equal(int(200), code, "response code should be 200") - if repos, ok := repositories.([]string); ok { - assert.Equal(int(1), len(repos), "the length of repositories should be 1") - assert.Equal(repos[0], "library/hello-world", "unexpected repository name") - } else { - t.Error("the response should not return detail info as detail is false") - } - } - - //-------------------case 4 : response code = 400------------------------// - fmt.Println("case 4 : response code = 400,invalid project_id") + //-------------------case 3 : response code = 400------------------------// + fmt.Println("case 3 : response code = 400,invalid project_id") projectID = "ccc" - httpStatusCode, _, err = apiTest.GetRepos(*admin, projectID, keyword, detail) + httpStatusCode, _, err = apiTest.GetRepos(*admin, projectID, keyword) if err != nil { t.Error("Error whihle get repos by projectID", err.Error()) t.Log(err) @@ -95,8 +76,7 @@ func TestGetReposTags(t *testing.T) { //-------------------case 1 : response code = 404------------------------// fmt.Println("case 1 : response code = 404,repo not found") repository := "errorRepos" - detail := "false" - code, _, err := apiTest.GetReposTags(*admin, repository, detail) + code, _, err := apiTest.GetReposTags(*admin, repository) if err != nil { t.Errorf("failed to get tags of repository %s: %v", repository, err) } else { @@ -105,33 +85,16 @@ func TestGetReposTags(t *testing.T) { //-------------------case 2 : response code = 200------------------------// fmt.Println("case 2 : response code = 200") repository = "library/hello-world" - code, tags, err := apiTest.GetReposTags(*admin, repository, detail) + code, tags, err := apiTest.GetReposTags(*admin, repository) if err != nil { t.Errorf("failed to get tags of repository %s: %v", repository, err) } else { assert.Equal(int(200), code, "httpStatusCode should be 200") - if tg, ok := tags.([]string); ok { - assert.Equal(1, len(tg), fmt.Sprintf("there should be only one tag, but now %v", tg)) - assert.Equal(tg[0], "latest", "the tag should be latest") - } else { - t.Error("the tags should be in simple style as the detail is false") - } - } - - //-------------------case 3 : response code = 200------------------------// - fmt.Println("case 3 : response code = 200") - repository = "library/hello-world" - detail = "true" - code, tags, err = apiTest.GetReposTags(*admin, repository, detail) - if err != nil { - t.Errorf("failed to get tags of repository %s: %v", repository, err) - } else { - assert.Equal(int(200), code, "httpStatusCode should be 200") - if tg, ok := tags.([]detailedTagResp); ok { + if tg, ok := tags.([]tagResp); ok { assert.Equal(1, len(tg), fmt.Sprintf("there should be only one tag, but now %v", tg)) assert.Equal(tg[0].Tag, "latest", "the tag should be latest") } else { - t.Error("the tags should be in detail style as the detail is true") + t.Error("unexpected response") } } @@ -190,38 +153,20 @@ func TestGetReposTop(t *testing.T) { apiTest := newHarborAPI() fmt.Println("Testing ReposTop Get API") - //-------------------case 1 : response code = 200------------------------// - fmt.Println("case 1 : response code = 200") - count := "1" - detail := "false" - code, repos, err := apiTest.GetReposTop(*admin, count, detail) - if err != nil { - t.Errorf("failed to get the most popular repositories: %v", err) - } else { - assert.Equal(int(200), code, "response code should be 200") - if r, ok := repos.([]*models.TopRepo); ok { - assert.Equal(int(1), len(r), "the length should be 1") - assert.Equal(r[0].RepoName, "library/docker", "the name of repository should be library/docker") - } else { - t.Error("the repositories should in simple style as the detail is false") - } - } - - //-------------------case 2 : response code = 400------------------------// - fmt.Println("case 2 : response code = 400,invalid count") - count = "cc" - code, _, err = apiTest.GetReposTop(*admin, count, detail) + //-------------------case 1 : response code = 400------------------------// + fmt.Println("case 1 : response code = 400,invalid count") + count := "cc" + code, _, err := apiTest.GetReposTop(*admin, count) if err != nil { t.Errorf("failed to get the most popular repositories: %v", err) } else { assert.Equal(int(400), code, "response code should be 400") } - //-------------------case 3 : response code = 200------------------------// - fmt.Println("case 3 : response code = 200") + //-------------------case 2 : response code = 200------------------------// + fmt.Println("case 2 : response code = 200") count = "1" - detail = "true" - code, repos, err = apiTest.GetReposTop(*admin, count, detail) + code, repos, err := apiTest.GetReposTop(*admin, count) if err != nil { t.Errorf("failed to get the most popular repositories: %v", err) } else { @@ -230,7 +175,7 @@ func TestGetReposTop(t *testing.T) { assert.Equal(int(1), len(r), "the length should be 1") assert.Equal(r[0].Name, "library/docker", "the name of repository should be library/docker") } else { - t.Error("the repositories should in detail style as the detail is true") + t.Error("unexpected response") } } diff --git a/src/ui/projectmanager/db/pm.go b/src/ui/projectmanager/db/pm.go index c191099c8..d5f603e4d 100644 --- a/src/ui/projectmanager/db/pm.go +++ b/src/ui/projectmanager/db/pm.go @@ -118,7 +118,14 @@ func (p *ProjectManager) GetPublic() []models.Project { // GetByMember returns all projects which the user is a member of func (p *ProjectManager) GetByMember(username string) []models.Project { - projects, err := dao.GetProjects(username) + user, err := dao.GetUser(models.User{ + Username: username, + }) + if err != nil { + log.Errorf("failed to get user %s: %v", username, err) + return []models.Project{} + } + projects, err := dao.GetUserRelevantProjects(user.UserID, "") if err != nil { log.Errorf("failed to get projects of %s: %v", username, err) return []models.Project{} diff --git a/src/ui/router.go b/src/ui/router.go index 90447cb3b..69f0f9912 100644 --- a/src/ui/router.go +++ b/src/ui/router.go @@ -71,8 +71,9 @@ func initRouters() { beego.Router("/api/users/?:id", &api.UserAPI{}) beego.Router("/api/users/:id([0-9]+)/password", &api.UserAPI{}, "put:ChangePassword") beego.Router("/api/internal/syncregistry", &api.InternalAPI{}, "post:SyncRegistry") - beego.Router("/api/repositories", &api.RepositoryAPI{}) - beego.Router("/api/repositories/*/tags/?:tag", &api.RepositoryAPI{}, "delete:Delete") + beego.Router("/api/repositories", &api.RepositoryAPI{}, "get:Get") + beego.Router("/api/repositories/*", &api.RepositoryAPI{}, "delete:Delete") + beego.Router("/api/repositories/*/tags/:tag", &api.RepositoryAPI{}, "delete:Delete") beego.Router("/api/repositories/*/tags", &api.RepositoryAPI{}, "get:GetTags") beego.Router("/api/repositories/*/tags/:tag/manifest", &api.RepositoryAPI{}, "get:GetManifests") beego.Router("/api/repositories/*/signatures", &api.RepositoryAPI{}, "get:GetSignatures") diff --git a/src/ui_ng/src/app/repository/repository.service.ts b/src/ui_ng/src/app/repository/repository.service.ts index 03dcfe9bd..f797d8a3d 100644 --- a/src/ui_ng/src/app/repository/repository.service.ts +++ b/src/ui_ng/src/app/repository/repository.service.ts @@ -34,14 +34,14 @@ export class RepositoryService { params.set('page_size', pageSize + ''); } return this.http - .get(`/api/repositories?project_id=${projectId}&q=${repoName}&detail=1`, {search: params}) + .get(`/api/repositories?project_id=${projectId}&q=${repoName}`, {search: params}) .map(response=>response) .catch(error=>Observable.throw(error)); } listTags(repoName: string): Observable { return this.http - .get(`/api/repositories/${repoName}/tags?detail=1`) + .get(`/api/repositories/${repoName}/tags`) .map(response=>response.json()) .catch(error=>Observable.throw(error)); } @@ -77,7 +77,7 @@ export class RepositoryService { deleteRepository(repoName: string): Observable { return this.http - .delete(`/api/repositories/${repoName}/tags`) + .delete(`/api/repositories/${repoName}`) .map(response=>response.status) .catch(error=>Observable.throw(error)); } diff --git a/src/ui_ng/src/app/repository/top-repo/top-repository.service.ts b/src/ui_ng/src/app/repository/top-repo/top-repository.service.ts index 0d68cdd25..ce103ef36 100644 --- a/src/ui_ng/src/app/repository/top-repo/top-repository.service.ts +++ b/src/ui_ng/src/app/repository/top-repo/top-repository.service.ts @@ -17,7 +17,7 @@ import 'rxjs/add/operator/toPromise'; import { Repository } from '../repository'; -export const topRepoEndpoint = "/api/repositories/top?detail=1"; +export const topRepoEndpoint = "/api/repositories/top"; /** * Declare service to handle the top repositories *