Commit c65e1df3 authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch 'devel' into...

Merge branch 'devel' into '517-macrorugo-complexe-et-prebarrages-modifier-le-message-d-erreur-synthetique'

# Conflicts:
#   jalhyd_branch
parents bea206c0 fb29ec90
Pipeline #36246 passed with stages
in 14 minutes and 33 seconds
......@@ -81,6 +81,7 @@ test:
- tags
- schedules
- web
- master
script:
- npm run e2e
......@@ -117,7 +118,8 @@ deploy-dev:
- build
script:
# Copie de la branche / du tag
- ./scripts/deploy-version.sh $CI_COMMIT_REF_NAME $DEV_LOGIN $DEV_HOST $DEV_PATH
- if [[ $CI_COMMIT_REF_NAME != "stable" ]]; then ./scripts/deploy-version.sh $CI_COMMIT_REF_NAME $DEV_LOGIN $DEV_HOST $DEV_PATH; fi
- if [[ $CI_COMMIT_REF_NAME == "stable" ]]; then ./scripts/deploy-version.sh $CI_COMMIT_REF_NAME $DEV_LOGIN $DEV_HOST $DEV_PATH/stable; fi
deploy-prod:
stage: deploy-prod
......
......@@ -5,22 +5,22 @@
#### Nouvelles fonctionnalités
* PAB : Variation du débit d'attrait ([nghyd#431](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/431))
* Ajouter un bouton "Annuler" sur la saisie des paramètres variables ([jalhyd#300](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/300),[nghyd#507](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/507))
* Prébarrages : mettre les enfants invalides en rouge dans le schéma ([jalhyd#298](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/298),[nghyd#484](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/484))
* Ajouter un bouton "Annuler" sur la saisie des paramètres variables ([jalhyd#300](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/300), [nghyd#507](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/507))
* Prébarrages : mettre les enfants invalides en rouge dans le schéma ([jalhyd#298](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/298), [nghyd#484](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/484))
#### Changements
* Fente Larinier : laisser le coefficient de débit vide ([nghyd#515](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/515))
* Cloisons : Générer une PAB : vider les champs ([jalhyd#306](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/306),[nghyd#516](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/516))
* Cloisons : Générer une PAB : vider les champs ([jalhyd#306](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/306), [nghyd#516](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/516))
#### Correction de bogues
* Courbe de remous: crash de l'application sur données erronées ([jalhyd#307](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/307),[nghyd#532](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/532))
* Courbe de remous: crash de l'application sur données erronées ([jalhyd#307](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/307), [nghyd#532](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/532))
Deux bugs en un, l'appli crashe quand :
- la hauteur de berge dépasse une certaine valeur avec des paramètres corrects pour effectuer un calcul (par exemple les valeurs par défaut)
- les deux cotes de l'eau se situent sous les cotes de fond amont et aval
* Sections : non convergence du calcul du tirant d'eau critique ([jalhyd#301](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/301),[nghyd#528](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/528))
* Sections : non convergence du calcul du tirant d'eau critique ([jalhyd#301](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/301), [nghyd#528](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/528))
* Remettre le paramètre dans son état initial quand le dialogue "Varier" est annulé ([nghyd#508](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/508))
* Prébarrages: les champs ne sont pas vides lors des ajouts de bassins et cloisons ([nghyd#503](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/503))
* Mode "champs vides par défaut" : changer le type d'un ouvrage (ex: dans Cloisons) remplit les champs ([nghyd#480](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/480))
......@@ -35,7 +35,7 @@
* Nightly build: clean folder before installation ([nghyd#495](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/495))
* Transfert du site de production sur OVH ([nghyd#505](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/505))
* Plantage des tests e2e sur le chargement des exemples ([nghyd#530](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/530),[nghyd#531](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/531))
* Plantage des tests e2e sur le chargement des exemples ([nghyd#530](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/530), [nghyd#531](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/531))
- Les champs des exemples chargés sont vides lorsque le mode "champ vides" est activé.
- Les tests e2e plantent par manque de temporisation
* CI : les jobs build en schedule de master et devel plantent ([nghyd#527](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/527))
......
......@@ -6,25 +6,35 @@ See also [developers documentation](DEVELOPERS.md) (in french)
### Requirements
Requirements for developping Cassiopee can be achieved by manually install the required dependencies on your computer or by using the dedicated docker container.
#### Required dependencies
* [jalhyd](https://gitlab.irstea.fr/cassiopee/jalhyd)
* npm
* python3
* pandoc ^2 (optional, for PDF documentation only)
* texlive (optional, for PDF documentation only)
Building the HTML documentation requires MkDocs and some extensions:
```sh
sudo apt install python3-pip python3-setuptools
python3 -m pip install mkdocs python-markdown-math mkdocs-material
```
Building the PDF documentation requires pandoc and a LaTeX distribution (for ex. texlive) with a few packages:
```sh
sudo apt install pandoc texlive latexmk texlive-latex-extra texlive-bibtex-extra
```
#### Using docker container
Download and use the following docker image: https://hub.docker.com/repository/docker/geaucassiopee/ci-cd-cross-platform-webapp
More details on how to use it on vscode are available at https://gitlab.irstea.fr/cassiopee/cassiopee2-integration
### Install dependencies
#### JaLHyd
......@@ -40,9 +50,11 @@ npm run package
Then in `nghyd` folder, run :
```sh
npm install
npm ci --force --unsafe-perm
```
This installs the exact same version of dependencies as the ones specified in `package.lock.json`.
The parameter `--unsafe-perm` solves permissions issues for running e2e tests in a docker container.
### Compile and get a deployable Web app
......@@ -225,7 +237,7 @@ npm install -g tsviz
```
There's currently a bug on debian like distribution due to a wrong declaration of graphviz path in the code: https://github.com/joaompneves/tsviz/issues/5
As a workaround, you can create a link to the right path: `sudo ln -s /usr/bin/dot /usr/local/bin/dot`
As a workaround, you can create a link to the right path: `sudo ln -s /usr/bin/dot /usr/local/bin/dot`
To draw the diagram:
```sh
......@@ -251,11 +263,11 @@ sudo find /usr/lib/node_modules/protractor -regextype sed -regex "^.*/chromedriv
Use [semantic versioning](https://semver.org/).
**It's discouraged to execute release steps manually, see Release Script below**
**It's discouraged to execute release steps manually, skip this section and see Release Script below**
Before releasing a new stable version, a new version of JaLHyd should be tagged, see "Release Policy" in [JaLHyd's README.md](https://gitlab.irstea.fr/cassiopee/jalhyd/blob/master/README.md)
Then, one should complete the following files
Then, one should complete the following files:
- `CHANGELOG.md`
- `package.json` (update "version", or use `npm version`)
- `jalhyd_branch` (be sure that it contains "master" or is empty)
......@@ -270,12 +282,16 @@ The `stable` tag should be set **before** the version tag, so that `git describe
**Important:** the release script assumes that you run it from the current nghyd source directory `nghyd`, and that JaLHyd source directory `jalhyd` is present at the same level.
Before running the script:
* update `CHANGELOG.md` in both JaLHyd and NgHyd
* set the content of `jalhyd_branch` to "master"
This script:
* checks out "master" branch of JaLHyd, pulls the latest changes, installs dependencies, runs unit tests, commits changes if any
* updates JaLHyd version, commits changes
* updates JaLHyd version in `package.json`, commits changes
* creates the right tags for JaLHyd and pushes them
* checks out "master" branch of NgHyd, pulls the latest changes, installs dependencies, commits changes if any
* updates NgHyd version, commits changes
* updates NgHyd version in `package.json`, commits changes
* creates the right tags for NgHyd and pushes them
It **does not** check that `jalhyd_branch` is OK nor that `jalhyd/CHANGELOG.md` and `nghyd/CHANGELOG.md` are up to date, but reminds you to do it.
......
import { browser } from "protractor";
import { PreferencesPage } from "./preferences.po"
import { Navbar } from "./navbar.po";
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
describe("ngHyd − check that results are not duplicated", () => {
let prefPage: PreferencesPage;
let navBar: Navbar;
let listPage: ListPage;
let calcPage: CalculatorPage;
beforeEach(async () => {
prefPage = new PreferencesPage();
listPage = new ListPage();
navBar = new Navbar();
calcPage = new CalculatorPage();
// disable evil option "empty fields on module creation"
await prefPage.navigateTo();
await browser.sleep(200);
await prefPage.disableEvilEmptyFields();
await browser.sleep(200);
});
it("in 'baffle fishway: setup' calculator", async () => {
// open baffle fishway setup calculator
await navBar.clickNewCalculatorButton();
await listPage.clickMenuEntryForCalcType(28);
await browser.sleep(200);
// run calculation
const calcButton = calcPage.getCalculateButton();
await calcButton.click();
// check result count
const fixRows = calcPage.getAllFixedResultsRows();
const nbRows = await fixRows.count();
console.log(nbRows);
expect(nbRows).toBe(24); // boundaries are included
});
});
......@@ -163,4 +163,23 @@ describe("ngHyd - check that created/cloned structures have empty fields - ", ()
const emptys = [true, true, true];
await checkFields(inputIds, emptys);
});
it("when a structure is modified (input) and then a structure is added", async () => {
await setup();
// fill
const inp = calcPage.getInputById("0_ZDV");
await inp.clear();
await inp.sendKeys("1");
// copy structure
const addStruct = calcPage.getAddStructureButton();
await addStruct.click();
await browser.sleep(200);
// check empty fields
const inputIds = ["1_ZDV", "1_L", "1_W", "1_CdGR"];
const emptys = [true, true, true, false];
await checkFields(inputIds, emptys);
});
});
......@@ -16,17 +16,21 @@ describe("ngHyd - check parameter mode is set to its previous value - ", () => {
it("when min/max/list values dialog is cancelled", async () => {
// start page
await listPage.navigateTo();
await browser.sleep(500);
// open PAB chute
await listPage.clickMenuEntryForCalcType(12);
await browser.sleep(500);
// click "calc" radio on Z1 parameter
const z1calcbtn = element(by.id("mat-button-toggle-3"));
await z1calcbtn.click();
await browser.sleep(200);
// click "var" radio on Z1 parameter
const z1varbtn = element(by.id("mat-button-toggle-2"));
await z1varbtn.click();
await browser.sleep(200);
// click cancel button
const cancelbtn = element(by.id("btn-cancel"));
......
{
"name": "fr.irstea.cassiopee",
"version": "4.14.2",
"version": "4.15.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -4026,7 +4026,8 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.1.tgz",
"integrity": "sha512-HRZPIjPcbwAVQvOTxR4YE3o8Xs98NqbbL1iEZDCz7CL8ql0Lt5iOyJFxfnAB0oFs8Oh02F/lLlg30Mexv46LjA==",
"dev": true
"dev": true,
"optional": true
},
"boxen": {
"version": "4.2.0",
......@@ -11693,11 +11694,13 @@
"dependencies": {
"@types/base-64": {
"version": "0.1.3",
"bundled": true
"resolved": "https://registry.npmjs.org/@types/base-64/-/base-64-0.1.3.tgz",
"integrity": "sha512-DJpw7RKNMXygZ0j2xe6ROBqiJUy7JWEItkzOPBzrT35HUWS7VLYyW9XJX8yCCvE2xg8QD7wesvVyXFg8AVHTMA=="
},
"base-64": {
"version": "0.1.0",
"bundled": true
"resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz",
"integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs="
}
}
},
......
......@@ -3,7 +3,7 @@
"displayName": "Cassiopée",
"description": "Hydraulic calculators",
"author": "Inrae",
"version": "4.14.2",
"version": "4.15.0",
"main": "main.js",
"homepage": "https://cassiopee.g-eau.fr",
"license": "MIT",
......
......@@ -37,11 +37,12 @@ exports.config = {
args: [
"--no-sandbox",
"--headless",
"--window-size=1024x768"
"--window-size=1024x768",
"--disable-dev-shm-usage"
],
prefs: {
download: {
prompt_for_download: false,
prompt_for_download: false,
directory_upgrade: true,
// default_directory: '/tmp/e2e-downloads'
},
......
......@@ -38,21 +38,22 @@ git checkout master
git pull --rebase
npm install
npm run jasmine
if [ ! -z "$(git status --porcelain)" ]
then
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]
then
echo "commiting changes induced by 'npm install'"
git commit -a -m "verify dependencies (npm install) before deploying version $VERSION"
fi
# 1.3 version in package.*
npm version "$VERSION" --allow-same-version --git-tag-version=false
if [ ! -z "$(git status --porcelain)" ]
then
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]
then
echo "commiting changes induced by 'npm version'"
git commit -a -m "update package.* to version $VERSION"
fi
# 1.4 tags
echo "setting tags to $VERSION version"
git tag -fa "nghyd_$VERSION" -m "release version $VERSION"
sleep 1
git tag -fa stable -m "stable version"
......@@ -71,7 +72,7 @@ cd ../nghyd
git checkout master
git pull --rebase
npm install
if [ ! -z "$(git status --porcelain)" ]
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]
then
echo "commiting changes induced by 'npm install'"
git commit -a -m "verify dependencies (npm install) before deploying version $VERSION"
......@@ -79,13 +80,14 @@ fi
# 2.3 version in package.*
npm version "$VERSION" --allow-same-version --git-tag-version=false
if [ ! -z "$(git status --porcelain)" ]
then
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]
then
echo "commiting changes induced by 'npm version'"
git commit -a -m "update package.* to version $VERSION"
fi
# 2.4 tags
echo "setting tags to $VERSION version"
git tag -fa stable -m "stable version"
sleep 1
git tag -fa "$VERSION" -m "release version $VERSION"
......
#!/bin/bash
set -o errexit
# Output command lines for debugging
set -x
# Fabrique les exécutables electron/cordova pour une version de Cassiopée $1, les
# distribue sur le serveur $2@$3 dans le dossier $4, et met à jour le fichier releases.json
......@@ -40,11 +42,11 @@ if (( $update_latest )); then
# fetch current releases file
scp "$HOST_LOGIN:$RELEASES_FILE" "./$TMP_RELEASES_FILE"
grep -P "\"latest\": \"$VERSION\"" "$TMP_RELEASES_FILE"
if [[ $? == 0 ]]; then
if [[ -n $(grep -P "\"latest\": \"$VERSION\"" "$TMP_RELEASES_FILE") ]]; then
echo "$VERSION est déjà la version la plus récente, pas de mise à jour du fichier releases.json"
else
echo "mise à jour du fichier releases.json à la version $VERSION"
sed -i -E "s/\"latest\": .+,/\"latest\": \"$VERSION\",/" "$TMP_RELEASES_FILE"
echo -e "\t\"$VERSION\": {
\t\t\"darwin\": \"Cassiopée-${VERSION}-mac.zip\",
......
......@@ -23,7 +23,7 @@
<input matInput class="form-control" type="number" inputmode="numeric" name="min-value" step="0.01"
[placeholder]="uitextValeurMini" [(ngModel)]="minValue" #min="ngModel" name="min"
(input)="minMaxForm.controls.max.updateValueAndValidity()" [appJalhydModelValidationMin]="param"
required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$">
required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" (keyup.enter)="onValidate()" (keyup.escape)="onCancel()">
<mat-error *ngIf="min.errors">
<div *ngIf="min.errors.required || min.errors.pattern">
......@@ -39,7 +39,7 @@
<input matInput class="form-control" type="number" inputmode="numeric" name="max-value" step="0.01"
[placeholder]="uitextValeurMaxi" [(ngModel)]="maxValue" #max="ngModel" name="max"
(input)="minMaxForm.controls.min.updateValueAndValidity()" [appJalhydModelValidationMax]="param"
required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$">
required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" (keyup.enter)="onValidate()" (keyup.escape)="onCancel()">
<mat-error *ngIf="max.errors">
<div *ngIf="max.errors.required || max.errors.pattern">
......@@ -54,7 +54,8 @@
<mat-form-field>
<input matInput class="form-control" type="number" inputmode="numeric" name="step-value" step="0.01"
[placeholder]="uitextPasVariation" [(ngModel)]="stepValue" #step="ngModel" name="step"
[appJalhydModelValidationStep]="param" required pattern="^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$">
[appJalhydModelValidationStep]="param" required pattern="^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"
(keyup.enter)="onValidate()" (keyup.escape)="onCancel()">
<mat-error *ngIf="step.errors">
{{ uitextMustBePositive }}
......@@ -128,4 +129,4 @@
{{ uitextValidate }}
</button>
</div>
</div>
\ No newline at end of file
</div>
......@@ -290,20 +290,22 @@ export class DialogEditParamValuesComponent implements OnInit {
}
public onValidate() {
switch (this.param.valueMode) {
case ParamValueMode.LISTE:
this.data.param.setValueList(this, this.param.valueList);
break;
case ParamValueMode.MINMAX:
this.data.param.setMinValue(this, this.param.minValue);
this.data.param.setMaxValue(this, this.param.maxValue);
this.data.param.setStepValue(this, this.param.stepValue);
break;
if (this.isFormValid) {
switch (this.param.valueMode) {
case ParamValueMode.LISTE:
this.data.param.setValueList(this, this.param.valueList);
break;
case ParamValueMode.MINMAX:
this.data.param.setMinValue(this, this.param.minValue);
this.data.param.setMaxValue(this, this.param.maxValue);
this.data.param.setStepValue(this, this.param.stepValue);
break;
}
this.dialogRef.close({
cancelled: false
});
}
this.dialogRef.close({
cancelled: false
});
}
/**
......
......@@ -75,15 +75,15 @@ export class FieldsetContainerComponent implements DoCheck, AfterViewInit {
* dans un nouveau fieldset
*/
private addSubNub(after: FieldSet, clone: boolean = false) {
const prms = after.backupParameters();
const prms = clone ? after.backupParameters() : undefined;
const newFs = this._container.addFromTemplate(0, after.indexAsKid());
if (clone) {
// replace in-place to change properties (overkill)
// @WTF why only those two ?
newFs.setPropValue("structureType", after.properties.getPropValue("structureType"));
newFs.setPropValue("loiDebit", after.properties.getPropValue("loiDebit"));
newFs.restoreParameters(prms);
}
newFs.restoreParameters(prms);
}
private onFieldsetListChange() {
......
......@@ -183,30 +183,6 @@ export class FixedResultsComponent extends ResultsComponentDirective {
}
}
}
// 2) else, is it a fixed parameter ?
if (! resultFound) {
for (const fp of this.fixedParams) {
if (fp.symbol === symbol) {
let label = this.formattedLabel(fp);
const nub = fp.paramDefinition.parentNub;
// add child type and position before label
if (nub && nub.parent && nub.parent.childrenType) {
const pos = nub.findPositionInParent();
// label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label;
const cn = capitalize(this.intlService.childName(nub));
label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (pos + 1) + ": " + label;
}
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: label,
value: this.formattedValue(fp),
isCalcResult: false // for CSS
});
}
}
}
}
return data;
}
......
......@@ -108,7 +108,7 @@ export class FormulaireFixedVar extends FormulaireDefinition {
protected compute() {
this.runNubCalc(this.currentNub);
this.refreshFieldsets(); // important: before reaffectResultComponents() or it will break results components localization
this.reaffectResultComponents();
// this.reaffectResultComponents(); // seems useless since called from runNubCalc()
}
protected reaffectResultComponents() {
......
......@@ -217,6 +217,7 @@ export class MacrorugoCompoundResults extends MultiDimensionResults implements P
case "Vmax":
case "PV":
case "xCenter":
case "Vg":
data.push(this.childrenResults[i].resultElements[vi].getValue(symbol));
break;
}
......
......@@ -355,6 +355,7 @@ export class VarResults extends CalculatedParamResults implements PlottableData
// result keys (extra or not) - some lines might miss some results, in case of an error;
// use those keys to ensure all columns are filled
if (this.resultKeys.length === 0) {
this.resultKeys.push(this.result.symbol);
for (const re of this.result.resultElements) { // re:ResultElement
for (const erk in re.values) {
if (!this.resultKeys.includes(erk)) {
......
Markdown is supported
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