Added versioning

pull/53/head
William Lewis 1 month ago
parent 54fddde47b
commit dc145649d6

@ -1,6 +1,6 @@
import { Counter } from "./components/Counter";
import { FetchData } from "./components/FetchData";
import { Home } from "./components/Home";
import Home from "./components/Home";
import CreateAccount from "./components/accounts/CreateAccount";
import DeleteAccount from "./components/accounts/DeleteAccount";
import UpdateAccount from "./components/accounts/UpdateAccount";

@ -1,26 +1,41 @@
import React, { Component } from 'react';
import React from 'react';
import { useEffect } from "react";
import { useState } from 'react';
import { EndPoints, getData } from './services/AccessAPI';
export class Home extends Component {
static displayName = Home.name;
export default function Home() {
useEffect(() => {
getVersion();
}, [])
render() {
return (
<div>
<h1>Hello, world!</h1>
<p>Welcome to your new single-page application, built with:</p>
<ul>
<li><a href='https://get.asp.net/'>ASP.NET Core</a> and <a href='https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx'>C#</a> for cross-platform server-side code</li>
<li><a href='https://facebook.github.io/react/'>React</a> for client-side code</li>
<li><a href='http://getbootstrap.com/'>Bootstrap</a> for layout and styling</li>
</ul>
<p>To help you get started, we have also set up:</p>
<ul>
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
<li><strong>Development server integration</strong>. In development mode, the development server from <code>create-react-app</code> runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.</li>
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and your <code>dotnet publish</code> configuration produces minified, efficiently bundled JavaScript files.</li>
</ul>
<p>The <code>ClientApp</code> subdirectory is a standard React application based on the <code>create-react-app</code> template. If you open a command prompt in that directory, you can run <code>npm</code> commands such as <code>npm test</code> or <code>npm install</code>.</p>
</div>
);
const [version, setVersion] = useState("");
function getVersion() {
getData(EndPoints.APPVERSION).then(
(result) => {
if (result) {
setVersion(result.version);
}
}
);
}
return (
<div>
<h1>Budget Software - Version {version}</h1>
<p>Welcome to your new single-page application, built with:</p>
<ul>
<li><a href='https://get.asp.net/'>ASP.NET Core</a> and <a href='https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx'>C#</a> for cross-platform server-side code</li>
<li><a href='https://facebook.github.io/react/'>React</a> for client-side code</li>
<li><a href='http://getbootstrap.com/'>Bootstrap</a> for layout and styling</li>
</ul>
<p>To help you get started, we have also set up:</p>
<ul>
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
<li><strong>Development server integration</strong>. In development mode, the development server from <code>create-react-app</code> runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.</li>
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and your <code>dotnet publish</code> configuration produces minified, efficiently bundled JavaScript files.</li>
</ul>
<p>The <code>ClientApp</code> subdirectory is a standard React application based on the <code>create-react-app</code> template. If you open a command prompt in that directory, you can run <code>npm</code> commands such as <code>npm test</code> or <code>npm install</code>.</p>
</div>
);
}

@ -20,6 +20,7 @@ export const EndPoints = {
AUTOCLASS_TRIGGERTRANSACTIONRULES: "Autoclass/TriggerTransactionRules",
APIKEY: "ApiKey",
APIKEY_CREATENEW: "ApiKey/CreateNew",
APPVERSION: "AppInfo/ApplicationVersion",
}
function getOrigin() {

@ -0,0 +1,32 @@
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using ActiveAllocator.API.Models.Users;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Config;
using System;
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
[ApiController]
[Route("[controller]")]
public class AppInfoController : ControllerBase
{
private IVersionService _versionService;
public AppInfoController(
IVersionService versionService)
{
_versionService = versionService;
}
[HttpGet("ApplicationVersion")]
public IActionResult GetApplicationVersion()
{
string appVersion = _versionService.GetVersion();
return Ok(new { version = appVersion });
}
}

@ -105,6 +105,8 @@ internal class Program
builder.Services.AddScoped<IAutoclassService, AutoclassService>();
builder.Services.AddScoped<ICacheService, CacheService>();
builder.Services.AddScoped<IApiKeyService, ApiKeyService>();
builder.Services.AddScoped<IVersionService, VersionService>();
builder.Services.AddScoped<ApiKeyAuthenticationHandler>();
builder.Services.AddSingleton<IEnvelopeFundingProcess, EnvelopeFundingProcess>();

@ -0,0 +1,35 @@
namespace ActiveAllocator.API.Services;
using AutoMapper;
using ActiveAllocator.API.Entities;
using ActiveAllocator.API.Config;
using ActiveAllocator.API.Models.Accounts;
using System.Collections.Generic;
using System.Linq;
using System;
using System.Security.Policy;
public interface IVersionService
{
string GetVersion();
}
public class VersionService : IVersionService
{
const string APP_VERSION = "1.0.0";
ILogger<VersionService> _logger;
public VersionService(
ILogger<VersionService> logger)
{
_logger = logger;
_logger.LogInformation("App Version: " + APP_VERSION);
}
public string GetVersion()
{
return APP_VERSION;
}
}
Loading…
Cancel
Save