1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(app): introduce react configurations [EE-1809] (#5953)

This commit is contained in:
Chaim Lev-Ari 2021-11-03 12:41:59 +02:00 committed by GitHub
parent b285219a58
commit 85a6a80722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 8974 additions and 599 deletions

View file

@ -27,6 +27,7 @@ import (
"github.com/portainer/portainer/api/http/handler/ssl"
"github.com/portainer/portainer/api/http/handler/stacks"
"github.com/portainer/portainer/api/http/handler/status"
"github.com/portainer/portainer/api/http/handler/storybook"
"github.com/portainer/portainer/api/http/handler/tags"
"github.com/portainer/portainer/api/http/handler/teammemberships"
"github.com/portainer/portainer/api/http/handler/teams"
@ -63,6 +64,7 @@ type Handler struct {
SSLHandler *ssl.Handler
StackHandler *stacks.Handler
StatusHandler *status.Handler
StorybookHandler *storybook.Handler
TagHandler *tags.Handler
TeamMembershipHandler *teammemberships.Handler
TeamHandler *teams.Handler
@ -227,6 +229,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.StripPrefix("/api", h.WebSocketHandler).ServeHTTP(w, r)
case strings.HasPrefix(r.URL.Path, "/api/webhooks"):
http.StripPrefix("/api", h.WebhookHandler).ServeHTTP(w, r)
case strings.HasPrefix(r.URL.Path, "/storybook"):
http.StripPrefix("/storybook", h.StorybookHandler).ServeHTTP(w, r)
case strings.HasPrefix(r.URL.Path, "/"):
h.FileHandler.ServeHTTP(w, r)
}

View file

@ -0,0 +1,23 @@
package storybook
import (
"net/http"
"path"
)
// Handler represents an HTTP API handler for managing static files.
type Handler struct {
http.Handler
}
// NewHandler creates a handler to serve static files.
func NewHandler(assetsPath string) *Handler {
h := &Handler{
http.FileServer(http.Dir(path.Join(assetsPath, "storybook"))),
}
return h
}
func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
handler.Handler.ServeHTTP(w, r)
}

View file

@ -38,6 +38,7 @@ import (
sslhandler "github.com/portainer/portainer/api/http/handler/ssl"
"github.com/portainer/portainer/api/http/handler/stacks"
"github.com/portainer/portainer/api/http/handler/status"
"github.com/portainer/portainer/api/http/handler/storybook"
"github.com/portainer/portainer/api/http/handler/tags"
"github.com/portainer/portainer/api/http/handler/teammemberships"
"github.com/portainer/portainer/api/http/handler/teams"
@ -213,6 +214,8 @@ func (server *Server) Start() error {
stackHandler.ComposeStackManager = server.ComposeStackManager
stackHandler.StackDeployer = server.StackDeployer
var storybookHandler = storybook.NewHandler(server.AssetsPath)
var tagHandler = tags.NewHandler(requestBouncer)
tagHandler.DataStore = server.DataStore
@ -271,6 +274,7 @@ func (server *Server) Start() error {
SSLHandler: sslHandler,
StatusHandler: statusHandler,
StackHandler: stackHandler,
StorybookHandler: storybookHandler,
TagHandler: tagHandler,
TeamHandler: teamHandler,
TeamMembershipHandler: teamMembershipHandler,