Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Application installation process - allow to skip create indexes
KrzysztofPajakd5004353c550
diff --git a/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationService.cs b/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationService.csindex 1ce89121f..792708850 100644--- a/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationService.cs+++ b/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationService.cs@@ -4,6 +4,6 @@ namespace Grand.Business.System.Interfaces.Installation{public partial interface IInstallationService{- Task InstallData(string defaultUserEmail, string defaultUserPassword, string collation, bool installSampleData = true, string companyName = "", string companyAddress = "", string companyPhoneNumber = "", string companyEmail = "");+ Task InstallData(string defaultUserEmail, string defaultUserPassword, string collation, bool skipCreateIndex = false, bool installSampleData = true, string companyName = "", string companyAddress = "", string companyPhoneNumber = "", string companyEmail = "");}}diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs b/src/Business/Grand.Business.System/Services/Installation/InstallationService.csindex d26162dea..64d061b62 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallationService.cs@@ -439,7 +439,7 @@ namespace Grand.Business.System.Services.Installationawait dbContext.CreateIndex(_customerReminderHistoryRepository, OrderBuilder<CustomerReminderHistory>.Create().Ascending(x => x.CustomerId).Ascending(x => x.CustomerReminderId), "CustomerId");}- private async Task CreateTables(string local)+ private async Task CreateTables(string local, bool skipCreateIndex){try{@@ -454,7 +454,8 @@ namespace Grand.Business.System.Services.Installationif (item.BaseType != null && item.IsClass && item.BaseType == typeof(BaseEntity))await dbContext.CreateTable(item.Name, local);}- await CreateIndexes(dbContext);+ if (!skipCreateIndex)+ await CreateIndexes(dbContext);}catch (Exception ex)@@ -469,12 +470,12 @@ namespace Grand.Business.System.Services.Installationpublic virtual async Task InstallData(string defaultUserEmail,- string defaultUserPassword, string collation, bool installSampleData = true, string companyName = "", string companyAddress = "",+ string defaultUserPassword, string collation, bool skipCreateIndex = false, bool installSampleData = true, string companyName = "", string companyAddress = "",string companyPhoneNumber = "", string companyEmail = ""){defaultUserEmail = defaultUserEmail.ToLower();- await CreateTables(collation);+ await CreateTables(collation, skipCreateIndex);await InstallVersion();await InstallMenuAdminSiteMap();await InstallStores(companyName, companyAddress, companyPhoneNumber, companyEmail);diff --git a/src/Web/Grand.Web/App_Data/Resources/Installation/installation.en.xml b/src/Web/Grand.Web/App_Data/Resources/Installation/installation.en.xmlindex 4ca36ba41..43db50984 100644--- a/src/Web/Grand.Web/App_Data/Resources/Installation/installation.en.xml+++ b/src/Web/Grand.Web/App_Data/Resources/Installation/installation.en.xml@@ -140,6 +140,9 @@<LocaleResource Name="StoreInformation"><Value>Store information</Value></LocaleResource>+ <LocaleResource Name="SkipCreateIndex">+ <Value>Skip create indexes</Value>+ </LocaleResource><LocaleResource Name="Title"><Value>grandnode installation</Value></LocaleResource>diff --git a/src/Web/Grand.Web/App_Data/Resources/Installation/installation.pl.xml b/src/Web/Grand.Web/App_Data/Resources/Installation/installation.pl.xmlindex 6b5ee51bd..3e8d41251 100644--- a/src/Web/Grand.Web/App_Data/Resources/Installation/installation.pl.xml+++ b/src/Web/Grand.Web/App_Data/Resources/Installation/installation.pl.xml@@ -143,6 +143,9 @@<LocaleResource Name="Title"><Value>grandnode instalacja</Value></LocaleResource>+ <LocaleResource Name="SkipCreateIndex">+ <Value>Pomin tworzenie indeksów</Value>+ </LocaleResource><LocaleResource Name="Tooltip1"><Value>grandnode jest w pełni funkcjonalną platformą e-commerce, stworzoną w oparciu o ASP.NET. Ten kreator poprowadzi cię przez proces instalacji i konfiguracji grandnode</Value></LocaleResource>diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.csindex d96b4fc0a..2674ce59d 100644--- a/src/Web/Grand.Web/Controllers/InstallController.cs+++ b/src/Web/Grand.Web/Controllers/InstallController.cs@@ -65,6 +65,7 @@ namespace Grand.Web.ControllersAdminEmail = "[email protected]",InstallSampleData = false,DatabaseConnectionString = "",+ SkipCreateIndex = false,};model.AvailableProviders = Enum.GetValues(typeof(DbProvider)).Cast<DbProvider>().Select(v => new SelectListItem {@@ -163,7 +164,7 @@ namespace Grand.Web.Controllersawait DataSettingsManager.SaveSettings(settings);var installationService = _serviceProvider.GetRequiredService<IInstallationService>();- await installationService.InstallData(model.AdminEmail, model.AdminPassword, model.Collation,+ await installationService.InstallData(model.AdminEmail, model.AdminPassword, model.Collation, model.SkipCreateIndex,model.InstallSampleData, model.CompanyName, model.CompanyAddress, model.CompanyPhoneNumber, model.CompanyEmail);//reset cachediff --git a/src/Web/Grand.Web/Models/Install/InstallModel.cs b/src/Web/Grand.Web/Models/Install/InstallModel.csindex e5231a754..bf6b0237b 100644--- a/src/Web/Grand.Web/Models/Install/InstallModel.cs+++ b/src/Web/Grand.Web/Models/Install/InstallModel.cs@@ -30,6 +30,7 @@ namespace Grand.Web.Models.Installpublic string MongoDBPassword { get; set; }public bool DisableSampleDataOption { get; set; }public bool InstallSampleData { get; set; }+ public bool SkipCreateIndex { get; set; }public bool Installed { get; set; }public string Collation { get; set; }public List<SelectListItem> AvailableLanguages { get; set; }diff --git a/src/Web/Grand.Web/Views/Install/Index.cshtml b/src/Web/Grand.Web/Views/Install/Index.cshtmlindex 8935edd64..ef9dae5cc 100644--- a/src/Web/Grand.Web/Views/Install/Index.cshtml+++ b/src/Web/Grand.Web/Views/Install/Index.cshtml@@ -18,200 +18,207 @@<div class="container">@if (!Model.Installed){- <form asp-action="Index" asp-controller="Install" id="installation-form" method="post" autocomplete="off">- <div class="row flex-row">- <div class="col-xl-5 col-lg-6 col-md-12 logo-container">- <img class="img-fluid" title="" alt="grandNode" src="~/logo.png" />- </div>- <div class="col-xl-7 col-lg-6 col-md-12">- <div class="row">- <div class="col-md">- <h1 class="generalTitle">@LocalizedService.GetResource("Title")</h1>- </div>- <div class="col-md-3 col-5 pt-3">- @Html.DropDownList("language", Model.AvailableLanguages, new { @class = "custom-select", onchange = "window.location.href = this.value;" })+ <form asp-action="Index" asp-controller="Install" id="installation-form" method="post" autocomplete="off">+ <div class="row flex-row">+ <div class="col-xl-5 col-lg-6 col-md-12 logo-container">+ <img class="img-fluid" title="" alt="grandNode" src="~/logo.png" />+ </div>+ <div class="col-xl-7 col-lg-6 col-md-12">+ <div class="row">+ <div class="col-md">+ <h1 class="generalTitle">@LocalizedService.GetResource("Title")</h1>+ </div>+ <div class="col-md-3 col-5 pt-3">+ @Html.DropDownList("language", Model.AvailableLanguages, new { @class = "custom-select", onchange = "window.location.href = this.value;" })+ </div></div></div></div>- </div>- <div class="content">- <p>- @LocalizedService.GetResource("Tooltip2")- <div style="color: Red;">- @Html.ValidationSummary(false)- </div>- </p>- </div>- <div class="card">- <a href="https://bit.ly/3cD1drT" target="_blank"><img class="img-fluid" title="" alt="GrandNode Support Services" src="~/banner.jpg" /></a>- </div>- <div class="card">- <h3 class="card-header">- @LocalizedService.GetResource("CompanyInformation")- </h3>- <div class="card-body">-- <div class="row">- <div class="col-md-6 col-12">- <label for="AdminPassword">- @LocalizedService.GetResource("CompanyName"):- </label>- <input asp-for="CompanyName" class="form-control" />- </div>- <div class="col-md-6">- <label for="ConfirmPassword">- @LocalizedService.GetResource("CompanyAddress"):- </label>- <input asp-for="CompanyAddress" class="form-control" />+ <div class="content">+ <p>+ @LocalizedService.GetResource("Tooltip2")+ <div style="color: Red;">+ @Html.ValidationSummary(false)</div>- </div>- <div class="row">- <div class="col-md-6 col-12">- <label for="AdminPassword">- @LocalizedService.GetResource("CompanyPhoneNumber"):- </label>- <input asp-for="CompanyPhoneNumber" class="form-control" />+ </p>+ </div>+ <div class="card">+ <a href="https://bit.ly/3cD1drT" target="_blank"><img class="img-fluid" title="" alt="GrandNode Support Services" src="~/banner.jpg" /></a>+ </div>+ <div class="card">+ <h3 class="card-header">+ @LocalizedService.GetResource("CompanyInformation")+ </h3>+ <div class="card-body">++ <div class="row">+ <div class="col-md-6 col-12">+ <label for="AdminPassword">+ @LocalizedService.GetResource("CompanyName"):+ </label>+ <input asp-for="CompanyName" class="form-control" />+ </div>+ <div class="col-md-6">+ <label for="ConfirmPassword">+ @LocalizedService.GetResource("CompanyAddress"):+ </label>+ <input asp-for="CompanyAddress" class="form-control" />+ </div></div>- <div class="col-md-6">- <label for="ConfirmPassword">- @LocalizedService.GetResource("CompanyEmail"):- </label>- <input asp-for="CompanyEmail" class="form-control" />+ <div class="row">+ <div class="col-md-6 col-12">+ <label for="AdminPassword">+ @LocalizedService.GetResource("CompanyPhoneNumber"):+ </label>+ <input asp-for="CompanyPhoneNumber" class="form-control" />+ </div>+ <div class="col-md-6">+ <label for="ConfirmPassword">+ @LocalizedService.GetResource("CompanyEmail"):+ </label>+ <input asp-for="CompanyEmail" class="form-control" />+ </div></div></div></div>- </div>- <div class="card">- <h3 class="card-header">- @LocalizedService.GetResource("StoreInformation")- </h3>- <div class="card-body">- <label for="AdminEmail" class="col-form-label">- @LocalizedService.GetResource("AdminEmail"):- </label>- <input asp-for="AdminEmail" class="form-control" required />- <div class="row">- <div class="col-md-6 col-12">- <label for="AdminPassword">- @LocalizedService.GetResource("AdminPassword"):- </label>- <input asp-for="AdminPassword" class="form-control password" required />- </div>- <div class="col-md-6">- <label for="ConfirmPassword">- @LocalizedService.GetResource("ConfirmPassword"):- </label>- <input asp-for="ConfirmPassword" class="form-control password" required />+ <div class="card">+ <h3 class="card-header">+ @LocalizedService.GetResource("StoreInformation")+ </h3>+ <div class="card-body">+ <label for="AdminEmail" class="col-form-label">+ @LocalizedService.GetResource("AdminEmail"):+ </label>+ <input asp-for="AdminEmail" class="form-control" required />+ <div class="row">+ <div class="col-md-6 col-12">+ <label for="AdminPassword">+ @LocalizedService.GetResource("AdminPassword"):+ </label>+ <input asp-for="AdminPassword" class="form-control password" required />+ </div>+ <div class="col-md-6">+ <label for="ConfirmPassword">+ @LocalizedService.GetResource("ConfirmPassword"):+ </label>+ <input asp-for="ConfirmPassword" class="form-control password" required />+ </div></div></div></div>- </div>- <div class="card">- <h3 class="card-header">- @LocalizedService.GetResource("DataProvider")- </h3>- <div class="card-body">- @Html.DropDownList("DataProvider", Model.AvailableProviders, new { @class = "custom-select", onchange = "DataProviderChange(this.value);" })- </div>- </div>- @if (!Model.DisableSampleDataOption)- {- <div nowrap="nowrap" align="left">- <label class="custom-control custom-checkbox my-3">- <input asp-for="InstallSampleData" class="custom-control-input" />- <span class="custom-control-label"></span>- <span class="custom-control-description">@LocalizedService.GetResource("CreateSampleData")</span>- </label>+ <div class="card">+ <h3 class="card-header">+ @LocalizedService.GetResource("DataProvider")+ </h3>+ <div class="card-body">+ @Html.DropDownList("DataProvider", Model.AvailableProviders, new { @class = "custom-select", onchange = "DataProviderChange(this.value);" })+ <label class="custom-control custom-checkbox my-3">+ <input asp-for="SkipCreateIndex" class="custom-control-input" />+ <span class="custom-control-label"></span>+ <span class="custom-control-description">@LocalizedService.GetResource("SkipCreateIndex")</span>+ </label>+ </div></div>- }- <section id="ConnectionInformation">- <div id="DBSampleData">- <div class="card">- <h3 class="card-header">- @LocalizedService.GetResource("DatabaseInformation")- </h3>- <div class="card-body">- <label for="MongoDBServerName">- @LocalizedService.GetResource("MongoDBServerName"):- </label>- <input asp-for="MongoDBServerName" class="form-control" />- <div class="row mongoDBDatabaseName">- <div class="col-6">- <label for="MongoDBDatabaseName">- @LocalizedService.GetResource("DatabaseName"):- </label>- <input asp-for="MongoDBDatabaseName" class="form-control" />- </div>- <div class="col-6 collation" id="collation">- <label for="Collation">- @LocalizedService.GetResource("Collation"):- </label>- @Html.DropDownList("Collation", Model.AvailableCollation, new { @class = "custom-select" })- </div>- </div>- <div class="row">- <div class="col-6">- <label for="MongoDBUsername">- @LocalizedService.GetResource("MongoDBUsername"):- </label>- <input asp-for="MongoDBUsername" class="form-control" />+ @if (!Model.DisableSampleDataOption)+ {+ <div nowrap="nowrap" align="left">+ <label class="custom-control custom-checkbox my-3">+ <input asp-for="InstallSampleData" class="custom-control-input" />+ <span class="custom-control-label"></span>+ <span class="custom-control-description">@LocalizedService.GetResource("CreateSampleData")</span>+ </label>+ </div>+ }+ <section id="ConnectionInformation">+ <div id="DBSampleData">+ <div class="card">+ <h3 class="card-header">+ @LocalizedService.GetResource("DatabaseInformation")+ </h3>+ <div class="card-body">+ <label for="MongoDBServerName">+ @LocalizedService.GetResource("MongoDBServerName"):+ </label>+ <input asp-for="MongoDBServerName" class="form-control" />+ <div class="row mongoDBDatabaseName">+ <div class="col-6">+ <label for="MongoDBDatabaseName">+ @LocalizedService.GetResource("DatabaseName"):+ </label>+ <input asp-for="MongoDBDatabaseName" class="form-control" />+ </div>+ <div class="col-6 collation" id="collation">+ <label for="Collation">+ @LocalizedService.GetResource("Collation"):+ </label>+ @Html.DropDownList("Collation", Model.AvailableCollation, new { @class = "custom-select" })+ </div></div>- <div class="col-6">- <label for="MongoDBPassword">- @LocalizedService.GetResource("MongoDBPassword"):- </label>- <input asp-for="MongoDBPassword" class="form-control password" />+ <div class="row">+ <div class="col-6">+ <label for="MongoDBUsername">+ @LocalizedService.GetResource("MongoDBUsername"):+ </label>+ <input asp-for="MongoDBUsername" class="form-control" />+ </div>+ <div class="col-6">+ <label for="MongoDBPassword">+ @LocalizedService.GetResource("MongoDBPassword"):+ </label>+ <input asp-for="MongoDBPassword" class="form-control password" />+ </div></div></div></div></div>- </div>- <label class="custom-control custom-checkbox my-3">- <input asp-for="ConnectionInfo" onchange="toggleMongoDBConnectionInfo()" class="custom-control-input" />- <span class="custom-control-label"></span>- <span class="custom-control-description">@LocalizedService.GetResource("ConnectionString"):</span>- </label>- <div id="DatabaseConnectionString" class="connection-string-container" style="display:none;">- <span style="white-space: nowrap;">- <input asp-for="DatabaseConnectionString" class="textbox form-control" />- </span>- <span class="hint">- @LocalizedService.GetResource("Example"):<br />- For MongoDB: @Html.Raw("mongodb://[username:password@]host1[:port1]/databaseName")- (Find more info <a href="https://docs.mongodb.org/manual/reference/connection-string/" target="_blank">here</a>)- </span>- </div>- </section>- <div class="row">- <div class="col-12">- @LocalizedService.GetResource("Documentation1") <a href="https://docs.grandnode.com/" target="_blank">@LocalizedService.GetResource("Documentation2")</a>.- </div>- <div class="col-6 text-left">- <input class="btn btn-success" type="button" id="installation" name="installation" value="@LocalizedService.GetResource("Install")" style="width: 100px;" />- </div>- <div class="col-6 text-right">- <a class="btn btn-secondary" href="@Url.Action("RestartInstall", "Install")" title="@LocalizedService.GetResource("RestartInstallationTooltip")">- @LocalizedService.GetResource("RestartInstallation")- </a>- </div>- </div>- <div class="throbber">- <div class="curtain">+ <label class="custom-control custom-checkbox my-3">+ <input asp-for="ConnectionInfo" onchange="toggleMongoDBConnectionInfo()" class="custom-control-input" />+ <span class="custom-control-label"></span>+ <span class="custom-control-description">@LocalizedService.GetResource("ConnectionString"):</span>+ </label>+ <div id="DatabaseConnectionString" class="connection-string-container" style="display:none;">+ <span style="white-space: nowrap;">+ <input asp-for="DatabaseConnectionString" class="textbox form-control" />+ </span>+ <span class="hint">+ @LocalizedService.GetResource("Example"):<br />+ For MongoDB: @Html.Raw("mongodb://[username:password@]host1[:port1]/databaseName")+ (Find more info <a href="https://docs.mongodb.org/manual/reference/connection-string/" target="_blank">here</a>)+ <br />+ For Amazon DocumentDB - you can't use Collation - is not supported+ </span>+ </div>+ </section>+ <div class="row">+ <div class="col-12">+ @LocalizedService.GetResource("Documentation1") <a href="https://docs.grandnode.com/" target="_blank">@LocalizedService.GetResource("Documentation2")</a>.+ </div>+ <div class="col-6 text-left">+ <input class="btn btn-success" type="button" id="installation" name="installation" value="@LocalizedService.GetResource("Install")" style="width: 100px;" />+ </div>+ <div class="col-6 text-right">+ <a class="btn btn-secondary" href="@Url.Action("RestartInstall", "Install")" title="@LocalizedService.GetResource("RestartInstallationTooltip")">+ @LocalizedService.GetResource("RestartInstallation")+ </a>+ </div></div>- <div class="curtain-content">- <div>- <h1 class="throbber-header">@LocalizedService.GetResource("Installing")</h1>- <div class="spinner active">- <svg style="width:100px; height:100px" viewBox="0 0 64 64">- <circle cx="32" cy="32" r="29" fill="none" stroke-width="3" stroke-miterlimit="10"></circle>- </svg>+ <div class="throbber">+ <div class="curtain">+ </div>+ <div class="curtain-content">+ <div>+ <h1 class="throbber-header">@LocalizedService.GetResource("Installing")</h1>+ <div class="spinner active">+ <svg style="width:100px; height:100px" viewBox="0 0 64 64">+ <circle cx="32" cy="32" r="29" fill="none" stroke-width="3" stroke-miterlimit="10"></circle>+ </svg>+ </div></div></div></div>- </div>- </form>+ </form>}else{diff --git a/src/Web/Grand.Web/wwwroot/assets/install/install.js b/src/Web/Grand.Web/wwwroot/assets/install/install.jsindex 0c2942070..35070dfd4 100644--- a/src/Web/Grand.Web/wwwroot/assets/install/install.js+++ b/src/Web/Grand.Web/wwwroot/assets/install/install.js@@ -22,6 +22,10 @@ function DataProviderChange(provider) {if (!elm.checked) {elm.click();}+ let collation = document.getElementById('Collation');+ if (collation.value != "") {+ collation.value = "";+ }}else {var elm = document.getElementById('ConnectionInfo');