diff --git a/e2e/compute-reset-chained-links.e2e-spec.ts b/e2e/compute-reset-chained-links.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..17a716766fc0cb7e5c6a8286de5f2a62d119059a --- /dev/null +++ b/e2e/compute-reset-chained-links.e2e-spec.ts @@ -0,0 +1,160 @@ +import { AppPage } from "./app.po"; +import { CalculatorPage } from "./calculator.po"; +import { Navbar } from "./navbar.po"; +import { SideNav } from "./sidenav.po"; +import { browser } from "protractor"; + +/** + * Load a session containing 3 calculators, having linked parameters + * from one to another, triggers computation from the top-most, triggers + * results reset from the bottom-most. + * Does it once with parameters linked to parameters, once with parameters + * linked to results. + */ +describe("ngHyd − compute then reset chained results", () => { + let startPage: AppPage; + let calcPage: CalculatorPage; + let navbar: Navbar; + let sidenav: SideNav; + + function init() { + startPage = new AppPage(); + calcPage = new CalculatorPage(); + navbar = new Navbar(); + sidenav = new SideNav(); + } + beforeEach(init); + + async function doTheJob(filename: string, topMostId: string, bottomMostId: string) { + // load session file + await startPage.navigateTo(); + await navbar.clickMenuButton(); + await browser.sleep(200); + await sidenav.clickLoadSessionButton(); + await browser.sleep(200); + await sidenav.loadSessionFile(filename); + await browser.sleep(500); + expect(await navbar.getAllCalculatorTabs().count()).toBe(3); + + // 1. get top most module + await navbar.clickCalculatorTabForUid(topMostId); + + // check that "compute" button is active + const calcButton = calcPage.getCalculateButton(); + const disabledState = await calcButton.getAttribute("disabled"); + expect(disabledState).not.toBe("disabled"); + // click "compute" button + await calcButton.click(); + + // check all 3 modules for results + for (let i = 0; i < 3; i++) { + await navbar.clickCalculatorTab(i); + const hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(true); + } + + // 2. get bottom-most module + await navbar.clickCalculatorTabForUid(bottomMostId); + + // modify any input (for ex. "Ks") + await calcPage.getInputById("Ks").clear(); + await calcPage.getInputById("Ks").sendKeys("42"); + + // check all 3 modules for absence of results + for (let i = 0; i < 3; i++) { + await navbar.clickCalculatorTab(i); + const hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(false); + } + } + + it("when loading session-cascade-params.json, computation should not be chained, but results reset should", async () => { + // load session file + await startPage.navigateTo(); + await navbar.clickMenuButton(); + await browser.sleep(200); + await sidenav.clickLoadSessionButton(); + await browser.sleep(200); + await sidenav.loadSessionFile("./session-cascade-params.json"); + await browser.sleep(500); + expect(await navbar.getAllCalculatorTabs().count()).toBe(3); + + // 1. get top most module + await navbar.clickCalculatorTabForUid("dWs5bm"); + + // check that "compute" button is active + const calcButton = calcPage.getCalculateButton(); + const disabledState = await calcButton.getAttribute("disabled"); + expect(disabledState).not.toBe("disabled"); + // click "compute" button + await calcButton.click(); + + // only top-most module should have results + let hasResults = await calcPage.hasResults(); + // other two should not + await navbar.clickCalculatorTabForUid("OGFzOH"); + hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(false); + await navbar.clickCalculatorTabForUid("NWp1a3"); + hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(false); + + // 2. get bottom-most module + await navbar.clickCalculatorTabForUid("OGFzOH"); + + // modify any input (for ex. "Ks") + await calcPage.getInputById("Ks").clear(); + await calcPage.getInputById("Ks").sendKeys("42"); + + // check all 3 modules for absence of results + for (let i = 0; i < 3; i++) { + await navbar.clickCalculatorTab(i); + hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(false); + } + }); + + it("when loading session-cascade-results.json, computation and results reset should be chained", async () => { + // load session file + await startPage.navigateTo(); + await navbar.clickMenuButton(); + await browser.sleep(200); + await sidenav.clickLoadSessionButton(); + await browser.sleep(200); + await sidenav.loadSessionFile("./session-cascade-results.json"); + await browser.sleep(500); + expect(await navbar.getAllCalculatorTabs().count()).toBe(3); + + // 1. get top most module + await navbar.clickCalculatorTabForUid("YWFqMD"); + + // check that "compute" button is active + const calcButton = calcPage.getCalculateButton(); + const disabledState = await calcButton.getAttribute("disabled"); + expect(disabledState).not.toBe("disabled"); + // click "compute" button + await calcButton.click(); + + // check all 3 modules for results + for (let i = 0; i < 3; i++) { + await navbar.clickCalculatorTab(i); + const hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(true); + } + + // 2. get bottom-most module + await navbar.clickCalculatorTabForUid("ZHd0ej"); + + // modify any input (for ex. "Ks") + await calcPage.getInputById("Ks").clear(); + await calcPage.getInputById("Ks").sendKeys("42"); + + // check all 3 modules for absence of results + for (let i = 0; i < 3; i++) { + await navbar.clickCalculatorTab(i); + const hasResults = await calcPage.hasResults(); + expect(hasResults).toBe(false); + } + }); + +}); diff --git a/e2e/load-linked-params.e2e-spec.ts b/e2e/load-linked-params.e2e-spec.ts index e77ed5aea5156f502366f9533a29648c85f1faa7..cd0b97a4c5d99b0eb3d40802c5f2cc1d62c0ee6d 100644 --- a/e2e/load-linked-params.e2e-spec.ts +++ b/e2e/load-linked-params.e2e-spec.ts @@ -23,7 +23,7 @@ describe("ngHyd − load session with multiple linked parameters", () => { } beforeEach(init); - it("when loading session-liens-spaghetti.json, all links should point to the right target - ", async () => { + it("when loading session-liens-spaghetti.json, all links should point to the right target", async () => { await startPage.navigateTo(); await navbar.clickMenuButton(); @@ -33,7 +33,7 @@ describe("ngHyd − load session with multiple linked parameters", () => { await browser.sleep(200); await sidenav.loadSessionFile("./session-liens-spaghetti.json"); - await browser.sleep(200); + await browser.sleep(500); expect(await navbar.getAllCalculatorTabs().count()).toBe(4); diff --git a/e2e/navbar.po.ts b/e2e/navbar.po.ts index 2112ceecf8ae3666311cee6fe7627b09dc433b9a..621416ac95243f7d0fd7917d45e556b8cc73e4ff 100644 --- a/e2e/navbar.po.ts +++ b/e2e/navbar.po.ts @@ -5,6 +5,10 @@ export class Navbar { return element.all(by.css("#tabs-container > button.calculator-button")); } + getCalculatorTabForUid(uid: string) { + return element(by.css("#tabs-container > button.calculator-button.calculator-uid-" + uid)); + } + getNewCalculatorButton() { return element(by.css("#new-calculator")); } @@ -18,6 +22,11 @@ export class Navbar { await tabs.get(n).click(); } + async clickCalculatorTabForUid(uid: string) { + const tab = this.getCalculatorTabForUid(uid); + await tab.click(); + } + async clickRandomCalculatorTab(n: number) { const tabs = this.getAllCalculatorTabs(); const l = await tabs.count(); diff --git a/e2e/session-6-calc.test.json b/e2e/session-6-calc.test.json index 54df75d63bd35b630fa75b19a592a9d41be3e817..a24a0012f32b98e2ecd3461342b56bcbb33d764c 100644 --- a/e2e/session-6-calc.test.json +++ b/e2e/session-6-calc.test.json @@ -1 +1,342 @@ -{"session":[{"uid":"NHY0cX","props":{"calcType":5,"nodeType":0},"meta":{"title":"PAB : dimensions"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"L","mode":"SINGLE","value":2},{"symbol":"W","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.5},{"symbol":"V","mode":"CALCUL"}]},{"uid":"YzAwMW","props":{"calcType":11,"nodeType":0},"meta":{"title":"Macro-rugo."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"ZF1","mode":"SINGLE","value":12.5},{"symbol":"L","mode":"SINGLE","value":6},{"symbol":"B","mode":"SINGLE","value":1},{"symbol":"If","mode":"SINGLE","value":0.05},{"symbol":"Q","mode":"CALCUL"},{"symbol":"Y","mode":"SINGLE","value":0.6},{"symbol":"Ks","mode":"SINGLE","value":0.01},{"symbol":"C","mode":"SINGLE","value":0.05},{"symbol":"PBD","mode":"SINGLE","value":0.5},{"symbol":"PBH","mode":"SINGLE","value":0.8},{"symbol":"Cd0","mode":"SINGLE","value":1.5}]},{"uid":"dGc5MD","props":{"calcType":8,"nodeType":0},"meta":{"title":"Ouvrages"},"structures":[{"uid":"NjZob3","props":{"calcType":7,"nodeType":5,"structureType":1,"loiDebit":1},"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"SINGLE","value":0.5},{"symbol":"L","mode":"SINGLE","value":2},{"symbol":"Cd","mode":"SINGLE","value":0.6}]}],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE","value":102},{"symbol":"Z2","mode":"SINGLE","value":101.5}]},{"uid":"OGZ4cm","props":{"varCalc":"Hs","calcType":2,"nodeType":2},"meta":{"title":"Sec. param."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.8},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]},{"uid":"ZTNvMD","props":{"methodeResolution":0,"calcType":4,"nodeType":2},"meta":{"title":"Remous"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Yamont","mode":"SINGLE","value":0.15},{"symbol":"Yaval","mode":"SINGLE","value":0.4},{"symbol":"Long","mode":"SINGLE","value":100},{"symbol":"Dx","mode":"SINGLE","value":5},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.2863766123093061},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]},{"uid":"eWllan","props":{"calcType":1,"nodeType":0},"meta":{"title":"Lechapt-Calmon"},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Q","mode":"SINGLE","value":3},{"symbol":"D","mode":"SINGLE","value":1.2},{"symbol":"J","mode":"CALCUL"},{"symbol":"Lg","mode":"SINGLE","value":100},{"symbol":"L","mode":"SINGLE","value":"1.863"},{"symbol":"M","mode":"SINGLE","value":"2"},{"symbol":"N","mode":"SINGLE","value":"5.33"}]}]} \ No newline at end of file +{ + "session": [ + { + "uid": "NHY0cX", + "props": { + "calcType": 5, + "nodeType": 0 + }, + "meta": { + "title": "PAB : dimensions" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "L", + "mode": "SINGLE", + "value": 2 + }, + { + "symbol": "W", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.5 + }, + { + "symbol": "V", + "mode": "CALCUL" + } + ] + }, + { + "uid": "YzAwMW", + "props": { + "calcType": 11, + "nodeType": 0 + }, + "meta": { + "title": "Macro-rugo." + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "ZF1", + "mode": "SINGLE", + "value": 12.5 + }, + { + "symbol": "L", + "mode": "SINGLE", + "value": 6 + }, + { + "symbol": "B", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.05 + }, + { + "symbol": "Q", + "mode": "CALCUL" + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.6 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 0.01 + }, + { + "symbol": "C", + "mode": "SINGLE", + "value": 0.05 + }, + { + "symbol": "PBD", + "mode": "SINGLE", + "value": 0.5 + }, + { + "symbol": "PBH", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "Cd0", + "mode": "SINGLE", + "value": 1.5 + } + ] + }, + { + "uid": "dGc5MD", + "props": { + "calcType": 8, + "nodeType": 0 + }, + "meta": { + "title": "Ouvrages" + }, + "structures": [ + { + "uid": "NjZob3", + "props": { + "calcType": 7, + "nodeType": 5, + "structureType": 1, + "loiDebit": 1 + }, + "parameters": [ + { + "symbol": "ZDV", + "mode": "SINGLE", + "value": 100 + }, + { + "symbol": "W", + "mode": "SINGLE", + "value": 0.5 + }, + { + "symbol": "L", + "mode": "SINGLE", + "value": 2 + }, + { + "symbol": "Cd", + "mode": "SINGLE", + "value": 0.6 + } + ] + } + ], + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Q", + "mode": "CALCUL" + }, + { + "symbol": "Z1", + "mode": "SINGLE", + "value": 102 + }, + { + "symbol": "Z2", + "mode": "SINGLE", + "value": 101.5 + } + ] + }, + { + "uid": "OGZ4cm", + "props": { + "varCalc": "Hs", + "calcType": 2, + "nodeType": 2 + }, + "meta": { + "title": "Sec. param." + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 2.5 + } + ] + }, + { + "uid": "ZTNvMD", + "props": { + "methodeResolution": 0, + "calcType": 4, + "nodeType": 2 + }, + "meta": { + "title": "Remous" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Yamont", + "mode": "SINGLE", + "value": 0.15 + }, + { + "symbol": "Yaval", + "mode": "SINGLE", + "value": 0.4 + }, + { + "symbol": "Long", + "mode": "SINGLE", + "value": 100 + }, + { + "symbol": "Dx", + "mode": "SINGLE", + "value": 5 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.2863766123093061 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 2.5 + } + ] + }, + { + "uid": "eWllan", + "props": { + "calcType": 1, + "nodeType": 0 + }, + "meta": { + "title": "Lechapt-Calmon" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 3 + }, + { + "symbol": "D", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "J", + "mode": "CALCUL" + }, + { + "symbol": "Lg", + "mode": "SINGLE", + "value": 100 + }, + { + "symbol": "L", + "mode": "SINGLE", + "value": "1.863" + }, + { + "symbol": "M", + "mode": "SINGLE", + "value": "2" + }, + { + "symbol": "N", + "mode": "SINGLE", + "value": "5.33" + } + ] + } + ] +} \ No newline at end of file diff --git a/e2e/session-cascade-params.json b/e2e/session-cascade-params.json new file mode 100644 index 0000000000000000000000000000000000000000..773053d5409813c93e2adfe6811d03ac299945d3 --- /dev/null +++ b/e2e/session-cascade-params.json @@ -0,0 +1,146 @@ +{ + "session": [ + { + "uid": "OGFzOH", + "props": { + "varCalc": "Hs", + "calcType": 2, + "nodeType": 2 + }, + "meta": { + "title": "Sec. param." + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 2.5 + } + ] + }, + { + "uid": "NWp1a3", + "props": { + "calcType": 3, + "nodeType": 2 + }, + "meta": { + "title": "R. uniforme" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "CALCUL" + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "LINK", + "targetNub": "OGFzOH", + "targetParam": "LargeurBerge" + } + ] + }, + { + "uid": "dWs5bm", + "props": { + "calcType": 3, + "nodeType": 2 + }, + "meta": { + "title": "R. uniforme 1" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "CALCUL" + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "LINK", + "targetNub": "NWp1a3", + "targetParam": "LargeurBerge" + } + ] + } + ] +} \ No newline at end of file diff --git a/e2e/session-cascade-results.json b/e2e/session-cascade-results.json new file mode 100644 index 0000000000000000000000000000000000000000..9825f301c4561fd08fab26df548de94c6b3961c4 --- /dev/null +++ b/e2e/session-cascade-results.json @@ -0,0 +1,191 @@ +{ + "session": [ + { + "uid": "YWFqMD", + "props": { + "calcType": 11, + "nodeType": 0 + }, + "meta": { + "title": "Macro-rugo." + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "ZF1", + "mode": "SINGLE", + "value": 12.5 + }, + { + "symbol": "L", + "mode": "SINGLE", + "value": 6 + }, + { + "symbol": "B", + "mode": "CALCUL" + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.05 + }, + { + "symbol": "Q", + "mode": "LINK", + "targetNub": "MXB0en", + "targetParam": "Q" + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.6 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 0.01 + }, + { + "symbol": "C", + "mode": "SINGLE", + "value": 0.05 + }, + { + "symbol": "PBD", + "mode": "SINGLE", + "value": 0.5 + }, + { + "symbol": "PBH", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "Cd0", + "mode": "SINGLE", + "value": 1.5 + } + ] + }, + { + "uid": "MXB0en", + "props": { + "calcType": 3, + "nodeType": 2 + }, + "meta": { + "title": "R. uniforme" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "CALCUL" + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "LINK", + "targetNub": "ZHd0ej", + "targetParam": "Yco" + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 2.5 + } + ] + }, + { + "uid": "ZHd0ej", + "props": { + "methodeResolution": 0, + "calcType": 4, + "nodeType": 2 + }, + "meta": { + "title": "Remous" + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Yamont", + "mode": "SINGLE", + "value": 0.15 + }, + { + "symbol": "Yaval", + "mode": "SINGLE", + "value": 0.4 + }, + { + "symbol": "Long", + "mode": "SINGLE", + "value": 100 + }, + { + "symbol": "Dx", + "mode": "SINGLE", + "value": 5 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.5643749999999994 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 2.5 + } + ] + } + ] +} \ No newline at end of file diff --git a/e2e/session-optional-params.test.json b/e2e/session-optional-params.test.json index 804c559cb54b2dfa3f367b66a9ca29de7e953e4a..6fb0e40e804a24c0926dec69b77e432a75c46355 100644 --- a/e2e/session-optional-params.test.json +++ b/e2e/session-optional-params.test.json @@ -1 +1,57 @@ -{"session":[{"uid":"N2U4OH","props":{"varCalc":"Hs","calcType":2,"nodeType":4},"meta":{"title":"Sec. param."},"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"SINGLE","value":1.2},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.8},{"symbol":"LargeurBerge","mode":"SINGLE","value":4},{"symbol":"k","mode":"SINGLE","value":0.5}]}]} \ No newline at end of file +{ + "session": [ + { + "uid": "N2U4OH", + "props": { + "varCalc": "Hs", + "calcType": 2, + "nodeType": 4 + }, + "meta": { + "title": "Sec. param." + }, + "parameters": [ + { + "symbol": "Pr", + "mode": "SINGLE", + "value": 0.0001 + }, + { + "symbol": "Ks", + "mode": "SINGLE", + "value": 40 + }, + { + "symbol": "Q", + "mode": "SINGLE", + "value": 1.2 + }, + { + "symbol": "If", + "mode": "SINGLE", + "value": 0.001 + }, + { + "symbol": "YB", + "mode": "SINGLE", + "value": 1 + }, + { + "symbol": "Y", + "mode": "SINGLE", + "value": 0.8 + }, + { + "symbol": "LargeurBerge", + "mode": "SINGLE", + "value": 4 + }, + { + "symbol": "k", + "mode": "SINGLE", + "value": 0.5 + } + ] + } + ] +} \ No newline at end of file diff --git a/src/app/app.component.html b/src/app/app.component.html index f2863b8e4cdfe3487b6b04c8626fa864f7f60cb9..fc3d49453c11e6096b8b155b1bf1d34f08fb0ded 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -40,9 +40,9 @@ <!-- calculators list as a tabs bar--> <div id="tabs-container" [hidden]="! tabsFitInNavbar"> - <button mat-raised-button color="primary" *ngFor="let c of calculators" class="calculator-button" [title]="c.title" - [routerLink]="['/calculator/',c.uid]" [color]="c.active ? '' : 'primary'" [class.active]="c.active" - (click)="setActiveCalc(c.uid)"> + <button mat-raised-button color="primary" *ngFor="let c of calculators" class="" [title]="c.title" + [routerLink]="['/calculator/',c.uid]" [color]="c.active ? '' : 'primary'" (click)="setActiveCalc(c.uid)" + [ngClass]="['calculator-button', 'calculator-uid-' + c.uid, c.active ? 'active' : '' ]"> <span class="calc-name"> {{ c.title }}