diff --git a/quesma/quesma/ui/console_routes.go b/quesma/quesma/ui/console_routes.go index f98e0bbf5..cc05c0cf3 100644 --- a/quesma/quesma/ui/console_routes.go +++ b/quesma/quesma/ui/console_routes.go @@ -76,6 +76,7 @@ func (qmc *QuesmaManagementConsole) createRouting() *mux.Router { if qmc.cfg.Elasticsearch.User == "" && qmc.cfg.Elasticsearch.Password == "" { logger.Warn().Msg("admin console authentication is disabled") } else { + qmc.isAuthEnabled = true authenticatedRoutes.Use(authMiddleware) } diff --git a/quesma/quesma/ui/dashboard.go b/quesma/quesma/ui/dashboard.go index 3f956e3f2..0068f5b50 100644 --- a/quesma/quesma/ui/dashboard.go +++ b/quesma/quesma/ui/dashboard.go @@ -21,7 +21,7 @@ import ( func (qmc *QuesmaManagementConsole) generateDashboard() []byte { buffer := newBufferWithHead() - buffer.Write(generateTopNavigation("dashboard")) + buffer.Write(qmc.generateTopNavigation("dashboard")) buffer.Html(`
` + "\n") diff --git a/quesma/quesma/ui/data_sources.go b/quesma/quesma/ui/data_sources.go index b279cd962..57efaf33a 100644 --- a/quesma/quesma/ui/data_sources.go +++ b/quesma/quesma/ui/data_sources.go @@ -10,7 +10,7 @@ import ( func (qmc *QuesmaManagementConsole) generateDatasourcesPage() []byte { buffer := newBufferWithHead() - buffer.Write(generateTopNavigation("data-sources")) + buffer.Write(qmc.generateTopNavigation("data-sources")) buffer.Html(`
`) buffer.Write(qmc.generateDatasources()) diff --git a/quesma/quesma/ui/html_utils.go b/quesma/quesma/ui/html_utils.go index 6fa4b5c5d..3419d43ef 100644 --- a/quesma/quesma/ui/html_utils.go +++ b/quesma/quesma/ui/html_utils.go @@ -18,7 +18,7 @@ func generateSimpleTop(title string) []byte { return buffer.Bytes() } -func generateTopNavigation(target string) []byte { +func (qmc *QuesmaManagementConsole) generateTopNavigation(target string) []byte { var buffer builder.HtmlBuffer buffer.Html(`
` + "\n") buffer.Html(`
` + "\n") @@ -76,7 +76,11 @@ func generateTopNavigation(target string) []byte { buffer.Html(` class="active"`) } buffer.Html(`>Data sources`) - buffer.Html(`
  • Logout
  • `) + + if qmc.isAuthEnabled { + buffer.Html(`
  • Logout
  • `) + } + buffer.Html("\n\n") buffer.Html("\n
    \n") diff --git a/quesma/quesma/ui/ingest.go b/quesma/quesma/ui/ingest.go index 1bca2dfc2..52a92e7af 100644 --- a/quesma/quesma/ui/ingest.go +++ b/quesma/quesma/ui/ingest.go @@ -11,7 +11,7 @@ import ( func (qmc *QuesmaManagementConsole) generateIngestStatistics() []byte { buffer := newBufferWithHead() - buffer.Write(generateTopNavigation("statistics")) + buffer.Write(qmc.generateTopNavigation("statistics")) buffer.Html(`
    `) buffer.Write(qmc.generateStatistics()) diff --git a/quesma/quesma/ui/live_tail.go b/quesma/quesma/ui/live_tail.go index 7a806994e..3f87f1c93 100644 --- a/quesma/quesma/ui/live_tail.go +++ b/quesma/quesma/ui/live_tail.go @@ -15,7 +15,7 @@ import ( func (qmc *QuesmaManagementConsole) generateLiveTail() []byte { buffer := newBufferWithHead() - buffer.Write(generateTopNavigation("queries")) + buffer.Write(qmc.generateTopNavigation("queries")) // This preserves scrolling, but does not work if new queries appear. buffer.Html(`