feat(ui): package zui within zot binary (#1161)

(cherry picked from commit d557da0baba819b7cd7e6b5941528776e125ac6d)

build(ui): fix stacker builds


(cherry picked from commit ba25daf02b4a9bc7ee1cb6f84b7a6b096ca7d61f)

build(ui): various fixes

- Fix metrics endpoint
- Fix unit tests unit tests
- Make the ui build optional in the makefile
before the linter lint runs in the golangci-lint workflow
- Do not attempt to include UI routes if search is enabled
- Fix authorization for search endpoint



fix: use zot tag in ui make target


(cherry picked from commit 2a6882fa23f06b2d68c6c299773a6ff50bf90e78)

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
Signed-off-by: Catalin Hofnar <catalin.hofnar@gmail.com>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Andrei Aaron
2023-02-11 00:52:54 +02:00
committed by GitHub
parent d12836e69c
commit c0aaca8ed1
16 changed files with 189 additions and 37 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ func SetupGQLPlaygroundRoutes(conf *config.Config, router *mux.Router,
}
//nolint:lll
router.PathPrefix(constants.RoutePrefix + debugCst.GQLPlaygroundEndpoint).HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
router.PathPrefix(debugCst.GQLPlaygroundEndpoint).HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
writer.Header().Add("Content-Type", "text/html")
proto := ""
+5 -2
View File
@@ -17,9 +17,12 @@ import (
_ "zotregistry.io/zot/swagger"
)
func SetupSwaggerRoutes(conf *config.Config, router *mux.Router, log log.Logger,
func SetupSwaggerRoutes(conf *config.Config, router *mux.Router, authFunc mux.MiddlewareFunc,
log log.Logger,
) {
log.Info().Msg("setting up swagger route")
// swagger swagger "/swagger/v2/index.html"
router.PathPrefix("/swagger/v2/").Methods("GET").Handler(httpSwagger.WrapHandler)
swgRouter := router.PathPrefix("/swagger/v2/").Subrouter()
swgRouter.Use(authFunc)
swgRouter.Methods("GET").Handler(httpSwagger.WrapHandler)
}
+2 -1
View File
@@ -16,7 +16,8 @@ import (
_ "zotregistry.io/zot/swagger"
)
func SetupSwaggerRoutes(conf *config.Config, router *mux.Router, log log.Logger,
func SetupSwaggerRoutes(conf *config.Config, router *mux.Router, authFunc mux.MiddlewareFunc,
log log.Logger,
) {
// swagger swagger "/swagger/v2/index.html"
log.Warn().Msg("skipping enabling swagger because given zot binary " +