From a89d6253e081923ad26e2303f8c543c53c9ed39c Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Thu, 7 Jun 2018 02:13:42 +0300 Subject: [PATCH] Show only needed values in database configuration section depending on type (#4164) --- options/locale/locale_en-US.ini | 2 -- templates/admin/config.tmpl | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index f2862bde8..e510e9954 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1475,9 +1475,7 @@ config.db_host = Host config.db_name = Name config.db_user = Username config.db_ssl_mode = SSL -config.db_ssl_mode_helper = (for "postgres" only) config.db_path = Path -config.db_path_helper = (for "sqlite3" and "tidb") config.service_config = Service Configuration config.register_email_confirm = Require Email Confirmation to Register diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index d8292a9e6..21aa8756f 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -92,16 +92,22 @@
{{.i18n.Tr "admin.config.db_type"}}
{{.DbCfg.Type}}
+ {{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}}
{{.i18n.Tr "admin.config.db_host"}}
{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}
{{.i18n.Tr "admin.config.db_name"}}
{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}
{{.i18n.Tr "admin.config.db_user"}}
{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}
+ {{end}} + {{if eq .DbCfg.Type "postgres"}}
{{.i18n.Tr "admin.config.db_ssl_mode"}}
-
{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}} {{.i18n.Tr "admin.config.db_ssl_mode_helper"}}
+
{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}
+ {{end}} + {{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}}
{{.i18n.Tr "admin.config.db_path"}}
-
{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}} {{.i18n.Tr "admin.config.db_path_helper"}}
+
{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}
+ {{end}}