diff options
author | dlob <dlob@users.noreply.github.com> | 2017-02-14 02:50:00 +0100 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2017-02-13 20:50:00 -0500 |
commit | 5179063e71d7234250209389e6f69db1cd6f0caa (patch) | |
tree | 3715ab896c028c4f53b4f6b797600c488727fc42 /public | |
parent | ad4bbf517335a6a782def7937de34eed6add6b79 (diff) |
Added mssql support. (#3772)
Diffstat (limited to 'public')
-rw-r--r-- | public/js/gogs.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index 6aadea59..45b11fe7 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -228,22 +228,21 @@ function initInstall() { return; } - var mysqlDefault = '127.0.0.1:3306'; - var postgresDefault = '127.0.0.1:5432'; + var dbDefaults = { + "MySQL": "127.0.0.1:3306", + "PostgreSQL": "127.0.0.1:5432", + "MSSQL": "127.0.0.1, 1433" + }; $('#sqlite_settings').hide(); $('#sql_settings').show(); - if (dbType === "PostgreSQL") { - $('#pgsql_settings').show(); - if ($('#db_host').val() == mysqlDefault) { - $('#db_host').val(postgresDefault); - } - } else { - $('#pgsql_settings').hide(); - if ($('#db_host').val() == postgresDefault) { - $('#db_host').val(mysqlDefault); + $('#pgsql_settings').toggle(dbType === "PostgreSQL"); + $.each(dbDefaults, function(type, defaultHost) { + if ($('#db_host').val() == defaultHost) { + $('#db_host').val(dbDefaults[dbType]); + return false; } - } + }); }); // TODO: better handling of exclusive relations. |