New methods have been added to the API for reading the system version and release notes.
parent
4449b79ff9
commit
81f50b7bde
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Import Project="dependencies.props" />
|
<Import Project="dependencies.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.1.3</Version>
|
<Version>1.2.3</Version>
|
||||||
<Authors>Tudor Stanciu</Authors>
|
<Authors>Tudor Stanciu</Authors>
|
||||||
<Company>STA</Company>
|
<Company>STA</Company>
|
||||||
<PackageTags>NetworkResurrector</PackageTags>
|
<PackageTags>NetworkResurrector</PackageTags>
|
||||||
|
|
|
@ -99,6 +99,10 @@
|
||||||
Tuitio latest updates
|
Tuitio latest updates
|
||||||
• Tuitio nuget packages upgrade
|
• Tuitio nuget packages upgrade
|
||||||
• Tuitio configuration changes
|
• Tuitio configuration changes
|
||||||
|
• Many frontend developments
|
||||||
|
• Tuitio client NPM package integration: @flare/tuitio-react-client
|
||||||
|
• Added license file
|
||||||
|
• Login with enter key
|
||||||
</Content>
|
</Content>
|
||||||
</Note>
|
</Note>
|
||||||
<Note>
|
<Note>
|
||||||
|
@ -110,4 +114,45 @@
|
||||||
• Netmash.Security.Authentication.Tuitio nuget package upgrade
|
• Netmash.Security.Authentication.Tuitio nuget package upgrade
|
||||||
</Content>
|
</Content>
|
||||||
</Note>
|
</Note>
|
||||||
|
<Note>
|
||||||
|
<Version>1.2.0</Version>
|
||||||
|
<Date>2023-03-19 14:56</Date>
|
||||||
|
<Content>
|
||||||
|
Massive frontend developments
|
||||||
|
• Complete UI refactoring
|
||||||
|
• A complete menu has been added to the application.
|
||||||
|
• The theme and the switch between dark and light mode have been implemented.
|
||||||
|
• Axios upgrade.
|
||||||
|
• The ugly and useless stepper has been removed from the machines page.
|
||||||
|
</Content>
|
||||||
|
</Note>
|
||||||
|
<Note>
|
||||||
|
<Version>1.2.1</Version>
|
||||||
|
<Date>2023-03-19 20:11</Date>
|
||||||
|
<Content>
|
||||||
|
Frontend developments
|
||||||
|
• Added sensitive info toggle.
|
||||||
|
• Apply mask on sensitive information.
|
||||||
|
• Mask machine logs.
|
||||||
|
</Content>
|
||||||
|
</Note>
|
||||||
|
<Note>
|
||||||
|
<Version>1.2.2</Version>
|
||||||
|
<Date>2023-03-19 23:14</Date>
|
||||||
|
<Content>
|
||||||
|
Added user profile page
|
||||||
|
• The data on the page is extracted from the Tuitio token.
|
||||||
|
</Content>
|
||||||
|
</Note>
|
||||||
|
<Note>
|
||||||
|
<Version>1.2.3</Version>
|
||||||
|
<Date>2023-03-25 02:26</Date>
|
||||||
|
<Content>
|
||||||
|
Important developments in frontend
|
||||||
|
• Machines view modes
|
||||||
|
• New menu entries: About, Administration and System
|
||||||
|
• About page. It contains information about the system and the release notes.
|
||||||
|
• New methods have been added to the API for reading the system version and release notes.
|
||||||
|
</Content>
|
||||||
|
</Note>
|
||||||
</ReleaseNotes>
|
</ReleaseNotes>
|
|
@ -13,7 +13,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NBB.Messaging.Abstractions" Version="$(NBBPackageVersion)" />
|
<PackageReference Include="NBB.Messaging.Abstractions" Version="$(NBBPackageVersion)" />
|
||||||
<PackageReference Include="NetworkResurrector.Agent.Wrapper" Version="1.1.0" />
|
<PackageReference Include="NetworkResurrector.Agent.Wrapper" Version="1.1.0" />
|
||||||
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.1.0" />
|
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
using MediatR;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace NetworkResurrector.Api.Application.Queries
|
||||||
|
{
|
||||||
|
public class GetReleaseNotes
|
||||||
|
{
|
||||||
|
public class Query : IRequest<Model[]>
|
||||||
|
{
|
||||||
|
public Query() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public record Model(string Version, DateTime Date, string[] Notes);
|
||||||
|
|
||||||
|
public class QueryHandler : IRequestHandler<Query, Model[]>
|
||||||
|
{
|
||||||
|
public QueryHandler() { }
|
||||||
|
|
||||||
|
public async Task<Model[]> Handle(Query request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var x = Directory.GetCurrentDirectory();
|
||||||
|
Console.WriteLine(x);
|
||||||
|
|
||||||
|
var releaseNotes = new XmlDocument();
|
||||||
|
releaseNotes.Load("ReleaseNotes.xml");
|
||||||
|
|
||||||
|
var rows = releaseNotes.DocumentElement.SelectNodes("Note");
|
||||||
|
var result = new List<Model>();
|
||||||
|
|
||||||
|
foreach (XmlNode node in rows)
|
||||||
|
{
|
||||||
|
var version = node.SelectSingleNode("Version").InnerText;
|
||||||
|
var date = GetReleaseDateUtc(node.SelectSingleNode("Date").InnerText);
|
||||||
|
var notes = ParseContent(node.SelectSingleNode("Content").InnerText);
|
||||||
|
|
||||||
|
result.Add(new Model(version, date, notes));
|
||||||
|
}
|
||||||
|
|
||||||
|
return await Task.FromResult(result.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
private string[] ParseContent(string text)
|
||||||
|
{
|
||||||
|
var lines = text
|
||||||
|
.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
|
||||||
|
.Where(z => !string.IsNullOrWhiteSpace(z))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < lines.Count(); i++)
|
||||||
|
{
|
||||||
|
lines[i] = lines[i].TrimStart().TrimEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime GetReleaseDateUtc(string date)
|
||||||
|
{
|
||||||
|
var datetime = Convert.ToDateTime(date);
|
||||||
|
var utcDatetime = TimeZoneInfo.ConvertTimeToUtc(datetime, TimeZoneInfo.Local);
|
||||||
|
return utcDatetime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
using NetworkResurrector.Server.Wrapper.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -11,15 +12,38 @@ namespace NetworkResurrector.Api.Application.Queries
|
||||||
{
|
{
|
||||||
public class Query : IRequest<Model> { }
|
public class Query : IRequest<Model> { }
|
||||||
|
|
||||||
public record Model(string Version, DateTime LastUpdateDate);
|
public class Model
|
||||||
|
{
|
||||||
|
public ServiceVersion Api { get; set; }
|
||||||
|
public ServiceVersion Server { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public record ServiceVersion(string Version, DateTime LastReleaseDate);
|
||||||
|
|
||||||
public class QueryHandler : IRequestHandler<Query, Model>
|
public class QueryHandler : IRequestHandler<Query, Model>
|
||||||
{
|
{
|
||||||
public QueryHandler()
|
private readonly IResurrectorService _resurrectorService;
|
||||||
|
|
||||||
|
public QueryHandler(IResurrectorService resurrectorService)
|
||||||
{
|
{
|
||||||
|
_resurrectorService=resurrectorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
|
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var serverVersion = await _resurrectorService.GetServiceVersion();
|
||||||
|
var apiVersion = GetApiVersion();
|
||||||
|
|
||||||
|
var result = new Model
|
||||||
|
{
|
||||||
|
Api = apiVersion,
|
||||||
|
Server = new ServiceVersion(serverVersion.Version, serverVersion.LastReleaseDate)
|
||||||
|
};
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ServiceVersion GetApiVersion()
|
||||||
{
|
{
|
||||||
var version = Environment.GetEnvironmentVariable("APP_VERSION");
|
var version = Environment.GetEnvironmentVariable("APP_VERSION");
|
||||||
var appDate = Environment.GetEnvironmentVariable("APP_DATE");
|
var appDate = Environment.GetEnvironmentVariable("APP_DATE");
|
||||||
|
@ -27,14 +51,14 @@ namespace NetworkResurrector.Api.Application.Queries
|
||||||
if (string.IsNullOrEmpty(version))
|
if (string.IsNullOrEmpty(version))
|
||||||
version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||||
|
|
||||||
if (!DateTime.TryParse(appDate, out var lastUpdateDate))
|
if (!DateTime.TryParse(appDate, out var lastReleaseDate))
|
||||||
{
|
{
|
||||||
var location = Assembly.GetExecutingAssembly().Location;
|
var location = Assembly.GetExecutingAssembly().Location;
|
||||||
lastUpdateDate = File.GetLastWriteTime(location);
|
lastReleaseDate = File.GetLastWriteTime(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = new Model(version, lastUpdateDate);
|
var result = new ServiceVersion(version, lastReleaseDate);
|
||||||
return await Task.FromResult(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,12 @@ namespace NetworkResurrector.Api.Controllers
|
||||||
var result = await _mediator.Send(query);
|
var result = await _mediator.Send(query);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("release-notes")]
|
||||||
|
public async Task<IActionResult> GetReleaseNotes([FromRoute] GetReleaseNotes.Query query)
|
||||||
|
{
|
||||||
|
var result = await _mediator.Send(query);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\..\..\ReleaseNotes.xml" Link="ReleaseNotes.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
|
|
Loading…
Reference in New Issue