diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-12-07 13:44:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 13:44:08 +0800 |
commit | a6f961fba416e146f5da6cb18115d2f6251d4fe3 (patch) | |
tree | 53f437167ca3720510d29e17081d0eaa1d1a9521 /templates | |
parent | b30870ef8bcf98bdf0f0829955fc8599a75e26df (diff) | |
download | gitea-a6f961fba416e146f5da6cb18115d2f6251d4fe3.tar.gz gitea-a6f961fba416e146f5da6cb18115d2f6251d4fe3.zip |
Refactor install page (db type) (#17919)
* Refactor install page (db type)
* set correct default DB HOST for different DB TYPE
* remove legacy TiDB from documents
* unify the usage of DB TYPE, in code we only use "mysql". "MySQL" is only shown to users for friendly name.
* Gitea can use TiDB via MySQL protocol
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/admin/config.tmpl | 4 | ||||
-rw-r--r-- | templates/install.tmpl | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index b419d04a1b..2a27baf535 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -119,7 +119,7 @@ <dl class="dl-horizontal admin-dl-horizontal"> <dt>{{.i18n.Tr "admin.config.db_type"}}</dt> <dd>{{.DbCfg.Type}}</dd> - {{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}} + {{if not (eq .DbCfg.Type "sqlite3")}} <dt>{{.i18n.Tr "admin.config.db_host"}}</dt> <dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd> <dt>{{.i18n.Tr "admin.config.db_name"}}</dt> @@ -133,7 +133,7 @@ <dt>{{.i18n.Tr "admin.config.db_ssl_mode"}}</dt> <dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}</dd> {{end}} - {{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}} + {{if eq .DbCfg.Type "sqlite3"}} <dt>{{.i18n.Tr "admin.config.db_path"}}</dt> <dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}</dd> {{end}} diff --git a/templates/install.tmpl b/templates/install.tmpl index 1fa0929afa..3c619e880c 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -13,22 +13,22 @@ <form class="ui form" action="{{AppSubUrl}}/" method="post"> <!-- Database Settings --> <h4 class="ui dividing header">{{.i18n.Tr "install.db_title"}}</h4> - <p>{{.i18n.Tr "install.requite_db_desc"}}</p> + <p>{{.i18n.Tr "install.require_db_desc"}}</p> <div class="inline required field {{if .Err_DbType}}error{{end}}"> <label>{{.i18n.Tr "install.db_type"}}</label> <div class="ui selection database type dropdown"> - <input type="hidden" id="db_type" name="db_type" value="{{.CurDbOption}}"> - <div class="text">{{.CurDbOption}}</div> + <input type="hidden" id="db_type" name="db_type" value="{{.CurDbType}}"> + <div class="text">{{.CurDbType}}</div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - {{range .DbOptions}} - <div class="item" data-value="{{.}}">{{.}}</div> + {{range .DbTypeNames}} + <div class="item" data-value="{{.type}}">{{.name}}</div> {{end}} </div> </div> </div> - <div id="sql_settings" class="{{if or (eq .CurDbOption "SQLite3")}}hide{{end}}"> + <div class="hide" data-db-setting-for="common-host"> <div class="inline required field {{if .Err_DbSetting}}error{{end}}"> <label for="db_host">{{.i18n.Tr "install.host"}}</label> <input id="db_host" name="db_host" value="{{.db_host}}"> @@ -48,7 +48,7 @@ </div> </div> - <div id="pgsql_settings" class="{{if not (eq .CurDbOption "PostgreSQL")}}hide{{end}}"> + <div class="hide" data-db-setting-for="postgres"> <div class="inline required field"> <label>{{.i18n.Tr "install.ssl_mode"}}</label> <div class="ui selection database type dropdown"> @@ -69,7 +69,7 @@ </div> </div> - <div id="mysql_settings" class="{{if not (eq .CurDbOption "MySQL")}}hide{{end}}"> + <div class="hide" data-db-setting-for="mysql"> <div class="inline required field"> <label>{{.i18n.Tr "install.charset"}}</label> <div class="ui selection database type dropdown"> @@ -83,7 +83,7 @@ </div> </div> - <div id="sqlite_settings" class="{{if not (or (eq .CurDbOption "SQLite3") (eq .CurDbOption "TiDB"))}}hide{{end}}"> + <div class="hide" data-db-setting-for="sqlite3"> <div class="inline required field {{if or .Err_DbPath .Err_DbSetting}}error{{end}}"> <label for="db_path">{{.i18n.Tr "install.path"}}</label> <input id="db_path" name="db_path" value="{{.db_path}}"> |