harbor/src/ui/router.go

107 lines
5.6 KiB
Go
Raw Normal View History

2016-02-01 12:59:10 +01:00
/*
Copyright (c) 2016 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.
*/
2016-02-26 11:54:14 +01:00
2016-04-07 12:34:12 +02:00
package main
2016-02-01 12:59:10 +01:00
import (
2016-10-19 08:32:00 +02:00
"github.com/vmware/harbor/src/ui/api"
"github.com/vmware/harbor/src/ui/controllers"
"github.com/vmware/harbor/src/ui/service"
"github.com/vmware/harbor/src/ui/service/token"
2016-02-01 12:59:10 +01:00
"github.com/astaxie/beego"
)
2016-04-07 12:34:12 +02:00
func initRouters() {
2016-02-01 12:59:10 +01:00
beego.SetStaticPath("static/resources", "static/resources")
beego.SetStaticPath("static/vendors", "static/vendors")
beego.SetStaticPath("/ng", "./static/new-ui")
beego.SetStaticPath("/ng/harbor", "./static/new-ui")
beego.SetStaticPath("/ng/harbor/dashboard", "./static/new-ui")
beego.SetStaticPath("/ng/harbor/projects", "./static/new-ui")
beego.SetStaticPath("/ng/harbor/users", "./static/new-ui")
//Page Controllers:
beego.Router("/", &controllers.IndexController{})
beego.Router("/dashboard", &controllers.DashboardController{})
beego.Router("/project", &controllers.ProjectController{})
beego.Router("/repository", &controllers.RepositoryController{})
beego.Router("/sign_up", &controllers.SignUpController{})
beego.Router("/add_new", &controllers.AddNewController{})
beego.Router("/account_setting", &controllers.AccountSettingController{})
2016-07-06 07:09:32 +02:00
beego.Router("/change_password", &controllers.ChangePasswordController{})
beego.Router("/admin_option", &controllers.AdminOptionController{})
beego.Router("/forgot_password", &controllers.ForgotPasswordController{})
beego.Router("/reset_password", &controllers.ResetPasswordController{})
beego.Router("/search", &controllers.SearchController{})
2016-02-01 12:59:10 +01:00
beego.Router("/login", &controllers.CommonController{}, "post:Login")
beego.Router("/log_out", &controllers.CommonController{}, "get:LogOut")
2016-02-01 12:59:10 +01:00
beego.Router("/reset", &controllers.CommonController{}, "post:ResetPassword")
beego.Router("/userExists", &controllers.CommonController{}, "post:UserExists")
2016-02-01 12:59:10 +01:00
beego.Router("/sendEmail", &controllers.CommonController{}, "get:SendEmail")
beego.Router("/language", &controllers.CommonController{}, "get:SwitchLanguage")
2016-02-01 12:59:10 +01:00
beego.Router("/optional_menu", &controllers.OptionalMenuController{})
beego.Router("/navigation_header", &controllers.NavigationHeaderController{})
beego.Router("/navigation_detail", &controllers.NavigationDetailController{})
beego.Router("/sign_in", &controllers.SignInController{})
2016-02-01 12:59:10 +01:00
//API:
beego.Router("/api/search", &api.SearchAPI{})
beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &api.ProjectMemberAPI{})
beego.Router("/api/projects/", &api.ProjectAPI{}, "get:List;post:Post")
beego.Router("/api/projects/:id", &api.ProjectAPI{})
2016-06-02 11:33:10 +02:00
beego.Router("/api/projects/:id/publicity", &api.ProjectAPI{}, "put:ToggleProjectPublic")
beego.Router("/api/statistics", &api.StatisticAPI{})
2016-05-27 12:46:07 +02:00
beego.Router("/api/projects/:id([0-9]+)/logs/filter", &api.ProjectAPI{}, "post:FilterAccessLog")
2016-05-30 09:39:51 +02:00
beego.Router("/api/users/?:id", &api.UserAPI{})
2016-05-27 12:46:07 +02:00
beego.Router("/api/users/:id([0-9]+)/password", &api.UserAPI{}, "put:ChangePassword")
beego.Router("/api/internal/syncregistry", &api.InternalAPI{}, "post:SyncRegistry")
2016-02-01 12:59:10 +01:00
beego.Router("/api/repositories", &api.RepositoryAPI{})
beego.Router("/api/repositories/tags", &api.RepositoryAPI{}, "get:GetTags")
beego.Router("/api/repositories/manifests", &api.RepositoryAPI{}, "get:GetManifests")
beego.Router("/api/repositories/signatures", &api.RepositoryAPI{}, "get:GetSignatures")
beego.Router("/api/jobs/replication/", &api.RepJobAPI{}, "get:List")
beego.Router("/api/jobs/replication/:id([0-9]+)", &api.RepJobAPI{})
2016-05-27 12:46:07 +02:00
beego.Router("/api/jobs/replication/:id([0-9]+)/log", &api.RepJobAPI{}, "get:GetLog")
2016-06-13 10:49:46 +02:00
beego.Router("/api/policies/replication/:id([0-9]+)", &api.RepPolicyAPI{})
beego.Router("/api/policies/replication", &api.RepPolicyAPI{}, "get:List")
2016-06-14 12:49:23 +02:00
beego.Router("/api/policies/replication", &api.RepPolicyAPI{}, "post:Post")
2016-05-27 12:46:07 +02:00
beego.Router("/api/policies/replication/:id([0-9]+)/enablement", &api.RepPolicyAPI{}, "put:UpdateEnablement")
2016-06-13 02:31:32 +02:00
beego.Router("/api/targets/", &api.TargetAPI{}, "get:List")
2016-06-14 12:49:23 +02:00
beego.Router("/api/targets/", &api.TargetAPI{}, "post:Post")
2016-06-13 02:31:32 +02:00
beego.Router("/api/targets/:id([0-9]+)", &api.TargetAPI{})
beego.Router("/api/targets/:id([0-9]+)/policies/", &api.TargetAPI{}, "get:ListPolicies")
2016-05-27 12:46:07 +02:00
beego.Router("/api/targets/ping", &api.TargetAPI{}, "post:Ping")
2016-06-02 11:57:39 +02:00
beego.Router("/api/users/:id/sysadmin", &api.UserAPI{}, "put:ToggleUserAdminRole")
2016-06-02 07:41:52 +02:00
beego.Router("/api/repositories/top", &api.RepositoryAPI{}, "get:GetTopRepos")
2016-06-21 12:43:31 +02:00
beego.Router("/api/logs", &api.LogAPI{})
2016-12-30 11:04:01 +01:00
beego.Router("/api/configurations", &api.ConfigAPI{})
2016-10-25 06:44:27 +02:00
2017-03-09 13:12:33 +01:00
beego.Router("/api/systeminfo", &api.SystemInfoAPI{}, "get:GetGeneralInfo")
2016-11-02 05:50:53 +01:00
beego.Router("/api/systeminfo/volumes", &api.SystemInfoAPI{}, "get:GetVolumeInfo")
2016-11-18 09:07:18 +01:00
beego.Router("/api/systeminfo/getcert", &api.SystemInfoAPI{}, "get:GetCert")
2017-01-09 11:24:31 +01:00
beego.Router("/api/ldap/ping", &api.LdapAPI{}, "post:Ping")
beego.Router("/api/ldap/users/search", &api.LdapAPI{}, "post:Search")
beego.Router("/api/ldap/users/import", &api.LdapAPI{}, "post:ImportUser")
2017-03-03 09:19:42 +01:00
beego.Router("/api/email/ping", &api.EmailAPI{}, "post:Ping")
2017-01-09 11:24:31 +01:00
2016-02-01 12:59:10 +01:00
//external service that hosted on harbor process:
beego.Router("/service/notifications", &service.NotificationHandler{})
2016-04-15 07:17:32 +02:00
beego.Router("/service/token", &token.Handler{})
2016-02-01 12:59:10 +01:00
}