Commit 7e9ebdf6 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Fix #158 ajout des tags de version dans le panneau latéral

Showing with 47 additions and 10 deletions
+47 -10
......@@ -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}`);
});
......@@ -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>
......
......@@ -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 {
......
......@@ -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
}
};
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment