Skip to content

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.

Add information about git branch/commit in the System Information (#378)

Krzysztof Pajak0e4cf57174e9
diff --git a/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj b/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
index d0ed222c2..52ec0d06f 100644
--- a/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
+++ b/src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\Build\Grand.Common.props" />
<ItemGroup>
+ <PackageReference Include="GitInfo" Version="3.0.4">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
<PackageReference Include="GoogleAuthenticator" Version="3.0.0" />
<PackageReference Include="MassTransit" Version="8.0.12" />
<PackageReference Include="MassTransit.RabbitMQ" Version="8.0.12" />
diff --git a/src/Core/Grand.Infrastructure/GrandVersion.cs b/src/Core/Grand.Infrastructure/GrandVersion.cs
index ebcafc2d3..6faa5f5ee 100644
--- a/src/Core/Grand.Infrastructure/GrandVersion.cs
+++ b/src/Core/Grand.Infrastructure/GrandVersion.cs
@@ -21,17 +21,26 @@
/// <summary>
/// Gets the full version
/// </summary>
- public const string FullVersion = MajorVersion + "." + MinorVersion + "." + PatchVersion;
+ public const string FullVersion = $"{MajorVersion}.{MinorVersion}.{PatchVersion}";
/// <summary>
/// Gets the Supported DB version
/// </summary>
- public const string SupportedDBVersion = MajorVersion + "." + MinorVersion;
+ public const string SupportedDBVersion = $"{MajorVersion}.{MinorVersion}";
/// <summary>
/// Gets the Supported plugin version
/// </summary>
- public const string SupportedPluginVersion = MajorVersion + "." + MinorVersion;
+ public const string SupportedPluginVersion = $"{MajorVersion}.{MinorVersion}";
+ /// <summary>
+ /// Gets the git branch
+ /// </summary>
+ public const string GitBranch = ThisAssembly.Git.Branch;
+
+ /// <summary>
+ /// Gets the git commit
+ /// </summary>
+ public const string GitCommit = ThisAssembly.Git.Commit;
}
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
index d65cb1478..8324115f4 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
@@ -15,95 +15,107 @@
<i class="fa fa-tasks"></i>
@Loc["Admin.System.SystemInfo"]
</div>
- <vc:admin-widget widget-zone="system_info_buttons" additional-data="null" />
+ <vc:admin-widget widget-zone="system_info_buttons" additional-data="null"/>
</div>
<div class="x_content form">
- <vc:admin-widget widget-zone="system_info_top" additional-data="null" />
+ <vc:admin-widget widget-zone="system_info_top" additional-data="null"/>
<div class="form-horizontal">
<div class="form-body">
<div class="x_content">
<div class="form-horizontal">
<div class="form-body">
<div class="form-group">
- <admin-label asp-for="GrandVersion" />
+ <admin-label asp-for="GrandVersion"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.GrandVersion</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="OperatingSystem" />
+ <admin-label asp-for="GitBranch"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.GitBranch</label>
+ </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="GitCommit"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.GitCommit</label>
+ </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="OperatingSystem"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.OperatingSystem</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="MachineName" />
+ <admin-label asp-for="MachineName"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.MachineName</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="AspNetInfo" />
+ <admin-label asp-for="AspNetInfo"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.AspNetInfo</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="WebRootPath" />
+ <admin-label asp-for="WebRootPath"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.WebRootPath</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ContentRootPath" />
+ <admin-label asp-for="ContentRootPath"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.ContentRootPath</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="EnvironmentName" />
+ <admin-label asp-for="EnvironmentName"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.EnvironmentName</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ServerTimeZone" />
+ <admin-label asp-for="ServerTimeZone"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.ServerTimeZone</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ServerLocalTime" />
+ <admin-label asp-for="ServerLocalTime"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.ServerLocalTime.ToString("F")</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ApplicationTime" />
+ <admin-label asp-for="ApplicationTime"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.ApplicationTime.ToString("F")</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="UtcTime" />
+ <admin-label asp-for="UtcTime"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.UtcTime.ToString("F")</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="RequestScheme" />
+ <admin-label asp-for="RequestScheme"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@httpContextAccessor.HttpContext.Request.Scheme</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="IsHttps" />
+ <admin-label asp-for="IsHttps"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@httpContextAccessor.HttpContext.Request.IsHttps</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ServerVariables" />
+ <admin-label asp-for="ServerVariables"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">
<a id="serverVariablesShowHide" href="javascript:toggleLoadedServerVariables();">@Loc["Admin.Common.Show"]</a>
@@ -111,26 +123,29 @@
<div id="pnlServerVariables" style="display:none">
@foreach (var serverVariable in Model.ServerVariables)
{
- @serverVariable.Name<text>:</text> @serverVariable.Value
- <br />
+ @serverVariable.Name<text>:</text>
+ @serverVariable.Value
+ <br/>
}
</div>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="LoadedAssemblies" />
+ <admin-label asp-for="LoadedAssemblies"/>
<div class="col-md-9 col-sm-9">
- <label class="control-label"><a id="loadedAssembliesShowHide" href="javascript:toggleLoadedAssemblies();">@Loc["Admin.Common.Show"]</a></label>
+ <label class="control-label">
+ <a id="loadedAssembliesShowHide" href="javascript:toggleLoadedAssemblies();">@Loc["Admin.Common.Show"]</a>
+ </label>
<div id="pnlLoadedAssemblies" style="display:none">
@foreach (var assembly in Model.LoadedAssemblies)
{
@assembly.FullName
if (!String.IsNullOrEmpty(assembly.Location))
{
- <br />
+ <br/>
<em>@assembly.Location</em>
}
- <br />
+ <br/>
}
</div>
</div>
@@ -141,7 +156,7 @@
</div>
</div>
</div>
- <vc:admin-widget widget-zone="system_info_bottom" additional-data="null" />
+ <vc:admin-widget widget-zone="system_info_bottom" additional-data="null"/>
</div>
</div>
</div>
@@ -154,9 +169,9 @@
<i class="fa fa-tasks"></i>
@Loc["Admin.System.Warnings"]
</div>
- <vc:admin-widget widget-zone="warnings_buttons" additional-data="null" />
+ <vc:admin-widget widget-zone="warnings_buttons" additional-data="null"/>
</div>
- <vc:admin-widget widget-zone="warnings_top" additional-data="null" />
+ <vc:admin-widget widget-zone="warnings_top" additional-data="null"/>
<div class="form-horizontal">
<div class="form-body">
<div class="x_content">
@@ -166,41 +181,41 @@
switch (warning.Level)
{
case SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass:
- {
- <div class="form-group">
- <div class="offset-md-2 col-md-10 col-sm-10">
- <label class="control-label">
- @warning.Text
- </label>
- </div>
+ {
+ <div class="form-group">
+ <div class="offset-md-2 col-md-10 col-sm-10">
+ <label class="control-label">
+ @warning.Text
+ </label>
</div>
- }
+ </div>
+ }
break;
case SystemInfoModel.SystemWarningModel.SystemWarningLevel.Warning:
- {
- <div class="form-group">
- <div class="offset-md-2 col-md-10 col-sm-10">
- <label class="control-label">
- @warning.Text
- </label>
- </div>
+ {
+ <div class="form-group">
+ <div class="offset-md-2 col-md-10 col-sm-10">
+ <label class="control-label">
+ @warning.Text
+ </label>
</div>
- }
+ </div>
+ }
break;
case SystemInfoModel.SystemWarningModel.SystemWarningLevel.Fail:
- {
- <div class="form-group">
- <div class="offset-md-2 col-md-10 col-sm-10">
- <label class="control-label">
- @warning.Text
- </label>
- </div>
+ {
+ <div class="form-group">
+ <div class="offset-md-2 col-md-10 col-sm-10">
+ <label class="control-label">
+ @warning.Text
+ </label>
</div>
- }
+ </div>
+ }
break;
}
}
- <vc:admin-widget widget-zone="warnings_bottom" additional-data="null" />
+ <vc:admin-widget widget-zone="warnings_bottom" additional-data="null"/>
</div>
</div>
</div>
@@ -229,4 +244,4 @@
$('#serverVariablesShowHide').html('@Loc["Admin.Common.Hide"]');
}
}
-</script>
+</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
index e9109410e..f1a2b5cc8 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
@@ -86,8 +86,11 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> SystemInfo()
{
- var model = new SystemInfoModel();
- model.GrandVersion = GrandVersion.FullVersion;
+ var model = new SystemInfoModel {
+ GrandVersion = GrandVersion.FullVersion,
+ GitBranch = GrandVersion.GitBranch,
+ GitCommit = GrandVersion.GitCommit
+ };
try
{
model.OperatingSystem = RuntimeInformation.OSDescription;
diff --git a/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs b/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
index 2d180701f..eef8adf15 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
@@ -18,9 +18,14 @@ namespace Grand.Web.Admin.Models.Common
[GrandResourceDisplayName("Admin.System.SystemInfo.MachineName")]
public string MachineName { get; set; }
-
[GrandResourceDisplayName("Admin.System.SystemInfo.GrandVersion")]
public string GrandVersion { get; set; }
+
+ [GrandResourceDisplayName("Admin.System.SystemInfo.GitBranch")]
+ public string GitBranch { get; set; }
+
+ [GrandResourceDisplayName("Admin.System.SystemInfo.GitCommit")]
+ public string GitCommit { get; set; }
[GrandResourceDisplayName("Admin.System.SystemInfo.OperatingSystem")]
public string OperatingSystem { get; set; }
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
index ee84ce91f..75f5c0141 100644
--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
@@ -11927,6 +11927,12 @@
<Resource Name="Admin.System.SystemInfo.ContentRootPath" Area="Admin">
<Value>Absolute path to the directory that contains the application content files</Value>
</Resource>
+ <Resource Name="Admin.System.SystemInfo.GitBranch" Area="Front">
+ <Value>Git branch</Value>
+ </Resource>
+ <Resource Name="Admin.System.SystemInfo.GitCommit" Area="Front">
+ <Value>Git commit</Value>
+ </Resource>
<Resource Name="Admin.System.SystemInfo.GrandVersion" Area="Admin">
<Value>grandnode version</Value>
</Resource>
diff --git a/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_210.xml b/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_210.xml
index 491dfea6b..cb7770d11 100644
--- a/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_210.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_210.xml
@@ -63,4 +63,10 @@
<Resource Name="Categories.List" Area="Front">
<Value>Categories List</Value>
</Resource>
+ <Resource Name="Admin.System.SystemInfo.GitBranch" Area="Front">
+ <Value>Git branch</Value>
+ </Resource>
+ <Resource Name="Admin.System.SystemInfo.GitCommit" Area="Front">
+ <Value>Git commit</Value>
+ </Resource>
</Language>
\ No newline at end of file