Add SPA UI for GARM
This change adds a single page application front-end to GARM. It uses a generated REST client, built from the swagger definitions, the websocket interface for live updates of entities and eager loading of everything except runners, as users may have many runners and we don't want to load hundreds of runners in memory. Proper pagination should be implemented in the API, in future commits, to avoid loading lots of elements for no reason. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
a811d129d0
commit
eec158b32c
230 changed files with 47324 additions and 2045 deletions
|
|
@ -663,6 +663,21 @@ func (m *Metrics) Duration() time.Duration {
|
|||
return duration
|
||||
}
|
||||
|
||||
// WebUI holds configuration for the web UI
|
||||
type WebUI struct {
|
||||
EnableWebUI bool `toml:"enable" json:"enable"`
|
||||
}
|
||||
|
||||
// Validate validates the WebUI config
|
||||
func (w *WebUI) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetWebappPath returns the webapp path with proper formatting
|
||||
func (w *WebUI) GetWebappPath() string {
|
||||
return "/ui/"
|
||||
}
|
||||
|
||||
// APIServer holds configuration for the API server
|
||||
// worker
|
||||
type APIServer struct {
|
||||
|
|
@ -671,6 +686,7 @@ type APIServer struct {
|
|||
UseTLS bool `toml:"use_tls" json:"use-tls"`
|
||||
TLSConfig TLSConfig `toml:"tls" json:"tls"`
|
||||
CORSOrigins []string `toml:"cors_origins" json:"cors-origins"`
|
||||
WebUI WebUI `toml:"webui" json:"webui"`
|
||||
}
|
||||
|
||||
// BindAddress returns a host:port string.
|
||||
|
|
@ -696,6 +712,11 @@ func (a *APIServer) Validate() error {
|
|||
// when we try to bind to it.
|
||||
return fmt.Errorf("invalid IP address")
|
||||
}
|
||||
|
||||
if err := a.WebUI.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid webui config: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue