From 9a4f846076a9bcb3284f7415ef280136550ba706 Mon Sep 17 00:00:00 2001
From: Tim Gross <tgross@hashicorp.com>
Date: Tue, 14 Dec 2021 11:00:05 -0500
Subject: [PATCH] Revert "config: UI configuration block with Vault/Consul
 links (#11555)"

This reverts commit 116081773118b6934046055a900047be9fb65abc.
---
 command/agent/config.go         | 12 ------------
 command/agent/http.go           | 15 +++------------
 website/data/docs-nav-data.json |  4 ----
 3 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/command/agent/config.go b/command/agent/config.go
index 2a18f0e2a8a..d3ab1e332b8 100644
--- a/command/agent/config.go
+++ b/command/agent/config.go
@@ -132,9 +132,6 @@ type Config struct {
 	// parameters necessary to derive tokens.
 	Vault *config.VaultConfig `hcl:"vault"`
 
-	// UI is used to configure the web UI
-	UI *config.UIConfig `hcl:"ui"`
-
 	// NomadConfig is used to override the default config.
 	// This is largely used for testing purposes.
 	NomadConfig *nomad.Config `hcl:"-" json:"-"`
@@ -929,7 +926,6 @@ func DefaultConfig() *Config {
 		AdvertiseAddrs: &AdvertiseAddrs{},
 		Consul:         config.DefaultConsulConfig(),
 		Vault:          config.DefaultVaultConfig(),
-		UI:             config.DefaultUIConfig(),
 		Client: &ClientConfig{
 			Enabled:               false,
 			MaxKillTimeout:        "30s",
@@ -1168,14 +1164,6 @@ func (c *Config) Merge(b *Config) *Config {
 		result.Vault = result.Vault.Merge(b.Vault)
 	}
 
-	// Apply the UI Configuration
-	if result.UI == nil && b.UI != nil {
-		uiConfig := *b.UI
-		result.UI = &uiConfig
-	} else if b.UI != nil {
-		result.UI = result.UI.Merge(b.UI)
-	}
-
 	// Apply the sentinel config
 	if result.Sentinel == nil && b.Sentinel != nil {
 		server := *b.Sentinel
diff --git a/command/agent/http.go b/command/agent/http.go
index f56215f7230..94a6fcf51c4 100644
--- a/command/agent/http.go
+++ b/command/agent/http.go
@@ -47,9 +47,8 @@ var (
 	// Set to false by stub_asset if the ui build tag isn't enabled
 	uiEnabled = true
 
-	// Displayed when ui is disabled, but overridden if the ui build
-	// tag isn't enabled
-	stubHTML = "<html><p>Nomad UI is disabled</p></html>"
+	// Overridden if the ui build tag isn't enabled
+	stubHTML = ""
 
 	// allowCORS sets permissive CORS headers for a handler
 	allowCORS = cors.New(cors.Options{
@@ -337,21 +336,13 @@ func (s *HTTPServer) registerHandlers(enableDebug bool) {
 	s.mux.HandleFunc("/v1/namespace", s.wrap(s.NamespaceCreateRequest))
 	s.mux.HandleFunc("/v1/namespace/", s.wrap(s.NamespaceSpecificRequest))
 
-	uiConfigEnabled := s.agent.config.UI != nil && s.agent.config.UI.Enabled
-
-	if uiEnabled && uiConfigEnabled {
+	if uiEnabled {
 		s.mux.Handle("/ui/", http.StripPrefix("/ui/", s.handleUI(http.FileServer(&UIAssetWrapper{FileSystem: assetFS()}))))
-		s.logger.Debug("UI is enabled")
 	} else {
 		// Write the stubHTML
 		s.mux.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) {
 			w.Write([]byte(stubHTML))
 		})
-		if uiEnabled && !uiConfigEnabled {
-			s.logger.Warn("UI is disabled")
-		} else {
-			s.logger.Debug("UI is disabled in this build")
-		}
 	}
 	s.mux.Handle("/", s.handleRootFallthrough())
 
diff --git a/website/data/docs-nav-data.json b/website/data/docs-nav-data.json
index dc56f2637ea..9fb4881ba0f 100644
--- a/website/data/docs-nav-data.json
+++ b/website/data/docs-nav-data.json
@@ -200,10 +200,6 @@
         "title": "tls",
         "path": "configuration/tls"
       },
-      {
-        "title": "ui",
-        "path": "configuration/ui"
-      },
       {
         "title": "vault",
         "path": "configuration/vault"