diff --git a/preprocessors.js b/preprocessors.js index ecc9953833312063a4e7cc40d45501c563218a1c..e95d481c3afaace51f8262ce13a5bed8f8e7e28d 100755 --- a/preprocessors.js +++ b/preprocessors.js @@ -7,13 +7,16 @@ var fs = require('fs'); date_last_commit = require('child_process') .execSync('git log -1 --format=%cd --date=short') .toString().trim() +version = require('child_process') + .execSync('git describe') + .toString().trim() var sFileName = "src/date_revision.ts"; -fs.writeFile(sFileName, `export const nghydDateRev = "${date_last_commit}";\n`, function(err) { +fs.writeFile(sFileName, `export const nghydDateRev = "${date_last_commit}";\nexport const nghydVersion = "${version}";\n`, function(err) { if(err) { return console.log(err); } - console.log(`File ${sFileName} saved with date ${date_last_commit}`); -}); \ No newline at end of file + console.log(`File ${sFileName} saved with date ${date_last_commit}, version ${version}`); +}); diff --git a/src/app/app.component.html b/src/app/app.component.html index 4ce195dc932e87b808a00f207ece07f32c081383..aa14cd73de4ea028a588099ebcb2bdc9de2ef1b7 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -96,8 +96,18 @@ </a> <div class="hyd_version"> - JaLHyd version: {{ getDateRevision()[0] }}<br/> - ngHyd version: {{ getDateRevision()[1] }} + <div class="jalhyd-version"> + <span class="version"> + JaLHyd: <span class="value">{{ revisionInfo.jalhyd.version }}</span> + </span> + <span class="date">updated {{ revisionInfo.jalhyd.date }}</span> + </div> + <div class="nghyd-version"> + <span class="version"> + ngHyd: <span class="value">{{ revisionInfo.nghyd.version }}</span> + </span> + <span class="date">updated {{ revisionInfo.nghyd.date }}</span> + </div> </div> </div> </mat-sidenav> diff --git a/src/app/app.component.scss b/src/app/app.component.scss index 98e0c6c01190ec530e9de00bbd4607cee816e439..6cf6170efb960b768f974b26cd99fe23ac0220cd 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -216,6 +216,22 @@ button:focus { color: #888888; padding: 0 2em 1em 0; text-align: right; + + .jalhyd-version { + margin-bottom: 0.6em; + } + + .version { + display: block; + + > .value { + font-weight: bold; + } + } + + .date { + font-size: 0.8em; + } } .closebtn { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 43e8c0f2cae73777a948eb1642331225313445bb..e61b8c3b88e7aedd8458f4823132d0114184df0f 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Router, Event, NavigationEnd, ActivationEnd } from "@angular/router"; import { MatSidenav, MatToolbar, MatDialog, MatIconRegistry } from "@angular/material"; import { DomSanitizer } from "@angular/platform-browser"; -import { Observer, jalhydDateRev, CalculatorType, Session } from "jalhyd"; +import { Observer, jalhydDateRev, jalhydVersion, CalculatorType, Session } from "jalhyd"; import { environment } from "../environments/environment"; import { I18nService } from "./services/internationalisation/internationalisation.service"; @@ -13,7 +13,7 @@ import { FormulaireDefinition } from "./formulaire/definition/form-definition"; import { ServiceFactory } from "./services/service-factory"; import { HttpService } from "./services/http/http.service"; import { ApplicationSetupService } from "./services/app-setup/app-setup.service"; -import { nghydDateRev } from "../date_revision"; +import { nghydDateRev, nghydVersion } from "../date_revision"; import { DialogConfirmEmptySessionComponent } from "./components/dialog-confirm-empty-session/dialog-confirm-empty-session.component"; import { DialogLoadSessionComponent } from "./components/dialog-load-session/dialog-load-session.component"; @@ -407,9 +407,17 @@ export class AppComponent implements OnInit, OnDestroy, Observer { }); } - public getDateRevision(): string[] { - const dr: string[] = [jalhydDateRev, nghydDateRev]; - return dr; + public get revisionInfo(): any { + return { + jalhyd: { + date: jalhydDateRev, + version: jalhydVersion, + }, + nghyd: { + date: nghydDateRev, + version: nghydVersion + } + }; } /**