From cfc3fae67c4e4ea4767d3aea760e94d2d9435f2b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 11 Jun 2018 09:31:11 -0400 Subject: [PATCH] application version --- src/app/layouts/footer.component.html | 2 +- src/app/layouts/footer.component.ts | 13 ++++++++++++- src/locales/en/messages.json | 9 +++++++++ src/services/webPlatformUtils.service.ts | 2 +- webpack.config.js | 4 +++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/app/layouts/footer.component.html b/src/app/layouts/footer.component.html index 116376c4..d8e28c86 100644 --- a/src/app/layouts/footer.component.html +++ b/src/app/layouts/footer.component.html @@ -7,7 +7,7 @@
- Version 2.0.0 + {{'versionNumber' | i18n : version}}
diff --git a/src/app/layouts/footer.component.ts b/src/app/layouts/footer.component.ts index 225beb1a..e545d60b 100644 --- a/src/app/layouts/footer.component.ts +++ b/src/app/layouts/footer.component.ts @@ -1,9 +1,20 @@ import { Component, + OnInit, } from '@angular/core'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; + @Component({ selector: 'app-footer', templateUrl: 'footer.component.html', }) -export class FooterComponent { } +export class FooterComponent implements OnInit { + version: string; + + constructor(private platformUtilsService: PlatformUtilsService) { } + + ngOnInit() { + this.version = this.platformUtilsService.getApplicationVersion(); + } +} diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index ff720712..b7109035 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -547,5 +547,14 @@ }, "noItemsInList": { "message": "There are no items to list." + }, + "versionNumber": { + "message": "Version $VERSION_NUMBER$", + "placeholders": { + "version_number": { + "content": "$1", + "example": "1.2.3" + } + } } } diff --git a/src/services/webPlatformUtils.service.ts b/src/services/webPlatformUtils.service.ts index 987232fb..1606004c 100644 --- a/src/services/webPlatformUtils.service.ts +++ b/src/services/webPlatformUtils.service.ts @@ -100,7 +100,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService { } getApplicationVersion(): string { - return '1.2.3'; + return process.env.APPLICATION_VERSION || '-'; } supportsU2f(win: Window): boolean { diff --git a/webpack.config.js b/webpack.config.js index edde3aeb..7ae42be2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,6 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; +const pjson = require('./package.json'); if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'development'; @@ -102,7 +103,8 @@ const plugins = [ extractCss, new webpack.DefinePlugin({ 'process.env': { - 'ENV': JSON.stringify(ENV) + 'ENV': JSON.stringify(ENV), + 'APPLICATION_VERSION': JSON.stringify(pjson.version), } }), ];