From 7e9ebdf6367310dec0fed60012df57aa10ec859f Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 11 Apr 2019 13:44:35 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#158=20ajout=20des=20tags=20de=20version?= =?UTF-8?q?=20dans=20le=20panneau=20lat=C3=A9ral?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- preprocessors.js | 9 ++++++--- src/app/app.component.html | 14 ++++++++++++-- src/app/app.component.scss | 16 ++++++++++++++++ src/app/app.component.ts | 18 +++++++++++++----- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/preprocessors.js b/preprocessors.js index ecc995383..e95d481c3 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 4ce195dc9..aa14cd73d 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 98e0c6c01..6cf6170ef 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 43e8c0f2c..e61b8c3b8 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 + } + }; } /** -- GitLab