From d0c8399dd94edbf2e04b5f5e9b28ffe1883343e8 Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Sat, 29 Aug 2020 11:30:16 -0400 Subject: [PATCH] enhanced Module Creator to allow developer to specify framework reference version so that modules can target any version including the local development environment --- .../Modules/Admin/ModuleCreator/Index.razor | 103 ++++++++++-------- .../Controllers/ModuleDefinitionController.cs | 15 ++- .../Client/[Owner].[Module].Client.csproj | 4 +- .../Server/[Owner].[Module].Server.csproj | 4 +- .../Shared/[Owner].[Module].Shared.csproj | 2 +- Oqtane.Shared/Shared/Constants.cs | 2 +- 6 files changed, 79 insertions(+), 51 deletions(-) diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor index b3de9742..799504da 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor @@ -5,55 +5,69 @@ @inject IModuleService ModuleService @inject ISystemService SystemService - - - - - - - - - - - - - - - - - - @if (!string.IsNullOrEmpty(_location)) - { +
- - - -
- - - -
- - - -
- - - -
- } -
- + - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @if (!string.IsNullOrEmpty(_location)) + { + + + + + + + + + } + @@ -62,6 +76,7 @@ private string _module = string.Empty; private string _description = string.Empty; private string _template = "-"; + public string _reference = Constants.Version; private string _location = string.Empty; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; @@ -77,7 +92,7 @@ { if (!string.IsNullOrEmpty(_owner) && !string.IsNullOrEmpty(_module) && _template != "-") { - var moduleDefinition = new ModuleDefinition { Owner = _owner.Replace(" ", ""), Name = _module.Replace(" ", ""), Description = _description, Template = _template }; + var moduleDefinition = new ModuleDefinition { Owner = _owner.Replace(" ", ""), Name = _module.Replace(" ", ""), Description = _description, Template = _template, Version = _reference }; await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition, ModuleState.ModuleId); } else diff --git a/Oqtane.Server/Controllers/ModuleDefinitionController.cs b/Oqtane.Server/Controllers/ModuleDefinitionController.cs index 6b53f198..9c6377d0 100644 --- a/Oqtane.Server/Controllers/ModuleDefinitionController.cs +++ b/Oqtane.Server/Controllers/ModuleDefinitionController.cs @@ -240,7 +240,20 @@ namespace Oqtane.Controllers text = text.Replace("[ServerManagerType]", moduleDefinition.ServerManagerType); text = text.Replace("[Folder]", folderPath); text = text.Replace("[File]", Path.GetFileName(filePath)); - text = text.Replace("[FrameworkVersion]", Constants.Version); + if (moduleDefinition.Version == "local") + { + text = text.Replace("[FrameworkVersion]", Constants.Version); + text = text.Replace("[ClientReference]", "..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Client.dll"); + text = text.Replace("[ServerReference]", "..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Server.dll"); + text = text.Replace("[SharedReference]", "..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Shared.dll"); + } + else + { + text = text.Replace("[FrameworkVersion]", moduleDefinition.Version); + text = text.Replace("[ClientReference]", ""); + text = text.Replace("[ServerReference]", ""); + text = text.Replace("[SharedReference]", ""); + } System.IO.File.WriteAllText(filePath, text); } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj index 4cd92d84..61ba7871 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj @@ -25,8 +25,8 @@ - - + [ClientReference] + [SharedReference] diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj index 8d6f5b57..60db0e22 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj @@ -31,7 +31,7 @@ - - + [ServerReference] + [SharedReference] diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj index 0e62a189..4e6e520c 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj @@ -17,7 +17,7 @@ - + [SharedReference] diff --git a/Oqtane.Shared/Shared/Constants.cs b/Oqtane.Shared/Shared/Constants.cs index bc0f77f1..7c5f07ed 100644 --- a/Oqtane.Shared/Shared/Constants.cs +++ b/Oqtane.Shared/Shared/Constants.cs @@ -6,7 +6,7 @@ namespace Oqtane.Shared { public const string PackageId = "Oqtane.Framework"; public const string Version = "1.0.3"; - public const string ReleaseVersions = "0.9.0,0.9.1,0.9.2,1.0.0,1.0.1,1.0.2,1.0.3"; + public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3"; public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client"; public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";