diff --git a/Oqtane.Client/Installer/Controls/LocalDBConfig.razor b/Oqtane.Client/Installer/Controls/LocalDBConfig.razor index 0785fe04..5d27d986 100644 --- a/Oqtane.Client/Installer/Controls/LocalDBConfig.razor +++ b/Oqtane.Client/Installer/Controls/LocalDBConfig.razor @@ -1,41 +1,30 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl -@inject IStringLocalizer Localizer -@{ - foreach (var field in _connectionStringFields) - { - var fieldId = field.Name.ToLowerInvariant(); - field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - - - - - - - - - - } -} +
+ +
+ +
+
+
+ +
+ +
+
@code { - private readonly List _connectionStringFields = new() - { - new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB", HelpText="Enter the database server"}, - new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"} - }; + private string _server = "(LocalDb)\\MSSQLLocalDB"; + private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm"); public string GetConnectionString() { var connectionString = String.Empty; - var server = _connectionStringFields[0].Value; - var database = _connectionStringFields[1].Value; - - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database)) + if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database)) { - connectionString = $"Data Source={server};AttachDbFilename=|DataDirectory|\\{database}.mdf;Initial Catalog={database};Integrated Security=SSPI;"; + connectionString = $"Data Source={_server};AttachDbFilename=|DataDirectory|\\{_database}.mdf;Initial Catalog={_database};Integrated Security=SSPI;"; } return connectionString; diff --git a/Oqtane.Client/Installer/Controls/MySQLConfig.razor b/Oqtane.Client/Installer/Controls/MySQLConfig.razor index 7bd1f512..7de576b0 100644 --- a/Oqtane.Client/Installer/Controls/MySQLConfig.razor +++ b/Oqtane.Client/Installer/Controls/MySQLConfig.razor @@ -1,54 +1,58 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl -@inject IStringLocalizer Localizer -@{ - foreach (var field in _connectionStringFields) - { - var fieldId = field.Name.ToLowerInvariant(); - var fieldType = (field.Name == "Pwd") ? "password" : "text"; - field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - - - - - - - - - - } -} +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
@code { - private readonly List _connectionStringFields = new() - { - new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"}, - new() {Name = "Port", FriendlyName = "Port", Value = "3306", HelpText="Enter the port used to connect to the server"}, - new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}, - new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"}, - new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"} - }; + private string _server = "127.0.0.1"; + private string _port = "3306"; + private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm"); + private string _uid = String.Empty; + private string _pwd = String.Empty; public string GetConnectionString() { var connectionString = String.Empty; - var server = _connectionStringFields[0].Value; - var port = _connectionStringFields[1].Value; - var database = _connectionStringFields[2].Value; - var userId = _connectionStringFields[3].Value; - var password = _connectionStringFields[4].Value; - - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password)) + if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database) && !String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd)) { - connectionString = $"Server={server};Database={database};Uid={userId};Pwd={password};"; + connectionString = $"Server={_server};Database={_database};Uid={_uid};Pwd={_pwd};"; } - if (!String.IsNullOrEmpty(port)) + if (!String.IsNullOrEmpty(_port)) { - connectionString += $"Port={port};"; + connectionString += $"Port={_port};"; } + return connectionString; } } \ No newline at end of file diff --git a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor index 012d6fdb..d3ff4eca 100644 --- a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor +++ b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor @@ -1,89 +1,76 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl -@inject IStringLocalizer Localizer -@inject IStringLocalizer SharedLocalizer +@inject IStringLocalizer Localizer -@{ - foreach (var field in _connectionStringFields) - { - var fieldId = field.Name.ToLowerInvariant(); - if (field.Name != "IntegratedSecurity") - { - var isVisible = ""; - var fieldType = (field.Name == "Pwd") ? "password" : "text"; - if ((field.Name == "Uid" || field.Name == "Pwd")) - { - var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity"); - if (intSecurityField != null) - { - isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : ""; - } - } - - field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - - - - - - - - - - } - else - { - - - - - - - - - } - } +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+@if (_security == "custom") +{ +
+ +
+ +
+
+
+ +
+ +
+
} @code { - private readonly List _connectionStringFields = new() - { - new() { Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText = "Enter the database server" }, - new() { Name = "Port", FriendlyName = "Port", Value = "5432", HelpText = "Enter the port used to connect to the server" }, - new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" }, - new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" }, - new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" }, - new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" } - }; + private string _server = "127.0.0.1"; + private string _port = "5432"; + private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm"); + private string _security = "integrated"; + private string _uid = String.Empty; + private string _pwd = String.Empty; public string GetConnectionString() { var connectionString = String.Empty; - var server = _connectionStringFields[0].Value; - var port = _connectionStringFields[1].Value; - var database = _connectionStringFields[2].Value; - var integratedSecurity = Boolean.Parse(_connectionStringFields[3].Value); - var userId = _connectionStringFields[4].Value; - var password = _connectionStringFields[5].Value; - - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port)) + if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database) && !String.IsNullOrEmpty(_port)) { - connectionString = $"Server={server};Port={port};Database={database};"; + connectionString = $"Server={_server};Port={_port};Database={_database};"; } - if (integratedSecurity) + if (_security == "integrated") { connectionString += "Integrated Security=true;"; } else { - if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password)) + if (!String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd)) { - connectionString += $"User ID={userId};Password={password};"; + connectionString += $"User ID={_uid};Password={_pwd};"; } else { diff --git a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor index 25ddd0ab..905f8006 100644 --- a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor +++ b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor @@ -1,87 +1,69 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl -@inject IStringLocalizer Localizer -@inject IStringLocalizer SharedLocalizer +@inject IStringLocalizer Localizer -@{ - foreach (var field in _connectionStringFields) - { - var fieldId = field.Name.ToLowerInvariant(); - if (field.Name != "IntegratedSecurity") - { - var isVisible = ""; - var fieldType = (field.Name == "Pwd") ? "password" : "text"; - if ((field.Name == "Uid" || field.Name == "Pwd")) - { - var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity"); - if (intSecurityField != null) - { - isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : ""; - } - } - - field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - - - - - - - - - - } - else - { - - - - - - - - - } - } +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+@if (_security == "custom") +{ +
+ +
+ +
+
+
+ +
+ +
+
} @code { - private readonly List _connectionStringFields = new() - { - new() { Name = "Server", FriendlyName = "Server", Value = ".", HelpText = "Enter the database server" }, - new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" }, - new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" }, - new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" }, - new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" } - }; + private string _server = String.Empty; + private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm"); + private string _security = "integrated"; + private string _uid = String.Empty; + private string _pwd = String.Empty; public string GetConnectionString() { var connectionString = String.Empty; - var server = _connectionStringFields[0].Value; - var database = _connectionStringFields[1].Value; - var integratedSecurity = Boolean.Parse(_connectionStringFields[2].Value); - var userId = _connectionStringFields[3].Value; - var password = _connectionStringFields[4].Value; - - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database)) + if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database)) { - connectionString = $"Data Source={server};Initial Catalog={database};"; + connectionString = $"Data Source={_server};Initial Catalog={_database};"; } - if (integratedSecurity) + if (_security == "integrated") { connectionString += "Integrated Security=SSPI;"; } else { - if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password)) + if (!String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd)) { - connectionString += $"User ID={userId};Password={password};"; + connectionString += $"User ID={_uid};Password={_pwd};"; } else { @@ -91,5 +73,4 @@ return connectionString; } - } \ No newline at end of file diff --git a/Oqtane.Client/Installer/Controls/SqliteConfig.razor b/Oqtane.Client/Installer/Controls/SqliteConfig.razor index e0445c7c..f35e5d6d 100644 --- a/Oqtane.Client/Installer/Controls/SqliteConfig.razor +++ b/Oqtane.Client/Installer/Controls/SqliteConfig.razor @@ -1,39 +1,23 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl -@inject IStringLocalizer Localizer -@{ - foreach (var field in _connectionStringFields) - { - var fieldId = field.Name.ToLowerInvariant(); - field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - - - - - - - - - - } -} +
+ +
+ +
+
@code { - private readonly List _connectionStringFields = new() - { - new() {Name = "Server", FriendlyName = "File Name", Value = "Oqtane-{{Date}}.db", HelpText="Enter the file name to use for the database"} - }; + private string _server = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm") + ".db"; public string GetConnectionString() { var connectionstring = String.Empty; - var server = _connectionStringFields[0].Value; - - if (!String.IsNullOrEmpty(server)) + if (!String.IsNullOrEmpty(_server)) { - connectionstring = $"Data Source={server};"; + connectionstring = $"Data Source={_server};"; } return connectionstring; diff --git a/Oqtane.Client/Installer/Installer.razor b/Oqtane.Client/Installer/Installer.razor index e0a1ac71..215fe4b1 100644 --- a/Oqtane.Client/Installer/Installer.razor +++ b/Oqtane.Client/Installer/Installer.razor @@ -20,78 +20,64 @@

@Localizer["DatabaseConfig"]


- - - - - - - @{ - if (_databaseConfigType != null) - { - @DatabaseConfigComponent; - } + } + + + + @{ + if (_databaseConfigType != null) + { + @DatabaseConfigComponent; } - -
- - - + @if (_databases != null) + { + foreach (var database in _databases) { - foreach (var database in _databases) + if (database.IsDefault) { - if (database.IsDefault) - { - - } - else - { - - } + + } + else + { + } } - -
+ } +

@Localizer["ApplicationAdmin"]


- - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+

@@ -215,5 +201,4 @@ _message = Localizer["Message.Require.DbInfo"]; } } - } diff --git a/Oqtane.Client/Resources/Installer/Controls/PostgreSQLConfig.resx b/Oqtane.Client/Resources/Installer/Controls/PostgreSQLConfig.resx index 86e92b80..10a6e230 100644 --- a/Oqtane.Client/Resources/Installer/Controls/PostgreSQLConfig.resx +++ b/Oqtane.Client/Resources/Installer/Controls/PostgreSQLConfig.resx @@ -153,4 +153,10 @@ Enter the password to use for the database + + Custom + + + Integrated + \ No newline at end of file diff --git a/Oqtane.Client/Resources/Installer/Controls/SqlServerConfig.resx b/Oqtane.Client/Resources/Installer/Controls/SqlServerConfig.resx index c526c9f9..b37a6487 100644 --- a/Oqtane.Client/Resources/Installer/Controls/SqlServerConfig.resx +++ b/Oqtane.Client/Resources/Installer/Controls/SqlServerConfig.resx @@ -147,4 +147,10 @@ Enter the password to use for the database + + Custom + + + Integrated + \ No newline at end of file diff --git a/Oqtane.Client/Resources/Installer/Installer.resx b/Oqtane.Client/Resources/Installer/Installer.resx index e8da5177..7d79c123 100644 --- a/Oqtane.Client/Resources/Installer/Installer.resx +++ b/Oqtane.Client/Resources/Installer/Installer.resx @@ -120,8 +120,8 @@ Database Configuration - - Database Type: + + Database: Application Administrator @@ -138,4 +138,31 @@ Please Register Me For Major Product Updates And Security Bulletins + + Please confirm the password entered above by entering it again + + + Confirm: + + + Select the type of database you wish to use + + + Provide the email address for the host user account + + + Email: + + + Provide the password for the host user account + + + Password: + + + The username of the host user account (this is not customizable) + + + Username: + \ No newline at end of file diff --git a/Oqtane.Shared/Models/ConnectionStringField.cs b/Oqtane.Shared/Models/ConnectionStringField.cs deleted file mode 100644 index 585c3b88..00000000 --- a/Oqtane.Shared/Models/ConnectionStringField.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Oqtane.Models -{ - /// - /// Helper class for input fields in the setup of the SQL connection - /// - public class ConnectionStringField - { - /// - /// Simple to understand field name / label - /// - public string FriendlyName { get; set; } - - /// - /// Instructions / help for the user - /// - public string HelpText { get; set; } - - /// - /// Property / Setting name which will be filled in by the user. Typically something like `Server`, `Port` etc. - /// - public string Name { get; set; } - - /// - /// Initial value used in the UI and probably later also the user input that was given. - /// - public string Value { get; set; } - } -}