Skip to content
Snippets Groups Projects
Commit 91c69f90 authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch 'devel' into...

Merge branch 'devel' into '585-restructurer-lechapt-et-calmon-pour-de-nouvelles-lois-de-pertes-de-charge'

# Conflicts:
#   jalhyd_branch
parents 8401a3cd a5649eea
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!193Resolve "Restructurer Lechapt et Calmon pour de nouvelles lois de pertes de charge"
Pipeline #140112 passed
Showing
with 267 additions and 66 deletions
......@@ -5,11 +5,8 @@
/tmp
/out-tsc
/src/assets/docs
/compodoc-fr
/docs/fr/pdf
/docs/en/pdf
/release
docs/pdf_build
/build
# dependencies
/node_modules
......
# Historique des versions
### 4.16.3 - 2023-01-11
#### Correction de bogues
* Lechapt et Calmon : erreur de sélection de matériau
([jalhyd#337](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/337), [nghyd#589](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/589))
### 4.16.1 - 2022-11-16
#### Correction de bogues
......
......@@ -13,15 +13,16 @@
% Insertion des différents préambules au document
\input{rapport/english/preambule_rapport_english}
\input{rapport_inrae/preambule_inrae}
% Cassiopée version in the form \newcommand{\cassiopeeversion}{x.y.z}
\input{cassiopee_version}
%*******************************************************************************
%Données de titre et d'auteur pour la page de garde, les entêtes et pieds de page
%*******************************************************************************
% Le titre doit être relativement court mais assez explicite
\newcommand{\service}{UMR G-EAU}
\newcommand{\titre}{Cassiopée 4 software}
\newcommand{\sousTitre}{User documentation}
\newcommand{\titre}{Cassiopée software}
\newcommand{\sousTitre}{version \cassiopeeversion\\User documentation}
%Statut du document [rapport final, rapport intermédiaire]
% auteur intellectuel, rédacteur du document, il peut y avoir plusieurs auteurs ; chaque auteur est renseigné sous la forme « Prénom NOM »
\newcommand{\auteur}{David DORCHIES, Mathias CHOUET, François GRAND}
......
......@@ -13,15 +13,16 @@
% Insertion des différents préambules au document
\input{rapport/francais/preambule_rapport_francais}
\input{rapport_inrae/preambule_inrae}
% version de Cassiopée sous la forme \newcommand{\cassiopeeversion}{x.y.z}
\input{cassiopee_version}
%*******************************************************************************
%Données de titre et d'auteur pour la page de garde, les entêtes et pieds de page
%*******************************************************************************
% Le titre doit être relativement court mais assez explicite
\newcommand{\service}{UMR G-EAU}
\newcommand{\titre}{Logiciel Cassiopée 4}
\newcommand{\sousTitre}{Documentation utilisateur}
\newcommand{\titre}{Logiciel Cassiopée}
\newcommand{\sousTitre}{version \cassiopeeversion\\Documentation utilisateur}
%Statut du document [rapport final, rapport intermédiaire]
% auteur intellectuel, rédacteur du document, il peut y avoir plusieurs auteurs ; chaque auteur est renseigné sous la forme « Prénom NOM »
\newcommand{\auteur}{David DORCHIES, Mathias CHOUET, François GRAND}
......
import { ListPage } from "./list.po";
import { browser, by } from "protractor";
import { CalculatorPage } from "./calculator.po";
import { PreferencesPage } from "./preferences.po";
import { Navbar } from "./navbar.po";
/**
* Check that created/cloned structures have empty fields when
* "empty fields on calculator creation" is enabled
*/
describe("Lechapt&Calmon - ", () => {
let prefPage: PreferencesPage;
let listPage: ListPage;
let calcPage: CalculatorPage;
let navBar: Navbar;
beforeAll(() => {
prefPage = new PreferencesPage();
listPage = new ListPage();
calcPage = new CalculatorPage();
navBar = new Navbar();
browser.manage().window().setPosition(2000, 30);
});
beforeEach(async () => {
// disable evil option "empty fields on module creation"
await prefPage.navigateTo();
await browser.sleep(200);
await prefPage.disableEvilEmptyFields();
await browser.sleep(200);
});
async function setup() {
// start page
await navBar.clickNewCalculatorButton();
await browser.sleep(200);
// open Lechapt-Calmon calculator
await listPage.clickMenuEntryForCalcType(1);
await browser.sleep(200);
}
it("when material is modified, results should change", async () => {
await setup();
// select last material type
const materialSelect = calcPage.getSelectById("select_material");
await calcPage.changeSelectValue(materialSelect, 8);
await browser.sleep(200);
// run calculation
const calcButton = calcPage.getCalculateButton();
await calcButton.click();
await browser.sleep(200);
// store total pressure loss result
const res1 = calcPage.getAllFixedResultsRows().get(4);
const pl1 = await res1.all(by.css("td")).get(1).getText();
// select first material type
await calcPage.changeSelectValue(materialSelect, 0);
await browser.sleep(200);
// run calculation
await calcButton.click();
await browser.sleep(200);
// compare total pressure loss result with first calculaiotn
const res2 = calcPage.getAllFixedResultsRows().get(4);
const pl2 = await res2.all(by.css("td")).get(1).getText();
expect(pl1).not.toEqual(pl2);
});
});
File moved
File moved
{
"name": "fr.irstea.cassiopee",
"version": "4.16.1",
"version": "4.16.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "fr.irstea.cassiopee",
"version": "4.16.1",
"version": "4.16.3",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
......@@ -80,7 +80,7 @@
}
},
"jalhyd": {
"version": "4.16.1",
"version": "4.16.3",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@types/base-64": "^1.0.0",
......@@ -3,7 +3,7 @@
"displayName": "Cassiopée",
"description": "Hydraulic calculators",
"author": "Inrae",
"version": "4.16.1",
"version": "4.16.3",
"main": "main.js",
"homepage": "https://cassiopee.g-eau.fr",
"license": "MIT",
......@@ -14,12 +14,13 @@
"e2e": "npm run preprocess && node scripts/check-translations.js && npm run ng -- e2e --suite=regular --webdriver-update=false",
"e2equick": "node scripts/check-translations.js && npm run ng -- e2e --dev-server-target= --suite=regular --webdriver-update=false",
"monkeytest": "npm run ng -- e2e --dev-server-target= --suite=monkeyTest --webdriver-update=false",
"mkdocs": "node scripts/python3.js -m mkdocs build -f mkdocs-fr.yml && node scripts/python3.js -m mkdocs build -f mkdocs-en.yml && node scripts/mkdocs-postprocess.js",
"mkdocs2pdf": "node scripts/python3.js mkdocs2pdf.py",
"preprocess": "node scripts/preprocessors.js && npm run mkdocs",
"start": "npm run preprocess && npm run ng serve -- --host 0.0.0.0 --poll 5000",
"build-no-pdf": "npm run preprocess && npm run ng build -- --configuration production",
"build": "npm run preprocess && npm run mkdocs2pdf && npm run ng build -- --configuration production",
"mkdocs": "bash scripts/prepare_mkdocs.sh; cd build; python3 -m mkdocs build -f mkdocs-fr.yml && python3 -m mkdocs build -f mkdocs-en.yml && cd .. && node scripts/mkdocs-postprocess.js",
"mkdocs2pdf": "node scripts/extract-nghyd-version.js build/cassiopee_version.tex && python3 scripts/mkdocs2pdf.py && node scripts/mkdocs2pdf-postprocess.js",
"clean": "rm -rf build dist release src/date_revision.ts src/assets/docs",
"preprocess": "mkdir -p build; node scripts/preprocessors.js",
"start": "npm run preprocess && npm run mkdocs && npm run ng serve -- --host 0.0.0.0 --poll 5000",
"build-no-pdf": "npm run preprocess && npm run mkdocs && npm run ng build -- --configuration production",
"build": "npm run preprocess && npm run mkdocs && npm run ng build -- --configuration production && npm run mkdocs2pdf",
"update-dist-index-mimetypes": "node scripts/update-dist-index-mimetypes.js",
"electron": "npm run update-dist-index-mimetypes && \"node_modules/.bin/electron\" .",
"release-linux-nocompile": "npm run update-dist-index-mimetypes && \"node_modules/.bin/electron-builder\"",
......
/*
* extract Cassiopée version from package.json and write files according to provided paths extension :
* - a LateX file defining a variable in the form \newcommand\{\cassiopeeversion}{x.y.z} for path(s) with .tex extension
* - a plain text file with version value (x.y.z) for path(s) without extension
*/
'use strict';
const fs = require('fs');
const path = require('path');
if (process.argv.length < 3) {
console.error("ERROR : missing output file path(s)\n");
console.error("syntax : extract-nghyd-version <path> [<path> ...]");
console.error(" extract ngHyd current version to given files according to extension");
console.error(" available extensions : .tex (LateX file with variable), <none (plain version in text file)>");
process.exit(1);
}
function createMissingDirs(p) {
const targetDir = path.dirname(p);
if (!fs.existsSync(targetDir)) {
console.log("creating output directory", targetDir)
fs.mkdirSync(targetDir, { recursive: true });
}
}
function writeTex(outPath, ver) {
// make LateX variable
const s = `\\newcommand\{\\cassiopeeversion\}\{${ver}\}`;
// create intermediate folders if necessary
createMissingDirs(outPath)
// write file
console.log("writing LateX file", outPath);
fs.writeFileSync(outPath, s);
}
function writePlain(outPath, ver) {
// create intermediate folders if necessary
createMissingDirs(outPath)
// write file
console.log("writing plain file", outPath);
fs.writeFileSync(outPath, ver);
}
// read package.json
console.log("reading package.json");
var fdata = fs.readFileSync('package.json', 'utf8');
var data = JSON.parse(fdata)
// get Cassiopée version
const ver = data.version
console.log("got ngHyd version", ver);
for (let i = 2; i < process.argv.length; i++) {
const p = process.argv[i];
if (p.endsWith(".tex")) {
writeTex(p, ver);
} else {
writePlain(p, ver);
}
}
......@@ -52,6 +52,3 @@ fs.copySync("docs/matomo-tracking.js", destPath_EN_JS + "/matomo-tracking.js");
fs.copySync("node_modules/mermaid/dist/mermaid.min.js", destPath_JS + "/mermaid.min.js");
fs.copySync("node_modules/mermaid/dist/mermaid.min.js", destPath_FR_JS + "/mermaid.min.js");
fs.copySync("node_modules/mermaid/dist/mermaid.min.js", destPath_EN_JS + "/mermaid.min.js");
// copy illustrated guide (not related to MkDocs, but still a part of the doc)
fs.copySync("docs/cassiopee_notice_illustree_fr.pdf", "src/assets/docs/pdf/cassiopee_notice_illustree_fr.pdf");
'use strict';
/*
* mkdocs2pdf post processing.
* - copy illustrated guide (not related to MkDocs, but still a part of the doc) to dist/assets/docs/pdf
*/
const fs = require('fs-extra');
const destPath_PDF = "dist/assets/docs/pdf"; // pour la doc illustrée
fs.ensureDirSync(destPath_PDF);
fs.copySync("docs/cassiopee_notice_illustree_fr.pdf", destPath_PDF + "/cassiopee_notice_illustree_fr.pdf");
......@@ -20,19 +20,24 @@ import yaml
import re
import shutil
baseDir = os.getcwd();
buildDir = os.path.join(baseDir, 'docs/pdf_build')
outputDir = os.path.join(baseDir, 'src/assets/docs/pdf')
baseDir = os.getcwd()
buildDir = os.path.join(baseDir, 'build')
latexSourceDir = os.path.join(baseDir, 'docs/latex')
pdfBuildDir = os.path.join(buildDir, 'pdf_build')
outputDir = os.path.join(baseDir, 'dist/assets/docs/pdf')
latexModelDir = 'latex_models'
modelDir = os.path.join(buildDir, latexModelDir)
modelDir = os.path.join(pdfBuildDir, latexModelDir)
mergedDocFilenamePrefix = 'cassiopee_doc_contents_'
filenamePrefix = 'cassiopee_doc_'
latexModelRepository = 'https://gitlab.irstea.fr/david.dorchies/latex_models.git'
def runCommand(cmd):
if os.waitstatus_to_exitcode(os.system(cmd)) != 0:
raise RuntimeError("error executing:",cmd)
# Reads an MkDocs configuration file
def readConfig(sYAML):
f = open(sYAML, 'r')
......@@ -71,7 +76,7 @@ def exploreAndMerge(docs_dir, nav, output = '', level = 0):
filepath = os.path.join(docs_dir, d)
f = open(filepath, 'r')
# Triple "../" because file will be compiled from pdf_build/latex_models
path = os.path.join('../../..', os.path.dirname(filepath))
path = os.path.join(baseDir, os.path.dirname(filepath))
s = f.read() + "\n"
# Modification of image and links paths
s = re.sub(r'(\!\[.+\]\()(.+)(\))', r'\1'+path+r'/\2\3', s)
......@@ -93,7 +98,7 @@ def exploreAndMerge(docs_dir, nav, output = '', level = 0):
# Creates a filePath.tex LaTeX contents file based on filePath.md
def convertMdToTex(filePath):
# Convert .md to .tex
os.system(
runCommand(
'pandoc {0}.md -f markdown -t latex -s -o {0}.tex'.format(filePath)
)
# Remove header of tex file
......@@ -124,8 +129,8 @@ def convertMdToTex(filePath):
def getLatexModel():
# Clone Git repository
os.chdir(buildDir)
os.system(
os.chdir(pdfBuildDir)
runCommand(
'git clone {} {}'.format(latexModelRepository, latexModelDir)
)
# back to original working drectory
......@@ -141,22 +146,34 @@ def injectContentIntoModel(mergedDocFilenameTex, lang):
# Symlink necessary resources
os.chdir(modelDir)
relPathToMergedTexDoc = os.path.join('..', mergedDocFilenameTex)
os.system(
runCommand(
'ln -s {} .'.format(relPathToMergedTexDoc)
)
latexTemplate = 'cassiopee_doc_' + lang + '.tex'
relPathToLatexTemplate = os.path.join('../../latex', latexTemplate)
os.system(
'ln -s {} .'.format(relPathToLatexTemplate)
latexTemplate = filenamePrefix + lang + '.tex'
relPathToLatexTemplate = os.path.join(latexSourceDir, latexTemplate)
runCommand(
'ln -s {}'.format(relPathToLatexTemplate)
)
os.system(
'ln -s ../../latex/logo_pole.png .'
runCommand(
'ln -s {}'.format(os.path.join(latexSourceDir, 'logo_pole.png'))
)
os.system(
runCommand(
'ln -s {}/schema_rugosite_fond.png'.format(os.path.join(baseDir, 'docs', lang, 'calculators', 'pam'))
)
runCommand(
'ln -s {}/bloc_cylindre.png'.format(os.path.join(baseDir, 'docs', lang, 'calculators', 'pam'))
)
runCommand(
'ln -s {}/bloc_face_arrondie.png'.format(os.path.join(baseDir, 'docs', lang, 'calculators', 'pam'))
)
runCommand(
'ln -s {}/bloc_base_carree.png'.format(os.path.join(baseDir, 'docs', lang, 'calculators', 'pam'))
)
runCommand(
'rm rapport_inrae/logos.tex'
)
os.system(
'ln -s ../../../latex/logos.tex rapport_inrae/'
runCommand(
'ln -s {} rapport_inrae/'.format(os.path.join(latexSourceDir, 'logos.tex'))
)
# back to original working drectory
os.chdir(baseDir)
......@@ -165,8 +182,13 @@ def injectContentIntoModel(mergedDocFilenameTex, lang):
def buildPDF(lang):
# Compile LaTeX source
os.chdir(modelDir)
sourceTexFile = 'cassiopee_doc_' + lang + '.tex'
outputPdfFile = 'cassiopee_doc_' + lang + '.pdf'
sourceTexFile = filenamePrefix + lang + '.tex'
outputPdfFile = filenamePrefix + lang + '.pdf'
# copy Cassiopée version LateX file
cvt = os.path.join(buildDir, 'cassiopee_version.tex')
shutil.copy(cvt, modelDir)
os.system(
'latexmk -f -xelatex -pdf -interaction=nonstopmode {} > /dev/null 2>&1'.format(sourceTexFile)
)
......@@ -179,19 +201,19 @@ def buildPDF(lang):
def buildDocForLang(lang):
# Prepare temporary build directory
os.makedirs(buildDir, exist_ok=True)
os.makedirs(pdfBuildDir, exist_ok=True)
# Prepare output directory
os.makedirs(outputDir, exist_ok=True)
# Read config
yamlPath = 'mkdocs-' + lang + '.yml'
yamlPath = 'mkdocs/mkdocs-' + lang + '.yml'
dMkdocsYaml = readConfig(yamlPath)
# Create string with merged MarkDown
s = exploreAndMerge(dMkdocsYaml['docs_dir'], dMkdocsYaml['nav'])
# Save the merged .md file
mergedDocFilename = mergedDocFilenamePrefix + lang
mergedDocOutputPath = os.path.join(buildDir, mergedDocFilename)
mergedDocOutputPath = os.path.join(pdfBuildDir, mergedDocFilename)
# remove internal links @TODO convert them to hyperref ?
s = re.sub(r'\[([^/]+)\]\([^ ]+\.md\)', r'\1', s)
with open('{}.md'.format(mergedDocOutputPath), 'w') as f:
......@@ -208,7 +230,8 @@ def buildDocForLang(lang):
buildPDF(lang)
# Clean build dir
shutil.rmtree(buildDir)
shutil.rmtree(pdfBuildDir)
#raise RuntimeError()
if __name__ == '__main__':
......
#!/bin/bash
set -o errexit
BUILD_DIR=build
VER_FILE=$BUILD_DIR/cassiopee_version
function prepareMkdocs
{
local lang=$1
# copy and modify Mkdocs configuration file :
# - add Cassiopée version
# - modify path to input files
# - modify path to output files
cat mkdocs/mkdocs-$lang.yml \
| sed "/^site_name:/ s/$/ v$VER/" \
| sed "/^docs_dir:/ s/docs_dir: /docs_dir: ..\//" \
| sed "/^site_dir:/ s/site_dir: /site_dir: ..\//" > $BUILD_DIR/mkdocs-$1.yml
}
node scripts/extract-nghyd-version.js $VER_FILE
VER=$(cat $VER_FILE)
prepareMkdocs fr
prepareMkdocs en
'use strict';
const exec = require("child_process").execSync;
const os = require("os");
let py = "python3";
if (os.platform() === "win32") {
py = "python";
}
const command = py + " " + process.argv.slice(2).join(" ");
console.log("executing", command);
const ret = exec(command);
console.log(ret.toString());
......@@ -4,6 +4,7 @@
"Q": "Flow",
"Z1": "Upstream elevation",
"Z2": "Downstream elevation",
"ZW": "Water line (m)",
"Z": "Water elevation",
"LB": "Basin length",
......
......@@ -4,6 +4,7 @@
"Q": "Débit",
"Z1": "Cote amont",
"Z2": "Cote aval",
"ZW": "Ligne d'eau (m)",
"Z": "Cote de l'eau",
"LB": "Longueur du bassin",
......@@ -29,4 +30,4 @@
"UNIT_H1": "m",
"UNIT_H2": "m",
"UNIT_SUBMERGENCE": "%"
}
\ No newline at end of file
}
......@@ -16,6 +16,7 @@ import { CalculatorResults } from 'app/results/calculator-results';
import zoomPlugin from 'chartjs-plugin-zoom';
import { Chart } from "chart.js";
import { FormulaireService } from "app/services/formulaire.service";
@Component({
selector: "pab-profile-chart",
......@@ -70,6 +71,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen
public constructor(
private intlService: I18nService,
private formService: FormulaireService,
private cd: ChangeDetectorRef
) {
super();
......@@ -444,7 +446,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen
label: (
this._results.variatedParameters.length > 0 ?
this.getLegendForSeries(n) :
this.intlService.localizeText("INFO_LIB_ZW") // ligne d'eau
this.formService.localizeText("ZW", this.formService.currentForm.calculatorType) // ligne d'eau
),
color: palette[ n % palette.length ]
});
......
......@@ -435,6 +435,13 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
}
public get enableRemoveButton() {
// do not allow to remove last basin
if (this._selectedItem instanceof PbBassin) {
if (this.predamService.bassins.length == 1) {
return false;
}
}
if (this._selectedItem === this.predamService.upstreamBassin) {
return false;
}
......
......@@ -607,7 +607,7 @@ export class FormulaireService extends Observable {
}
}
private get currentForm(): FormulaireDefinition {
public get currentForm(): FormulaireDefinition {
return this.getFormulaireFromId(this._currentFormId);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment